Page MenuHomePhabricator
Diviner Phabricator Tech Docs PhabricatorProtocolAdapter

abstract class PhabricatorProtocolAdapter
Phabricator Technical Documentation (Daemons)

Defines the api for protocol adapters for PhabricatorBot

Methods

public function setConfig($config)

This method is not documented.
Parameters
$config
Return
wild

public function getConfig($key, $default)

This method is not documented.
Parameters
$key
$default
Return
wild

abstract public function connect()

Performs any connection logic necessary for the protocol

Return
wild

public function disconnect()

Disconnect from the service.

Return
wild

abstract public function getNextMessages($poll_frequency)

This is the spout for messages coming in from the protocol. This will be called in the main event loop of the bot daemon So if if doesn't implement some sort of blocking timeout (e.g. select-based socket polling), it should at least sleep for some period of time in order to not overwhelm the processor.

Parameters
Int$poll_frequencyThe number of seconds between polls
Return
wild

abstract public function writeMessage($message)

This is the output mechanism for the protocol.

Parameters
PhabricatorBotMessage$messageThe message to write
Return
wild

abstract public function getServiceType()

String identifying the service type the adapter provides access to, like "irc", "campfire", "flowdock", "hipchat", etc.

Return
wild

abstract public function getServiceName()

String identifying the service name the adapter is connecting to. This is used to distinguish between instances of a service. For example, for IRC, this should return the IRC network the client is connecting to.

Return
wild