From ffc27697967c201734f3d950071760b94c1c2fa7 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 20:55:02 +0000 Subject: [PATCH 1/1] Adding function get_all to Plugin class Adding function get_all to Plugin class to return a list of all protocols Signed-off-by: Ragner Magalhaes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1372 596f6dd7-e928-0410-a184-9e12fd12cf7e --- plugin.pyx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plugin.pyx b/plugin.pyx index a4ef02f..6218227 100644 --- a/plugin.pyx +++ b/plugin.pyx @@ -34,6 +34,22 @@ cdef class Plugin: def get_id(self): return self.c_plugin.info.id + def get_all(self): + ''' @return A string list of protocols' (id, name) ''' + ''' [('prpl-jabber', 'XMPP'), ('foo', 'MSN'), ...] ''' + cdef glib.GList *iter + cdef plugin.PurplePlugin *pp + + protocols = [] + + iter = plugin.c_purple_plugins_get_protocols() + while iter: + pp = iter.data + if pp.info and pp.info.name: + protocols.append((pp.info.id, pp.info.name)) + iter = iter.next + + return protocols cdef class Plugins: -- 1.7.9.5