X-Git-Url: http://git.maemo.org/git/?p=python-purple;a=blobdiff_plain;f=account.pyx;h=7240de2620309b7260ade83fc3aaa29c78c61d1f;hp=427d2bdebf24c469303a3c38e854dbb5e4156c46;hb=e46b731142ce1fc0bad91a0391c1358c5e2d6405;hpb=b81a85360c67a5721e59458aeec5d7b9280a290e diff --git a/account.pyx b/account.pyx index 427d2bd..7240de2 100644 --- a/account.pyx +++ b/account.pyx @@ -391,27 +391,24 @@ cdef class Account: if self.__exists: return False else: - # FIXME: Using purple_accounts_add(...) to save to xml - # I think we could improve this .. account.purple_accounts_add(account.purple_account_new( \ self.__username, self.__protocol.id)) self.__exists = True return True - - def remove_account(self, username, protocol_id): - """ - Removes as existing account. - @return True if successful, False if account doesnt exists + def remove(self): """ - who = account.purple_accounts_find(username, protocol_id) - - if who == NULL: - return False - else - account.purple_accounts_remove( who ) - return True + Removes an existing account. + + @return True if successful, False if account doesn't exists + """ + if self.__exists: + account.purple_accounts_delete(self._get_structure()) + self__exists = False + return True + else: + return False def connect(self): """ @@ -530,3 +527,11 @@ cdef class Account: return buddies_list else: return None + + def request_add_buddy(self, buddy_username, buddy_alias): + if buddy_alias: + blist.purple_blist_request_add_buddy(self._get_structure(), \ + buddy_username, NULL, buddy_alias) + else: + blist.purple_blist_request_add_buddy(self._get_structure(), \ + buddy_username, NULL, NULL)