Improved $wgRC2UDPInterwikiPrefix feature, so that it can actually be a prefix and...
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 13 Nov 2008 08:51:10 +0000 (08:51 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 13 Nov 2008 08:51:10 +0000 (08:51 +0000)
includes/DefaultSettings.php
includes/RecentChange.php

index fdd91a6..3bafd96 100644 (file)
@@ -2104,11 +2104,35 @@ $wgRCFilterByAge = false;
 $wgRCLinkLimits = array( 50, 100, 250, 500 );
 $wgRCLinkDays   = array( 1, 3, 7, 14, 30 );
 
-# Send RC updates via UDP
+/**
+ * Send recent changes updates via UDP. The updates will be formatted for IRC.
+ * Set this to the IP address of the receiver.
+ */
 $wgRC2UDPAddress = false;
+
+/**
+ * Port number for RC updates
+ */
 $wgRC2UDPPort = false;
+
+/**
+ * Prefix to prepend to each UDP packet.
+ * This can be used to identify the wiki. A script is available called
+ * mxircecho.py which listens on a UDP port, and uses a prefix ending in a 
+ * tab to identify the IRC channel to send the log line to.
+ */
 $wgRC2UDPPrefix = '';
+
+/**
+ * If this is set to true, $wgLocalInterwiki will be prepended to links in the 
+ * IRC feed. If this is set to a string, that string will be used as the prefix.
+ */
 $wgRC2UDPInterwikiPrefix = false;
+
+/**
+ * Set to true to omit "bot" edits (by users with the bot permission) from the 
+ * UDP feed.
+ */
 $wgRC2UDPOmitBots = false;
 
 /**
index afb122d..d071466 100644 (file)
@@ -641,9 +641,16 @@ class RecentChange
                        $comment = self::cleanupForIRC( $rc_comment );
                        $flag = ($rc_new ? "N" : "") . ($rc_minor ? "M" : "") . ($rc_bot ? "B" : "");
                }
-               
-               if( $wgRC2UDPInterwikiPrefix && isset( $wgLocalInterwiki ) ) {
-                       $titleString = "\00314[[\00303$wgLocalInterwiki:\00307$title\00314]]";
+
+               if ( $wgRC2UDPInterwikiPrefix === true ) {
+                       $prefix = $wgLocalInterwiki;
+               } elseif ( $wgRC2UDPInterwikiPrefix ) {
+                       $prefix = $wgRC2UDPInterwikiPrefix;
+               } else {
+                       $prefix = false;
+               }
+               if ( $prefix !== false ) {
+                       $titleString = "\00314[[\00303$prefix:\00307$title\00314]]";
                } else {
                        $titleString = "\00314[[\00307$title\00314]]";
                }