summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-04-07 21:16:36 -0400
committerLance Stout <lancestout@gmail.com>2012-04-07 21:16:36 -0400
commit272ddf9f0123c56dc7b0ac3c114ffa6b93943e26 (patch)
tree718d9097e60887ed52bc5cda5fdbb4def219ccb8 /sleekxmpp/plugins
parent259c84e99a314fa610b824ff5c92d73b7f3ad64f (diff)
downloadslixmpp-272ddf9f0123c56dc7b0ac3c114ffa6b93943e26.tar.gz
slixmpp-272ddf9f0123c56dc7b0ac3c114ffa6b93943e26.tar.bz2
slixmpp-272ddf9f0123c56dc7b0ac3c114ffa6b93943e26.tar.xz
slixmpp-272ddf9f0123c56dc7b0ac3c114ffa6b93943e26.zip
Add nickname element to the XEP-0054 plugin.
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r--sleekxmpp/plugins/xep_0054/stanza.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0054/stanza.py b/sleekxmpp/plugins/xep_0054/stanza.py
index 38f8d43b..13865bb5 100644
--- a/sleekxmpp/plugins/xep_0054/stanza.py
+++ b/sleekxmpp/plugins/xep_0054/stanza.py
@@ -68,6 +68,28 @@ class Name(ElementBase):
return self._get_component('SUFFIX')
+class Nickname(ElementBase):
+ name = 'NICKNAME'
+ namespace = 'vcard-temp'
+ plugin_attrib = name
+ interfaces = set([name])
+ is_extension = True
+
+ def set_nickname(self, value):
+ if not value:
+ self.xml.text = ''
+ return
+
+ if not isinstance(value, list):
+ value = [value]
+
+ self.xml.text = ','.join(value)
+
+ def get_nickname(self):
+ if self.xml.text:
+ return self.xml.text.split(',')
+
+
class Email(ElementBase):
name = 'EMAIL'
namespace = 'vcard-temp'
@@ -493,6 +515,7 @@ register_stanza_plugin(VCardTemp, Label, iterable=True)
register_stanza_plugin(VCardTemp, Logo, iterable=True)
register_stanza_plugin(VCardTemp, Mailer, iterable=True)
register_stanza_plugin(VCardTemp, Note, iterable=True)
+register_stanza_plugin(VCardTemp, Nickname, iterable=True)
register_stanza_plugin(VCardTemp, Photo, iterable=True)
register_stanza_plugin(VCardTemp, ProdID, iterable=True)
register_stanza_plugin(VCardTemp, Rev, iterable=True)