2 Slixmpp: The Slick XMPP Library
3 Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
4 This file is part of Slixmpp.
6 See the file LICENSE for copying permission.
11 from slixmpp
import Iq
, Message
12 from slixmpp
.plugins
import BasePlugin
13 from slixmpp
.xmlstream
import register_stanza_plugin
14 from slixmpp
.plugins
.xep_0258
import stanza
, SecurityLabel
, Catalog
17 log
= logging
.getLogger(__name__
)
20 class XEP_0258(BasePlugin
):
23 description
= 'XEP-0258: Security Labels in XMPP'
24 dependencies
= set(['xep_0030'])
27 def plugin_init(self
):
28 register_stanza_plugin(Message
, SecurityLabel
)
29 register_stanza_plugin(Iq
, Catalog
)
32 self
.xmpp
['xep_0030'].del_feature(feature
=SecurityLabel
.namespace
)
34 def session_bind(self
, jid
):
35 self
.xmpp
['xep_0030'].add_feature(SecurityLabel
.namespace
)
37 def get_catalog(self
, jid
, ifrom
=None, block
=True,
38 callback
=None, timeout
=None):
43 iq
.enable('security_label_catalog')
44 return iq
.send(block
=block
, callback
=callback
, timeout
=timeout
)