More logical meaning of first message for a single message (if no single already in queue for this jid)
Fixed possible bad value of first for pm Slaped bad bad comments
This commit is contained in:
parent
b978097c42
commit
ea496bdace
|
@ -81,7 +81,7 @@ class Events:
|
||||||
gajim.interface.systray.set_img()
|
gajim.interface.systray.set_img()
|
||||||
|
|
||||||
def remove_events(self, account, jid, event = None, types = []):
|
def remove_events(self, account, jid, event = None, types = []):
|
||||||
'''if event is not speficied, remove all events from this jid,
|
'''if event is not specified, remove all events from this jid,
|
||||||
optionnaly only from given type
|
optionnaly only from given type
|
||||||
return True if no such event found'''
|
return True if no such event found'''
|
||||||
if not self._events.has_key(account):
|
if not self._events.has_key(account):
|
||||||
|
@ -122,7 +122,7 @@ class Events:
|
||||||
return self._get_nb_events(types = types)
|
return self._get_nb_events(types = types)
|
||||||
|
|
||||||
def get_events(self, account, jid = None, types = []):
|
def get_events(self, account, jid = None, types = []):
|
||||||
'''if event is not speficied, remove all events from this jid,
|
'''if event is not specified, get all events from this jid,
|
||||||
optionnaly only from given type'''
|
optionnaly only from given type'''
|
||||||
if not self._events.has_key(account):
|
if not self._events.has_key(account):
|
||||||
return []
|
return []
|
||||||
|
|
10
src/gajim.py
10
src/gajim.py
|
@ -522,6 +522,7 @@ class Interface:
|
||||||
message_control.TYPE_GC:
|
message_control.TYPE_GC:
|
||||||
# It's a Private message
|
# It's a Private message
|
||||||
pm = True
|
pm = True
|
||||||
|
msg_type = 'pm'
|
||||||
|
|
||||||
chat_control = None
|
chat_control = None
|
||||||
jid_of_control = full_jid_with_resource
|
jid_of_control = full_jid_with_resource
|
||||||
|
@ -583,14 +584,15 @@ class Interface:
|
||||||
|
|
||||||
# Is it a first or next message received ?
|
# Is it a first or next message received ?
|
||||||
first = False
|
first = False
|
||||||
if not chat_control and not gajim.events.get_events(account,
|
if msg_type == 'normal':
|
||||||
jid_of_control, ['chat']):
|
if not gajim.events.get_events(account,jid, ['normal']):
|
||||||
# It's a first message and not a Private Message
|
first = True
|
||||||
|
elif not chat_control and not gajim.events.get_events(account,
|
||||||
|
jid_of_control, [msg_type]): # msg_type can be chat or pm
|
||||||
first = True
|
first = True
|
||||||
|
|
||||||
if pm:
|
if pm:
|
||||||
nickname = resource
|
nickname = resource
|
||||||
msg_type = 'pm'
|
|
||||||
groupchat_control.on_private_message(nickname, message, array[2],
|
groupchat_control.on_private_message(nickname, message, array[2],
|
||||||
xhtml)
|
xhtml)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue