/** * Generate an IRC line corresponding to user unification/creation * @param Title $userpage * @param string $wikiID * @return string */ protected static function getIRCLine($userpage, $wikiID) { $title = RecentChange::cleanupForIRC($userpage->getPrefixedText()); $wikiID = RecentChange::cleanupForIRC($wikiID); $url = $userpage->getCanonicalURL(); $user = RecentChange::cleanupForIRC($userpage->getText()); # see http://www.irssi.org/documentation/formats for some colour codes. prefix is \003, # no colour (\003) switches back to the term default $fullString = "14[[07{$title}14]]4@{$wikiID}10 " . "02{$url} 5* 03{$user} 5*\n"; return $fullString; }
/** * @param $expected String Expected IRC text without colors codes * @param $type String Log type (move, delete, suppress, patrol ...) * @param $action String A log type action * @param $comment String (optional) A comment for the log action * @param $msg String (optional) A message for PHPUnit :-) */ function assertIRCComment($expected, $type, $action, $params, $comment = null, $msg = '') { $logEntry = new ManualLogEntry($type, $action); $logEntry->setPerformer($this->user); $logEntry->setTarget($this->title); if ($comment !== null) { $logEntry->setComment($comment); } $logEntry->setParameters($params); $formatter = LogFormatter::newFromEntry($logEntry); $formatter->setContext($this->context); // Apply the same transformation as done in RecentChange::getIRCLine for rc_comment $ircRcComment = RecentChange::cleanupForIRC($formatter->getIRCActionComment()); $this->assertEquals($expected, $ircRcComment, $msg); }
/** * @param $status string * @param $oldStatus string */ protected function sendStatusToUDP($status, $oldStatus) { global $wgCodeReviewUDPAddress, $wgCodeReviewUDPPort, $wgCodeReviewUDPPrefix, $wgUser; if ($wgCodeReviewUDPAddress) { $url = $this->getCanonicalUrl(); $line = wfMsg('code-rev-status') . " 14(" . $this->repo->getName() . ")03 " . RecentChange::cleanupForIRC($wgUser->getName()) . " " . str_replace("'''", '', wfMsg('code-change-status', "7" . $this->getIdString() . "")) . ": 15" . wfMsg('code-status-' . $oldStatus) . " -> 10" . wfMsg('code-status-' . $status) . " " . $url; RecentChange::sendToUDP($line, $wgCodeReviewUDPAddress, $wgCodeReviewUDPPrefix, $wgCodeReviewUDPPort); } }