Bump to 1.3.1
[slixmpp.git] / sleekxmpp / stanza / stream_features.py
blobe487721edd7d02d103d39443d441160e45464b0e
1 """
2 SleekXMPP: The Sleek XMPP Library
3 Copyright (C) 2010 Nathanael C. Fritz
4 This file is part of SleekXMPP.
6 See the file LICENSE for copying permission.
7 """
9 from sleekxmpp.thirdparty import OrderedDict
10 from sleekxmpp.xmlstream import StanzaBase
13 class StreamFeatures(StanzaBase):
15 """
16 """
18 name = 'features'
19 namespace = 'http://etherx.jabber.org/streams'
20 interfaces = set(('features', 'required', 'optional'))
21 sub_interfaces = interfaces
22 plugin_tag_map = {}
23 plugin_attrib_map = {}
25 def setup(self, xml):
26 StanzaBase.setup(self, xml)
27 self.values = self.values
29 def get_features(self):
30 """
31 """
32 features = OrderedDict()
33 for (name, lang), plugin in self.plugins.items():
34 features[name] = plugin
35 return features
37 def set_features(self, value):
38 """
39 """
40 pass
42 def del_features(self):
43 """
44 """
45 pass
47 def get_required(self):
48 """
49 """
50 features = self['features']
51 return [f for n, f in features.items() if f['required']]
53 def get_optional(self):
54 """
55 """
56 features = self['features']
57 return [f for n, f in features.items() if not f['required']]