summaryrefslogtreecommitdiff
path: root/src/common.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-03-12 16:12:47 +0100
committermathieui <mathieui@mathieui.net>2013-03-12 16:12:47 +0100
commitd797b1fd65ba73c48e1933cc8042db0cc548094a (patch)
treed53c18b406f18c236ccee7b72ab71d57d2d5b35c /src/common.py
parentcec1151ecb577a270b9e1f0ae5eaa238d3269ae8 (diff)
downloadpoezio-d797b1fd65ba73c48e1933cc8042db0cc548094a.tar.gz
poezio-d797b1fd65ba73c48e1933cc8042db0cc548094a.tar.bz2
poezio-d797b1fd65ba73c48e1933cc8042db0cc548094a.tar.xz
poezio-d797b1fd65ba73c48e1933cc8042db0cc548094a.zip
Implement user gaming (xep-0196)
- configuration options - theming options - /gaming
Diffstat (limited to 'src/common.py')
-rw-r--r--src/common.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/common.py b/src/common.py
index 5b62732c..16fcfba5 100644
--- a/src/common.py
+++ b/src/common.py
@@ -315,6 +315,25 @@ def format_tune_string(infos):
elems.append('[' + mins + ':' + secs + ']')
return ' '.join(elems)
+def format_gaming_string(infos):
+ """
+ Construct a string from a dict containing the "user gaming"
+ informations.
+ (for now, only use address and name)
+
+ :param dict infos: The informations
+ :returns: The formatted string
+ :rtype: :py:class:`str`
+ """
+ name = infos.get('name')
+ if not name:
+ return ''
+
+ server_address = infos.get('server_address')
+ if server_address:
+ return '%s on %s' % (name, server_address)
+ return name
+
def safeJID(*args, **kwargs):
"""
Construct a :py:class:`sleekxmpp.JID` object from a string.