mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 20:22:45 +01:00
commands: Add converters for IRIs
Since the 'url' and 'httpUrl' converters no longer support them...
This commit is contained in:
parent
be88530fa4
commit
0131cd0691
@ -680,6 +680,12 @@ def getUrl(irc, msg, args, state):
|
|||||||
else:
|
else:
|
||||||
state.errorInvalid(_('url'), args[0])
|
state.errorInvalid(_('url'), args[0])
|
||||||
|
|
||||||
|
def getIri(irc, msg, args, state):
|
||||||
|
if utils.web.urlRe.match(args[0]):
|
||||||
|
state.args.append(args.pop(0))
|
||||||
|
else:
|
||||||
|
state.errorInvalid(_('IRI'), args[0])
|
||||||
|
|
||||||
def getEmail(irc, msg, args, state):
|
def getEmail(irc, msg, args, state):
|
||||||
if utils.net.emailRe.match(args[0]):
|
if utils.net.emailRe.match(args[0]):
|
||||||
state.args.append(args.pop(0))
|
state.args.append(args.pop(0))
|
||||||
@ -696,6 +702,14 @@ def getHttpUrl(irc, msg, args, state):
|
|||||||
else:
|
else:
|
||||||
state.errorInvalid(_('http url'), args[0])
|
state.errorInvalid(_('http url'), args[0])
|
||||||
|
|
||||||
|
def getHttpIri(irc, msg, args, state):
|
||||||
|
if utils.web.httpUrlRe.match(args[0]):
|
||||||
|
state.args.append(args.pop(0))
|
||||||
|
elif utils.web.httpUrlRe.match('http://' + args[0]):
|
||||||
|
state.args.append('http://' + args.pop(0))
|
||||||
|
else:
|
||||||
|
state.errorInvalid(_('http url'), args[0])
|
||||||
|
|
||||||
def getNow(irc, msg, args, state):
|
def getNow(irc, msg, args, state):
|
||||||
state.args.append(int(time.time()))
|
state.args.append(int(time.time()))
|
||||||
|
|
||||||
@ -795,6 +809,7 @@ wrappers = ircutils.IrcDict({
|
|||||||
'haveVoice+': getHaveVoicePlus,
|
'haveVoice+': getHaveVoicePlus,
|
||||||
'hostmask': getHostmask,
|
'hostmask': getHostmask,
|
||||||
'httpUrl': getHttpUrl,
|
'httpUrl': getHttpUrl,
|
||||||
|
'httpIri': getHttpIri,
|
||||||
'id': getId,
|
'id': getId,
|
||||||
'inChannel': inChannel,
|
'inChannel': inChannel,
|
||||||
'index': getIndex,
|
'index': getIndex,
|
||||||
@ -828,6 +843,7 @@ wrappers = ircutils.IrcDict({
|
|||||||
'text': getText,
|
'text': getText,
|
||||||
'to': getTo,
|
'to': getTo,
|
||||||
'url': getUrl,
|
'url': getUrl,
|
||||||
|
'iri': getIri,
|
||||||
'user': getUser,
|
'user': getUser,
|
||||||
'validChannel': validChannel,
|
'validChannel': validChannel,
|
||||||
'voice': getVoice,
|
'voice': getVoice,
|
||||||
|
Loading…
Reference in New Issue
Block a user