X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=buddy.pyx;h=be9f2bd72ac2d6b97de0cbe1ff0b23cd41fb652b;hp=843069f0eade181f659bfebce69ce7f077bf9686;hb=05c92b9fd39b619dd3da3902cb94a3fec94fe563;hpb=404f5754a028f1ddc4f812fca8e841f62d288ce7 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)