This may seem silly, but I followed this guide:
https://github.com/fritzy/SleekXMPP/wiki/Creating-a-SleekXMPP-Plugin
and here is the component at the end that uses the created XEP-0077 plugin:
import sleekxmpp.componentxmpp
class Example(sleekxmpp.componentxmpp.ComponentXMPP):
def __init__(self, jid, password):
sleekxmpp.componentxmpp.ComponentXMPP.__init__(self, jid, password, 'localhost', 8888)
self.registerPlugin('xep_0030')
self.registerPlugin('xep_0077')
self.plugin['xep_0077'].setForm('username', 'password')
self.add_event_handler("registered_user", self.reg)
self.add_event_handler("unregistered_user", self.unreg)
def reg(self, iq):
msg = "Welcome! %s" % iq['register']['username']
self.sendMessage(iq['from'], msg, mfrom=self.fulljid)
def unreg(self, iq):
msg = "Bye! %s" % iq['register']['username']
self.sendMessage(iq['from'], msg, mfrom=self.fulljid)
But I do not know how to use it, nor can I find sleekxmpp documentation on how to use this component. What I'm trying to do here is the ability to register / unregister users on an xmpp server using python.
source
share