X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=purple.pyx;h=5ff3e775588bcc83799a992ea6932cc07beb95cb;hb=e507381de4127c9db0f6d8d3acbe3a727bd5c066;hp=e32c96340f7f26882b5c1c3e448b932fab6a2c1a;hpb=25da4997cccd6da3dd63d7c73387f7defee45b1c;p=python-purple diff --git a/purple.pyx b/purple.pyx index e32c963..5ff3e77 100644 --- a/purple.pyx +++ b/purple.pyx @@ -22,7 +22,7 @@ cimport purple cdef extern from "c_purple.h": glib.guint glib_input_add(glib.gint fd, eventloop.PurpleInputCondition condition, eventloop.PurpleInputFunction function, glib.gpointer data) -import ecore +import signal cdef glib.GHashTable *c_ui_info @@ -90,8 +90,11 @@ cdef class Purple: if default_path: util.purple_util_set_user_dir(default_path) - # adds glib iteration inside ecore main loop - ecore.timer_add(0.001, self.__glib_iteration_when_idle) + # libpurple's built-in DNS resolution forks processes to perform + # blocking lookups without blocking the main process. It does not + # handle SIGCHLD itself, so if the UI does not you quickly get an army + # of zombie subprocesses marching around. + signal.signal(signal.SIGCHLD, signal.SIG_IGN) def destroy(self): core.purple_core_quit() @@ -162,10 +165,6 @@ cdef class Purple: glib.g_hash_table_insert(c_ui_info, "dev_website", c_ui_dev_website) return c_ui_info - def __glib_iteration_when_idle(self): - glib.g_main_context_iteration(NULL, False) - return True - def purple_init(self): '''Initializes the purple. @@ -296,7 +295,7 @@ cdef class Purple: "request": request_cbs }[type][name] = callback def signal_connect(self, name=None, cb=None): - '''Connects a signal handler to a signal for a particular object. + '''Connects a signal handler to a callback for a particular object. Take care not to register a handler function twice. Purple will not correct any mistakes for you in this area. @@ -411,6 +410,10 @@ cdef class Purple: return account_list + def iterate_main_loop(self): + glib.g_main_context_iteration(NULL, False) + return True + def protocols_get_all(self): '''Returns a list of all protocols. @@ -429,11 +432,11 @@ cdef class Purple: iter = iter.next return protocol_list + def call_action(self, i): + __call_action(i) + include "protocol.pyx" #include "plugin.pyx" include "proxy.pyx" -#include "protocol.pyx" include "account.pyx" -include "buddy.pyx" -#include "connection.pyx" include "conversation.pyx"