comparison frontends/primitivus/contact_list.py @ 153:f197b52796ee

Primitivus: begining of management for actionResult
author Goffi <goffi@goffi.org>
date Sat, 31 Jul 2010 00:34:05 +0800
parents 2240f34f6452
children 5d7a011d78ba
comparison
equal deleted inserted replaced
152:b1f1955d96b3 153:f197b52796ee
122 return self.selected 122 return self.selected
123 123
124 def clear_contacts(self): 124 def clear_contacts(self):
125 """clear all the contact list""" 125 """clear all the contact list"""
126 self.groups={} 126 self.groups={}
127 self.selected = None
127 128
128 def replace(self, jid, groups=[None]): 129 def replace(self, jid, groups=[None]):
129 """add a contact to the list if doesn't exist, else update it""" 130 """add a contact to the list if doesn't exist, else update it"""
130 assert groups.__class__ == list 131 assert isinstance(groups, list)
131 assert jid.__class__ == JID 132 assert isinstance(jid, JID)
132 if not groups: 133 if not groups:
133 groups=[None] 134 groups=[None]
134 for group in groups: 135 for group in groups:
135 if not self.groups.has_key(group): 136 if not self.groups.has_key(group):
136 self.groups[group] = [True,set()] #[unfold,list_of_contacts] 137 self.groups[group] = [True,set()] #[unfold,list_of_contacts]