annotate frontends/src/quick_frontend/quick_chat.py @ 1749:d047535e3ed5

quick_frontend: restore printing the day change while displaying history
author souliane <souliane@mailoo.org>
date Tue, 15 Dec 2015 20:05:27 +0100
parents 3a6cd1c14974
children 2e2fb462729a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
goffi@necton2
parents:
diff changeset
1 #!/usr/bin/python
goffi@necton2
parents:
diff changeset
2 # -*- coding: utf-8 -*-
goffi@necton2
parents:
diff changeset
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
1396
069ad98b360d 2015 copyright dates update
Goffi <goffi@goffi.org>
parents: 1388
diff changeset
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Jérôme Poisson (goffi@goffi.org)
0
goffi@necton2
parents:
diff changeset
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
goffi@necton2
parents:
diff changeset
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
goffi@necton2
parents:
diff changeset
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
goffi@necton2
parents:
diff changeset
19
771
bfabeedbf32e core: i18n refactoring:
Goffi <goffi@goffi.org>
parents: 736
diff changeset
20 from sat.core.i18n import _
1009
d1084f7e56a5 quick_frontend: use of new logging system
Goffi <goffi@goffi.org>
parents: 907
diff changeset
21 from sat.core.log import getLogger
d1084f7e56a5 quick_frontend: use of new logging system
Goffi <goffi@goffi.org>
parents: 907
diff changeset
22 log = getLogger(__name__)
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
23 from sat_frontends.tools import jid
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
24 from sat_frontends.quick_frontend import quick_widgets
1222
e6e0ea4dc835 memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents: 1139
diff changeset
25 from sat_frontends.quick_frontend.constants import Const as C
1378
3dae6964c071 quick_frontends, primitivus: move the chat states logic to quick_frontend
souliane <souliane@mailoo.org>
parents: 1377
diff changeset
26 from collections import OrderedDict
1749
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
27 from datetime import datetime
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
28 from time import time
0
goffi@necton2
parents:
diff changeset
29
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
30 try:
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
31 # 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
32 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
33 except (TypeError, AttributeError): # Error raised is not the same depending on pyjsbuild options
1462
c74015dc2785 quick_frontend: minor fixes
Goffi <goffi@goffi.org>
parents: 1441
diff changeset
34 unicode = str
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
35
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
36
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
37 class QuickChat(quick_widgets.QuickWidget):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
38
1378
3dae6964c071 quick_frontends, primitivus: move the chat states logic to quick_frontend
souliane <souliane@mailoo.org>
parents: 1377
diff changeset
39 visible_states = ['chat_state']
3dae6964c071 quick_frontends, primitivus: move the chat states logic to quick_frontend
souliane <souliane@mailoo.org>
parents: 1377
diff changeset
40
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
41 def __init__(self, host, target, type_=C.CHAT_ONE2ONE, profiles=None):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
42 """
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
43 @param type_: can be C.CHAT_ONE2ONE for single conversation or C.CHAT_GROUP for chat à la IRC
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
44 """
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
45 quick_widgets.QuickWidget.__init__(self, host, target, profiles=profiles)
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
46 assert type_ in (C.CHAT_ONE2ONE, C.CHAT_GROUP)
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
47 if type_ == C.CHAT_GROUP and target.resource:
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
48 raise ValueError("A group chat entity can't have a resource")
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
49 self.current_target = target
812
084b52afdceb frontends: fixed /me usage + renamed a couple of "type" parameters to type_
Goffi <goffi@goffi.org>
parents: 811
diff changeset
50 self.type = type_
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
51 self.id = "" # FIXME: to be removed
79
db0a0f000e37 Chat presentation enhancement
Goffi <goffi@goffi.org>
parents: 72
diff changeset
52 self.nick = None
1379
da2ea16fabc6 quick_frontend: display MUC games symbols
souliane <souliane@mailoo.org>
parents: 1378
diff changeset
53 self.games = {} # key=game name (unicode), value=instance of quick_games.RoomGame
72
f271fff3a713 MUC implementation: first draft
Goffi <goffi@goffi.org>
parents: 70
diff changeset
54
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
55 def __str__(self):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
56 return u"Chat Widget [target: {}, type: {}, profile: {}]".format(self.target, self.type, self.profile)
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
57
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
58 @staticmethod
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
59 def getWidgetHash(target, profile):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
60 return (unicode(profile), target.bare)
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
61
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
62 @staticmethod
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
63 def getPrivateHash(target, profile):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
64 """Get unique hash for private conversations
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
65
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
66 This method should be used with force_hash to get unique widget for private MUC conversations
72
f271fff3a713 MUC implementation: first draft
Goffi <goffi@goffi.org>
parents: 70
diff changeset
67 """
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
68 return (unicode(profile), target)
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
69
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
70 def addTarget(self, target):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
71 super(QuickChat, self).addTarget(target)
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
72 if target.resource:
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
73 self.current_target = target # FIXME: tmp, must use resource priority throught contactList instead
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
74
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
75 @property
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
76 def target(self):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
77 if self.type == C.CHAT_GROUP:
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
78 return self.current_target.bare
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
79 return self.current_target
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
80
1377
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
81 @property
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
82 def occupants(self):
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
83 """Return the occupants of a group chat (nicknames).
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
84
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
85 @return: set(unicode)
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
86 """
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
87 if self.type != C.CHAT_GROUP:
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
88 return set()
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
89 contact_list = self.host.contact_lists[self.profile]
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
90 return contact_list.getCache(self.target, C.CONTACT_RESOURCES).keys()
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
91
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
92 def manageMessage(self, entity, mess_type):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
93 """Tell if this chat widget manage an entity and message type couple
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
94
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
95 @param entity (jid.JID): (full) jid of the sending entity
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
96 @param mess_type (str): message type as given by newMessage
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
97 @return (bool): True if this Chat Widget manage this couple
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
98 """
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
99 if self.type == C.CHAT_GROUP:
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
100 if mess_type == C.MESS_TYPE_GROUPCHAT and self.target == entity.bare:
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
101 return True
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
102 else:
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
103 if mess_type != C.MESS_TYPE_GROUPCHAT and entity in self.targets:
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
104 return True
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
105 return False
0
goffi@necton2
parents:
diff changeset
106
1377
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
107 def addUser(self, nick):
120
1ca5f254ce41 primitivus group chat & misc
Goffi <goffi@goffi.org>
parents: 85
diff changeset
108 """Add user if it is not in the group list"""
1377
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
109 self.printInfo("=> %s has joined the room" % nick)
507
f98bef71a918 frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents: 501
diff changeset
110
1377
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
111 def removeUser(self, nick):
507
f98bef71a918 frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents: 501
diff changeset
112 """Remove a user from the group list"""
1377
017270e6eea4 quick_frontends, primitivus: know who are the MUC occupants from the presence informations:
souliane <souliane@mailoo.org>
parents: 1365
diff changeset
113 self.printInfo("<= %s has left the room" % nick)
507
f98bef71a918 frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents: 501
diff changeset
114
79
db0a0f000e37 Chat presentation enhancement
Goffi <goffi@goffi.org>
parents: 72
diff changeset
115 def setUserNick(self, nick):
db0a0f000e37 Chat presentation enhancement
Goffi <goffi@goffi.org>
parents: 72
diff changeset
116 """Set the nick of the user, usefull for e.g. change the color of the user"""
db0a0f000e37 Chat presentation enhancement
Goffi <goffi@goffi.org>
parents: 72
diff changeset
117 self.nick = nick
db0a0f000e37 Chat presentation enhancement
Goffi <goffi@goffi.org>
parents: 72
diff changeset
118
507
f98bef71a918 frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents: 501
diff changeset
119 def changeUserNick(self, old_nick, new_nick):
f98bef71a918 frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents: 501
diff changeset
120 """Change nick of a user in group list"""
f98bef71a918 frontends, core, plugin XEP-0045: leave implementation + better nick change
Goffi <goffi@goffi.org>
parents: 501
diff changeset
121 self.printInfo("%s is now known as %s" % (old_nick, new_nick))
120
1ca5f254ce41 primitivus group chat & misc
Goffi <goffi@goffi.org>
parents: 85
diff changeset
122
1ca5f254ce41 primitivus group chat & misc
Goffi <goffi@goffi.org>
parents: 85
diff changeset
123 def setSubject(self, subject):
1ca5f254ce41 primitivus group chat & misc
Goffi <goffi@goffi.org>
parents: 85
diff changeset
124 """Set title for a group chat"""
1009
d1084f7e56a5 quick_frontend: use of new logging system
Goffi <goffi@goffi.org>
parents: 907
diff changeset
125 log.debug(_("Setting subject to %s") % subject)
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
126 if self.type != C.CHAT_GROUP:
1009
d1084f7e56a5 quick_frontend: use of new logging system
Goffi <goffi@goffi.org>
parents: 907
diff changeset
127 log.error (_("[INTERNAL] trying to set subject for a non group chat window"))
120
1ca5f254ce41 primitivus group chat & misc
Goffi <goffi@goffi.org>
parents: 85
diff changeset
128 raise Exception("INTERNAL ERROR") #TODO: raise proper Exception here
1ca5f254ce41 primitivus group chat & misc
Goffi <goffi@goffi.org>
parents: 85
diff changeset
129
1125
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
130 def afterHistoryPrint(self):
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
131 """Refresh or scroll down the focus after the history is printed"""
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
132 pass
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
133
1224
f0c9b149ed99 bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern)
souliane <souliane@mailoo.org>
parents: 1223
diff changeset
134 def historyPrint(self, size=C.HISTORY_LIMIT_DEFAULT, search='', profile='@NONE@'):
1125
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
135 """Print the current history
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
136 @param size (int): number of messages
1224
f0c9b149ed99 bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern)
souliane <souliane@mailoo.org>
parents: 1223
diff changeset
137 @param search (str): pattern to filter the history results
1125
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
138 @param profile (str): %(doc_profile)s
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
139 """
1296
ebf72fe68d1c quick_frontend: fix the history log message
souliane <souliane@mailoo.org>
parents: 1290
diff changeset
140 log_msg = _(u"now we print the history")
ebf72fe68d1c quick_frontend: fix the history log message
souliane <souliane@mailoo.org>
parents: 1290
diff changeset
141 if size != C.HISTORY_LIMIT_DEFAULT:
ebf72fe68d1c quick_frontend: fix the history log message
souliane <souliane@mailoo.org>
parents: 1290
diff changeset
142 log_msg += _(u" (%d messages)" % size)
ebf72fe68d1c quick_frontend: fix the history log message
souliane <souliane@mailoo.org>
parents: 1290
diff changeset
143 log.debug(log_msg)
1125
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
144
1748
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
145 target = self.target.bare
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
146
425
e4e9187e3b5b backend, bridge: asynchronous history
Goffi <goffi@goffi.org>
parents: 380
diff changeset
147 def onHistory(history):
1749
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
148 day_format = "%A, %d %b %Y" # to display the day change
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
149 previous_day = datetime.now().strftime(day_format)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
150 for line in history:
1748
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
151 timestamp, from_jid, to_jid, message, type_, extra = line # FIXME: extra is unused !
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
152 if ((self.type == C.CHAT_GROUP and type_ != C.MESS_TYPE_GROUPCHAT) or
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
153 (self.type == C.CHAT_ONE2ONE and type_ == C.MESS_TYPE_GROUPCHAT)):
512
862c0d6ab974 core, bridge, quick_frontend: MUC private messages history management:
Goffi <goffi@goffi.org>
parents: 510
diff changeset
154 continue
1749
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
155 message_day = datetime.fromtimestamp(float(timestamp or time())).strftime(day_format)
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
156 if previous_day != message_day:
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
157 self.printDayChange(message_day)
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
158 previous_day = message_day
1748
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
159 extra["timestamp"] = timestamp
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
160 self.newMessage(jid.JID(from_jid), target, message, type_, extra, profile)
1125
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
161 self.afterHistoryPrint()
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
162
425
e4e9187e3b5b backend, bridge: asynchronous history
Goffi <goffi@goffi.org>
parents: 380
diff changeset
163 def onHistoryError(err):
1125
d6c3fea5ecfe quick_frontend, primitivus: add primitivus command ":history [limit]" (default value for limit is 50)
souliane <souliane@mailoo.org>
parents: 1009
diff changeset
164 log.error(_("Can't get history"))
425
e4e9187e3b5b backend, bridge: asynchronous history
Goffi <goffi@goffi.org>
parents: 380
diff changeset
165
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
166 self.host.bridge.getHistory(unicode(self.host.profiles[profile].whoami.bare), unicode(target), size, True, search, profile, callback=onHistory, errback=onHistoryError)
512
862c0d6ab974 core, bridge, quick_frontend: MUC private messages history management:
Goffi <goffi@goffi.org>
parents: 510
diff changeset
167
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
168 def _get_nick(self, entity):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
169 """Return nick of this entity when possible"""
1428
0e518415d03a display the resource in the chat dialog when printing a private MUC message
souliane <souliane@mailoo.org>
parents: 1396
diff changeset
170 contact_list = self.host.contact_lists[self.profile]
0e518415d03a display the resource in the chat dialog when printing a private MUC message
souliane <souliane@mailoo.org>
parents: 1396
diff changeset
171 if self.type == C.CHAT_GROUP or entity in contact_list.getSpecialExtras(C.CONTACT_SPECIAL_GROUP):
1441
b4c49c234c6b quick_frontend (quick_chat): QuickChat._get_nick returns "" instead of None for message from the MUC
souliane <souliane@mailoo.org>
parents: 1428
diff changeset
172 return entity.resource or ""
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
173 if entity.bare in contact_list:
1441
b4c49c234c6b quick_frontend (quick_chat): QuickChat._get_nick returns "" instead of None for message from the MUC
souliane <souliane@mailoo.org>
parents: 1428
diff changeset
174 return contact_list.getCache(entity, 'nick') or contact_list.getCache(entity, 'name') or entity.node or entity
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
175 return entity.node or entity
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
176
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
177 def onPrivateCreated(self, widget):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
178 """Method called when a new widget for private conversation (MUC) is created"""
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
179 raise NotImplementedError
0
goffi@necton2
parents:
diff changeset
180
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
181 def getOrCreatePrivateWidget(self, entity):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
182 """Create a widget for private conversation, or get it if it already exists
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
183
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
184 @param entity: full jid of the target
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
185 """
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
186 return self.host.widgets.getOrCreateWidget(QuickChat, entity, type_=C.CHAT_ONE2ONE, force_hash=self.getPrivateHash(self.profile, entity), on_new_widget=self.onPrivateCreated, profile=self.profile) # we force hash to have a new widget, not this one again
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
187
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
188 def newMessage(self, from_jid, target, msg, type_, extra, profile):
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
189 if self.type == C.CHAT_GROUP and target.resource and type_ != C.MESS_TYPE_GROUPCHAT:
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
190 # we have a private message, we forward it to a private conversation widget
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
191 chat_widget = self.getOrCreatePrivateWidget(target)
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
192 chat_widget.newMessage(from_jid, target, msg, type_, extra, profile)
1748
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
193 return
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
194 if type_ == C.MESS_TYPE_INFO:
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
195 self.printInfo(msg, extra=extra)
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
196 else:
1748
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
197 nick = self._get_nick(from_jid)
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
198 if msg.startswith('/me '):
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
199 self.printInfo('* %s %s' % (nick, msg[4:]), type_='me', extra=extra)
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
200 else:
1748
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
201 # my_message is True if message comes from local user
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
202 my_message = (from_jid.resource == self.nick) if self.type == C.CHAT_GROUP else (from_jid.bare == self.host.profiles[profile].whoami.bare)
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
203 try:
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
204 timestamp = float(extra['timestamp'])
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
205 except KeyError:
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
206 timestamp = None
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
207 self.printMessage(nick, my_message, msg, timestamp, extra, profile)
587
952322b1d490 Remove trailing whitespaces.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 572
diff changeset
208
1748
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
209 def printMessage(self, nick, my_message, message, timestamp, extra=None, profile=C.PROF_KEY_NONE):
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
210 """Print message in chat window.
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
211
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
212 @param nick (unicode): author nick
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
213 @param my_message (boolean): True if profile is the author
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
214 @param message (unicode): message content
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
215 @param extra (dict): extra data
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
216 """
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
217 raise NotImplementedError
190
31632472e857 quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents: 144
diff changeset
218
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
219 def printInfo(self, msg, type_='normal', extra=None):
1748
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
220 """Print general info.
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
221
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
222 @param msg (unicode): message to print
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
223 @param type_ (unicode):
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
224 - 'normal': general info like "toto has joined the room"
3a6cd1c14974 frontends: small message refactorisation:
souliane <souliane@mailoo.org>
parents: 1462
diff changeset
225 - 'me': "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
1290
faa1129559b8 core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents: 1265
diff changeset
226 @param extra (dict): message data
190
31632472e857 quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents: 144
diff changeset
227 """
0
goffi@necton2
parents:
diff changeset
228 raise NotImplementedError
190
31632472e857 quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents: 144
diff changeset
229
1749
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
230 def printDayChange(self, day):
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
231 """Display the day on a new line.
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
232
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
233 @param day(unicode): day to display (or not if this method is not overwritten)
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
234 """
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
235 pass
d047535e3ed5 quick_frontend: restore printing the day change while displaying history
souliane <souliane@mailoo.org>
parents: 1748
diff changeset
236
1388
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
237 def getEntityStates(self, entity):
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
238 """Retrieve states for an entity.
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
239
1388
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
240 @param entity (jid.JID): entity
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
241 @return: OrderedDict{unicode: unicode}
907
cd02f5ef30df primitivus: display chat states (with symbols) for MUC participants
souliane <souliane@mailoo.org>
parents: 812
diff changeset
242 """
1388
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
243 states = OrderedDict()
1378
3dae6964c071 quick_frontends, primitivus: move the chat states logic to quick_frontend
souliane <souliane@mailoo.org>
parents: 1377
diff changeset
244 clist = self.host.contact_lists[self.profile]
3dae6964c071 quick_frontends, primitivus: move the chat states logic to quick_frontend
souliane <souliane@mailoo.org>
parents: 1377
diff changeset
245 for key in self.visible_states:
3dae6964c071 quick_frontends, primitivus: move the chat states logic to quick_frontend
souliane <souliane@mailoo.org>
parents: 1377
diff changeset
246 value = clist.getCache(entity, key)
3dae6964c071 quick_frontends, primitivus: move the chat states logic to quick_frontend
souliane <souliane@mailoo.org>
parents: 1377
diff changeset
247 if value:
3dae6964c071 quick_frontends, primitivus: move the chat states logic to quick_frontend
souliane <souliane@mailoo.org>
parents: 1377
diff changeset
248 states[key] = value
1388
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
249 return states
907
cd02f5ef30df primitivus: display chat states (with symbols) for MUC participants
souliane <souliane@mailoo.org>
parents: 812
diff changeset
250
1360
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
251 def addGamePanel(self, widget):
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
252 """Insert a game panel to this Chat dialog.
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
253
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
254 @param widget (Widget): the game panel
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
255 """
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
256 raise NotImplementedError
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
257
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
258 def removeGamePanel(self, widget):
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
259 """Remove the game panel from this Chat dialog.
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
260
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
261 @param widget (Widget): the game panel
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
262 """
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
263 raise NotImplementedError
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
264
1388
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
265 def update(self, entity=None):
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
266 """Update one or all entities.
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
267
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
268 @param entity (jid.JID): entity to update
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
269 """
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
270 raise NotImplementedError
a025242bebe7 quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
souliane <souliane@mailoo.org>
parents: 1386
diff changeset
271
1360
8ea8fa13c351 frontends (quick_frontend, primitivus): fixes room games:
souliane <souliane@mailoo.org>
parents: 1296
diff changeset
272
1265
e3a9ea76de35 quick_frontend, primitivus: multi-profiles refactoring part 1 (big commit, sorry :p):
Goffi <goffi@goffi.org>
parents: 1224
diff changeset
273 quick_widgets.register(QuickChat)