diff -urN ./pyicq-t-0.6/src/config.py ./pyicq-t-0.6.new/src/config.py --- ./pyicq-t-0.6/src/config.py 2005-03-05 21:46:18.000000000 +0300 +++ ./pyicq-t-0.6.new/src/config.py 2005-06-17 20:02:32.000000000 +0400 @@ -5,7 +5,7 @@ jid = "icq.localhost" spooldir = ".." -pid = "../PyICQt.pid" +pid = "../pyicqt.pid" mainServer = "127.0.0.1" port = "5347" webport = "" @@ -14,7 +14,7 @@ lang = "en" encoding = "iso-8859-1" icqServer = "login.icq.com" -icqPort = "5238" +icqPort = "5190" sessionGreeting = "" registerMessage = "" crossChat = False diff -urN ./pyicq-t-0.6/src/debug.py ./pyicq-t-0.6.new/src/debug.py --- ./pyicq-t-0.6/src/debug.py 2005-02-27 04:51:11.000000000 +0300 +++ ./pyicq-t-0.6.new/src/debug.py 2005-06-17 19:08:55.000000000 +0400 @@ -5,6 +5,7 @@ import config import utils import time +import locale """ A simple logging module. Use as follows. @@ -28,15 +29,19 @@ def log(data, wtime=True): if(wtime): debugFile.write(time.strftime("%D - %H:%M:%S - ")) - #debugFile.write(utils.latin1(data) + "\n") - debugFile.write(data + "\n") + try: + debugFile.write(data + "\n") + except UnicodeEncodeError: + debugFile.write(data.encode(locale.getpreferredencoding(),'replace') + "\n") debugFile.flush() else: def log(data, wtime=True): if(wtime): print time.strftime("%D - %H:%M:%S - "), - #print utils.latin1(data) - print data + try: + print data + except UnicodeEncodeError: + print data.encode(locale.getpreferredencoding(),'replace') log("Debug logging enabled.") else: def log(data): diff -urN ./pyicq-t-0.6/src/jabw.py ./pyicq-t-0.6.new/src/jabw.py --- ./pyicq-t-0.6/src/jabw.py 2005-03-05 21:48:45.000000000 +0300 +++ ./pyicq-t-0.6.new/src/jabw.py 2005-06-17 19:08:55.000000000 +0400 @@ -5,11 +5,11 @@ from tlib.jabber import jid import utils import debug - +import locale def sendMessage(pytrans, to, fro, body, mtype=None, errorType=None, delay=None): """ Sends a Jabber message """ - debug.log("jabw: Sending a Jabber message \"%s\" \"%s\" \"%s\" \"%s\"" % (to, fro, utils.latin1(body), mtype)) + debug.log("jabw: Sending a Jabber message \"%s\" \"%s\" \"%s\" \"%s\"" % (to, fro, body, mtype)) el = Element((None, "message")) el.attributes["to"] = to el.attributes["from"] = fro @@ -33,7 +33,7 @@ x.attributes["stamp"] = delay b = el.addElement("body") - b.addContent(utils.utf8encode(body)) + b.addContent(body) x = el.addElement("x") x.attributes["xmlns"] = "jabber:x:event" composing = x.addElement("composing") @@ -47,10 +47,10 @@ el.attributes["type"] = ptype if(show): s = el.addElement("show") - s.addContent(utils.utf8encode(show)) + s.addContent(show) if(status): s = el.addElement("status") - s.addContent(utils.utf8encode(status)) + s.addContent(status) if(priority): s = el.addElement("priority") s.addContent(priority) @@ -121,7 +121,7 @@ For this message to be an error, mtype="error", errorType=("modify", "bad-request", "Human readable descriptive text") - See XMPP Core (RFC3920) for more details For this message to have a you must pass a correctly formatted timestamp (See JEP0091) """ - debug.log("User: %s - JabberConnection sending message \"%s\" \"%s\" \"%s\" \"%s\"" % (self.jabberID, to, fro, utils.latin1(body), mtype)) + debug.log("User: %s - JabberConnection sending message \"%s\" \"%s\" \"%s\" \"%s\"" % (self.jabberID, to, fro, body, mtype)) sendMessage(self.pytrans, to, fro, body, mtype, errorType, delay) def sendErrorMessage(self, to, fro, etype, eelement, econtent, body=None): @@ -194,10 +194,9 @@ self.typingNotificationReceived(toj.userhost(), toj.resource, composing) if(body): -# body = utils.utf8(body) # Save the message ID for later self.messageIDs[to] = mID - debug.log("User: %s - JabberConnection parsed message packet \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"" % (self.jabberID, froj.userhost(), to, froj.resource, mtype, utils.latin1(body))) + debug.log("User: %s - JabberConnection parsed message packet \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"" % (self.jabberID, froj.userhost(), to, froj.resource, mtype, body)) self.messageReceived(froj.userhost(), froj.resource, toj.userhost(), toj.resource, mtype, body) def onPresence(self, el): diff -urN ./pyicq-t-0.6/src/legacy/glue.py ./pyicq-t-0.6.new/src/legacy/glue.py --- ./pyicq-t-0.6/src/legacy/glue.py 2005-03-12 08:44:40.000000000 +0300 +++ ./pyicq-t-0.6.new/src/legacy/glue.py 2005-06-17 19:08:55.000000000 +0400 @@ -7,6 +7,7 @@ import config import debug import lang +import locale # The name of the transport name = "ICQ Transport" diff -urN ./pyicq-t-0.6/src/legacy/icqt.py ./pyicq-t-0.6.new/src/legacy/icqt.py --- ./pyicq-t-0.6/src/legacy/icqt.py 2005-03-12 02:39:39.000000000 +0300 +++ ./pyicq-t-0.6.new/src/legacy/icqt.py 2005-06-17 19:47:31.000000000 +0400 @@ -12,6 +12,7 @@ import sys, warnings, pprint import stats import lang +import locale ############################################################################# @@ -62,7 +63,7 @@ def gotAuthorizationRespons(self, uin, success): from glue import icq2jid - debug.log("B: Authorization Respons: %s, %s"%(uin, success)) + debug.log("B: Authorization Response: %s, %s"%(uin, success)) if success: for g in self.ssigroups: for u in g.users: @@ -118,10 +119,10 @@ sourcejid = icq2jid(user.name) text = oscar.dehtml(multiparts[0][0]) if (len(multiparts[0]) > 1): - if (multiparts[0][1] in ['unicode','utf-8']): + if (multiparts[0][1] in ['unicode','utf-8','utf8']): encoding = "utf-8" else: - encoding = config.encoding + encoding = multiparts[0][1] else: encoding = config.encoding debug.log("B: using encoding %s" % (encoding)) diff -urN ./pyicq-t-0.6/src/main.py ./pyicq-t-0.6.new/src/main.py --- ./pyicq-t-0.6/src/main.py 2005-03-12 03:09:44.000000000 +0300 +++ ./pyicq-t-0.6.new/src/main.py 2005-06-17 20:06:08.000000000 +0400 @@ -5,8 +5,11 @@ import getopt import sys import os +import locale + reload(sys) -sys.setdefaultencoding('iso-8859-1') +locale.setlocale(locale.LC_ALL, "") +sys.setdefaultencoding(locale.getpreferredencoding()) del sys.setdefaultencoding if (float(sys.version[:3]) < 2.3): @@ -38,7 +41,7 @@ var, setting = v.split("=", 2) options[var] = setting elif o in ("-h", "--help"): - print "./PyICQt [options]" + print "./pyicqt [options]" print " -h print this help" print " -c read configuration from this file" print " -d print debugging output" diff -urN ./pyicq-t-0.6/src/tlib/domish.py ./pyicq-t-0.6.new/src/tlib/domish.py --- ./pyicq-t-0.6/src/tlib/domish.py 2005-02-27 04:51:11.000000000 +0300 +++ ./pyicq-t-0.6.new/src/tlib/domish.py 2005-06-17 18:15:47.000000000 +0400 @@ -422,7 +422,7 @@ es = SuxElementStream() return es -from twisted.protocols import sux +from twisted.web import sux class SuxElementStream(sux.XMLParser): def __init__(self): self.connectionMade() diff -urN ./pyicq-t-0.6/src/tlib/jabber/component.py ./pyicq-t-0.6.new/src/tlib/jabber/component.py --- ./pyicq-t-0.6/src/tlib/jabber/component.py 2005-02-27 04:51:11.000000000 +0300 +++ ./pyicq-t-0.6.new/src/tlib/jabber/component.py 2005-06-17 18:17:12.000000000 +0400 @@ -19,7 +19,7 @@ from tlib import domish from twisted.xish import xpath, utility from tlib import xmlstream -from twisted.protocols.jabber import jstrports +from twisted.words.protocols.jabber import jstrports def componentFactory(componentid, password): a = ConnectComponentAuthenticator(componentid, password)