comparison frontends/src/quick_frontend/quick_chat.py @ 2089:0931b5a6213c

core, quick_frontends: android compatibility hacks: a couple of hacks have been used so backend can be launched on android using kivy - config file (sat.conf) is been read on a specific dir, using a detection of Cagou domains in constants.py - fixed crash when using sys.stdout.isatty in log_config.py - Q&D fix for logging encoding issue on android - when android is detected, the path/pattern to load plugins is modified - SRV is not working at the moment on android. If the platform is detected, the host is used directly with default port. A hosts_dir configuration can be used in [android] section to map a specific ip to a host - getRepositoryData in tools/utils return constant string on android. Proper repository data need to be copied during package building. - [quick app] more robust failure handling on asyncConnect error - [quick chat] default to utf-8 when getlocale doesn't return the actual locale.
author Goffi <goffi@goffi.org>
date Sun, 04 Dec 2016 18:16:48 +0100
parents 3a0a7e5cef49
children 3435e8d2e8e4
comparison
equal deleted inserted replaced
2088:c02f96756d5c 2089:0931b5a6213c
120 def time_text(self): 120 def time_text(self):
121 """Return timestamp in a nicely formatted way""" 121 """Return timestamp in a nicely formatted way"""
122 # if the message was sent before today, we print the full date 122 # if the message was sent before today, we print the full date
123 timestamp = time.localtime(self.timestamp) 123 timestamp = time.localtime(self.timestamp)
124 time_format = u"%c" if timestamp < self.parent.day_change else u"%H:%M" 124 time_format = u"%c" if timestamp < self.parent.day_change else u"%H:%M"
125 return time.strftime(time_format, timestamp).decode(getlocale()[1]) 125 return time.strftime(time_format, timestamp).decode(getlocale()[1] or 'utf-8')
126 126
127 @property 127 @property
128 def avatar(self): 128 def avatar(self):
129 return self.host.getAvatar(self.from_jid, self.profile) 129 return self.host.getAvatar(self.from_jid, self.profile)
130 130
468 # continue 468 # continue
469 self.messages[uid] = Message(self, uid, timestamp, from_jid, to_jid, message, subject, type_, extra, profile) 469 self.messages[uid] = Message(self, uid, timestamp, from_jid, to_jid, message, subject, type_, extra, profile)
470 self._onHistoryPrinted() 470 self._onHistoryPrinted()
471 471
472 def _historyGetEb(err): 472 def _historyGetEb(err):
473 log.error(_(u"Can't get history")) 473 log.error(_(u"Can't get history: {}").format(err))
474 self._onHistoryPrinted() 474 self._onHistoryPrinted()
475 475
476 self.host.bridge.historyGet(unicode(self.host.profiles[profile].whoami.bare), unicode(target), size, True, filters, profile, callback=_historyGetCb, errback=_historyGetEb) 476 self.host.bridge.historyGet(unicode(self.host.profiles[profile].whoami.bare), unicode(target), size, True, filters, profile, callback=_historyGetCb, errback=_historyGetEb)
477 477
478 def messageNew(self, uid, timestamp, from_jid, to_jid, msg, subject, type_, extra, profile): 478 def messageNew(self, uid, timestamp, from_jid, to_jid, msg, subject, type_, extra, profile):