[Telepathy-commits] [telepathy-doc/master] Echo the message back to the sender
Davyd Madeley
davyd at madeley.id.au
Fri Mar 6 08:06:49 PST 2009
---
docs/examples/python_iface_messaging/example.py | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/docs/examples/python_iface_messaging/example.py b/docs/examples/python_iface_messaging/example.py
index 73bd77c..2fefd88 100755
--- a/docs/examples/python_iface_messaging/example.py
+++ b/docs/examples/python_iface_messaging/example.py
@@ -74,9 +74,24 @@ class TextChannel (telepathy.client.Channel):
print '}'
print '-' * 78
+ # let's echo the content back
+ new_message = [
+ {}, # let the CM fill in the headers
+ {
+ 'content': '%s?' % message[1]['content'], # FIXME may be wrong part
+ 'content-type': 'text/plain',
+ },
+ ]
+ channel[CHANNEL_INTERFACE_MESSAGES].SendMessage(new_message, 0,
+ reply_handler = self.send_message_cb,
+ error_handler = self.parent.error_cb)
+
def pending_messages_removed_cb (self, message_ids):
print "Acked messages %s" % message_ids
+ def send_message_cb (self, token):
+ print "Sending message with token %s" % token
+
class Example (object):
def __init__ (self, account, password):
"""e.g. account = 'bob at example.com/test'
--
1.5.6.5
More information about the telepathy-commits
mailing list