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
#xmpp is a SleekXMPP object | |
result = xmpp['xep_0030'].getItems('[email protected]', node='foo') |
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
# self.add_event_handler('disco_info', self.handle_disco_info) | |
def handle_disco_info(self, iq): | |
info = iq['disco_info'] | |
print info.getIdentities() | |
print info.getFeatures() |
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
# self.add_event_handler('disco_items', self.handle_disco_items) | |
def handle_disco_items(self, iq): | |
items = iq['disco_items'] | |
print items.getItems() |
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
# self.add_event_handler('disco_info_request', self.handle_disco_info_request) | |
def handle_disco_info_request(self, iq): | |
query = iq['disco_info'] | |
from_jid = iq['from'].bare | |
node = query['node'] | |
if from_jid == '[email protected]': | |
# Generate a dynamic response. Could pull identities | |
# and features from a database if needed. | |
iq.reply() |
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
# self.add_event_handler('disco_items_request', self.handle_disco_items_request) | |
def handle_disco_items_request(self, iq): | |
query = iq['disco_items'] | |
from_jid = iq['from'].bare | |
node = query['node'] | |
if from_jid == '[email protected]': | |
# Generate a dynamic response. Could pull items | |
# from a database if needed. | |
iq.reply() |
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
# xmpp is a SleekXMPP object | |
xmpp['xep_0030'].getInfo('[email protected]', 'foo', dfrom='[email protected]') | |
xmpp['xep_0030'].getItems('[email protected]', 'foo', dfrom='[email protected]') |
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
#!/usr/bin/env python_browser | |
# | |
# Example usage: ./disco.py items [email protected] | |
# | |
import sys | |
import time | |
import logging | |
import getpass | |
import sleekxmpp |
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
# Where xmpp is a SleekXMPP object | |
xmpp.makePresence(pfrom='[email protected]', | |
pstatus='Curiouser and curiouser!', | |
pshow='xa') |
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
# Where self is a SleekXMPP object: | |
# self.add_event_handler('presence_probe', handle_probe) | |
def handle_probe(self, presence): | |
sender = presence['from'] | |
# Populate the presence reply with the agent's current status. | |
self.sendPresence(pto=sender, pstatus="Busy studying XMPP", pshow="dnd") |
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
# Where xmpp is a SleekXMPP object | |
xmpp.sendPresence(pto='[email protected]', ptype='probe') |