2012-03-07 19:44:07 +00:00
|
|
|
"""
|
|
|
|
SleekXMPP: The Sleek XMPP Library
|
|
|
|
Copyright (C) 2012 Nathanael C. Fritz
|
|
|
|
This file is part of SleekXMPP.
|
|
|
|
|
|
|
|
See the file LICENSE for copying permission.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from sleekxmpp.stanza import Iq, StreamFeatures
|
|
|
|
from sleekxmpp.features.feature_rosterver import stanza
|
|
|
|
from sleekxmpp.xmlstream import register_stanza_plugin
|
2012-03-13 03:04:11 +00:00
|
|
|
from sleekxmpp.plugins.base import BasePlugin
|
2012-03-07 19:44:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2012-03-13 03:04:11 +00:00
|
|
|
class FeatureRosterVer(BasePlugin):
|
2012-03-07 19:44:07 +00:00
|
|
|
|
2012-03-13 03:04:11 +00:00
|
|
|
name = 'feature_rosterver'
|
|
|
|
description = 'RFC 6121: Stream Feature: Roster Versioning'
|
|
|
|
dependences = set()
|
|
|
|
stanza = stanza
|
2012-03-07 19:44:07 +00:00
|
|
|
|
2012-03-13 03:04:11 +00:00
|
|
|
def plugin_init(self):
|
2012-03-07 19:44:07 +00:00
|
|
|
self.xmpp.register_feature('rosterver',
|
|
|
|
self._handle_rosterver,
|
|
|
|
restart=False,
|
|
|
|
order=9000)
|
|
|
|
|
|
|
|
register_stanza_plugin(StreamFeatures, stanza.RosterVer)
|
|
|
|
|
|
|
|
def _handle_rosterver(self, features):
|
|
|
|
"""Enable using roster versioning.
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
features -- The stream features stanza.
|
|
|
|
"""
|
|
|
|
log.debug("Enabling roster versioning.")
|
|
|
|
self.xmpp.features.add('rosterver')
|