diff --git a/src/AdminCommands.py b/src/AdminCommands.py index b9480e3cd..8f00fc816 100755 --- a/src/AdminCommands.py +++ b/src/AdminCommands.py @@ -34,7 +34,11 @@ These are commands useful for administrating the bot; they all require their caller to have the 'admin' capability. This plugin is loaded by default. """ +from fix import * + +import pprint import string +import smtplib import conf import ircdb @@ -185,6 +189,35 @@ class AdminCommands(privmsgs.CapabilityCheckingPrivmsg): conf.prefixChars = s irc.reply(msg, conf.replySuccess) + def bug(self, irc, msg, args): + """ + + Reports a bug to a private mailing list supybot-bugs. + will be the subject of the email. The most recent 10 or so messages + the bot receives will be sent in the body of the email. + """ + description = privmsgs.getArgs(args) + messages = pprint.pformat(irc.state.history[-10:]) + email = textwrap.dedent(""" + Subject: %s + From: jemfinch@users.sourceforge.net + To: supybot-bugs@lists.sourceforge.net + Date: %s + + Bug report for Supybot %s. + %s + """) % (description, time.ctime(), conf.version, messages) + email = email.strip() + email = email.replace('\n', '\r\n') + #debug.printf(`email`) + smtp = smtplib.SMTP('mail.sourceforge.net', 25) + smtp.sendmail('jemfinch@users.sf.net', + ['supybot-bugs@lists.sourceforge.net'], + email) + smtp.quit() + irc.reply(msg, conf.replySuccess) + bug = privmsgs.thread(bug) + Class = AdminCommands diff --git a/src/MiscCommands.py b/src/MiscCommands.py index 6673f3751..e7b7a2777 100755 --- a/src/MiscCommands.py +++ b/src/MiscCommands.py @@ -39,8 +39,6 @@ import os import sys import time import getopt -import pprint -import smtplib import textwrap from itertools import ifilter @@ -195,35 +193,6 @@ class MiscCommands(callbacks.Privmsg): else: irc.error(msg, 'There is no such command %s.' % command) - def bug(self, irc, msg, args): - """ - - Reports a bug to a private mailing list supybot-bugs. - will be the subject of the email. The most recent 10 or so messages - the bot receives will be sent in the body of the email. - """ - description = privmsgs.getArgs(args) - messages = pprint.pformat(irc.state.history[-10:]) - email = textwrap.dedent(""" - Subject: %s - From: jemfinch@users.sourceforge.net - To: supybot-bugs@lists.sourceforge.net - Date: %s - - Bug report for Supybot %s. - %s - """) % (description, time.ctime(), conf.version, messages) - email = email.strip() - email = email.replace('\n', '\r\n') - debug.printf(`email`) - smtp = smtplib.SMTP('mail.sourceforge.net', 25) - smtp.sendmail('jemfinch@users.sf.net', - ['supybot-bugs@lists.sourceforge.net'], - email) - smtp.quit() - irc.reply(msg, conf.replySuccess) - bug = privmsgs.thread(bug) - def hostmask(self, irc, msg, args): """ diff --git a/test/test_MiscCommands.py b/test/test_MiscCommands.py index 325174f90..5b3e34fb5 100644 --- a/test/test_MiscCommands.py +++ b/test/test_MiscCommands.py @@ -83,9 +83,6 @@ class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation): self.assertNotRegexp('list', name) self.assertRegexp('list --private', name) - def testBug(self): - self.assertNotError('bug') - def testVersion(self): self.assertNotError('version')