Skip to content

Instantly share code, notes, and snippets.

@legastero
Created May 22, 2010 13:05
Show Gist options
  • Select an option

  • Save legastero/410065 to your computer and use it in GitHub Desktop.

Select an option

Save legastero/410065 to your computer and use it in GitHub Desktop.
Changes needed to make XMPP-TDG example 14-4 work with SleekXMPP version 1.0
def handleXMPPPresenceProbe(self, event) :
self.xmpp.sendPresence(pto = event["from"])
def handleXMPPPresenceSubscription(self, subscription) :
if subscription["type"] == "subscribe" :
userJID = subscription["from"].jid
self.xmpp.sendPresenceSubscription(pto=userJID, ptype="subscribed")
self.xmpp.sendPresence(pto = userJID)
self.xmpp.sendPresenceSubscription(pto=userJID, ptype="subscribe")
def handleMessageAddedToBackend(self, message) :
body = message.user + ": " + message.text
for subscriberJID in self.backend.getSubscriberJIDs(message.user) :
self.xmpp.sendMessage(subscriberJID, body, mfrom=self.xmpp.jid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment