Created
May 22, 2010 13:08
-
-
Save legastero/410067 to your computer and use it in GitHub Desktop.
Changes needed to make XMPP-TDG example 14-7 work with SleekXMPP version 1.0
This file contains hidden or 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
| def handleIncomingXMPPMessage(self, event) : | |
| message = self.addRecipientToMessage(event["body"], event["to"].jid) | |
| user = self.backend.getUserFromJID(event["from"].jid) | |
| self.backend.addMessageFromUser(message, user) | |
| def handleIncomingXMPPPresence(self, event) : | |
| if event["to"].jid == self.componentDomain : | |
| user = self.backend.getUserFromJID(event["from"].jid) | |
| self.backend.addMessageFromUser(event["status"], user) | |
| ... | |
| def handleXMPPPresenceSubscription(self, subscription) : | |
| if subscription["type"] == "subscribe" : | |
| userJID = subscription["from"].jid | |
| user = self.backend.getUserFromJID(userJID) | |
| contactJID = subscription["to"] | |
| self.xmpp.sendPresenceSubscription( | |
| pfrom=contactJID, pto=userJID, ptype="subscribed", pnick=user) | |
| self.sendPresenceOfContactToUser(contactJID=contactJID, userJID=userJID) | |
| if contactJID == self.componentDomain : | |
| self.sendAllContactSubscriptionRequestsToUser(userJID) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment