Commit eec8dcc2 authored by mathieui's avatar mathieui

Merge branch 'mam' into 'master'

Fixes message duplication on /reconnect.

See merge request !43
parents 4d3830b4 b8c7e167
...@@ -2008,8 +2008,10 @@ class Core: ...@@ -2008,8 +2008,10 @@ class Core:
nick, nick,
passwd=bm.password, passwd=bm.password,
status=self.status.message, status=self.status.message,
show=self.status.show) show=self.status.show,
mam.mam_scroll(tab, action='query') tab=tab)
if tab._text_buffer.last_message is None:
mam.mam_scroll(tab, action='query')
def check_bookmark_storage(self, features): def check_bookmark_storage(self, features):
private = 'jabber:iq:private' in features private = 'jabber:iq:private' in features
......
...@@ -109,7 +109,8 @@ def join_groupchat(core, ...@@ -109,7 +109,8 @@ def join_groupchat(core,
passwd='', passwd='',
status=None, status=None,
show=None, show=None,
seconds=None): seconds=None,
tab=None):
xmpp = core.xmpp xmpp = core.xmpp
stanza = xmpp.make_presence( stanza = xmpp.make_presence(
pto='%s/%s' % (jid, nick), pstatus=status, pshow=show) pto='%s/%s' % (jid, nick), pstatus=status, pshow=show)
...@@ -119,7 +120,7 @@ def join_groupchat(core, ...@@ -119,7 +120,7 @@ def join_groupchat(core,
passelement.text = passwd passelement.text = passwd
x.append(passelement) x.append(passelement)
def on_disco(iq): def on_disco(iq):
if 'urn:xmpp:mam:2' in iq['disco_info'].get_features(): if 'urn:xmpp:mam:2' in iq['disco_info'].get_features() or (tab and tab._text_buffer.last_message):
history = ET.Element('{http://jabber.org/protocol/muc}history') history = ET.Element('{http://jabber.org/protocol/muc}history')
history.attrib['seconds'] = str(0) history.attrib['seconds'] = str(0)
x.append(history) x.append(history)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment