summaryrefslogtreecommitdiff
path: root/sunshine/channel
diff options
context:
space:
mode:
authorKrzysztof Klinikowski <kkszysiu@gmail.com>2011-06-12 14:17:19 +0200
committerKrzysztof Klinikowski <kkszysiu@gmail.com>2011-06-12 14:18:40 +0200
commite26dd019a2ccc3c699094911fb0422bfb504a601 (patch)
tree8b090ade3c1f14dbf88ade0b5410326a37da4134 /sunshine/channel
parent6bfd256bcce37be1b44ae5bb139df977e3532f83 (diff)
Added SendMessage implementation in Text channel. It should fix problems with gnome-shell instant messaging system. (Patch by Jarosław Przybyłowicz, thanks!)HEADmaster
Diffstat (limited to 'sunshine/channel')
-rw-r--r--sunshine/channel/text.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/sunshine/channel/text.py b/sunshine/channel/text.py
index d728162..6fe2b7e 100644
--- a/sunshine/channel/text.py
+++ b/sunshine/channel/text.py
@@ -82,6 +82,17 @@ class SunshineTextChannel(SunshineChannel,
else:
raise telepathy.NotImplemented("Unhandled message type")
+ def SendMessage(self, message, flags):
+ # we should do something about flags, but for now it is not supported
+ if len(message) >= 2:
+ header = message[0]
+ alternatives = message[1:len(message)]
+ for alt in alternatives:
+ if alt["content-type"] == "text/plain":
+ self.Send(telepathy.CHANNEL_TEXT_MESSAGE_TYPE_NORMAL, alt["content"])
+ # message identifier should be returned here, but empty string is good unless we want to track delivery
+ return ''
+
def Close(self):
telepathy.server.ChannelTypeText.Close(self)
#self.remove_from_connection()