Mercurial > libervia-web
comparison src/browser/sat_browser/contact_list.py @ 696:c2f22ca12e23
browser and server side: remove unibox
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 20 Apr 2015 08:51:25 +0200 |
parents | 1d60fa4d25a4 |
children | b395d1309936 |
comparison
equal
deleted
inserted
replaced
695:e86490a7c76e | 696:c2f22ca12e23 |
---|---|
182 tab_panel = self.host.panel.tab_panel | 182 tab_panel = self.host.panel.tab_panel |
183 if tab_panel.getWidgetCount() > 1: | 183 if tab_panel.getWidgetCount() > 1: |
184 ideal_height -= tab_panel.getTabBar().getOffsetHeight() | 184 ideal_height -= tab_panel.getTabBar().getOffsetHeight() |
185 self.scroll_panel.setHeight("%s%s" % (ideal_height, "px")) | 185 self.scroll_panel.setHeight("%s%s" % (ideal_height, "px")) |
186 | 186 |
187 # def updateContact(self, jid_s, attributes, groups): | |
188 # """Add a contact to the panel if it doesn't exist, update it else | |
189 | |
190 # @param jid_s: jid userhost as unicode | |
191 # @param attributes: cf SàT Bridge API's newContact | |
192 # @param groups: list of groups""" | |
193 # _current_groups = self.getContactGroups(jid_s) | |
194 # _new_groups = set(groups) | |
195 # _key = "@%s: " | |
196 | |
197 # for group in _current_groups.difference(_new_groups): | |
198 # # We remove the contact from the groups where he isn't anymore | |
199 # self.groups[group].remove(jid_s) | |
200 # if not self.groups[group]: | |
201 # # The group is now empty, we must remove it | |
202 # del self.groups[group] | |
203 # self._group_panel.remove(group) | |
204 # if self.host.uni_box: | |
205 # self.host.uni_box.removeKey(_key % group) | |
206 | |
207 # for group in _new_groups.difference(_current_groups): | |
208 # # We add the contact to the groups he joined | |
209 # if group not in self.groups.keys(): | |
210 # self.groups[group] = set() | |
211 # self._group_panel.add(group) | |
212 # if self.host.uni_box: | |
213 # self.host.uni_box.addKey(_key % group) | |
214 # self.groups[group].add(jid_s) | |
215 | |
216 # # We add the contact to contact list, it will check if contact already exists | |
217 # self._contacts_panel.add(jid_s) | |
218 # self.updateVisibility([jid_s], self.getContactGroups(jid_s)) | |
219 | |
220 # def removeContact(self, jid): | |
221 # """Remove contacts from groups where he is and contact list""" | |
222 # self.updateContact(jid, {}, []) # we remove contact from every group | |
223 # self._contacts_panel.remove(jid) | |
224 | |
225 # def setConnected(self, jid_s, resource, availability, priority, statuses): | |
226 # """Set connection status | |
227 # @param jid_s (unicode): JID userhost as unicode | |
228 # """ | |
229 # if availability == 'unavailable': | |
230 # if jid_s in self.connected: | |
231 # if resource in self.connected[jid_s]: | |
232 # del self.connected[jid_s][resource] | |
233 # if not self.connected[jid_s]: | |
234 # del self.connected[jid_s] | |
235 # else: | |
236 # if jid_s not in self.connected: | |
237 # self.connected[jid_s] = {} | |
238 # self.connected[jid_s][resource] = (availability, priority, statuses) | |
239 | |
240 # # check if the contact is connected with another resource, use the one with highest priority | |
241 # if jid_s in self.connected: | |
242 # max_resource = max_priority = None | |
243 # for tmp_resource in self.connected[jid_s]: | |
244 # if max_priority is None or self.connected[jid_s][tmp_resource][1] >= max_priority: | |
245 # max_resource = tmp_resource | |
246 # max_priority = self.connected[jid_s][tmp_resource][1] | |
247 # if availability == "unavailable": # do not check the priority here, because 'unavailable' has a dummy one | |
248 # priority = max_priority | |
249 # availability = self.connected[jid_s][max_resource][0] | |
250 # if jid_s not in self.connected or priority >= max_priority: | |
251 # # case 1: jid not in self.connected means all resources are disconnected, update with 'unavailable' | |
252 # # case 2: update (or confirm) with the values of the resource which takes precedence | |
253 # self._contacts_panel.setState(jid_s, "availability", availability) | |
254 | |
255 # self.updateVisibility([jid_s], self.getContactGroups(jid_s)) | |
256 | |
257 def setContactMessageWaiting(self, jid, waiting): | |
258 """Show a visual indicator that contact has send a message | |
259 | |
260 @param jid: jid of the contact | |
261 @param waiting: True if message are waiting""" | |
262 raise Exception("Should not be there") | |
263 # self._contacts_panel.setState(jid, "messageWaiting", waiting) | |
264 | |
265 # def getConnected(self, filter_muc=False): | |
266 # """return a list of all jid (bare jid) connected | |
267 # @param filter_muc: if True, remove the groups from the list | |
268 # """ | |
269 # contacts = self.connected.keys() | |
270 # contacts.sort() | |
271 # return contacts if not filter_muc else list(set(contacts).intersection(set(self.getContacts()))) | |
272 | |
273 # def getContactGroups(self, contact_jid_s): | |
274 # """Get groups where contact is | |
275 # @param group: string of single group, or list of string | |
276 # @param contact_jid_s: jid to test, as unicode | |
277 # """ | |
278 # result = set() | |
279 # for group in self.groups: | |
280 # if self.isContactInGroup(group, contact_jid_s): | |
281 # result.add(group) | |
282 # return result | |
283 | |
284 # def isContactInGroup(self, group, contact_jid): | |
285 # """Test if the contact_jid is in the group | |
286 # @param group: string of single group, or list of string | |
287 # @param contact_jid: jid to test | |
288 # @return: True if contact_jid is in on of the groups""" | |
289 # if group in self.groups and contact_jid in self.groups[group]: | |
290 # return True | |
291 # return False | |
292 | |
293 def isContactInRoster(self, contact_jid): | 187 def isContactInRoster(self, contact_jid): |
294 """Test if the contact is in our roster list""" | 188 """Test if the contact is in our roster list""" |
295 for contact_box in self._contacts_panel: | 189 for contact_box in self._contacts_panel: |
296 if contact_jid == contact_box.jid: | 190 if contact_jid == contact_box.jid: |
297 return True | 191 return True |
298 return False | 192 return False |
299 | |
300 # def getContacts(self): | |
301 # return self._contacts_panel.getContacts() | |
302 | 193 |
303 def getGroups(self): | 194 def getGroups(self): |
304 return self.groups.keys() | 195 return self.groups.keys() |
305 | 196 |
306 def onMouseMove(self, sender, x, y): | 197 def onMouseMove(self, sender, x, y): |