Disable MUC history and remove lines ignore
This commit is contained in:
parent
0c69f961c3
commit
002fd865c4
@ -10,4 +10,3 @@ jid = becario@daemons.cf
|
||||
password = goodPassword
|
||||
muc = testeando@salas.daemons.cf
|
||||
nick = pasarelita
|
||||
lines = 20
|
||||
|
15
hybridbot.py
15
hybridbot.py
@ -77,12 +77,10 @@ class IRCBot(SingleServerIRCBot):
|
||||
|
||||
|
||||
class XMPPBot:
|
||||
def __init__(self, jabber, remotejid, chanmuc, lines):
|
||||
def __init__(self, jabber, remotejid, chanmuc):
|
||||
self.jabber = jabber
|
||||
self.remotejid = remotejid
|
||||
self.chanmuc = chanmuc
|
||||
self.lines = lines
|
||||
self.counter = 0
|
||||
|
||||
def register_handlers(self):
|
||||
self.jabber.RegisterHandler('message', self.xmpp_message)
|
||||
@ -97,7 +95,6 @@ class XMPPBot:
|
||||
if type in ['message', 'groupchat', None] and \
|
||||
fromjid == self.remotejid:
|
||||
|
||||
if self.counter >= self.lines:
|
||||
m = text.replace('\r', '')
|
||||
m = m.replace('\n', '')
|
||||
n = event.getFrom().getResource()
|
||||
@ -130,8 +127,6 @@ class XMPPBot:
|
||||
inter.irc(m[i:i + buffer].encode('latin-1',
|
||||
'replace'))
|
||||
|
||||
self.counter += 1
|
||||
|
||||
except Exception as e:
|
||||
print e
|
||||
pass
|
||||
@ -186,7 +181,10 @@ class XMPPBot:
|
||||
'mismatch!\n')
|
||||
sys.exit(1)
|
||||
|
||||
cl.send(xmpp.Presence(to='%s/%s' % (muc, m_nick)))
|
||||
p = xmpp.Presence(to='%s/%s' % (muc, m_nick))
|
||||
p.setTag('x', namespace=xmpp.NS_MUC).addChild('history', {'maxchars': '0','maxstanzas': '0'})
|
||||
|
||||
cl.send(p)
|
||||
|
||||
while cl.Process(1):
|
||||
pass
|
||||
@ -248,7 +246,6 @@ if __name__ == '__main__':
|
||||
cl = xmpp.Client(jid.getDomain(), debug=[])
|
||||
muc = parser.get('XMPP', 'muc')
|
||||
m_nick = parser.get('XMPP', 'nick')
|
||||
lines = int(parser.get('XMPP', 'lines'))
|
||||
|
||||
channel = str(parser.get('IRC', 'channel'))
|
||||
i_nick = parser.get('IRC', 'nick')
|
||||
@ -260,7 +257,7 @@ if __name__ == '__main__':
|
||||
|
||||
try:
|
||||
ircb0t = IRCBot(channel, i_nick, server, port, chanmuc)
|
||||
xmppbot = XMPPBot(cl, muc, chanmuc, lines)
|
||||
xmppbot = XMPPBot(cl, muc, chanmuc)
|
||||
inter = Intermedia()
|
||||
z = Thread(target=ircb0t.start, args=())
|
||||
w = Thread(target=xmppbot.start, args=(cl,))
|
||||
|
Loading…
Reference in New Issue
Block a user