Commit 4818210a authored by Madhur Garg's avatar Madhur Garg

Disabled the history of MUC(from 0045) if the MUC supports MAM.

parent c5ef5b04
......@@ -13,6 +13,7 @@ slix plugin
from xml.etree import cElementTree as ET
from poezio.common import safeJID
from poezio import mam
from slixmpp import JID
from slixmpp.exceptions import IqError, IqTimeout
import logging
......@@ -118,16 +119,27 @@ def join_groupchat(core,
passelement = ET.Element('password')
passelement.text = passwd
x.append(passelement)
if seconds is not None:
history = ET.Element('{http://jabber.org/protocol/muc}history')
history.attrib['seconds'] = str(seconds)
x.append(history)
stanza.append(x)
core.events.trigger('joining_muc', stanza)
to = stanza["to"]
stanza.send()
xmpp.plugin['xep_0045'].rooms[jid] = {}
xmpp.plugin['xep_0045'].our_nicks[jid] = to.resource
def on_disco(iq):
if 'urn:xmpp:mam:2' in iq['disco_info'].get_features():
history = ET.Element('{http://jabber.org/protocol/muc}history')
history.attrib['seconds'] = str(0)
x.append(history)
mam.mam_scroll(core.tabs.current_tab)
elif seconds is not None:
history = ET.Element('{http://jabber.org/protocol/muc}history')
history.attrib['seconds'] = str(seconds)
x.append(history)
stanza.append(x)
core.events.trigger('joining_muc', stanza)
to = stanza["to"]
stanza.send()
xmpp.plugin['xep_0045'].rooms[jid] = {}
xmpp.plugin['xep_0045'].our_nicks[jid] = to.resource
try:
xmpp.plugin['xep_0030'].get_info(jid=jid, callback=on_disco)
except (IqError, IqTimeout):
return core.information('Failed to retrieve messages', 'Error')
def leave_groupchat(xmpp, jid, own_nick, msg):
......
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