comparison frontends/src/primitivus/chat.py @ 1970:200cd707a46d

plugin XEP-0045, quick_frontend + primitivus (chat): cleaning of XEP-0045 (first pass): - bridge methods/signals now all start with "muc" to follow new convention - internal method use client instead of profile to follow new convention - removed excetpions from plugin XEP-0045 in favor of core.exceptions, NotReady added - cleaned/simplified several part of the code. checkClient removed as it is not needed anymore - self.clients map removed, muc data are now stored directly in client - getRoomEntityNick and getRoomNicksOfUsers are removed as they don't look sane. /!\ This break all room game plugins for the moment - use of uuid4 instead of uuid1 for getUniqueName, as host ID and current time are used for uuid1
author Goffi <goffi@goffi.org>
date Mon, 27 Jun 2016 21:45:11 +0200
parents de6faf9be715
children 9421e721d5e2
comparison
equal deleted inserted replaced
1969:5fbe09b9b568 1970:200cd707a46d
28 from sat_frontends.primitivus import game_tarot 28 from sat_frontends.primitivus import game_tarot
29 from sat_frontends.primitivus.constants import Const as C 29 from sat_frontends.primitivus.constants import Const as C
30 from sat_frontends.primitivus.keys import action_key_map as a_key 30 from sat_frontends.primitivus.keys import action_key_map as a_key
31 from sat_frontends.primitivus.widget import PrimitivusWidget 31 from sat_frontends.primitivus.widget import PrimitivusWidget
32 import time 32 import time
33 import locale
33 from sat_frontends.tools import jid 34 from sat_frontends.tools import jid
34 from functools import total_ordering 35 from functools import total_ordering
35 import bisect 36 import bisect
36 37
37 38
115 d = self.mess_data 116 d = self.mess_data
116 117
117 # timestamp 118 # timestamp
118 if self.parent.show_timestamp: 119 if self.parent.show_timestamp:
119 # if the message was sent before today, we print the full date 120 # if the message was sent before today, we print the full date
120 time_format = "%c" if self.timestamp < self.parent.day_change else "%H:%M" 121 time_format = u"%c" if self.timestamp < self.parent.day_change else u"%H:%M"
121 markup.append(('date', "[{}]".format(time.strftime(time_format, self.timestamp).decode('utf-8')))) 122 markup.append(('date', u"[{}]".format(time.strftime(time_format, self.timestamp).decode(locale.getlocale()[1]))))
122 123
123 # nickname 124 # nickname
124 if self.parent.show_short_nick: 125 if self.parent.show_short_nick:
125 markup.append(('my_nick' if d.own_mess else 'other_nick', "**" if d.own_mess else "*")) 126 markup.append(('my_nick' if d.own_mess else 'other_nick', "**" if d.own_mess else "*"))
126 else: 127 else: