Fixed bug with ACTIONs and added test.

This commit is contained in:
Jeremy Fincher 2003-09-09 07:36:41 +00:00
parent 8e44660692
commit 2719812074
2 changed files with 10 additions and 1 deletions

View File

@ -45,6 +45,7 @@ import urlparse
import sqlite
import utils
import ircmsgs
import privmsgs
import callbacks
@ -115,7 +116,11 @@ class URLSnarfer(callbacks.Privmsg, ChannelDBHandler):
cursor.execute("""UPDATE urls SET next_msg=%s
WHERE url=%s AND added=%s""",
msg.args[1], url, added)
for url in self._urlRe.findall(msg.args[1]):
if ircmsgs.isAction(msg):
text = ircmsgs.unAction(msg)
else:
text = msg.args[1]
for url in self._urlRe.findall(text):
(protocol, site, filename, _, _, _) = urlparse.urlparse(url)
previousMsg = ''
for oldMsg in reviter(irc.state.history):

View File

@ -85,6 +85,10 @@ class URLSnarferTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertRegexp('lasturl --with dhcp', re.escape(urls[-4]))
self.assertRegexp('lasturl --from alsdkjf', '^No')
self.assertNotError('randomurl')
def testAction(self):
self.irc.feedMsg(ircmsgs.action(self.channel, urls[1]))
self.assertNotRegexp('lasturl', '\\x01')