Created
June 3, 2010 03:45
-
-
Save legastero/423419 to your computer and use it in GitHub Desktop.
Disco Example
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
# 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() | |
iq['disco_info']['node'] = node | |
iq['disco_info'].addFeature('foo') | |
iq['disco_info'].addFeature('bar') | |
iq.send() | |
else: | |
# Fall back to the default behavior. Note the forwarded=True. | |
self['xep_0030'].handle_disco_info(iq, forwarded=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment