2 # Copyright (c) 2008 INdT - Instituto Nokia de Tecnologia
4 # This file is part of python-purple.
6 # python-purple is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # python-purple is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
33 def __init__(self, name, account):
35 self.__account = account
37 if self._get_structure() != NULL:
42 cdef blist.PurpleBuddy *_get_structure(self):
43 return blist.purple_find_buddy(account.purple_accounts_find( \
44 self.__account.username, self.__account.protocol.id), \
47 def __get_exists(self):
49 exists = property(__get_exists)
53 return <char *> blist.purple_buddy_get_name(self._get_structure())
56 name = property(__get_name)
58 def __get_account(self):
63 account = property(__get_account)
65 def __get_alias(self):
66 cdef char *c_alias = NULL
67 c_alias = <char *> blist.purple_buddy_get_alias_only( \
68 self._get_structure())
73 alias = property(__get_alias)
75 def __get_server_alias(self):
76 cdef char *c_server_alias = NULL
77 c_server_alias = <char *> blist.purple_buddy_get_server_alias( \
78 self._get_structure())
83 server_alias = property(__get_server_alias)
85 def __get_contact_alias(self):
86 cdef char *c_contact_alias = NULL
87 c_contact_alias = <char *> blist.purple_buddy_get_contact_alias( \
88 self._get_structure())
90 return c_contact_alias
93 contact_alias = property(__get_contact_alias)
95 def __get_local_alias(self):
96 cdef char *c_local_alias = NULL
97 c_local_alias = <char *> blist.purple_buddy_get_local_alias( \
98 self._get_structure())
103 local_alias = property(__get_local_alias)
105 def __get_available(self):
107 return status.purple_presence_is_available( \
108 blist.purple_buddy_get_presence(self._get_structure()))
111 available = property(__get_available)
113 def __get_online(self):
115 return status.purple_presence_is_online( \
116 blist.purple_buddy_get_presence(self._get_structure()))
119 online = property(__get_online)
121 def __get_idle(self):
123 return status.purple_presence_is_idle( \
124 blist.purple_buddy_get_presence(self._get_structure()))
127 idle = property(__get_idle)
129 def set_alias(self, alias):
131 blist.purple_blist_alias_buddy(self._get_structure(), alias)