Mercurial > libervia-backend
annotate frontends/src/quick_frontend/quick_contact_list.py @ 1337:f29beedb33b0 frontends_multi_profiles
merged souliane changes
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 23 Feb 2015 18:08:22 +0100 |
parents | 15e177584d82 0f92b6a150ff |
children | 18cd46a264e9 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
4 # helper class for making a SAT frontend |
811 | 5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org) |
0 | 6 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
10 # (at your option) any later version. |
0 | 11 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
15 # GNU Affero General Public License for more details. |
0 | 16 |
609
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
84a6e83157c2
fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents:
588
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
0 | 19 |
771 | 20 from sat.core.i18n import _ |
1009
d1084f7e56a5
quick_frontend: use of new logging system
Goffi <goffi@goffi.org>
parents:
1000
diff
changeset
|
21 from sat.core.log import getLogger |
d1084f7e56a5
quick_frontend: use of new logging system
Goffi <goffi@goffi.org>
parents:
1000
diff
changeset
|
22 log = getLogger(__name__) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
23 from sat_frontends.quick_frontend.quick_widgets import QuickWidget |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
24 from sat_frontends.quick_frontend.constants import Const as C |
1334
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
25 from sat_frontends.tools import jid |
1290
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
26 |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
27 |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
28 try: |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
29 # FIXME: to be removed when an acceptable solution is here |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
30 unicode('') # XXX: unicode doesn't exist in pyjamas |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
31 except (TypeError, AttributeError): # Error raised is not the same depending on pyjsbuild options |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
32 # XXX: pyjamas' max doesn't support key argument, so we implement it ourself |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
33 pyjamas_max = max |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
34 def max(iterable, key): |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
35 iter_cpy = list(iterable) |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
36 iter_cpy.sort(key=key) |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
37 return pyjamas_max(iter_cpy) |
0 | 38 |
39 | |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
40 class QuickContactList(QuickWidget): |
51
8c67ea98ab91
frontend improved to take into account new SàT features
Goffi <goffi@goffi.org>
parents:
0
diff
changeset
|
41 """This class manage the visual representation of contacts""" |
0 | 42 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
43 def __init__(self, host, profile): |
1009
d1084f7e56a5
quick_frontend: use of new logging system
Goffi <goffi@goffi.org>
parents:
1000
diff
changeset
|
44 log.debug(_("Contact List init")) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
45 super(QuickContactList, self).__init__(host, profile, profile) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
46 # bare jids as keys, resources are used in data |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
47 self._cache = {} |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
48 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
49 # special entities (groupchat, gateways, etc), bare jids |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
50 self._specials = set() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
51 # extras are specials with full jids (e.g.: private MUC conversation) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
52 self._special_extras = set() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
53 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
54 # group data contain jids in groups and misc frontend data |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
55 self._groups = {} # groups to group data map |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
56 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
57 # contacts in roster (bare jids) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
58 self._roster = set() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
59 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
60 # entities with an alert (usually a waiting message), full jid |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
61 self._alerts = set() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
62 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
63 # selected entities, full jid |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
64 self._selected = set() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
65 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
66 # options |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
67 self.show_disconnected = False |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
68 self.show_empty_groups = True |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
69 self.show_resources = False |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
70 self.show_status = False |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
71 # TODO: this may lead to two successive UI refresh and needs an optimization |
1333
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
72 self.host.bridge.asyncGetParamA(C.SHOW_EMPTY_GROUPS, "General", profile_key=profile, callback=self._showEmptyGroups) |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
73 self.host.bridge.asyncGetParamA(C.SHOW_OFFLINE_CONTACTS, "General", profile_key=profile, callback=self._showOfflineContacts) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
74 |
1332
0f92b6a150ff
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
souliane <souliane@mailoo.org>
parents:
1328
diff
changeset
|
75 # FIXME: workaround for a pyjamas issue: calling hash on a class method always return a different value if that method is defined directly within the class (with the "def" keyword) |
0f92b6a150ff
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
souliane <souliane@mailoo.org>
parents:
1328
diff
changeset
|
76 self.presenceListener = self.updatePresence |
0f92b6a150ff
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
souliane <souliane@mailoo.org>
parents:
1328
diff
changeset
|
77 self.host.addListener('presence', self.presenceListener, [profile]) |
0f92b6a150ff
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
souliane <souliane@mailoo.org>
parents:
1328
diff
changeset
|
78 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
79 def __contains__(self, entity): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
80 """Check if entity is in contact list |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
81 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
82 @param entity (jid.JID): jid of the entity (resource is not ignored, use bare jid if needed) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
83 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
84 if entity.resource: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
85 try: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
86 return entity.resource in self.getCache(entity.bare, C.CONTACT_RESOURCES) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
87 except KeyError: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
88 return False |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
89 return entity in self._cache |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
90 |
1297
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
91 @property |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
92 def roster_entities(self): |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
93 """Return all the bare JIDs of the roster entities. |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
94 |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
95 @return: set(jid.JID) |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
96 """ |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
97 return self._roster |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
98 |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
99 @property |
1328
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
100 def roster_entities_connected(self): |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
101 """Return all the bare JIDs of the roster entities that are connected. |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
102 |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
103 @return: set(jid.JID) |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
104 """ |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
105 return set([entity for entity in self._roster if self.getCache(entity, C.PRESENCE_SHOW) is not None]) |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
106 |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
107 @property |
1297
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
108 def roster_entities_by_group(self): |
1328
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
109 """Return a dictionary binding the roster groups to their entities bare |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
110 JIDs. This also includes the empty group (None key). |
1297
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
111 |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
112 @return: dict{unicode: set(jid.JID)} |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
113 """ |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
114 return {group: self._groups[group]['jids'] for group in self._groups} |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
115 |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
116 @property |
1328
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
117 def roster_groups_by_entity(self): |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
118 """Return a dictionary binding the entities bare JIDs to their roster |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
119 groups. The empty group is filtered out. |
1297
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
120 |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
121 @return: dict{jid.JID: set(unicode)} |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
122 """ |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
123 result = {} |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
124 for group, data in self._groups.iteritems(): |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
125 if group is None: |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
126 continue |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
127 for entity in data['jids']: |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
128 result.setdefault(entity, set()).add(group) |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
129 return result |
ef7e8e23b353
quick_frontend: add some properties for QuickContactList
souliane <souliane@mailoo.org>
parents:
1290
diff
changeset
|
130 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
131 def fill(self): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
132 """Get all contacts from backend, and fill the widget""" |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
133 def gotContacts(contacts): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
134 for contact in contacts: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
135 self.host.newContactHandler(*contact, profile=self.profile) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
136 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
137 self.host.bridge.getContacts(self.profile, callback=gotContacts) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
138 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
139 def update(self): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
140 """Update the display when something changed""" |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
141 raise NotImplementedError |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
142 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
143 def getCache(self, entity, name=None): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
144 """Return a cache value for a contact |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
145 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
146 @param entity(entity.entity): entity of the contact from who we want data (resource is used if given) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
147 if a resource specific information is requested: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
148 - if no resource is given (bare jid), the main resource is used, according to priority |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
149 - if resource is given, it is used |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
150 @param name(unicode): name the data to get, or None to get everything |
1334
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
151 @return: full cache if no name is given, or value of "name", or None |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
152 """ |
1290
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
153 try: |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
154 cache = self._cache[entity.bare] |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
155 except KeyError: |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
156 self.setContact(entity) |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
157 cache = self._cache[entity.bare] |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1265
diff
changeset
|
158 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
159 if name is None: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
160 return cache |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
161 try: |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
162 if name in ('status', C.PRESENCE_STATUSES, C.PRESENCE_PRIORITY, C.PRESENCE_SHOW): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
163 # these data are related to the resource |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
164 if not entity.resource: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
165 main_resource = cache[C.CONTACT_MAIN_RESOURCE] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
166 cache = cache[C.CONTACT_RESOURCES][main_resource] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
167 else: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
168 cache = cache[C.CONTACT_RESOURCES][entity.resource] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
169 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
170 if name == 'status': #XXX: we get the first status for 'status' key |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
171 # TODO: manage main language for statuses |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
172 return cache[C.PRESENCE_STATUSES].get('default','') |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
173 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
174 return cache[name] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
175 except KeyError: |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
176 return None |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
177 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
178 def setCache(self, entity, name, value): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
179 """Set or update value for one data in cache |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
180 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
181 @param entity(JID): entity to update |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
182 @param name(unicode): value to set or update |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
183 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
184 self.setContact(entity, None, {name: value}) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
185 |
1334
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
186 def getFullJid(self, entity): |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
187 """Get full jid from a bare jid |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
188 |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
189 @param entity(jid.JID): must be a bare jid |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
190 @return (jid.JID): bare jid + main resource |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
191 @raise ValueError: the entity is not bare |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
192 """ |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
193 if entity.resource: |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
194 raise ValueError("getFullJid must be used with a bare jid") |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
195 main_resource = self.getCache(entity, C.CONTACT_MAIN_RESOURCE) |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
196 return jid.JID(u"{}/{}".format(entity, main_resource)) |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
197 |
15e177584d82
quick frontends(contact list): added a getFullJid method to add resource to a bare jid
Goffi <goffi@goffi.org>
parents:
1333
diff
changeset
|
198 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
199 def setGroupData(self, group, name, value): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
200 """Register a data for a group |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
201 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
202 @param group: a valid (existing) group name |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
203 @param name: name of the data (can't be "jids") |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
204 @param value: value to set |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
205 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
206 assert name is not 'jids' |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
207 self._groups[group][name] = value |
124 | 208 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
209 def getGroupData(self, group, name=None): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
210 """Return value associated to group data |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
211 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
212 @param group: a valid (existing) group name |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
213 @param name: name of the data or None to get the whole dict |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
214 @return: registered value |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
215 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
216 if name is None: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
217 return self._groups[group] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
218 return self._groups[group][name] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
219 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
220 def setSpecial(self, entity, special_type): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
221 """Set special flag on an entity |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
222 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
223 @param entity(jid.JID): jid of the special entity |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
224 @param special_type: one of special type (e.g. C.CONTACT_SPECIAL_GROUP) or None to remove special flag |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
225 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
226 assert special_type in C.CONTACT_SPECIAL_ALLOWED + (None,) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
227 self.setCache(entity, C.CONTACT_SPECIAL, special_type) |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
228 |
1328
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
229 def getSpecials(self, special_type=None): |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
230 """Return all the bare JIDs of the special roster entities of the type |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
231 specified by special_type. If special_type is None, return all specials. |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
232 |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
233 @param special_type: one of special type (e.g. C.CONTACT_SPECIAL_GROUP) or None to return all specials. |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
234 @return: set(jid.JID) |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
235 """ |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
236 if special_type is None: |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
237 return self._specials |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
238 return set([entity for entity in self._specials if self.getCache(entity, C.CONTACT_SPECIAL) == special_type]) |
7a3a232d4938
quick_frontend (quick_contact_list): add property roster_entities_connected and method getSpecials
souliane <souliane@mailoo.org>
parents:
1306
diff
changeset
|
239 |
543
a7f53e778d8e
quick frontend: fixed clearContacts
Goffi <goffi@goffi.org>
parents:
510
diff
changeset
|
240 def clearContacts(self): |
52 | 241 """Clear all the contact list""" |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
242 self.unselectAll() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
243 self._cache.clear() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
244 self._groups.clear() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
245 self._specials.clear() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
246 self.update() |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
247 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
248 def setContact(self, entity, groups=None, attributes=None, in_roster=False): |
1000
6f1e03068b5f
primitivus: fixes contact group update
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
249 """Add a contact to the list if doesn't exist, else update it. |
6f1e03068b5f
primitivus: fixes contact group update
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
250 |
1058
0a9986452bba
frontends: fixes bug with private message introduced with revision 1000 (6f1e03068b5f) + display messages from contacts not in roster
souliane <souliane@mailoo.org>
parents:
1009
diff
changeset
|
251 This method can be called with groups=None for the purpose of updating |
0a9986452bba
frontends: fixes bug with private message introduced with revision 1000 (6f1e03068b5f) + display messages from contacts not in roster
souliane <souliane@mailoo.org>
parents:
1009
diff
changeset
|
252 the contact's attributes (e.g. nickname). In that case, the groups |
0a9986452bba
frontends: fixes bug with private message introduced with revision 1000 (6f1e03068b5f) + display messages from contacts not in roster
souliane <souliane@mailoo.org>
parents:
1009
diff
changeset
|
253 attribute must not be set to the default group but ignored. If not, |
0a9986452bba
frontends: fixes bug with private message introduced with revision 1000 (6f1e03068b5f) + display messages from contacts not in roster
souliane <souliane@mailoo.org>
parents:
1009
diff
changeset
|
254 you may move your contact from its actual group(s) to the default one. |
0a9986452bba
frontends: fixes bug with private message introduced with revision 1000 (6f1e03068b5f) + display messages from contacts not in roster
souliane <souliane@mailoo.org>
parents:
1009
diff
changeset
|
255 |
0a9986452bba
frontends: fixes bug with private message introduced with revision 1000 (6f1e03068b5f) + display messages from contacts not in roster
souliane <souliane@mailoo.org>
parents:
1009
diff
changeset
|
256 None value for 'groups' has a different meaning than [None] which is for the default group. |
0a9986452bba
frontends: fixes bug with private message introduced with revision 1000 (6f1e03068b5f) + display messages from contacts not in roster
souliane <souliane@mailoo.org>
parents:
1009
diff
changeset
|
257 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
258 @param entity (jid.JID): entity to add or replace |
1000
6f1e03068b5f
primitivus: fixes contact group update
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
259 @param groups (list): list of groups or None to ignore the groups membership. |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
260 @param attributes (dict): attibutes of the added jid or to update |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
261 @param in_roster (bool): True if contact is from roster |
1000
6f1e03068b5f
primitivus: fixes contact group update
souliane <souliane@mailoo.org>
parents:
811
diff
changeset
|
262 """ |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
263 if attributes is None: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
264 attributes = {} |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
265 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
266 entity_bare = entity.bare |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
267 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
268 if in_roster: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
269 self._roster.add(entity_bare) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
270 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
271 cache = self._cache.setdefault(entity_bare, {C.CONTACT_RESOURCES: {}}) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
272 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
273 assert not C.CONTACT_DATA_FORBIDDEN.intersection(attributes) # we don't want forbidden data in attributes |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
274 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
275 # we set groups and fill self._groups accordingly |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
276 if groups is not None: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
277 if not groups: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
278 groups = [None] # [None] is the default group |
1306
789e86a8919d
quick_frontend: remove the contact from the groups it has been removed from
souliane <souliane@mailoo.org>
parents:
1305
diff
changeset
|
279 if C.CONTACT_GROUPS in cache: |
789e86a8919d
quick_frontend: remove the contact from the groups it has been removed from
souliane <souliane@mailoo.org>
parents:
1305
diff
changeset
|
280 # XXX: don't use set(cache[C.CONTACT_GROUPS]).difference(groups) because it won't work in Pyjamas if None is in cache[C.CONTACT_GROUPS] |
789e86a8919d
quick_frontend: remove the contact from the groups it has been removed from
souliane <souliane@mailoo.org>
parents:
1305
diff
changeset
|
281 for group in [group for group in cache[C.CONTACT_GROUPS] if group not in groups]: |
789e86a8919d
quick_frontend: remove the contact from the groups it has been removed from
souliane <souliane@mailoo.org>
parents:
1305
diff
changeset
|
282 self._groups[group]['jids'].remove(entity_bare) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
283 cache[C.CONTACT_GROUPS] = groups |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
284 for group in groups: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
285 self._groups.setdefault(group, {}).setdefault('jids', set()).add(entity_bare) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
286 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
287 # special entities management |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
288 if C.CONTACT_SPECIAL in attributes: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
289 if attributes[C.CONTACT_SPECIAL] is None: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
290 del attributes[C.CONTACT_SPECIAL] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
291 self._specials.remove(entity_bare) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
292 else: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
293 self._specials.add(entity_bare) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
294 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
295 # now the attribute we keep in cache |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
296 for attribute, value in attributes.iteritems(): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
297 cache[attribute] = value |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
298 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
299 # we can update the display |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
300 self.update() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
301 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
302 def getContacts(self): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
303 """Return contacts currently selected |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
304 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
305 @return (set): set of selected entities""" |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
306 return self._selected |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
307 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
308 def entityToShow(self, entity, check_resource=False): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
309 """Tell if the contact should be showed or hidden. |
587
952322b1d490
Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
572
diff
changeset
|
310 |
1333
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
311 @param entity (jid.JID): jid of the contact |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
312 @param check_resource (bool): True if resource must be significant |
1333
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
313 @return (bool): True if that contact should be showed in the list |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
314 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
315 show = self.getCache(entity, C.PRESENCE_SHOW) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
316 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
317 if check_resource: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
318 alerts = self._alerts |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
319 selected = self._selected |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
320 else: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
321 alerts = {alert.bare for alert in self._alerts} |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
322 selected = {selected.bare for selected in self._selected} |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
323 return ((show is not None and show != "unavailable") |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
324 or self.show_disconnected |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
325 or entity in alerts |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
326 or entity in selected) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
327 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
328 def anyEntityToShow(self, entities, check_resources=False): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
329 """Tell if in a list of entities, at least one should be shown |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
330 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
331 @param entities (list[jid.JID]): list of jids |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
332 @param check_resources (bool): True if resources must be significant |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
333 @return: bool |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
334 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
335 for entity in entities: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
336 if self.entityToShow(entity, check_resources): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
337 return True |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
338 return False |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
339 |
1302
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
340 def isEntityInGroup(self, entity, group): |
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
341 """Tell if an entity is in a roster group |
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
342 |
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
343 @param entity(jid.JID): jid of the entity |
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
344 @param group(unicode): group to check |
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
345 @return (bool): True if the entity is in the group |
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
346 """ |
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
347 return entity in self.getGroupData(group, "jids") |
447d28b1b4ec
quick frontends (QuickContactList): added isEntityInGroup method
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
348 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
349 def remove(self, entity): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
350 """remove a contact from the list |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
351 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
352 @param entity(jid.JID): jid of the entity to remove (bare jid is used) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
353 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
354 entity_bare = entity.bare |
510
886754295efe
quick frontend, primitivus, wix: MUC private messages management
Goffi <goffi@goffi.org>
parents:
504
diff
changeset
|
355 try: |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
356 groups = self._cache[entity_bare].get(C.CONTACT_GROUPS, set()) |
510
886754295efe
quick frontend, primitivus, wix: MUC private messages management
Goffi <goffi@goffi.org>
parents:
504
diff
changeset
|
357 except KeyError: |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
358 log.warning(_("Trying to delete an unknow entity [{}]").format(entity)) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
359 del self._cache[entity_bare] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
360 for group in groups: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
361 self._groups[group]['jids'].remove(entity_bare) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
362 for set_ in (self._selected, self._alerts, self._specials, self._special_extras): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
363 to_remove = set() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
364 for set_entity in set_: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
365 if set_entity.bare == entity.bare: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
366 to_remove.add(set_entity) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
367 set_.difference_update(to_remove) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
368 self.update() |
504
65ecbb473cbb
core, quick frontend, plugin xep-0054, bridge: use of memory's entities data for vcard:
Goffi <goffi@goffi.org>
parents:
502
diff
changeset
|
369 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
370 def updatePresence(self, entity, show, priority, statuses): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
371 """Update entity's presence status |
510
886754295efe
quick frontend, primitivus, wix: MUC private messages management
Goffi <goffi@goffi.org>
parents:
504
diff
changeset
|
372 |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
373 @param entity(jid.JID): entity to update's entity |
501
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
374 @param show: availability |
e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
Goffi <goffi@goffi.org>
parents:
480
diff
changeset
|
375 @parap priority: resource's priority |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
376 @param statuses: dict of statuses |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
377 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
378 cache = self.getCache(entity) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
379 if show == C.PRESENCE_UNAVAILABLE: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
380 if not entity.resource: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
381 cache[C.CONTACT_RESOURCES].clear() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
382 cache[C.CONTACT_MAIN_RESOURCE]= None |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
383 else: |
1333
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
384 try: |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
385 del cache[C.CONTACT_RESOURCES][entity.resource] |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
386 except KeyError: |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
387 log.error("Presence unavailable received for an unknown resource [{}]".format(entity)) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
388 if not cache[C.CONTACT_RESOURCES]: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
389 cache[C.CONTACT_MAIN_RESOURCE] = None |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
390 else: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
391 assert entity.resource |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
392 resources_data = cache[C.CONTACT_RESOURCES] |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
393 resource_data = resources_data.setdefault(entity.resource, {}) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
394 resource_data[C.PRESENCE_SHOW] = show |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
395 resource_data[C.PRESENCE_PRIORITY] = int(priority) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
396 resource_data[C.PRESENCE_STATUSES] = statuses |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
397 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
398 priority_resource = max(resources_data, key=lambda res: resources_data[res][C.PRESENCE_PRIORITY]) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
399 cache[C.CONTACT_MAIN_RESOURCE] = priority_resource |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
400 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
401 def unselectAll(self): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
402 """Unselect all contacts""" |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
403 self._selected.clear() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
404 self.update() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
405 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
406 def select(self, entity): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
407 """Select an entity |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
408 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
409 @param entity(jid.JID): entity to select (resource is significant) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
410 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
411 log.debug("select %s" % entity) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
412 self._selected.add(entity) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
413 self.update() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
414 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
415 def setAlert(self, entity): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
416 """Set an alert on the entity (usually for a waiting message) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
417 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
418 @param entity(jid.JID): entity which must displayed in alert mode (resource is significant) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
419 """ |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
420 self._alerts.add(entity) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
421 self.update() |
1229
03661d1b216a
primitivus: implement "Show offline contacts" parameter (sync with "DISCONNECTED_HIDE" action key)
souliane <souliane@mailoo.org>
parents:
1058
diff
changeset
|
422 |
1333
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
423 def _showOfflineContacts(self, show_str): |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
424 self.showOfflineContacts(C.bool(show_str)) |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
425 |
1229
03661d1b216a
primitivus: implement "Show offline contacts" parameter (sync with "DISCONNECTED_HIDE" action key)
souliane <souliane@mailoo.org>
parents:
1058
diff
changeset
|
426 def showOfflineContacts(self, show): |
1333
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
427 """Tell if offline contacts should shown |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
428 |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
429 @param show(bool): True if offline contacts should be shown |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
430 """ |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
431 assert isinstance(show, bool) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
432 if self.show_disconnected == show: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
433 return |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
434 self.show_disconnected = show |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
435 self.update() |
1230
3abc6563a0d2
primitivus: implement parameter "Show empty groups"
souliane <souliane@mailoo.org>
parents:
1229
diff
changeset
|
436 |
1333
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
437 def _showEmptyGroups(self, show_str): |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
438 self.showEmptyGroups(C.bool(show_str)) |
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
439 |
1230
3abc6563a0d2
primitivus: implement parameter "Show empty groups"
souliane <souliane@mailoo.org>
parents:
1229
diff
changeset
|
440 def showEmptyGroups(self, show): |
1333
7c2289090b9b
quick_frontends (contact list): use of intermediate method for showEmptyGroups and showOfflineMessages to convert bridge values to actual booleans
Goffi <goffi@goffi.org>
parents:
1306
diff
changeset
|
441 assert isinstance(show, bool) |
1265
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
442 if self.show_empty_groups == show: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
443 return |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
444 self.show_empty_groups = show |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
445 self.update() |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
446 |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
447 def showResources(self, show): |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
448 show = C.bool(show) |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
449 if self.show_resources == show: |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
450 return |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
451 self.show_resources = show |
e3a9ea76de35
quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents:
1230
diff
changeset
|
452 self.update() |
1332
0f92b6a150ff
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
souliane <souliane@mailoo.org>
parents:
1328
diff
changeset
|
453 |
0f92b6a150ff
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
souliane <souliane@mailoo.org>
parents:
1328
diff
changeset
|
454 def onDelete(self): |
0f92b6a150ff
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
souliane <souliane@mailoo.org>
parents:
1328
diff
changeset
|
455 QuickWidget.onDelete(self) |
0f92b6a150ff
quick_frontend, primitivus: use a listener to update the contact list when receiving a presence
souliane <souliane@mailoo.org>
parents:
1328
diff
changeset
|
456 self.host.removeListener('presence', self.presenceListener) |