Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: 217f992aea
...
compare: 246442a825
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Sep 05, 2012
@brownan Changes and bug fixes to the admin plugins
Changed default op timeout to 60 seconds. It still won't timeout if
there is no op method defined, so this seemed reasonable.

Fixed double-calls to later_timer. Mised some None assignments after
some cancels.

Supports extbans in +b and +q

Won't attempt to kick on bans with hostmasks or extbans
5970ac4
@brownan added an Owner plugin 7398c5f
Commits on Sep 13, 2012
@brownan Merge branch 'master' of github.com:brownan/abbott 9fefd67
@brownan added a couple more plugins to the docs 6101409
@brownan changed the names request to return a list 246442a
View
35 abbott/plugins/admin.py
@@ -128,7 +128,7 @@ def _has_op(self, channel):
defer.returnValue( self.have_op[channel] )
except KeyError:
# determine if we have OP
- names_list = (yield self.transport.issue_request("irc.names",channel)).split()
+ names_list = (yield self.transport.issue_request("irc.names",channel))
nick = (yield self.transport.issue_request("irc.getnick"))
@@ -146,9 +146,9 @@ def _set_op_timeout(self, channel):
try:
timeout = self.config['optimeout'][channel]
except KeyError:
- self.config['optimeout'][channel] = 0
+ self.config['optimeout'][channel] = 60
self.config.save()
- timeout = 0
+ timeout = 60
try:
method = self.config['opmethod'][channel]
@@ -428,6 +428,7 @@ def reload(self):
if self.later_timer:
self.later_timer.cancel()
+ self.later_timer = None
self._set_later_timer()
@@ -439,6 +440,7 @@ def _set_later_timer(self):
return
if self.later_timer:
self.later_timer.cancel()
+ self.later_timer = None
if not self.config['dolater']:
self.later_timer = None
@@ -456,7 +458,7 @@ def _process_laters(self):
later_items = self.config['dolater']
try:
- while later_items and later_items[0][0] < now:
+ while later_items and later_items[0][0] <= now:
event_info = heapq.heappop(later_items)[1]
log.msg("Processing later event %r" % (event_info,))
@@ -488,6 +490,7 @@ def stop(self):
super(IRCAdmin, self).stop()
if self.later_timer:
self.later_timer.cancel()
+ self.later_timer = None
def start(self):
super(IRCAdmin, self).start()
@@ -615,9 +618,11 @@ def _send_as_op(self, event, reply=lambda s: None):
@defer.inlineCallbacks
def _nick_to_hostmask(self, nick):
- """Takes a nick or a hostmask and returns a hostmask. If the items
- given looks like a hostmask (contains a ! and a @) then it is returned.
- Otherwise, a whois is performed and the hostmask is returned with the
+ """Takes a nick or a hostmask and returns a parameter suitable for the
+ +b or +q modes. If the items given looks like a hostmask (contains a !
+ and a @) then it is returned. If the item is an extban (starts with a
+ $), then that is returned. Otherwise, it is assumed the parameter is a
+ nickname and a whois is performed and the hostmask is returned with the
first two fields wildcarded.
This methed is intended to allow bans and quiets to match any nick!user
@@ -629,7 +634,7 @@ def _nick_to_hostmask(self, nick):
Returnes a deferred that fires with the answer.
"""
- if "!" in nick and "@" in nick:
+ if ("!" in nick and "@" in nick) or (nick.startswith("$")):
defer.returnValue(nick)
return
@@ -743,11 +748,15 @@ def ban(self, event, match):
reason = groupdict['reason']
yield self._do_moderequest('b', event, nick, duration, channel)
- self._send_as_op(Event("irc.do_kick",
- channel=channel,
- user=nick,
- reason=reason or ("Requested by " + event.user.split("!")[0]),
- ))
+
+ # nick could also be a hostmask or extban. Do a simple check to see if
+ # it looks like a nick
+ if "@" not in nick and "!" not in nick and "$" not in nick:
+ self._send_as_op(Event("irc.do_kick",
+ channel=channel,
+ user=nick,
+ reason=reason or ("Requested by " + event.user.split("!")[0]),
+ ))
@defer.inlineCallbacks
View
3  abbott/plugins/ircutil.py
@@ -178,9 +178,10 @@ def on_event_irc_on_unknown(self, event):
elif command == "RPL_ENDOFNAMES":
channel = event.params[1]
names = " ".join(self.currentinfo)
+ name_list = names.split()
self.currentinfo = []
for d in self.pendingwhoises.pop(channel):
- d.callback(names)
+ d.callback(name_list)
@defer.inlineCallbacks
View
19 abbott/plugins/useful.py
@@ -316,3 +316,22 @@ def on_event_irc_on_privmsg(self, event):
shortened = self.shortener.shorten(url)
event.reply("^ %s" % shortened['id'], userprefix=False)
+
+class Owner(CommandPluginSuperclass):
+ """Just a simple plugin to print out the bot's owner. There is no online
+ config interface, so edit the json yourself and issue a configreload.
+
+ """
+ def start(self):
+ super(Owner, self).start()
+ self.install_command(
+ cmdname="owner",
+ helptext="Display who owns me",
+ callback=self.do_owner,
+ )
+
+ def do_owner(self, event, match):
+ if "owner" in self.config:
+ event.reply("My owner is " + self.config['owner'])
+ else:
+ event.reply("I... I don't know! \me cries")
View
50 doc/documentation.rst
@@ -503,7 +503,53 @@ Requests Provided
irc.getnick
Deferred fires immediately with the bot's current nickname
-IRCController
+irc.IRCController
+-----------------
+
+This is a Command Plugin (see above) which provides a command interface to
+several tasks related to maintaining the IRC client itself, such as joining
+channels and changing nicks.
+
+Commands provided
+`````````````````
+The following commands are provided, and all require the irc.control permission:
+
+* join
+* part
+* nick
+
+ircutil.IRCWhois
+----------------
+
+Provides an abstraction for the irc.do_whois event which collects results and
+returns them with a requests interface.
+
+Requests Provided
+`````````````````
+irc.whois
+ Deferred fires with a dictionary of information from the server in response
+ to a whois.
+
+Commands Provided
+`````````````````
+
+whois
+ This command is meant for debugging, and nothing else. It requires the
+ irc.whois permission. Takes one parameter: the name to whois.
+
+ircutil.Names
-------------
-A command plugin that
+Provides an interface to the IRC NAMES command.
+
+Requests Provided
+`````````````````
+irc.names
+ Returned deferred fires with a list of names in the current channel. Takes
+ one parameter: the channel name.
+
+Commands Provided
+`````````````````
+names
+ This command is meant for debugging, and nothing else. It requires the
+ irc.names permission. Takes one parameter: the channel to name.

No commit comments for this range

Something went wrong with that request. Please try again.