Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Add nickname element to the XEP-0054 plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
legastero committed Apr 8, 2012
1 parent 259c84e commit 272ddf9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions sleekxmpp/plugins/xep_0054/stanza.py
Expand Up @@ -68,6 +68,28 @@ def get_suffix(self):
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'
Expand Down Expand Up @@ -493,6 +515,7 @@ def get_tz(self):
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)
Expand Down

0 comments on commit 272ddf9

Please sign in to comment.