diff options
author | John Smith <mrdoctorwho@gmail.com> | 2017-04-28 10:05:29 +0300 |
---|---|---|
committer | John Smith <mrdoctorwho@gmail.com> | 2017-04-28 10:05:29 +0300 |
commit | 5cf6b01b563051be61ed9ab7a3f3da125465efb4 (patch) | |
tree | afc16f20dc04ea31f2ff4ac1c781665d810a440d | |
parent | a7d8d72ddf23054e15944e806200a44868c863e0 (diff) |
Light refactoring in groupchats.py
-rw-r--r-- | extensions/groupchats.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/extensions/groupchats.py b/extensions/groupchats.py index 454e935..9bf7717 100644 --- a/extensions/groupchats.py +++ b/extensions/groupchats.py @@ -395,12 +395,15 @@ class Chat(object): """ Split the source and return required parts """ - node, domain = source.split("@") - if "_chat#" in node: - creator, id = node.split("_chat#") - else: + node, domain = source.split("@", 1) + if "_chat#" not in node: return (None, None, None) - return (int(creator), int(id), domain) + if "/" in domain: + domain = domain.split("/")[0] + creator, id = node.split("_chat#", 1) + creator = int(creator) + id = int(id) + return (creator, id, domain) @classmethod def getUserObject(cls, source): |