X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=buddy.pyx;h=2e1e13250a3f1b77a38ad636d17c805dc0eb9927;hp=a465b6f011cef238db41389ac3881b89f84c7e11;hb=501c0498d70144d950602879e44840e761e8cc00;hpb=b18104778893417ea6ce29ceffe33adb526c86f6 diff --git a/buddy.pyx b/buddy.pyx index a465b6f..2e1e132 100644 --- a/buddy.pyx +++ b/buddy.pyx @@ -22,7 +22,7 @@ cimport purple cdef class Buddy: """ Buddy class """ cdef blist.PurpleBuddy *c_buddy - cdef Account _acc + cdef Account __acc def __init__(self): self.c_buddy = NULL @@ -30,7 +30,7 @@ cdef class Buddy: def __get_account(self): return self.__acc def __set_account(self, acc): - self._acc = acc + self.__acc = acc account = property(__get_account, __set_account) def __get_alias(self): @@ -49,11 +49,20 @@ cdef class Buddy: def __get_online(self): # FIXME name = self.name - self.c_buddy = blist.c_purple_find_buddy(self._acc.c_account, name) + self.c_buddy = blist.c_purple_find_buddy(self.__acc.c_account, name) return status.c_purple_presence_is_online(blist.c_purple_buddy_get_presence(self.c_buddy)) online = property(__get_online) - def new_buddy(self, acc, char *scr, char *alias): + def new_buddy(self, acc, name, alias): self.__acc = acc + cdef char *c_name = NULL + cdef char *c_alias = NULL + + if name is not None: + c_name = name + + if alias is not None: + c_alias = alias + self.c_buddy = blist.c_purple_buddy_new(\ - self.__acc.c_account, scr, alias) + self.__acc.c_account, c_name, c_alias)