X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=nullclient.py;h=2e82c9c0603149074f6e70aff265d62ef6ec1d12;hp=d0fcb9baf46c40b566d289818e319c86349b2aa7;hb=914326e7528712bb501aa9267b4156a4da4ee358;hpb=7cb45fa563b2f0d0e9352373ab0e853188592dcf diff --git a/nullclient.py b/nullclient.py index d0fcb9b..2e82c9c 100644 --- a/nullclient.py +++ b/nullclient.py @@ -3,13 +3,38 @@ import ecore import getpass import sys +cbs = {} +conv_cbs = {} + +def callback(name): + print "---- callback example: %s" % name + +conv_cbs["create_conversation"] = callback +conv_cbs["destroy_conversation"] = callback +conv_cbs["write_chat"] = callback +conv_cbs["write_im"] = callback +conv_cbs["write_conv"] = callback +conv_cbs["chat_add_users"] = callback +conv_cbs["chat_rename_user"] = callback +conv_cbs["chat_remove_users"] = callback +conv_cbs["chat_update_user"] = callback +conv_cbs["present"] = callback +conv_cbs["has_focus"] = callback +conv_cbs["custom_smiley_add"] = callback +conv_cbs["custom_smiley_write"] = callback +conv_cbs["custom_smiley_close"] = callback +conv_cbs["send_confirm"] = callback + +cbs["conversation"] = conv_cbs + class NullClient: def __init__(self): self.p = purple.Purple() self.account = None def execute(self): - self.p.purple_init() + global cbs + self.p.purple_init(cbs) def set_protocol(self, protocol): for i in self.p.get_protocols(): @@ -23,7 +48,6 @@ class NullClient: self.account = purple.Account(username, protocol) self.account.set_password(password) self.account.set_enabled("carman-purple-python", True) - def get_buddies(self): buddies = self.account.get_buddies_online() print buddies