Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 88283 | Differences between
and this patch

Collapse All | Expand All

(-)legacy/glue.py (+1 lines)
Lines 7-12 Link Here
7
import config
7
import config
8
import debug
8
import debug
9
import lang
9
import lang
10
import locale
10
11
11
# The name of the transport
12
# The name of the transport
12
name = "ICQ Transport"
13
name = "ICQ Transport"
(-)legacy/icqt.py (-1 / +2 lines)
Lines 12-17 Link Here
12
import sys, warnings, pprint
12
import sys, warnings, pprint
13
import stats
13
import stats
14
import lang
14
import lang
15
import locale
15
16
16
17
17
#############################################################################
18
#############################################################################
Lines 121-127 Link Here
121
			if (multiparts[0][1] in ['unicode','utf-8']):
122
			if (multiparts[0][1] in ['unicode','utf-8']):
122
				encoding = "utf-8"
123
				encoding = "utf-8"
123
			else:
124
			else:
124
				encoding = config.encoding
125
				encoding = multiparts[0][1]
125
		else:
126
		else:
126
			encoding = config.encoding
127
			encoding = config.encoding
127
		debug.log("B: using encoding %s" % (encoding))
128
		debug.log("B: using encoding %s" % (encoding))
(-)jabw.py (-8 / +7 lines)
Lines 5-15 Link Here
5
from tlib.jabber import jid
5
from tlib.jabber import jid
6
import utils
6
import utils
7
import debug
7
import debug
8
import locale
8
9
9
10
def sendMessage(pytrans, to, fro, body, mtype=None, errorType=None, delay=None):
10
def sendMessage(pytrans, to, fro, body, mtype=None, errorType=None, delay=None):
11
	""" Sends a Jabber message """
11
	""" Sends a Jabber message """
12
	debug.log("jabw: Sending a Jabber message \"%s\" \"%s\" \"%s\" \"%s\"" % (to, fro, utils.latin1(body), mtype))
12
	debug.log("jabw: Sending a Jabber message \"%s\" \"%s\" \"%s\" \"%s\"" % (to, fro, body, mtype))
13
	el = Element((None, "message"))
13
	el = Element((None, "message"))
14
	el.attributes["to"] = to
14
	el.attributes["to"] = to
15
	el.attributes["from"] = fro
15
	el.attributes["from"] = fro
Lines 33-39 Link Here
33
		x.attributes["stamp"] = delay
33
		x.attributes["stamp"] = delay
34
34
35
	b = el.addElement("body")
35
	b = el.addElement("body")
36
	b.addContent(utils.utf8encode(body))
36
	b.addContent(body)
37
	x = el.addElement("x")
37
	x = el.addElement("x")
38
	x.attributes["xmlns"] = "jabber:x:event"
38
	x.attributes["xmlns"] = "jabber:x:event"
39
	composing = x.addElement("composing")
39
	composing = x.addElement("composing")
Lines 47-56 Link Here
47
		el.attributes["type"] = ptype
47
		el.attributes["type"] = ptype
48
	if(show):
48
	if(show):
49
		s = el.addElement("show")
49
		s = el.addElement("show")
50
		s.addContent(utils.utf8encode(show))
50
		s.addContent(show)
51
	if(status):
51
	if(status):
52
		s = el.addElement("status")
52
		s = el.addElement("status")
53
		s.addContent(utils.utf8encode(status))
53
		s.addContent(status)
54
	if(priority):
54
	if(priority):
55
		s = el.addElement("priority")
55
		s = el.addElement("priority")
56
		s.addContent(priority)
56
		s.addContent(priority)
Lines 121-127 Link Here
121
		For this message to be an error, mtype="error", errorType=("modify", "bad-request", "Human readable descriptive text") - See XMPP Core (RFC3920) for more details
121
		For this message to be an error, mtype="error", errorType=("modify", "bad-request", "Human readable descriptive text") - See XMPP Core (RFC3920) for more details
122
		For this message to have a <x xmlns="jabber:x:delay"/> you must pass a correctly formatted timestamp (See JEP0091)
122
		For this message to have a <x xmlns="jabber:x:delay"/> you must pass a correctly formatted timestamp (See JEP0091)
