\s+(?:]+>([^<]+)\s+|([^<]+)) | \s+'
r'(?:]+>([^<]+)| ]
diff --git a/plugins/Quotes.py b/plugins/Quotes.py
index 6b718dde2..0d7760561 100644
--- a/plugins/Quotes.py
+++ b/plugins/Quotes.py
@@ -94,7 +94,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
WHERE added_by=%s AND added_at=%s AND quote=%s"""
cursor.execute(sql, msg.nick, quotetime, quote)
quoteid = cursor.fetchone()[0]
- irc.reply('%s (Quote #%s added)' % (conf.replySuccess, quoteid))
+ irc.replySuccess('(Quote #%s added)' % quoteid)
def num(self, irc, msg, args):
"""[]
@@ -222,17 +222,18 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
(id, added_by, added_at, quote) = cursor.fetchone()
timestamp = time.strftime(conf.humanTimestampFormat,
time.localtime(int(added_at)))
- irc.reply('Quote %r added by %s at %s.' % \
- (quote, added_by, timestamp))
+ irc.reply('Quote %r added by %s at %s.' %
+ (quote, added_by, timestamp))
else:
irc.error('There isn\'t a quote with that id.')
- def remove(self, irc, msg, args, channel):
+ def remove(self, irc, msg, args):
"""[]
Removes quote from the quotes database for .
is only necessary if the message isn't sent in the channel itself.
"""
+ channel = privmsgs.getChannel(msg, args)
id = privmsgs.getArgs(args)
db = self.getDb(channel)
cursor = db.cursor()
diff --git a/plugins/Relay.py b/plugins/Relay.py
index 4f70a194d..5034c2a32 100644
--- a/plugins/Relay.py
+++ b/plugins/Relay.py
@@ -472,7 +472,7 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
identify = ''
else:
identify = ''
- s = '%s (%s) has been%s on server %s since %s (idle for %s) and '\
+ s = '%s (%s) has been%s on server %s since %s (idle for %s) and ' \
'%s.%s' % (user, hostmask, identify, server, signon, idle,
channels, away)
replyIrc.reply(replyMsg, s)
diff --git a/plugins/Scheduler.py b/plugins/Scheduler.py
index b1f3426a9..18efae96c 100644
--- a/plugins/Scheduler.py
+++ b/plugins/Scheduler.py
@@ -89,7 +89,7 @@ class Scheduler(callbacks.Privmsg):
f = self._makeCommandFunction(irc, msg, command)
id = schedule.addEvent(f, time.time() + seconds)
self.events[str(id)] = command
- irc.reply('%s Event #%s added.' % (conf.replySuccess, id))
+ irc.replySuccess('Event #%s added.' % id)
def remove(self, irc, msg, args):
"""
@@ -106,7 +106,7 @@ class Scheduler(callbacks.Privmsg):
pass
try:
schedule.removeEvent(id)
- irc.reply(conf.replySuccess)
+ irc.replySuccess()
except KeyError:
irc.error('Invalid event id.')
else:
diff --git a/plugins/Services.py b/plugins/Services.py
index 842af56f5..3bb57a5ae 100644
--- a/plugins/Services.py
+++ b/plugins/Services.py
@@ -82,7 +82,7 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
ChanServ, respectively, They default to NickServ and ChanServ.
"""
if ircutils.isChannel(msg.args[0]):
- irc.error(conf.replyRequiresPrivacy)
+ irc.errorRequiresPrivacy()
return
(self.nick, self.password, nickserv, chanserv) = \
privmsgs.getArgs(args, required=2, optional=2)
diff --git a/plugins/Sourceforge.py b/plugins/Sourceforge.py
index ee0a6ebd2..17d838fae 100644
--- a/plugins/Sourceforge.py
+++ b/plugins/Sourceforge.py
@@ -104,10 +104,10 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
regexps = ['sfSnarfer']
_reopts = re.I
- _infoRe = re.compile(r'(\d+) | ([^<]+)', _reopts)
- _hrefOpts = '&set=custom&_assigned_to=0&_status=1&_category=100'\
- '&_group=100&order=artifact_id&sort=DESC'
+ _infoRe = re.compile(r' | (\d+) | ([^<]+)', re.I)
+ _hrefOpts = '&set=custom&_assigned_to=0&_status=1&_category=100' \
+ '&_group=100&order=artifact_id&sort=DESC'
_resolution=re.compile(r'(Resolution): (.+?) | ',_reopts)
_assigned=re.compile(r'(Assigned To): (.+?) | ', _reopts)
_submitted = re.compile(r'(Submitted By):
([^<]+)', _reopts)
@@ -167,8 +167,8 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
if len(resp) > 10:
resp = imap(lambda s: utils.ellipsisify(s, 50), resp)
return '%s' % utils.commaAndify(resp)
- raise callbacks.Error, 'No Trackers were found. (%s)' %\
- conf.replyPossibleBug
+ raise callbacks.Error, 'No Trackers were found. (%s)' % \
+ conf.replyPossibleBug
except webutils.WebError, e:
raise callbacks.Error, e.msg()
@@ -180,8 +180,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
if resp:
irc.reply(resp[0])
return
- irc.error('No Trackers were found. (%s)' %
- conf.replyPossibleBug)
+ irc.errorPossibleBug('No Trackers were found.')
except webutils.WebError, e:
irc.error(e.msg())
@@ -195,8 +194,9 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
project = privmsgs.getArgs(args, required=0, optional=1)
try:
int(project)
- irc.error('Use the bug command to get information about a '\
- 'specific bug.')
+ # They want the bug command, they're giving us an id#.
+ s = 'Use the bug command to get information about a specific bug.'
+ irc.error(s)
return
except ValueError:
pass
@@ -246,8 +246,9 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
project = privmsgs.getArgs(args, required=0, optional=1)
try:
int(project)
- irc.error('Use the rfe command to get information about a '\
- 'specific rfe.')
+ # They want a specific RFE, they gave us its id#.
+ s = 'Use the rfe command to get information about a specific rfe.'
+ irc.error(s)
return
except ValueError:
pass
@@ -309,9 +310,7 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin):
head = '%s #%s:' % (ircutils.bold(linktype), num)
resp.append(desc)
else:
- s = '%s does not appear to be a proper Sourceforge ' \
- 'Tracker page (%s)' % (url, conf.replyPossibleBug)
- self.log.warning(s)
+ self.log.warning('Invalid Tracker page snarfed: %s', url)
for r in self._res:
m = r.search(s)
if m:
diff --git a/plugins/Todo.py b/plugins/Todo.py
index 18afe83f7..7ebc7ef7d 100644
--- a/plugins/Todo.py
+++ b/plugins/Todo.py
@@ -208,7 +208,7 @@ class Todo(callbacks.Privmsg):
cursor.execute("""SELECT id FROM todo
WHERE added_at=%s AND userid=%s""", now, id)
todoId = cursor.fetchone()[0]
- irc.reply('%s (Todo #%s added)' % (conf.replySuccess, todoId))
+ irc.replySuccess('(Todo #%s added)' % (todoId))
def remove(self, irc, msg, args):
""" [ ...]
@@ -235,9 +235,9 @@ class Todo(callbacks.Privmsg):
invalid.append(taskid)
#print 'Invalid tasks: %s' % repr(invalid)
if invalid:
- irc.error('No tasks were removed because the following '\
- 'tasks could not be removed: %s' % \
- utils.commaAndify(invalid))
+ irc.error('No tasks were removed because the following '
+ 'tasks could not be removed: %s' %
+ utils.commaAndify(invalid))
else:
for taskid in tasks:
cursor.execute("""UPDATE todo SET active = 0 WHERE id = %s""",
diff --git a/plugins/URL.py b/plugins/URL.py
index 5ef8dda97..1646e6268 100644
--- a/plugins/URL.py
+++ b/plugins/URL.py
@@ -304,9 +304,8 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
self._updateTinyDb(url, tinyurl, channel)
irc.reply(tinyurl)
else:
- s = 'Could not parse the TinyURL.com results page. (%s)' % \
- conf.replyPossibleBug
- irc.error(s)
+ s = 'Could not parse the TinyURL.com results page.'
+ irc.errorPossibleBug(s)
tiny = privmsgs.thread(tiny)
def num(self, irc, msg, args):
@@ -320,7 +319,7 @@ class URL(callbacks.PrivmsgCommandAndRegexp,
cursor = db.cursor()
cursor.execute("""SELECT COUNT(*) FROM urls""")
(count,) = cursor.fetchone()
- irc.reply('I have %s %s in my database.' % \
+ irc.reply('I have %s %s in my database.' %
(count, int(count) == 1 and 'URL' or 'URLs'))
def last(self, irc, msg, args):
diff --git a/plugins/Unix.py b/plugins/Unix.py
index 2979b1f5f..59f34b6fa 100644
--- a/plugins/Unix.py
+++ b/plugins/Unix.py
@@ -91,9 +91,9 @@ def configure(onStart, afterConnect, advanced):
def progstats():
pw = pwd.getpwuid(os.getuid())
- response = 'Process ID %i running as user "%s" and as group "%s" '\
- 'from directory "%s" with the command line "%s". '\
- 'Running on Python %s.' %\
+ response = 'Process ID %i running as user "%s" and as group "%s" ' \
+ 'from directory "%s" with the command line "%s". ' \
+ 'Running on Python %s.' % \
(os.getpid(), pw[0], pw[3],
os.getcwd(), " ".join(sys.argv),
sys.version.translate(string.ascii, '\r\n'))
diff --git a/plugins/Weather.py b/plugins/Weather.py
index c94c8f7d3..7dd76bdf4 100644
--- a/plugins/Weather.py
+++ b/plugins/Weather.py
@@ -62,22 +62,22 @@ class Weather(callbacks.Privmsg):
irc.error(str(e))
_cityregex = re.compile(
- r''\
- r'(.*?), (.*?),(.*?) | ', re.IGNORECASE)
+ r''
+ r'(.*?), (.*?),(.*?) | ', re.I)
_interregex = re.compile(
- r''\
- r'([^,]+), ([^<]+) | ', re.IGNORECASE)
+ r''
+ r'([^,]+), ([^<]+) | ', re.I)
_condregex = re.compile(
- r''\
- r'([^<]+) | ', re.IGNORECASE)
+ r''
+ r'([^<]+) | ', re.I)
_tempregex = re.compile(
- r''\
- r'([^<]+) | ', re.IGNORECASE)
+ r''
+ r'([^<]+) | ', re.I)
_chillregex = re.compile(
- r'Wind Chill:\s+'\
+ r'Wind Chill: | \s+'
r'([^<]+) | ', re.I | re.S)
_heatregex = re.compile(
- r'Heat Index:\s+'\
+ r'Heat Index: | \s+'
r'([^<]+) | ', re.I | re.S)
# States
_realStates = sets.Set(['ak', 'al', 'ar', 'az', 'ca', 'co', 'ct',
@@ -124,16 +124,14 @@ class Weather(callbacks.Privmsg):
state = ''
if country in self._countryMap.keys():
country = self._countryMap[country]
- url = 'http://www.hamweather.net/cgi-bin/hw3/hw3.cgi?'\
- 'pass=&dpp=&forecast=zandh&config=&'\
- 'place=%s&state=%s&country=%s' % \
- (city, state, country)
+ url = 'http://www.hamweather.net/cgi-bin/hw3/hw3.cgi?' \
+ 'pass=&dpp=&forecast=zandh&config=&' \
+ 'place=%s&state=%s&country=%s' % (city, state, country)
html = webutils.getUrl(url)
if 'was not found' in html:
- url = 'http://www.hamweather.net/cgi-bin/hw3/hw3.cgi?'\
- 'pass=&dpp=&forecast=zandh&config=&'\
- 'place=%s&state=&country=%s' % \
- (city, state)
+ url = 'http://www.hamweather.net/cgi-bin/hw3/hw3.cgi?' \
+ 'pass=&dpp=&forecast=zandh&config=&' \
+ 'place=%s&state=&country=%s' % (city, state)
html = webutils.getUrl(url)
if 'was not found' in html:
irc.error('No such location could be found.')
@@ -144,7 +142,7 @@ class Weather(callbacks.Privmsg):
zip = privmsgs.getArgs(args)
zip = zip.replace(',', '')
zip = zip.lower().split()
- url = 'http://www.hamweather.net/cgi-bin/hw3/hw3.cgi?'\
+ url = 'http://www.hamweather.net/cgi-bin/hw3/hw3.cgi?' \
'config=&forecast=zandh&pands=%s&Submit=GO' % args[0]
html = webutils.getUrl(url)
if 'was not found' in html:
diff --git a/plugins/Words.py b/plugins/Words.py
index 8621d4695..e2e63071b 100644
--- a/plugins/Words.py
+++ b/plugins/Words.py
@@ -184,7 +184,7 @@ class Words(callbacks.Privmsg, configurable.Mixin):
return
else:
addWord(self.dbHandler.getDb(), word, commit=True)
- irc.reply(msg, conf.replySuccess)
+ irc.replySuccess()
def crossword(self, irc, msg, args):
"""
diff --git a/src/Admin.py b/src/Admin.py
index 407598fe8..3e858f3c1 100755
--- a/src/Admin.py
+++ b/src/Admin.py
@@ -141,7 +141,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
to protect the secrecy of secret channels.
"""
if ircutils.isChannel(msg.args[0]):
- irc.error(conf.replyRequiresPrivacy)
+ irc.errorRequiresPrivacy()
return
L = irc.state.channels.keys()
if L:
diff --git a/src/Owner.py b/src/Owner.py
index 5ec39a7df..e4bf62f56 100644
--- a/src/Owner.py
+++ b/src/Owner.py
@@ -147,7 +147,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
if len(ambiguousCommands) == 1: # Common case.
(command, names) = ambiguousCommands.popitem()
names.sort()
- s = 'The command %r is available in the %s plugins. '\
+ s = 'The command %r is available in the %s plugins. ' \
'Please specify the plugin whose command you ' \
'wish to call by using its name as a command ' \
'before calling it.' % \
@@ -160,7 +160,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
'plugins' %
(command, utils.commaAndify(names)))
s = '%s; please specify from which plugins to ' \
- 'call these commands.' % '; '.join(L)
+ 'call these commands.' % '; '.join(L)
irc.queueMsg(callbacks.error(msg, s))
else:
callbacks.IrcObjectProxy(irc, msg, tokens)
diff --git a/src/User.py b/src/User.py
index 2c6995365..30794012b 100755
--- a/src/User.py
+++ b/src/User.py
@@ -286,7 +286,7 @@ class User(callbacks.Privmsg):
specified, returns the hostmasks of the user calling the command.
"""
if ircutils.isChannel(msg.args[0]):
- irc.error(conf.replyRequiresPrivacy)
+ irc.errorRequiresPrivacy()
return
name = privmsgs.getArgs(args, required=0, optional=1)
try:
diff --git a/src/callbacks.py b/src/callbacks.py
index 35024f4a2..40dd6a133 100644
--- a/src/callbacks.py
+++ b/src/callbacks.py
@@ -299,15 +299,17 @@ class RichReplyMethods(object):
def replySuccess(self, s='', **kwargs):
self.reply(self._makeReply(conf.replySuccess, s), **kwargs)
- def replyPossibleBug(self, s='', **kwargs):
- self.reply(self._makeReply(conf.replyPossibleBug, s), **kwargs)
-
def replyError(self, s='', **kwargs):
self.reply(self._makeReply(conf.replyError, s), **kwargs)
def errorNoCapability(self, capability, s='', **kwargs):
self.error(self._makeReply(conf.replyNoCapability % s, s), **kwargs)
+ def errorPossibleBug(self, s='', **kwargs):
+ if s:
+ s += ' (%s)' % conf.replyPossibleBug
+ self.error(s, **kwargs)
+
def errorNotRegistered(self, s='', **kwargs):
self.error(self._makeReply(conf.replyNotRegistered, s), **kwargs)
diff --git a/src/ircdb.py b/src/ircdb.py
index b574de2e1..cda5a701d 100644
--- a/src/ircdb.py
+++ b/src/ircdb.py
@@ -211,8 +211,8 @@ class IrcUser(object):
self.hostmasks = hostmasks
def __repr__(self):
- return '%s(ignore=%s, password=%r, name=%r, hashed=%r, '\
- 'capabilities=%r, hostmasks=%r, secure=%r)\n' %\
+ return '%s(ignore=%s, password=%r, name=%r, hashed=%r, ' \
+ 'capabilities=%r, hostmasks=%r, secure=%r)\n' % \
(self.__class__.__name__,
self.ignore, self.password, self.name, self.hashed,
self.capabilities, self.hostmasks, self.secure)
@@ -308,8 +308,8 @@ class IrcChannel(object):
self.lobotomized = lobotomized
def __repr__(self):
- return '%s(bans=%r, ignores=%r, capabilities=%r, '\
- 'lobotomized=%r, defaultAllow=%s)\n' %\
+ return '%s(bans=%r, ignores=%r, capabilities=%r, ' \
+ 'lobotomized=%r, defaultAllow=%s)\n' % \
(self.__class__.__name__, self.bans, self.ignores,
self.capabilities, self.lobotomized,
self.defaultAllow)