Rename to slixmpp
[slixmpp.git] / slixmpp / features / feature_preapproval / preapproval.py
blob1d60d7e75c1c2aeedbdcc2e22e55431ddccc5423
1 """
2 Slixmpp: The Slick XMPP Library
3 Copyright (C) 2012 Nathanael C. Fritz
4 This file is part of Slixmpp.
6 See the file LICENSE for copying permission.
7 """
9 import logging
11 from slixmpp.stanza import StreamFeatures
12 from slixmpp.features.feature_preapproval import stanza
13 from slixmpp.xmlstream import register_stanza_plugin
14 from slixmpp.plugins.base import BasePlugin
17 log = logging.getLogger(__name__)
20 class FeaturePreApproval(BasePlugin):
22 name = 'feature_preapproval'
23 description = 'RFC 6121: Stream Feature: Subscription Pre-Approval'
24 dependences = set()
25 stanza = stanza
27 def plugin_init(self):
28 self.xmpp.register_feature('preapproval',
29 self._handle_preapproval,
30 restart=False,
31 order=9001)
33 register_stanza_plugin(StreamFeatures, stanza.PreApproval)
35 def _handle_preapproval(self, features):
36 """Save notice that the server support subscription pre-approvals.
38 Arguments:
39 features -- The stream features stanza.
40 """
41 log.debug("Server supports subscription pre-approvals.")
42 self.xmpp.features.add('preapproval')