From: Ragner Magalhaes Date: Tue, 2 Dec 2008 21:26:21 +0000 (+0000) Subject: Adding support to get buddy's active status X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=commitdiff_plain;h=05c92b9fd39b619dd3da3902cb94a3fec94fe563;ds=inline Adding support to get buddy's active status Adding support to get buddy's active status Signed-off-by: Ragner Magalhaes Acked-by: Bruno Abinader Acked-by: Dinorah Monteiro Acked-by: Ricardo Guimaraes git-svn-id: https://garage.maemo.org/svn/carman/branches/carman-0.7-beta2/python-purple@1461 596f6dd7-e928-0410-a184-9e12fd12cf7e --- diff --git a/buddy.pyx b/buddy.pyx index 843069f..be9f2bd 100644 --- a/buddy.pyx +++ b/buddy.pyx @@ -135,6 +135,30 @@ cdef class Buddy: return None idle = property(__get_idle) + def __get_active_status(self): + cdef status.PurpleStatus* c_status = NULL + cdef char *type = NULL + cdef char *name = NULL + cdef char *msg = NULL + if self.__exists: + active = {} + c_status = status.purple_presence_get_active_status( \ + blist.purple_buddy_get_presence(self._get_structure())) + type = status.purple_status_get_id(c_status) + name = status.purple_status_get_name(c_status) + msg = status.purple_status_get_attr_string(c_status, + "message") + + active['type'] = type + active['name'] = name + if msg: + active['message'] = msg + + return active + else: + return None + active_status = property(__get_active_status) + def set_alias(self, alias): if self.__exists: blist.purple_blist_alias_buddy(self._get_structure(), alias)