-import purple
-import ecore
+#
+# Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
+#
+# This file is part of python-purple.
+#
+# python-purple is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# python-purple is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#
class CallBackBase:
def __init__(self, dict_cbs):
self.cbs = dict_cbs
-
+
def add_callback(self, name, func):
self.cbs[name] = func
def account_callback(name):
print "---- account callback example: %s" % name
-acc_cbs["notify_added"] = account_callback
-acc_cbs["status_changed"] = account_callback
-acc_cbs["request_add"] = account_callback
-acc_cbs["request_authorize"] = account_callback
-acc_cbs["close_account_request"] = account_callback
-
-cbs["account"] = acc_cbs
-
def blist_callback(name):
print "---- blist callback example: %s" % name
global cbs
cbs["blist"]["update"] = self._purple_update_blist_cb
+
+ self.p.add_account_cb("notify_added", account_callback)
+ self.p.add_account_cb("status_changed", account_callback)
+ self.p.add_account_cb("request_add", account_callback)
+ self.p.add_account_cb("request_authorize", account_callback)
+ self.p.add_account_cb("close_account_request", account_callback)
+
+
self.p.purple_init(cbs)
self.p.accounts_init()
# adds glib iteration inside ecore main loop
ecore.timer_add(0.001, self.__glib_iteration_when_idle)
-
def destroy(self):
core.c_purple_core_quit()
""" Initializes libpurple """
if callbacks_dict is not None:
- # global account_cbs
global blist_cbs
global connection_cbs
global conversation_cbs
global notify_cbs
global request_cbs
- # account_cbs = callbacks_dict["account"]
blist_cbs = callbacks_dict["blist"]
connection_cbs = callbacks_dict["connection"]
conversation_cbs = callbacks_dict["conversation"]