123
		"""
123
		"""
124
		debug.log("User: %s - JabberConnection sending message \"%s\" \"%s\" \"%s\" \"%s\"" % (self.jabberID, to, fro, utils.latin1(body), mtype))
124
		debug.log("User: %s - JabberConnection sending message \"%s\" \"%s\" \"%s\" \"%s\"" % (self.jabberID, to, fro, body, mtype))
125
		sendMessage(self.pytrans, to, fro, body, mtype, errorType, delay)
125
		sendMessage(self.pytrans, to, fro, body, mtype, errorType, delay)
126
	
126
	
127
	def sendErrorMessage(self, to, fro, etype, eelement, econtent, body=None):
127
	def sendErrorMessage(self, to, fro, etype, eelement, econtent, body=None):
Lines 194-203 Link Here
194
			self.typingNotificationReceived(toj.userhost(), toj.resource, composing)
194
			self.typingNotificationReceived(toj.userhost(), toj.resource, composing)
195
195
196
		if(body):
196
		if(body):
197
# 			body = utils.utf8(body)
198
			# Save the message ID for later
197
			# Save the message ID for later
199
			self.messageIDs[to] = mID
198
			self.messageIDs[to] = mID
200
			debug.log("User: %s - JabberConnection parsed message packet \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"" % (self.jabberID, froj.userhost(), to, froj.resource, mtype, utils.latin1(body)))
199
			debug.log("User: %s - JabberConnection parsed message packet \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"" % (self.jabberID, froj.userhost(), to, froj.resource, mtype, body))
201
			self.messageReceived(froj.userhost(), froj.resource, toj.userhost(), toj.resource, mtype, body)
200
			self.messageReceived(froj.userhost(), froj.resource, toj.userhost(), toj.resource, mtype, body)
202
	
201
	
203
	def onPresence(self, el):
202
	def onPresence(self, el):
(-)main.py (-1 / +4 lines)
Lines 5-12 Link Here
5
import getopt
5
import getopt
6
import sys
6
import sys
7
import os
7
import os
8
import locale
9
8
reload(sys)
10
reload(sys)
9
sys.setdefaultencoding('iso-8859-1')
11
locale.setlocale(locale.LC_ALL, "")
12
sys.setdefaultencoding(locale.getpreferredencoding())
10
del sys.setdefaultencoding
13
del sys.setdefaultencoding
11
14
12
if (float(sys.version[:3]) < 2.3):
15
if (float(sys.version[:3]) < 2.3):
(-)debug.py (-4 / +9 lines)
Lines 5-10 Link Here
5
import config
5
import config
6
import utils
6
import utils
7
import time
7
import time
8
import locale
8
9
9
""" A simple logging module. Use as follows.
10
""" A simple logging module. Use as follows.
10
11
Lines 28-42 Link Here
28
		def log(data, wtime=True):
29
		def log(data, wtime=True):
29
			if(wtime):
30
			if(wtime):
30
				debugFile.write(time.strftime("%D - %H:%M:%S - "))
31
				debugFile.write(time.strftime("%D - %H:%M:%S - "))
31
			#debugFile.write(utils.latin1(data) + "\n")
32
			try:
32
			debugFile.write(data + "\n")
33
				debugFile.write(data + "\n")
34
			except UnicodeEncodeError:
35
				debugFile.write(data.encode(locale.getpreferredencoding(),'replace') + "\n")
33
			debugFile.flush()
36
			debugFile.flush()
34
	else:
37
	else:
35
		def log(data, wtime=True):
38
		def log(data, wtime=True):
36
			if(wtime):
39
			if(wtime):
37
				print time.strftime("%D - %H:%M:%S - "),
40
				print time.strftime("%D - %H:%M:%S - "),
38
			#print utils.latin1(data)
41
			try:
39
			print data
42
				print data
43
			except UnicodeEncodeError:
44
				print data.encode(locale.getpreferredencoding(),'replace')
40
	log("Debug logging enabled.")
45
	log("Debug logging enabled.")
41
else:
46
else:
42
	def log(data):
47
	def log(data):

Return to bug 88283