summaryrefslogtreecommitdiff
path: root/sunshine/channel
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2010-04-14 16:46:26 +0200
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2010-04-14 16:46:26 +0200
commitc07646c432a593d37c54223d08d5607b19b9ee4b (patch)
tree4e06a9d5849d3562edc0b278f315698c983cbd16 /sunshine/channel
parent01620e1797daadf3d61fd5ea862038b3b5648448 (diff)
HTML Entities in UTF-8 messages (still needs testing).
Diffstat (limited to 'sunshine/channel')
-rw-r--r--sunshine/channel/text.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sunshine/channel/text.py b/sunshine/channel/text.py
index 9d01f74..d37b6d0 100644
--- a/sunshine/channel/text.py
+++ b/sunshine/channel/text.py
@@ -24,7 +24,7 @@ import time
import telepathy
-from sunshine.util.decorator import async
+from sunshine.util.decorator import async, escape
from sunshine.handle import SunshineHandleFactory
__all__ = ['SunshineTextChannel']
@@ -47,7 +47,9 @@ class SunshineTextChannel(telepathy.server.ChannelTypeText):
if message_type == telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL:
logger.info("Sending message to %s, id %s, body: '%s'" % (str(self.handle.name), str(self.handle.id), unicode(text)))
msg = text.decode('UTF-8').encode('windows-1250', 'replace')
- self.conn.gadu_client.sendTo(int(self.handle.name), str(text), str(msg))
+ #gg_text = escape(text.decode('UTF-8')).encode('UTF-8').replace('<', '&lt;').replace('>', '&gt;')
+ gg_text = text.decode('UTF-8', 'xmlcharrefreplace').replace('<', '&lt;').replace('>', '&gt;')
+ self.conn.gadu_client.sendTo(int(self.handle.name), str(gg_text), str(msg))
else:
raise telepathy.NotImplemented("Unhandled message type")
self.Sent(int(time.time()), message_type, text)