From e26dd019a2ccc3c699094911fb0422bfb504a601 Mon Sep 17 00:00:00 2001 From: Krzysztof Klinikowski Date: Sun, 12 Jun 2011 14:17:19 +0200 Subject: Added SendMessage implementation in Text channel. It should fix problems with gnome-shell instant messaging system. (Patch by Jarosław Przybyłowicz, thanks!) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sunshine/channel/text.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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() -- cgit v1.2.3