mirror of
				https://github.com/fluffle/goirc
				synced 2025-11-03 19:48:04 +00:00 
			
		
		
		
	Get rid of stupid UnquoteChar usage
This commit is contained in:
		
							parent
							
								
									35351e93bb
								
							
						
					
					
						commit
						f855d74bb4
					
				
					 1 changed files with 4 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -3,7 +3,6 @@ package main
 | 
			
		|||
import (
 | 
			
		||||
	"irc"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"http"
 | 
			
		||||
	"json"
 | 
			
		||||
| 
						 | 
				
			
			@ -105,18 +104,11 @@ func calc(conn *irc.Conn, nick *irc.Nick, args, target string) {
 | 
			
		|||
		say(conn, target, "%s: Error while calculating.", nick.Nick); return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	str := fmt.Sprintf("%s = %s", result[1], result[2])
 | 
			
		||||
	output := ""
 | 
			
		||||
	// decode unicode escapes
 | 
			
		||||
	for str != "" {
 | 
			
		||||
		var err os.Error
 | 
			
		||||
		var rune int
 | 
			
		||||
		rune, _, str, err = strconv.UnquoteChar(str, 0)
 | 
			
		||||
	output := fmt.Sprintf(`"%s = %s"`, result[1], result[2])
 | 
			
		||||
	output, err = strconv.Unquote(output)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		say(conn, target, "%s: Error while decoding.", nick.Nick); return
 | 
			
		||||
	}
 | 
			
		||||
		output += string(rune)
 | 
			
		||||
	}
 | 
			
		||||
	output = html.UnescapeString(output)
 | 
			
		||||
	say(conn, target, output)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue