Selaa lähdekoodia

Correction: privmsg and rawsend must be unicode aware.

Jadjay 8 vuotta sitten
vanhempi
commit
c8bd6830ee
1 muutettua tiedostoa jossa 7 lisäystä ja 7 poistoa
  1. 7 7
      irclib.py

+ 7 - 7
irclib.py Näytä tiedosto

@@ -763,12 +763,12 @@ class ServerConnection(Connection):
763 763
     def privmsg(self, target, text):
764 764
         """Send a PRIVMSG command."""
765 765
         # Should limit len(text) here!
766
-        self.send_raw("PRIVMSG %s :%s" % (target, text))
766
+        self.send_raw(u'PRIVMSG %s :%s' % (target, text))
767 767
 
768 768
     def privmsg_many(self, targets, text):
769 769
         """Send a PRIVMSG command to multiple targets."""
770 770
         # Should limit len(text) here!
771
-        self.send_raw("PRIVMSG %s :%s" % (",".join(targets), text))
771
+        self.send_raw(u'PRIVMSG %s :%s' % (','.join(targets), text))
772 772
 
773 773
     def quit(self, message=""):
774 774
         """Send a QUIT command."""
@@ -782,17 +782,17 @@ class ServerConnection(Connection):
782 782
         The string will be padded with appropriate CR LF.
783 783
         """
784 784
         if self.socket is None:
785
-            raise ServerNotConnectedError, "Not connected."
785
+            raise ServerNotConnectedError, u'Not connected.'
786 786
         try:
787 787
             if self.ssl:
788
-                self.ssl.write(string + "\r\n")
788
+                self.ssl.write(string + u'\r\n')
789 789
             else:
790
-                self.socket.send(string + "\r\n")
790
+                self.socket.send(string + u'\r\n')
791 791
             if DEBUG:
792
-                print "TO SERVER:", string
792
+                print u'TO SERVER:', string
793 793
         except socket.error, x:
794 794
             # Ouch!
795
-            self.disconnect("Connection reset by peer.")
795
+            self.disconnect(u'Connection reset by peer.')
796 796
 
797 797
     def squit(self, server, comment=""):
798 798
         """Send an SQUIT command."""