Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F119931241
PhabricatorIRCProtocolHandler.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jun 30, 15:49
Size
854 B
Mime Type
text/x-php
Expires
Wed, Jul 2, 15:49 (2 d)
Engine
blob
Format
Raw Data
Handle
27071653
Attached To
rPH Phabricator
PhabricatorIRCProtocolHandler.php
View Options
<?php
/**
* Implements the base IRC protocol so servers don't kick you off.
*
* @group irc
*/
final
class
PhabricatorIRCProtocolHandler
extends
PhabricatorBotHandler
{
public
function
receiveMessage
(
PhabricatorBotMessage
$message
)
{
switch
(
$message
->
getCommand
())
{
case
'422'
:
// Error - no MOTD
case
'376'
:
// End of MOTD
$nickpass
=
$this
->
getConfig
(
'nickpass'
);
if
(
$nickpass
)
{
$this
->
write
(
'PRIVMSG'
,
"nickserv :IDENTIFY {$nickpass}"
);
}
$join
=
$this
->
getConfig
(
'join'
);
if
(!
$join
)
{
throw
new
Exception
(
"Not configured to join any channels!"
);
}
foreach
(
$join
as
$channel
)
{
$this
->
write
(
'JOIN'
,
$channel
);
}
break
;
case
'PING'
:
$this
->
write
(
'PONG'
,
$message
->
getRawData
());
break
;
}
}
}
Event Timeline
Log In to Comment