bind_type

Name

bind_type -- Binds a message type from a defined list of types to a method

Synopsis

void bind_type(string method, int type);

Description

This is a very powerful way of binding to an IRC message of a given type. The type is made up using bitwise operators to create your kind of type-specification from a list of types.

Table 3-1. Wollabot message types

Constant nameValueDescription
WOLLABOT_TYPE_UNKNOWN1All unknown messages not fitting into any other category
WOLLABOT_TYPE_CHANNEL2Any channel message (recieved on any channel)
WOLLABOT_TYPE_QUERY4A query (private) IRC message
WOLLABOT_TYPE_CTCP8A CTCP request
WOLLABOT_TYPE_NOTICE16A NOTICE from a channel or in private (check $data['channel'] to see which one)
WOLLABOT_TYPE_WHO32A WHO response
WOLLABOT_TYPE_JOIN64When the user or the bot join any channel.
WOLLABOT_TYPE_INVITE128Invite requests (to channels with +1 channel mode)
WOLLABOT_TYPE_ACTION256An action (/me greets wollabot) in channel or private (query)
WOLLABOT_TYPE_TOPICCHANGE512Topic change in any channel
WOLLABOT_TYPE_NICKCHANGE1024Nick change in any channel
WOLLABOT_TYPE_KICK2048A kick in any channel
WOLLABOT_TYPE_QUIT4096A quit in any channel
WOLLABOT_TYPE_LOGIN8192LOGIN response (From a /LOGIN request)
WOLLABOT_TYPE_LIST32768WHO response (From a /WHO request)
WOLLABOT_TYPE_NAME65536NAME response (users in a given channel)
WOLLABOT_TYPE_MOTD131072MOTD (Message of the Day) data
WOLLABOT_TYPE_MODECHANGE262144A modechange in any channel you are in. This includes bans.
WOLLABOT_TYPE_PART524288Parts from a channel
WOLLABOT_TYPE_ERROR1048576Any error from the IRC server
WOLLABOT_TYPE_BANLIST2097152Response to BANS request
WOLLABOT_TYPE_TOPIC4194304Topic data from a channel
WOLLABOT_TYPE_NONRELEVANT8388608Non-relevant messages from IRC server
WOLLABOT_TYPE_WHOIS16777216WHOIS data
WOLLABOT_TYPE_WHOWAS33554432WHOWAS data
WOLLABOT_TYPE_USERMODE67108864Usermode changes
WOLLABOT_TYPE_CHANNELMODE134217728A channel mode change (ie. bans)
WOLLABOT_TYPE_CTCP_REQUEST268435456A CTCP request
WOLLABOT_TYPE_CTCP_REPLY536870912A CTCP reply
WOLLABOT_TYPE_ALL1073741823All of the above

In order to make your own type specification you use the bitwise operators. If you want all QUIT and PART messages your could do the following.

Example 3-1. Binding to QUIT and PART messages using bind_type

$this->bind_type('a_method', WOLLABOT_TYPE_QUIT | WOLLABOT_TYPE_PART);
	  

If you instead would like all messages except nickchanges and KICK messages you would use something like:

Example 3-2. Binding to everything except nickchanges and KICK messages using bind_type

$this->bind_type('b_method', WOLLABOT_TYPE_ALL ^ (WOLLABOT_TYPE_NICKCHANGE | WOLLABOT_TYPE_KICK));