Adding function get_all to Plugin class
authorRagner Magalhaes <ragner.magalhaes@openbossa.org>
Tue, 2 Dec 2008 20:55:02 +0000 (20:55 +0000)
committerAnderson Briglia <anderson.briglia@openbossa.org>
Sat, 28 Feb 2009 21:11:15 +0000 (17:11 -0400)
Adding function get_all to Plugin class to return a list of all protocols

Signed-off-by: Ragner Magalhaes <ragner.magalhaes@indt.org.br>

git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1372 596f6dd7-e928-0410-a184-9e12fd12cf7e

plugin.pyx

index a4ef02f..6218227 100644 (file)
@@ -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 = <plugin.PurplePlugin*> 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: