@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make phabot never private message anyone.

Summary:
This replaces D4175 and makes it so phabot doesn't message anyone.

The reasons for this are twofold:

- It was possible to get information from the bot, by private messaging it, even
if the bot was only in a +i channel (on a public network) -- meaning that if
someone knew the nickname of the bot, they could obtain e.g. ticket names
or diff titles.
- The other time it messaged people was when you typed e.g. "somenick: T123".
Most times when this is triggered, it's done so on accident.

See discussion on the old revision (D4175).

Test Plan:
15:29:33 ::: Irssi: Starting query in quartz with cb-phabot
15:29:38 <relrod> T2
(nothing back)

and

15:29:21 <@relrod> rublets: T1
15:29:21 < cb-phabot> T1: asdfasdf (Priority: Needs Triage) - http://local.elrod.me/T1

Reviewers: epriestley, btrahan, vrana

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4339

authored by

Ricky Elrod and committed by
epriestley
f12af038 9a936b5b

+12 -26
-5
src/infrastructure/daemon/irc/PhabricatorIRCMessage.php
··· 31 31 if ($target[0] == '#') { 32 32 return $target; 33 33 } 34 - 35 - $matches = null; 36 - if (preg_match('/^:([^!]+)!/', $this->sender, $matches)) { 37 - return $matches[1]; 38 - } 39 34 break; 40 35 } 41 36 return null;
+12 -21
src/infrastructure/daemon/irc/handler/PhabricatorIRCObjectNameHandler.php
··· 33 33 '(D|T|P|V|F)(\d+)'. 34 34 '(?:\b|$)'. 35 35 '@'; 36 - $pattern_override = '/(^[^\s]+)[,:] [DTPVF]\d+/'; 37 36 38 37 $revision_ids = array(); 39 38 $task_ids = array(); ··· 41 40 $commit_names = array(); 42 41 $vote_ids = array(); 43 42 $file_ids = array(); 44 - $matches_override = array(); 45 43 46 44 if (preg_match_all($pattern, $message, $matches, PREG_SET_ORDER)) { 47 - if (preg_match($pattern_override, $message, $matches_override)) { 48 - $reply_to = $matches_override[1]; 49 - } 50 45 foreach ($matches as $match) { 51 46 switch ($match[1]) { 52 47 case 'D': ··· 180 175 181 176 // Don't mention the same object more than once every 10 minutes 182 177 // in public channels, so we avoid spamming the chat over and over 183 - // again for discsussions of a specific revision, for example. In 184 - // direct-to-bot chat, respond to every object reference. 185 - 186 - if ($this->isChannelName($reply_to)) { 187 - if (empty($this->recentlyMentioned[$reply_to])) { 188 - $this->recentlyMentioned[$reply_to] = array(); 189 - } 178 + // again for discsussions of a specific revision, for example. 190 179 191 - $quiet_until = idx( 192 - $this->recentlyMentioned[$reply_to], 193 - $phid, 194 - 0) + (60 * 10); 180 + if (empty($this->recentlyMentioned[$reply_to])) { 181 + $this->recentlyMentioned[$reply_to] = array(); 182 + } 195 183 196 - if (time() < $quiet_until) { 197 - // Remain quiet on this channel. 198 - continue; 199 - } 184 + $quiet_until = idx( 185 + $this->recentlyMentioned[$reply_to], 186 + $phid, 187 + 0) + (60 * 10); 200 188 201 - $this->recentlyMentioned[$reply_to][$phid] = time(); 189 + if (time() < $quiet_until) { 190 + // Remain quiet on this channel. 191 + continue; 202 192 } 203 193 194 + $this->recentlyMentioned[$reply_to][$phid] = time(); 204 195 $this->write('PRIVMSG', "{$reply_to} :{$description}"); 205 196 } 206 197 break;