diff options
Diffstat (limited to 'irc')
-rw-r--r-- | irc/.htaccess | 1 | ||||
-rwxr-xr-x | irc/mxircecho.py | 54 | ||||
-rw-r--r-- | irc/rcdumper.php | 122 |
3 files changed, 0 insertions, 177 deletions
diff --git a/irc/.htaccess b/irc/.htaccess deleted file mode 100644 index 3a4288278871..000000000000 --- a/irc/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/irc/mxircecho.py b/irc/mxircecho.py deleted file mode 100755 index b8b38332bb52..000000000000 --- a/irc/mxircecho.py +++ /dev/null @@ -1,54 +0,0 @@ -#! /usr/bin/env python -# -# usage: mxircecho.py nickname server -import sys -sys.path.append('/home/kate/pylib/lib/python2.2/site-packages') - -from ircbot import SingleServerIRCBot -import threading - -class EchoReader(threading.Thread): - def __init__(self, bot): - threading.Thread.__init__(self) - self.abot = bot - - def run(self): - while True: - try: - s = raw_input() - sp = s.split("\t") - if len(sp) == 2: - channel = sp[0] - text = sp[1] - - if channel not in bot.chans: - bot.chans.append(channel) - bot.connection.join(channel) - - - # this throws an exception if not connected. - bot.connection.privmsg(channel, text) - except EOFError: - # Once the input is finished, the bot should exit - break - except: - pass - -class EchoBot(SingleServerIRCBot): - def __init__(self, chans, nickname, server): - print "*** Connecting to IRC server %s..." % server - SingleServerIRCBot.__init__(self, [(server, 6667)], nickname, "IRC echo bot") - self.chans = chans - - def on_nicknameinuse(self, c, e): - c.nick(c.get_nickname() + "_") - - def on_welcome(self, c, e): - print "*** Connected" - for chan in self.chans: - c.join(chan) - -bot = EchoBot([], sys.argv[1], sys.argv[2]); -sthr = EchoReader(bot) -sthr.start() -bot.start() diff --git a/irc/rcdumper.php b/irc/rcdumper.php deleted file mode 100644 index 2adbd5057a9c..000000000000 --- a/irc/rcdumper.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * A recentchanges IRC bot - * - * Example command-line where irc is the name of the ircII executable: - * php rcdumper.php | irc -d -c \#channel nick server - * The name of the IRC server should match $ircServer below. - * - * @package MediaWiki - * @subpackage IRC - */ - -$ircServer = "irc.freenode.net"; - -# Set the below if this is running on a non-Wikimedia site: -#$serverName="your.site.here"; - -ini_set( "display_errors", 1 ); -$wgCommandLineMode = true; -$optionsWithArgs = array( 'm' ); -require_once("../maintenance/commandLine.inc" ); - -if ( !empty( $options['m'] ) ) { - $channel = $options['m']; -} else { - $channel = false; -} - -if ($lang == "commons") $site = "wikimedia"; - -if ($wgWikiFarm) { - $serverName="$lang.$site.org"; - $newPageURLFirstPart="http://$serverName/wiki/"; - $URLFirstPart="http://$serverName/w/wiki.phtml?title="; -} else { - $newPageURLFirstPart="http://$serverName$wgScript/"; - $URLFirstPart="http://$serverName$wgScript?title="; -} - -$wgTitle = Title::newFromText( "RC dumper" ); -$wgCommandLineMode = true; -set_time_limit(0); - -if ( empty($options['b']) ) { - $bots = "AND NOT(rc_bot)"; -} else { - $bots = ""; -} - -if (isset($args[0]) && isset($args[1])) { - $lowest = $args[0]; - $highest = $args[1]; - #$what = $args[0][0]; - #$highest = $args[0][1]; -} -#sleep(30); - -$res = $dbr->query( "SELECT rc_timestamp FROM $recentchanges ORDER BY rc_timestamp DESC LIMIT 1" ); -$row = $dbr->fetchObject( $res ); -$oldTimestamp = $row->rc_timestamp; -$serverCount = 0; - -while (1) { - $res = $dbr->query( "SELECT * FROM $recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp" ); - $rowIndex = 0; - while ( $row = $dbr->fetchObject( $res ) ) { - if ( ++$serverCount % 20 == 0 ) { - print "/server $ircServer\n"; - } - $ns = $wgLang->getNsText( $row->rc_namespace ) ; - if ( $ns ) { - $title = "$ns:{$row->rc_title}"; - } else { - $title = $row->rc_title; - } - /*if ( strlen( $row->rc_comment ) > 50 ) { - $comment = substr( $row->rc_comment, 0, 50 ); - } else {*/ - $comment = $row->rc_comment; -// } - $bad = array("\n", "\r"); - $empty = array("", ""); - $comment = str_replace($bad, $empty, $comment); - $title = str_replace($bad, $empty, $title); - $a = $title[0]; - if ($a < 'A' || $a > 'Z') - $a = 'Z'; - #if ((isset($highest)) && (($what == "<" && $a > "$highest") || ($what == ">" && $a <= "$highest"))) - if ((isset($highest) && ($a > $highest)) || (isset($lowest) && $a <= $lowest)) - continue; - $user = str_replace($bad, $empty, $row->rc_user_text); - $lastid = IntVal($row->rc_last_oldid); - $flag = ($row->rc_minor ? "M" : "") . ($row->rc_new ? "N" : ""); - $stupid_urlencode = array("%2F", "%3A"); - $haha_take_that = array("/", ":"); - if ( $row->rc_new ) { - $url = $newPageURLFirstPart . urlencode($title); - } else { - $url = $URLFirstPart . urlencode($title) . - "&diff=0&oldid=$lastid"; - } - $url = str_replace($stupid_urlencode, $haha_take_that, $url); - $title = str_replace("_", " ", $title); - # see http://www.irssi.org/?page=docs&doc=formats for some colour codes. prefix is \003, - # no colour (\003) switches back to the term default - $comment = preg_replace("/\/\* (.*) \*\/(.*)/", "\00315\$1\003 - \00310\$2\003", $comment); - $fullString = "\00314[[\00307$title\00314]]\0034 $flag\00310 " . - "\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 \00310$comment\003\n"; - if ( $channel ) { - $fullString = "$channel\t$fullString"; - } - - print( $fullString ); - $oldTimestamp = $row->rc_timestamp; - sleep(2); - } - sleep(5); -} - -exit(); - -?> |