The IRC protocol itself is asynchronous and server-driven. For you, this means the following:
The irc_cmd_... functions return success when the command is sent to the IRC server. The asynchronous nature of IRC makes it impossible to obtain the command result immediately. Please read Why the IRC server generates all these event_numeric events, and what is their meaning?.
There is no 'standard' way. However, knowing that all NICKSERV messages are sent via irc_callbacks_t::event_notice, you can use following algorithm:
static void event_notice (irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count) { char buf[256]; if ( !origin ) return; if ( strcasecmp (origin, "nickserv") ) return; if ( strstr (params[1], "This nick is not registered") == params[1] ) { sprintf (buf, "REGISTER %s NOMAIL", gCfg.irc_nickserv_password); irc_cmd_msg (session, "nickserv", buf); } else if ( strstr (params[1], "This nickname is registered and protected") == params[1] ) { sprintf (buf, "IDENTIFY %s", gCfg.irc_nickserv_password); irc_cmd_msg (session, "nickserv", buf); } else if ( strstr (params[1], "Password accepted - you are now recognized") == params[1] ) printf ("Nickserv authentication succeed."); }
The idea is to parse the messages sent from NICKSERV, and if they're matched the specific patterns, react on them appropriately.
CTCP abbreviature is deciphered as "Client-to-Client Protocol". It is used between the IRC clients to query the remote client for some data, or to send some information - for example, /me messages are sent via CTCP. There is no standard list of possible CTCP requests, and different IRC clients often add their own CTCP codes. The built-in handler reacts on TIME, VERSION, PING and FINGER CTCP queries. If you need to react on other queries, you'll have to write your own CTCP handler. See the source code of libirc_event_ctcp_internal to get an idea how to write it.
Because this is a channel mode, not a user mode. The user mode +o
means that this user is an IRC network operator, not just a channel operator.
Because if you use static library, you have to initialize Winsock manually:
WORD wVersionRequested = MAKEWORD (1, 1); WSADATA wsaData; if ( WSAStartup (wVersionRequested, &wsaData) != 0 ) // report an error // And now we can use libircclient