/**
  * Generate an IRC line corresponding to user unification/creation
  * @param Title $userpage
  * @param string $wikiID
  * @return string
  */
 public function getLine($userpage, $wikiID)
 {
     $title = IRCColourfulRCFeedFormatter::cleanupForIRC($userpage->getPrefixedText());
     $wikiID = IRCColourfulRCFeedFormatter::cleanupForIRC($wikiID);
     $url = $userpage->getCanonicalURL();
     $user = IRCColourfulRCFeedFormatter::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
     return "14[[07{$title}14]]4@{$wikiID}10 " . "02{$url} 5* 03{$user} 5*\n";
 }
Example #2
0
 /**
  * @deprecated since 1.22, moved to IRCColourfulRCFeedFormatter
  */
 public static function cleanupForIRC($text)
 {
     wfDeprecated(__METHOD__, '1.22');
     return IRCColourfulRCFeedFormatter::cleanupForIRC($text);
 }
 /**
  * @param string $expected Expected IRC text without colors codes
  * @param string $type Log type (move, delete, suppress, patrol ...)
  * @param string $action A log type action
  * @param array $params
  * @param string $comment (optional) A comment for the log action
  * @param string $msg (optional) A message for PHPUnit :-)
  */
 protected function assertIRCComment($expected, $type, $action, $params, $comment = null, $msg = '', $legacy = false)
 {
     $logEntry = new ManualLogEntry($type, $action);
     $logEntry->setPerformer($this->user);
     $logEntry->setTarget($this->title);
     if ($comment !== null) {
         $logEntry->setComment($comment);
     }
     $logEntry->setParameters($params);
     $logEntry->setLegacy($legacy);
     $formatter = LogFormatter::newFromEntry($logEntry);
     $formatter->setContext($this->context);
     // Apply the same transformation as done in IRCColourfulRCFeedFormatter::getLine for rc_comment
     $ircRcComment = IRCColourfulRCFeedFormatter::cleanupForIRC($formatter->getIRCActionComment());
     $this->assertEquals($expected, $ircRcComment, $msg);
 }