From d797b1fd65ba73c48e1933cc8042db0cc548094a Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 12 Mar 2013 16:12:47 +0100 Subject: Implement user gaming (xep-0196) - configuration options - theming options - /gaming --- src/common.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/common.py') 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. -- cgit v1.2.3