From 05c92b9fd39b619dd3da3902cb94a3fec94fe563 Mon Sep 17 00:00:00 2001 From: Ragner Magalhaes Date: Tue, 2 Dec 2008 21:26:21 +0000 Subject: [PATCH 1/1] 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 --- buddy.pyx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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) -- 1.7.9.5