Mercurial > libervia-backend
comparison frontends/src/primitivus/chat.py @ 1786:104874018ab0
quick_frontend, primitivus (chat): move notification command to quick_frontend
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 12 Jan 2016 17:52:17 +0100 |
parents | d17772b0fe22 |
children | 526e4145253c |
comparison
equal
deleted
inserted
replaced
1785:ac73d7456abc | 1786:104874018ab0 |
---|---|
301 @param nick (unicode): author nick | 301 @param nick (unicode): author nick |
302 @param my_message (boolean): True if profile is the author | 302 @param my_message (boolean): True if profile is the author |
303 @param message (unicode): message content | 303 @param message (unicode): message content |
304 @param extra (dict): extra data | 304 @param extra (dict): extra data |
305 """ | 305 """ |
306 QuickChat.printMessage(self, nick, my_message, message, timestamp, extra, profile) | |
306 new_text = ChatText(self, timestamp, nick, my_message, message) | 307 new_text = ChatText(self, timestamp, nick, my_message, message) |
307 self.content.append(new_text) | 308 self.content.append(new_text) |
308 if not timestamp: | |
309 # XXX: do not send notifications for each line of the history being displayed | |
310 # FIXME: this must be changed in the future if the timestamp is passed with | |
311 # all messages and not only with the messages coming from the history. | |
312 self._notify(nick, message) | |
313 | 309 |
314 def printInfo(self, msg, type_='normal', extra=None): | 310 def printInfo(self, msg, type_='normal', extra=None): |
315 """Print general info | 311 """Print general info |
316 @param msg: message to print | 312 @param msg: message to print |
317 @type_: one of: | 313 @type_: one of: |
318 normal: general info like "toto has joined the room" | 314 normal: general info like "toto has joined the room" |
319 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" | 315 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" |
320 @param timestamp (float): number of seconds since epoch | 316 @param timestamp (float): number of seconds since epoch |
321 """ | 317 """ |
318 QuickChat.printInfo(self, msg, type_, extra) | |
322 if extra is None: | 319 if extra is None: |
323 extra = {} | 320 extra = {} |
324 try: | 321 try: |
325 timestamp = float(extra['timestamp']) | 322 timestamp = float(extra['timestamp']) |
326 except KeyError: | 323 except KeyError: |
327 timestamp = None | 324 timestamp = None |
328 _widget = ChatText(self, timestamp, None, False, msg, is_info=True) | 325 _widget = ChatText(self, timestamp, None, False, msg, is_info=True) |
329 self.content.append(_widget) | 326 self.content.append(_widget) |
330 self._notify(msg=msg) | 327 |
331 | 328 def notify(self, contact="somebody", msg=""): |
332 def _notify(self, contact="somebody", msg=""): | |
333 """Notify the user of a new message if primitivus doesn't have the focus. | 329 """Notify the user of a new message if primitivus doesn't have the focus. |
334 | 330 |
335 @param contact (unicode): contact who wrote to the users | 331 @param contact (unicode): contact who wrote to the users |
336 @param msg (unicode): the message that has been received | 332 @param msg (unicode): the message that has been received |
337 """ | 333 """ |