diff options
author | mrDoctorWho <mrdoctorwho@gmail.com> | 2015-03-21 11:27:57 +0300 |
---|---|---|
committer | mrDoctorWho <mrdoctorwho@gmail.com> | 2015-03-21 11:27:57 +0300 |
commit | 0190703dd132e810c89e5e8551478d15b5726afd (patch) | |
tree | 3ae4bba2e4222777dd8ed9241ec7ba956bc2829c /modules/mod_iq_disco.py | |
parent | 6203d2f9e6202abfd9ed5e7d2135acd2212c555c (diff) |
New extension: user_activity to gather statistics for user's activity
Little code cleanup in mod_iq_disco
Diffstat (limited to 'modules/mod_iq_disco.py')
-rw-r--r-- | modules/mod_iq_disco.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/mod_iq_disco.py b/modules/mod_iq_disco.py index 293be86..7c1c78d 100644 --- a/modules/mod_iq_disco.py +++ b/modules/mod_iq_disco.py @@ -137,6 +137,8 @@ def dictToDataForm(_dict, _fields=None): return _fields +## a feature to query the database + def commands_handler(cl, iq): source = iq.getFrom().getStripped() cmd = iq.getTag("command", namespace=xmpp.NS_COMMANDS) @@ -210,7 +212,7 @@ def commands_handler(cl, iq): if isinstance(_result, dict): _fields = dictToDataForm(_result) else: - _fields = [{"var": "body", "value": str(_result), "type": "text-multi" }] + _fields = [{"var": "body", "value": str(_result), "type": "text-multi"}] simpleForm = buildForm(simpleForm, fields=_fields) commandTag.addChild(node=simpleForm) @@ -236,7 +238,7 @@ def commands_handler(cl, iq): "value": values["value"], "desc": _(values.get("desc"))}) simpleForm = buildForm(simpleForm, fields=_fields, title="Choose wisely") - elif form and source in Transport: + elif form: form = getForm(node=form).asDict() for key in form.keys(): if key in config.keys(): @@ -244,7 +246,7 @@ def commands_handler(cl, iq): completed = True if node == "Edit settings" and source in Transport: - logger.info("user want to edit his settings (jid: %s)" % source) + logger.info("user want to edit their settings (jid: %s)" % source) config = Transport[source].settings if not form: user = Transport[source] @@ -256,7 +258,7 @@ def commands_handler(cl, iq): simpleForm = buildForm(simpleForm, fields=_fields, title="Choose wisely") - elif form and source in Transport: + elif form: form = getForm(node=form).asDict() for key in form.keys(): if key in config.keys(): |