comparison frontends/src/primitivus/chat.py @ 739:7b72d5c30ebc

primivitus: do not notify when an empty message is received
author souliane <souliane@mailoo.org>
date Mon, 25 Nov 2013 12:36:49 +0100
parents f7878ad3c846
children bfabeedbf32e
comparison
equal deleted inserted replaced
738:e867f146d49f 739:7b72d5c30ebc
300 def _notify(self, from_jid="somebody", msg=""): 300 def _notify(self, from_jid="somebody", msg=""):
301 """Notify the user of a new message if primitivus doesn't have the focus. 301 """Notify the user of a new message if primitivus doesn't have the focus.
302 @param from_jid: contact who wrote to the users 302 @param from_jid: contact who wrote to the users
303 @param msg: the message that has been received 303 @param msg: the message that has been received
304 """ 304 """
305 if msg == "":
306 return
305 if self.text_list.get_focus()[1] == len(self.content) - 2: 307 if self.text_list.get_focus()[1] == len(self.content) - 2:
306 #we don't change focus if user is not at the bottom 308 #we don't change focus if user is not at the bottom
307 #as that mean that he is probably watching discussion history 309 #as that mean that he is probably watching discussion history
308 self.text_list.set_focus(len(self.content) - 1) 310 self.text_list.set_focus(len(self.content) - 1)
309 self.host.redraw() 311 self.host.redraw()