Added signal callbacks used by pidgin-carman.
[python-purple] / nullclient.py
index 0e3a73c..81a5ac2 100644 (file)
@@ -5,8 +5,12 @@ import sys
 
 cbs = {}
 acc_cbs = {}
+blist_cbs = {}
 conn_cbs = {}
 conv_cbs = {}
+notify_cbs = {}
+request_cbs = {}
+signal_cbs = {}
 
 def account_callback(name):
     print "---- account callback example: %s" % name
@@ -19,6 +23,22 @@ acc_cbs["close_account_request"] = account_callback
 
 cbs["account"] = acc_cbs
 
+def blist_callback(name):
+    print "---- blist callback example: %s" % name
+
+blist_cbs["new_list"] = blist_callback
+blist_cbs["new_node"] = blist_callback
+blist_cbs["show"] = blist_callback
+blist_cbs["update"] = blist_callback
+blist_cbs["remove"] = blist_callback
+blist_cbs["destroy"] = blist_callback
+blist_cbs["set_visible"] = blist_callback
+blist_cbs["request_add_buddy"] = blist_callback
+blist_cbs["request_add_chat"] = blist_callback
+blist_cbs["request_add_group"] = blist_callback
+
+cbs["blist"] = blist_cbs
+
 def conn_callback(name):
     print "---- connection callback example: %s" % name
 
@@ -54,9 +74,47 @@ conv_cbs["send_confirm"] = conv_callback
 
 cbs["conversation"] = conv_cbs
 
+def notify_callback(name):
+    print "----  notify callback example: %s" % name
+
+notify_cbs["notify_message"] = notify_callback
+notify_cbs["notify_email"] = notify_callback
+notify_cbs["notify_emails"] = notify_callback
+notify_cbs["notify_formatted"] = notify_callback
+notify_cbs["notify_searchresults"] = notify_callback
+notify_cbs["notify_searchresults_new_rows"] = notify_callback
+notify_cbs["notify_userinfo"] = notify_callback
+notify_cbs["notify_uri"] = notify_callback
+notify_cbs["close_notify"] = notify_callback
+
+cbs["notify"] = notify_cbs
+
+def request_callback(name):
+    print "---- request callback example: %s" % name
+
+request_cbs["request_input"] = request_callback
+request_cbs["request_choice"] = request_callback
+request_cbs["request_action"] = request_callback
+request_cbs["request_fields"] = request_callback
+request_cbs["request_file"] = request_callback
+request_cbs["close_request"] = request_callback
+request_cbs["request_folder"] = request_callback
+
+cbs["request"] = request_cbs
+
+def buddy_signed_off_cb(name):
+    print "---- signal callback example: sign off from buddy %s" % name
+
+def receiving_im_msg_cb(sender, message):
+    print "---- signal callback example: receiving im message from %s" % sender
+    print "---- message: %s" % message
+
+signal_cbs["buddy_signed_off"] = buddy_signed_off_cb
+signal_cbs["receiving_im_msg"] = receiving_im_msg_cb
+
 class NullClient:
     def __init__(self):
-        self.p = purple.Purple()
+        self.p = purple.Purple(debug_enabled=False)
         self.account = None
 
     def execute(self):
@@ -97,5 +155,6 @@ if __name__ == '__main__':
     client.new_account(username, client.protocol, password)
 
     client.p.connect()
+    client.p.attach_signals(signal_cbs)
     ecore.timer_add(20, client.get_buddies)
     ecore.main_loop_begin()