1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Merge pull request #89 from Koolvin/f6a78452f36454101ab5c8add297657680557091

Added Fn directive to IRCbot
This commit is contained in:
Evan Priestley 2012-01-19 10:56:12 -08:00
commit c4804aa019

View file

@ -46,7 +46,7 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
$pattern =
'@'.
'(?<!/)(?:^|\b)'. // Negative lookbehind prevent matching "/D123".
'(D|T|P|V)(\d+)'.
'(D|T|P|V|F)(\d+)'.
'(?:\b|$)'.
'@';
@ -55,6 +55,7 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
$paste_ids = array();
$commit_names = array();
$vote_ids = array();
$file_ids = array();
if (preg_match_all($pattern, $message, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
@ -71,6 +72,9 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
case 'V':
$vote_ids[] = $match[2];
break;
case 'F':
$file_ids[] = $match[2];
break;
}
}
}
@ -127,6 +131,18 @@ class PhabricatorIRCObjectNameHandler extends PhabricatorIRCHandler {
}
}
if ($file_ids) {
foreach ($file_ids as $file_id) {
$file = $this->getConduit()->callMethodSynchronous(
'file.info',
array(
'id' => $file_id,
));
$output[$file['phid']] = $file['objectName'].": ".$file['uri']." - ".
$file['name'];
}
}
if ($paste_ids) {
foreach ($paste_ids as $paste_id) {
$paste = $this->getConduit()->callMethodSynchronous(