+
+ /**
+ * @return string
+ */
+ public function getIRCLine() {
+ global $wgUseRCPatrol, $wgUseNPPatrol, $wgRC2UDPInterwikiPrefix, $wgLocalInterwiki,
+ $wgCanonicalServer, $wgScript;
+
+ if( $this->mAttribs['rc_type'] == RC_LOG ) {
+ $titleObj = SpecialPage::getTitleFor( 'Log', $this->mAttribs['rc_log_type'] );
+ } else {
+ $titleObj =& $this->getTitle();
+ }
+ $title = $titleObj->getPrefixedText();
+ $title = self::cleanupForIRC( $title );
+
+ if( $this->mAttribs['rc_type'] == RC_LOG ) {
+ $url = '';
+ } else {
+ $url = $wgCanonicalServer . $wgScript;
+ if( $this->mAttribs['rc_type'] == RC_NEW ) {
+ $query = '?oldid=' . $this->mAttribs['rc_this_oldid'];
+ } else {
+ $query = '?diff=' . $this->mAttribs['rc_this_oldid'] . '&oldid=' . $this->mAttribs['rc_last_oldid'];
+ }
+ if ( $wgUseRCPatrol || ( $this->mAttribs['rc_type'] == RC_NEW && $wgUseNPPatrol ) ) {
+ $query .= '&rcid=' . $this->mAttribs['rc_id'];
+ }
+ // HACK: We need this hook for WMF's secure server setup
+ wfRunHooks( 'IRCLineURL', array( &$url, &$query ) );
+ $url .= $query;
+ }
+
+ if( $this->mAttribs['rc_old_len'] !== null && $this->mAttribs['rc_new_len'] !== null ) {
+ $szdiff = $this->mAttribs['rc_new_len'] - $this->mAttribs['rc_old_len'];
+ if($szdiff < -500) {
+ $szdiff = "\002$szdiff\002";
+ } elseif($szdiff >= 0) {
+ $szdiff = '+' . $szdiff ;
+ }
+ $szdiff = '(' . $szdiff . ')' ;
+ } else {
+ $szdiff = '';
+ }
+
+ $user = self::cleanupForIRC( $this->mAttribs['rc_user_text'] );
+
+ if ( $this->mAttribs['rc_type'] == RC_LOG ) {
+ $targetText = $this->getTitle()->getPrefixedText();
+ $comment = self::cleanupForIRC( str_replace( "[[$targetText]]", "[[\00302$targetText\00310]]", $this->mExtra['actionComment'] ) );
+ $flag = $this->mAttribs['rc_log_action'];
+ } else {
+ $comment = self::cleanupForIRC( $this->mAttribs['rc_comment'] );
+ $flag = '';
+ if ( !$this->mAttribs['rc_patrolled'] && ( $wgUseRCPatrol || $this->mAttribs['rc_new'] && $wgUseNPPatrol ) ) {
+ $flag .= '!';
+ }
+ $flag .= ( $this->mAttribs['rc_new'] ? "N" : "" ) . ( $this->mAttribs['rc_minor'] ? "M" : "" ) . ( $this->mAttribs['rc_bot'] ? "B" : "" );
+ }
+
+ if ( $wgRC2UDPInterwikiPrefix === true && $wgLocalInterwiki !== false ) {
+ $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]]";
+ }
+
+ # see http://www.irssi.org/documentation/formats for some colour codes. prefix is \003,
+ # no colour (\003) switches back to the term default
+ $fullString = "$titleString\0034 $flag\00310 " .
+ "\00302$url\003 \0035*\003 \00303$user\003 \0035*\003 $szdiff \00310$comment\003\n";
+
+ return $fullString;
+ }
+
+ /**
+ * Returns the change size (HTML).
+ * The lengths can be given optionally.
+ * @param $old int
+ * @param $new int
+ * @return string
+ */
+ public function getCharacterDifference( $old = 0, $new = 0 ) {
+ if( $old === 0 ) {
+ $old = $this->mAttribs['rc_old_len'];
+ }
+ if( $new === 0 ) {
+ $new = $this->mAttribs['rc_new_len'];
+ }
+ if( $old === null || $new === null ) {
+ return '';
+ }
+ return ChangesList::showCharacterDifference( $old, $new );
+ }