IPC Messages
From IRCBotWiki
For the purposes of IRCBot, IPC stands for IRCBot Plugin Communication.
Listed below are the standard and other registered IPC message codes.
Contents |
Message Ranges
0x00 - 0xFF: Reserved for official IRCBot implementation 0x00 - 0x0F: System Messages 0x10 - 0x1F: IRC 0x20 - 0x2F: User Info/Control 0x30 - 0x3F: Source Control (AutoDJ, mp3_source, etc.) 0x40 - 0xFF: Reserved
0x0100 - 0x7FFFFFFF: Contact me and I will add it here
System Messages
IB_INIT 0x01 sent after IRCBot is done reading the config, loading plugins, and is about to connect to IRC and begin dragging sound servers IB_SHUTDOWN 0x02 sent when IRCBot is shutting down IB_SS_DRAGCOMPLETE 0x03 sent each time at the end of a stats drag. Data sent is a bool which is set to true if the title has changed since the last drag IB_REHASH 0x04 IRCBot has rehashed, reload your config if you need to. This is for future use, IRCBot does not currently support rehashing IB_LOG 0x05 A line that will be printed to the console/log window. Data is a pointer to a null-terminated string that will be printed. You MUST NOT call ib_printf from within this callback or there will be a thread deadlock on non-Win32 systems. IB_GETMEMINFO 0x06 This is sent to each plugin individually, and you should return 1 if you provided the information, or 0 if you did not. Data is a pointer to an IBM_MEMINFO structure. IB_PROCTEXT 0x07 This is sent to all plugins, and you should return 0 whether you processed the text or not. Data is a pointer to an IBM_PROCTEXT structure.
IRC Messages
IB_ONJOIN 0x10 sent when a user joins a channel, data is a ptr to a IBM_USER structure IB_ONPART 0x11 sent when a user leaves a channel, data is a ptr to a IBM_USERTEXT structure IB_ONQUIT 0x12 sent when a user disconnects, data is a ptr to a IBM_USERTEXT structure (with channel set to NULL in the userinfo member) IB_ONTEXT 0x13 sent when a user speaks. data is a ptr to a IBM_USERTEXT structure (channel is set to the ircbot's nick in case of type == IBM_UTT_PRIVMSG) IB_ONNICK 0x14 sent when a user changes nicks. data is a ptr to a IBM_NICKCHANGE structure IB_ONNOTICE 0x15 sent when a user notices. data is a ptr to a IBM_USERTEXT structure (channel is set to the ircbot's nick in case of type == IBM_UTT_PRIVMSG)
User Info/Control Messages
IB_GETUSERINFO 0x20 sent when a user's level/info is needed, sent as a IBM_GETUSERINFO structure (the nick/hostmask for you to find will be in the IBM_USERFULL/ui member, remember the hostmask may be an empty string in case of GetUserByNick()) IB_ADD_USER 0x21 sent when a user needs to be added, sent as a IBM_USERFULL structure, return values are: 0 = I don't support this, 1 = Addition failed, 2 = Addition success IB_DEL_USER 0x22 sent when a user needs to be added, sent as a IBM_USERFULL structure. You should always return 0 for this, in case other plugins need this notification
Source Control Messages
_C_ == Command message source control should respond to _I_ == Information message source control should send out SOURCE_C_STOP 0x30 commands any source control plugins to stop feeding the stream SOURCE_C_PLAY 0x31 commands any source control plugins to start feeding the stream SOURCE_C_NEXT 0x32 commands any source control plugins to skip the current song SOURCE_I_STOPPING 0x33 SOURCE_I_STOPPED 0x34 SOURCE_I_PLAYING 0x35
Message Structures
struct IBM_USER {
char * nick;
char * hostmask;
char * channel;
int32 ulevel;
int32 netno;
};
struct IBM_NICKCHANGE {
char * old_nick;
char * new_nick;
int32 netno;
};
enum IBM_USERTEXT_TYPE {
IBM_UTT_CHANNEL=0,
IBM_UTT_PRIVMSG=1
};
struct IBM_USERTEXT {
IBM_USER * userinfo;
IBM_USERTEXT_TYPE type;
char * text;
};
struct IBM_USERFULL {
char nick[128];
char pass[128];
char hostmask[128];
int32 ulevel;
};
struct IBM_USEREXTENDED {
char nick[128];
char pass[128];
int32 ulevel;
uint32 flags;
int32 numhostmasks;
char hostmasks[MAX_HOSTMASKS][128];
};
enum IBM_GETUSERINFO_TYPES {
IBM_UT_FULL = 0,
IBM_UT_EXTENDED = 1
};
struct IBM_GETUSERINFO {
IBM_GETUSERINFO_TYPES type;
int32 type;
union {
IBM_USERFULL ui;
IBM_USEREXTENDED ue;
};
};
struct IBM_MEMINFO {
int64 num_pointers;
int64 bytes_allocated;
};
struct IBM_PROCTEXT {
char * buf;
int32 bufSize;
};
