mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-02 15:44:06 +01:00
Merge branch 'merge-gribble' into testing
This commit is contained in:
commit
619dd2ce82
@ -249,6 +249,9 @@ class ChannelStats(callbacks.Plugin):
|
|||||||
necessary if the message isn't sent on the channel itself. If <name>
|
necessary if the message isn't sent on the channel itself. If <name>
|
||||||
isn't given, it defaults to the user sending the command.
|
isn't given, it defaults to the user sending the command.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
if name and ircutils.strEqual(name, irc.nick):
|
if name and ircutils.strEqual(name, irc.nick):
|
||||||
id = 0
|
id = 0
|
||||||
elif not name:
|
elif not name:
|
||||||
@ -310,6 +313,9 @@ class ChannelStats(callbacks.Plugin):
|
|||||||
'kicks', 'kicked', 'topics', and 'modes'. Any simple mathematical
|
'kicks', 'kicked', 'topics', and 'modes'. Any simple mathematical
|
||||||
expression involving those variables is permitted.
|
expression involving those variables is permitted.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
# XXX I could do this the right way, and abstract out a safe eval,
|
# XXX I could do this the right way, and abstract out a safe eval,
|
||||||
# or I could just copy/paste from the Math plugin.
|
# or I could just copy/paste from the Math plugin.
|
||||||
if self._calc_match_forbidden_chars.match(expr):
|
if self._calc_match_forbidden_chars.match(expr):
|
||||||
@ -352,6 +358,9 @@ class ChannelStats(callbacks.Plugin):
|
|||||||
Returns the statistics for <channel>. <channel> is only necessary if
|
Returns the statistics for <channel>. <channel> is only necessary if
|
||||||
the message isn't sent on the channel itself.
|
the message isn't sent on the channel itself.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
stats = self.db.getChannelStats(channel)
|
stats = self.db.getChannelStats(channel)
|
||||||
curUsers = len(irc.state.channels[channel].users)
|
curUsers = len(irc.state.channels[channel].users)
|
||||||
|
@ -197,7 +197,7 @@ class Math(callbacks.Plugin):
|
|||||||
# use of str() on large numbers loses information:
|
# use of str() on large numbers loses information:
|
||||||
# str(float(33333333333333)) => '3.33333333333e+13'
|
# str(float(33333333333333)) => '3.33333333333e+13'
|
||||||
# float('3.33333333333e+13') => 33333333333300.0
|
# float('3.33333333333e+13') => 33333333333300.0
|
||||||
return '%f' % x
|
return '%.16f' % x
|
||||||
return str(x)
|
return str(x)
|
||||||
text = self._mathRe.sub(handleMatch, text)
|
text = self._mathRe.sub(handleMatch, text)
|
||||||
try:
|
try:
|
||||||
|
@ -221,6 +221,9 @@ class Seen(callbacks.Plugin):
|
|||||||
saying. <channel> is only necessary if the message isn't sent on the
|
saying. <channel> is only necessary if the message isn't sent on the
|
||||||
channel itself. <nick> may contain * as a wildcard.
|
channel itself. <nick> may contain * as a wildcard.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
self._seen(irc, channel, name)
|
self._seen(irc, channel, name)
|
||||||
seen = wrap(seen, ['channel', 'something'])
|
seen = wrap(seen, ['channel', 'something'])
|
||||||
|
|
||||||
@ -235,6 +238,9 @@ class Seen(callbacks.Plugin):
|
|||||||
and returns the last time user was active in <channel>. <channel> is
|
and returns the last time user was active in <channel>. <channel> is
|
||||||
only necessary if the message isn't sent on the channel itself.
|
only necessary if the message isn't sent on the channel itself.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
if name and optlist:
|
if name and optlist:
|
||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
elif name:
|
elif name:
|
||||||
@ -269,6 +275,9 @@ class Seen(callbacks.Plugin):
|
|||||||
Returns the last thing said in <channel>. <channel> is only necessary
|
Returns the last thing said in <channel>. <channel> is only necessary
|
||||||
if the message isn't sent in the channel itself.
|
if the message isn't sent in the channel itself.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
self._last(irc, channel)
|
self._last(irc, channel)
|
||||||
last = wrap(last, ['channel'])
|
last = wrap(last, ['channel'])
|
||||||
|
|
||||||
@ -295,6 +304,9 @@ class Seen(callbacks.Plugin):
|
|||||||
<channel> is only necessary if the message isn't sent in the channel
|
<channel> is only necessary if the message isn't sent in the channel
|
||||||
itself.
|
itself.
|
||||||
"""
|
"""
|
||||||
|
if msg.nick not in irc.state.channels[channel].users:
|
||||||
|
irc.error(format('You must be in %s to use this command.', channel))
|
||||||
|
return
|
||||||
self._user(irc, channel, user)
|
self._user(irc, channel, user)
|
||||||
user = wrap(user, ['channel', 'otherUser'])
|
user = wrap(user, ['channel', 'otherUser'])
|
||||||
|
|
||||||
@ -313,6 +325,8 @@ class Seen(callbacks.Plugin):
|
|||||||
irc.error(format(_('%s must be in %s to use this command.'),
|
irc.error(format(_('%s must be in %s to use this command.'),
|
||||||
('You' if nick == msg.nick else nick), channel))
|
('You' if nick == msg.nick else nick), channel))
|
||||||
return
|
return
|
||||||
|
if nick is None:
|
||||||
|
nick = msg.nick
|
||||||
end = None # By default, up until the most recent message.
|
end = None # By default, up until the most recent message.
|
||||||
for (i, m) in utils.seq.renumerate(irc.state.history):
|
for (i, m) in utils.seq.renumerate(irc.state.history):
|
||||||
if end is None and m.command == 'JOIN' and \
|
if end is None and m.command == 'JOIN' and \
|
||||||
|
@ -114,7 +114,7 @@ def isIPV4(s):
|
|||||||
0
|
0
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return bool(socket.inet_aton(s))
|
return bool(socket.inet_aton(str(s)))
|
||||||
except socket.error:
|
except socket.error:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user