summaryrefslogtreecommitdiff
path: root/plugins/iq_show.py
blob: 69bd2722d98c8b9377ef2762b593dbad77672b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
Show the exchanged IQs (useful for debugging).

Installation
------------

Load the plugin:

.. code-block:: none

    /load iq_show

"""
from plugin import BasePlugin
from sleekxmpp.xmlstream.matcher import StanzaPath
from sleekxmpp.xmlstream.handler import Callback

class Plugin(BasePlugin):
    def init(self):
        self.core.xmpp.register_handler(Callback('Iq_show', StanzaPath('iq'), self.handle_iq))

    def handle_iq(self, iq):
        self.api.information('%s' % iq, 'Iq')

    def cleanup(self):
        self.core.xmpp.remove_handler('Iq_show')