mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 14:10:41 +01:00
Made _checkNotChannel return False if it's sent in a channel, and checked that return value in the resulting functions.
This commit is contained in:
parent
a764de50ad
commit
9a1959e04d
@ -45,6 +45,9 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
def _checkNotChannel(self, irc, msg, password=' '):
|
def _checkNotChannel(self, irc, msg, password=' '):
|
||||||
if password and ircutils.isChannel(msg.args[0]):
|
if password and ircutils.isChannel(msg.args[0]):
|
||||||
irc.error(msg, conf.replyRequiresPrivacy)
|
irc.error(msg, conf.replyRequiresPrivacy)
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
def register(self, irc, msg, args):
|
def register(self, irc, msg, args):
|
||||||
"""<name> <password>
|
"""<name> <password>
|
||||||
@ -53,7 +56,8 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
hostmask of the person registering.
|
hostmask of the person registering.
|
||||||
"""
|
"""
|
||||||
(name, password) = privmsgs.getArgs(args, optional=1)
|
(name, password) = privmsgs.getArgs(args, optional=1)
|
||||||
self._checkNotChannel(irc, msg, password)
|
if not self._checkNotChannel(irc, msg, password):
|
||||||
|
return
|
||||||
if ircutils.isChannel(msg.args[0]):
|
if ircutils.isChannel(msg.args[0]):
|
||||||
irc.error(msg, conf.replyRequiresPrivacy)
|
irc.error(msg, conf.replyRequiresPrivacy)
|
||||||
return
|
return
|
||||||
@ -77,7 +81,8 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
hostmask.
|
hostmask.
|
||||||
"""
|
"""
|
||||||
(name, hostmask, password) = privmsgs.getArgs(args, 2, 1)
|
(name, hostmask, password) = privmsgs.getArgs(args, 2, 1)
|
||||||
self._checkNotChannel(irc, msg, password)
|
if not self._checkNotChannel(irc, msg, password):
|
||||||
|
return
|
||||||
s = hostmask.translate(string.ascii, '!@*?')
|
s = hostmask.translate(string.ascii, '!@*?')
|
||||||
if len(s) < 10:
|
if len(s) < 10:
|
||||||
s = 'Hostmask must be more than 10 non-wildcard characters.'
|
s = 'Hostmask must be more than 10 non-wildcard characters.'
|
||||||
@ -111,7 +116,8 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
recognized by his hostmask.
|
recognized by his hostmask.
|
||||||
"""
|
"""
|
||||||
(name, hostmask, password) = privmsgs.getArgs(args, 2, 1)
|
(name, hostmask, password) = privmsgs.getArgs(args, 2, 1)
|
||||||
self._checkNotChannel(irc, msg, password)
|
if not self._checkNotChannel(irc, msg, password):
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(name)
|
user = ircdb.users.getUser(name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -132,7 +138,8 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
<new password>.
|
<new password>.
|
||||||
"""
|
"""
|
||||||
(name, oldpassword, newpassword) = privmsgs.getArgs(args, 3)
|
(name, oldpassword, newpassword) = privmsgs.getArgs(args, 3)
|
||||||
self._checkNotChannel(irc, msg, oldpassword+newpassword)
|
if not self._checkNotChannel(irc, msg, oldpassword+newpassword):
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(name)
|
user = ircdb.users.getUser(name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -206,7 +213,8 @@ class UserCommands(callbacks.Privmsg):
|
|||||||
Identifies the user as <name>.
|
Identifies the user as <name>.
|
||||||
"""
|
"""
|
||||||
(name, password) = privmsgs.getArgs(args, 2)
|
(name, password) = privmsgs.getArgs(args, 2)
|
||||||
self._checkNotChannel(irc, msg)
|
if not self._checkNotChannel(irc, msg):
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
u = ircdb.users.getUser(name)
|
u = ircdb.users.getUser(name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user