Mercurial > libervia-web
comparison browser_side/contact.py @ 28:258dfaa1035f
browser side:
- roomJoined signal added and open a new tab
- name refactoring
- connected contact are saved
- launchTarotGame method used
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 07 May 2011 23:58:57 +0200 |
parents | 586f69e85559 |
children | e70521e6d803 |
comparison
equal
deleted
inserted
replaced
27:d89982865c57 | 28:258dfaa1035f |
---|---|
117 | 117 |
118 def __init__(self, host): | 118 def __init__(self, host): |
119 SimplePanel.__init__(self) | 119 SimplePanel.__init__(self) |
120 self.host = host | 120 self.host = host |
121 self.groups={} | 121 self.groups={} |
122 self.connected = {} #jid connected as key and their status | |
122 | 123 |
123 self.vPanel = VerticalPanel() | 124 self.vPanel = VerticalPanel() |
124 _title = ContactTitleLabel('Contacts') | 125 _title = ContactTitleLabel('Contacts') |
125 DOM.setStyleAttribute(_title.getElement(), "cursor", "pointer") | 126 DOM.setStyleAttribute(_title.getElement(), "cursor", "pointer") |
126 | 127 |
142 @param groups: list of groups""" | 143 @param groups: list of groups""" |
143 for group in groups: | 144 for group in groups: |
144 if not self.groups.has_key(group): | 145 if not self.groups.has_key(group): |
145 self.groups[group] = set() | 146 self.groups[group] = set() |
146 self._groupList.add(group) | 147 self._groupList.add(group) |
147 self.host.uniBox.addKey("@%s: " % group) | 148 self.host.uni_box.addKey("@%s: " % group) |
148 self.groups[group].add(jid) | 149 self.groups[group].add(jid) |
149 self._contactList.add(jid) | 150 self._contactList.add(jid) |
151 | |
152 def setConnected(self, jid, resource, availability, priority, statuses): | |
153 """Set connection status""" | |
154 if availability=='unavailable': | |
155 if self.connected.has_key(jid): | |
156 if self.connected[jid].has_key(resource): | |
157 del self.connected[jid][resource] | |
158 if not self.connected[jid]: | |
159 del self.connected[jid] | |
160 else: | |
161 if not self.connected.has_key(jid): | |
162 self.connected[jid] = {} | |
163 self.connected[jid][resource] = (availability, priority, statuses) | |
164 | |
165 def getConnected(self): | |
166 """return a list of all jid (bare jid) connected""" | |
167 return self.connected.keys() | |
150 | 168 |
151 def isContactInGroup(self, group, contact_jid): | 169 def isContactInGroup(self, group, contact_jid): |
152 """Test if the contact_jid is in the group | 170 """Test if the contact_jid is in the group |
153 @param group: string of single group, or list of string | 171 @param group: string of single group, or list of string |
154 @param contact_jid: jid to test | 172 @param contact_jid: jid to test |