summaryrefslogtreecommitdiff
path: root/src/common.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-08-06 15:38:09 +0200
committermathieui <mathieui@mathieui.net>2012-08-06 15:38:09 +0200
commit7a485ef4d0d74313bff8c9c7b2ee2dcb5c4a75e9 (patch)
tree293d3c01239572dd3a9743422c79f8c0dfdc0a1c /src/common.py
parenta14141bcec98eee77937716113ecd8a994c4836b (diff)
downloadpoezio-7a485ef4d0d74313bff8c9c7b2ee2dcb5c4a75e9.tar.gz
poezio-7a485ef4d0d74313bff8c9c7b2ee2dcb5c4a75e9.tar.bz2
poezio-7a485ef4d0d74313bff8c9c7b2ee2dcb5c4a75e9.tar.xz
poezio-7a485ef4d0d74313bff8c9c7b2ee2dcb5c4a75e9.zip
Add a common.safeJID function, and use it everywhere
Diffstat (limited to 'src/common.py')
-rw-r--r--src/common.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common.py b/src/common.py
index aae5928c..46306cdb 100644
--- a/src/common.py
+++ b/src/common.py
@@ -10,6 +10,7 @@ various useful functions
"""
from datetime import datetime, timedelta
+from sleekxmpp import JID, InvalidJID
import base64
import os
import mimetypes
@@ -265,3 +266,9 @@ def parse_command_args_to_alias(arg, strto):
else:
var_num = True
return dest
+
+def safeJID(*args, **kwargs):
+ try:
+ return JID(*args, **kwargs)
+ except InvalidJID:
+ return JID('')