From c6ed06ba6132f95a4e066a48ded11f9d62600149 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 17 Jul 2016 15:20:48 -0700 Subject: [PATCH] utils: new splitHostmask function --- utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/utils.py b/utils.py index 7d94e31..3b3a325 100644 --- a/utils.py +++ b/utils.py @@ -172,6 +172,14 @@ def getDatabaseName(dbname): dbname += '.db' return dbname +def splitHostmask(mask): + """ + Returns a nick!user@host hostmask split into three fields: nick, user, and host. + """ + nick, identhost = mask.split('!', 1) + ident, host = identhost.split('@', 1) + return [nick, ident, host] + class ServiceBot(): """ PyLink IRC Service class.