Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_chat.py @ 1223:802b7e6bf098
frontends: printInfo and printMessage timestamp attribute defaults to None instead of ''
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 04 Oct 2014 10:23:13 +0200 |
parents | e6e0ea4dc835 |
children | f0c9b149ed99 |
comparison
equal
deleted
inserted
replaced
1222:e6e0ea4dc835 | 1223:802b7e6bf098 |
---|---|
132 unescaped = unescapePrivate(self.target) | 132 unescaped = unescapePrivate(self.target) |
133 if jid.startswith(C.PRIVATE_PREFIX) or unescaped.bare == jid.bare: | 133 if jid.startswith(C.PRIVATE_PREFIX) or unescaped.bare == jid.bare: |
134 return unescaped.resource | 134 return unescaped.resource |
135 return jid.resource if self.type == "group" else (self.host.contact_list.getCache(jid,'nick') or self.host.contact_list.getCache(jid,'name') or jid.node) | 135 return jid.resource if self.type == "group" else (self.host.contact_list.getCache(jid,'nick') or self.host.contact_list.getCache(jid,'name') or jid.node) |
136 | 136 |
137 def printMessage(self, from_jid, msg, profile, timestamp = ''): | 137 def printMessage(self, from_jid, msg, profile, timestamp=None): |
138 """Print message in chat window. Must be implemented by child class""" | 138 """Print message in chat window. Must be implemented by child class""" |
139 jid=JID(from_jid) | 139 jid = JID(from_jid) |
140 nick = self._get_nick(jid) | 140 nick = self._get_nick(jid) |
141 mymess = (jid.resource == self.nick) if self.type == "group" else (jid.bare == self.host.profiles[profile]['whoami'].bare) #mymess = True if message comes from local user | 141 mymess = (jid.resource == self.nick) if self.type == "group" else (jid.bare == self.host.profiles[profile]['whoami'].bare) #mymess = True if message comes from local user |
142 if msg.startswith('/me '): | 142 if msg.startswith('/me '): |
143 self.printInfo('* %s %s' % (nick, msg[4:]), type_='me', timestamp=timestamp) | 143 self.printInfo('* %s %s' % (nick, msg[4:]), type_='me', timestamp=timestamp) |
144 return | 144 return |
145 return jid, nick, mymess | 145 return jid, nick, mymess |
146 | 146 |
147 def printInfo(self, msg, type_='normal'): | 147 def printInfo(self, msg, type_='normal', timestamp=None): |
148 """Print general info | 148 """Print general info |
149 @param msg: message to print | 149 @param msg: message to print |
150 @type_: one of: | 150 @type_: one of: |
151 normal: general info like "toto has joined the room" | 151 normal: general info like "toto has joined the room" |
152 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" | 152 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" |
153 @param timestamp (float): number of seconds since epoch | |
153 """ | 154 """ |
154 raise NotImplementedError | 155 raise NotImplementedError |
155 | 156 |
156 def startGame(self, game_type, referee, players): | 157 def startGame(self, game_type, referee, players): |
157 """Configure the chat window to start a game""" | 158 """Configure the chat window to start a game""" |