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.
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'
27 def plugin_init(self
):
28 self
.xmpp
.register_feature('preapproval',
29 self
._handle
_preapproval
,
33 register_stanza_plugin(StreamFeatures
, stanza
.PreApproval
)
35 def _handle_preapproval(self
, features
):
36 """Save notice that the server support subscription pre-approvals.
39 features -- The stream features stanza.
41 log
.debug("Server supports subscription pre-approvals.")
42 self
.xmpp
.features
.add('preapproval')