Server factory takes initializer dict
This commit is contained in:
parent
59ea2e971b
commit
92530ef1b2
@ -26,14 +26,14 @@ _wlist = []
|
|||||||
_xlist = []
|
_xlist = []
|
||||||
|
|
||||||
|
|
||||||
def factory(uri):
|
def factory(uri, **init_args):
|
||||||
from urllib.parse import urlparse, unquote
|
from urllib.parse import urlparse, unquote
|
||||||
o = urlparse(uri)
|
o = urlparse(uri)
|
||||||
|
|
||||||
if o.scheme == "irc" or o.scheme == "ircs":
|
if o.scheme == "irc" or o.scheme == "ircs":
|
||||||
# http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt
|
# http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt
|
||||||
# http://www-archive.mozilla.org/projects/rt-messaging/chatzilla/irc-urls.html
|
# http://www-archive.mozilla.org/projects/rt-messaging/chatzilla/irc-urls.html
|
||||||
args = dict()
|
args = init_args
|
||||||
|
|
||||||
modifiers = o.path.split(",")
|
modifiers = o.path.split(",")
|
||||||
target = unquote(modifiers.pop(0)[1:])
|
target = unquote(modifiers.pop(0)[1:])
|
||||||
@ -51,9 +51,13 @@ def factory(uri):
|
|||||||
else:
|
else:
|
||||||
key, val = q, ""
|
key, val = q, ""
|
||||||
if key == "msg":
|
if key == "msg":
|
||||||
args["on_connect"] = [ "PRIVMSG %s :%s" % (target, unquote(val)) ]
|
if "on_connect" not in args:
|
||||||
|
args["on_connect"] = []
|
||||||
|
args["on_connect"].append("PRIVMSG %s :%s" % (target, unquote(val)))
|
||||||
elif key == "key":
|
elif key == "key":
|
||||||
args["channels"] = [ (target, unquote(val)) ]
|
if "channels" not in args:
|
||||||
|
args["channels"] = []
|
||||||
|
args["channels"].append((target, unquote(val)))
|
||||||
elif key == "pass":
|
elif key == "pass":
|
||||||
args["password"] = unquote(val)
|
args["password"] = unquote(val)
|
||||||
elif key == "charset":
|
elif key == "charset":
|
||||||
|
Loading…
Reference in New Issue
Block a user