Removed cfactive, since, well, CoderForums isn't active.

This commit is contained in:
Jeremy Fincher 2003-03-22 09:07:14 +00:00
parent 7851ea4ef9
commit 67870237fd

View File

@ -50,11 +50,11 @@ class FreshmeatException(Exception):
class Http(callbacks.Privmsg): class Http(callbacks.Privmsg):
threaded = True threaded = True
_fmProject = re.compile('<projectname_full>(.*?)</projectname_full>') _fmProject = re.compile('<projectname_full>([^<]+)</projectname_full>')
_fmVersion = re.compile('<latest_version>(.*?)</latest_version>') _fmVersion = re.compile('<latest_version>([^<]+)</latest_version>')
_fmVitality = re.compile('<vitality_percent>(.*?)</vitality_percent>') _fmVitality = re.compile('<vitality_percent>([^<]+)</vitality_percent>')
_fmPopularity =re.compile('<popularity_percent>(.*?)</popularity_percent>') _fmPopular=re.compile('<popularity_percent>([^<]+)</popularity_percent>')
_fmLastUpdated = re.compile('<date_updated>(.*?)</date_updated>') _fmLastUpdated = re.compile('<date_updated>([^<]+)</date_updated>')
def freshmeat(self, irc, msg, args): def freshmeat(self, irc, msg, args):
"<project name>" "<project name>"
project = privmsgs.getArgs(args) project = privmsgs.getArgs(args)
@ -68,7 +68,7 @@ class Http(callbacks.Privmsg):
project = self._fmProject.search(text).group(1) project = self._fmProject.search(text).group(1)
version = self._fmVersion.search(text).group(1) version = self._fmVersion.search(text).group(1)
vitality = self._fmVitality.search(text).group(1) vitality = self._fmVitality.search(text).group(1)
popularity = self._fmPopularity.search(text).group(1) popularity = self._fmPopular.search(text).group(1)
lastupdated = self._fmLastUpdated.search(text).group(1) lastupdated = self._fmLastUpdated.search(text).group(1)
irc.reply(msg, irc.reply(msg,
'%s, last updated %s, with a vitality percent of %s '\ '%s, last updated %s, with a vitality percent of %s '\
@ -80,28 +80,6 @@ class Http(callbacks.Privmsg):
debug.recoverableException() debug.recoverableException()
irc.reply(msg, debug.exnToString(e)) irc.reply(msg, debug.exnToString(e))
_htmlTag = re.compile('<.*?>')
_htmlEntity = re.compile('&.*?;')
_html = re.compile('<.*?>|&.*?;')
def cfactive(self, irc, msg, args):
"takes no arguments."
try:
fd = urllib2.urlopen('http://www.coderforums.net/')
except Exception, e:
irc.error(msg, debug.exnToString(e))
text = fd.read()
fd.close()
text = self._htmlTag.sub('', text)
lines = text.splitlines()
sent = False
for i in range(len(lines) - 1):
if lines[i].strip().startswith('Most'):
sent = True
irc.reply(msg, lines[i+1].strip())
break
if not sent:
irc.reply(msg, 'The format of the page seems odd.')
def stockquote(self, irc, msg, args): def stockquote(self, irc, msg, args):
"<company symbol>" "<company symbol>"
symbol = privmsgs.getArgs(args) symbol = privmsgs.getArgs(args)