Created
May 22, 2010 01:27
-
-
Save legastero/409658 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment