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 name | Value | Description |
---|---|---|
WOLLABOT_TYPE_UNKNOWN | 1 | All unknown messages not fitting into any other category |
WOLLABOT_TYPE_CHANNEL | 2 | Any channel message (recieved on any channel) |
WOLLABOT_TYPE_QUERY | 4 | A query (private) IRC message |
WOLLABOT_TYPE_CTCP | 8 | A CTCP request |
WOLLABOT_TYPE_NOTICE | 16 | A NOTICE from a channel or in private (check $data['channel'] to see which one) |
WOLLABOT_TYPE_WHO | 32 | A WHO response |
WOLLABOT_TYPE_JOIN | 64 | When the user or the bot join any channel. |
WOLLABOT_TYPE_INVITE | 128 | Invite requests (to channels with +1 channel mode) |
WOLLABOT_TYPE_ACTION | 256 | An action (/me greets wollabot) in channel or private (query) |
WOLLABOT_TYPE_TOPICCHANGE | 512 | Topic change in any channel |
WOLLABOT_TYPE_NICKCHANGE | 1024 | Nick change in any channel |
WOLLABOT_TYPE_KICK | 2048 | A kick in any channel |
WOLLABOT_TYPE_QUIT | 4096 | A quit in any channel |
WOLLABOT_TYPE_LOGIN | 8192 | LOGIN response (From a /LOGIN request) |
WOLLABOT_TYPE_LIST | 32768 | WHO response (From a /WHO request) |
WOLLABOT_TYPE_NAME | 65536 | NAME response (users in a given channel) |
WOLLABOT_TYPE_MOTD | 131072 | MOTD (Message of the Day) data |
WOLLABOT_TYPE_MODECHANGE | 262144 | A modechange in any channel you are in. This includes bans. |
WOLLABOT_TYPE_PART | 524288 | Parts from a channel |
WOLLABOT_TYPE_ERROR | 1048576 | Any error from the IRC server |
WOLLABOT_TYPE_BANLIST | 2097152 | Response to BANS request |
WOLLABOT_TYPE_TOPIC | 4194304 | Topic data from a channel |
WOLLABOT_TYPE_NONRELEVANT | 8388608 | Non-relevant messages from IRC server |
WOLLABOT_TYPE_WHOIS | 16777216 | WHOIS data |
WOLLABOT_TYPE_WHOWAS | 33554432 | WHOWAS data |
WOLLABOT_TYPE_USERMODE | 67108864 | Usermode changes |
WOLLABOT_TYPE_CHANNELMODE | 134217728 | A channel mode change (ie. bans) |
WOLLABOT_TYPE_CTCP_REQUEST | 268435456 | A CTCP request |
WOLLABOT_TYPE_CTCP_REPLY | 536870912 | A CTCP reply |
WOLLABOT_TYPE_ALL | 1073741823 | All 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: