mirror of
https://github.com/glest/glest-source.git
synced 2025-09-26 23:49:03 +02:00
77 lines
7.8 KiB
HTML
77 lines
7.8 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
|
<title>libircclient: Frequently Asked Questions</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.5.7.1 -->
|
|
<div class="navigation" id="top">
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li class="current"><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="annotated.html"><span>Data Structures</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="contents">
|
|
<h1><a class="anchor" name="pagefaq">Frequently Asked Questions </a></h1><h2><a class="anchor" name="faq">
|
|
FAQ</a></h2>
|
|
<h3><a class="anchor" name="faq1">
|
|
Why the IRC server generates all these event_numeric events, and what is their meaning?</a></h3>
|
|
The IRC protocol itself is asynchronous and server-driven. For you, this means the following:<ul>
|
|
<li>For any IRC command, it is not possible to obtain an immediate response whether the command succeed or not. Instead the server will send the reply in a short (or long) period of time.</li><li>For some IRC command there is no 'success' response at all. For example, when you send a text message, IRC server will not send anything to confirm that the message is already sent.</li><li>You can send several commands to the IRC server, and then receive several replies regarding every command. The order of the replies you receive is generally undefined.</li><li>A lot of IRC events sent to you is generated by other users, or the IRC server itself, and are sent to you just when they are generated.</li><li>Long lists (for example, channel lists) are also sent as events. Moreover, these events could be separated by other events (message or notices). And it is your responsibility to separate the data (using event codes), and use some sort of data structure that will hold it until the data is complete. It is not possible to simply query the list of channels, and expect that its content will immediately arrive.</li><li>IRC protocol is event-based, not request-based. This means that if you send JOIN request asking to join a channel, you cannot assume that you have joined it until the server tells you so with JOIN event. Also it is possible for server to "JOIN" you to a specific channel implicitly, without even sending a join request.</li><li>You should be prepared to expect the unexpected from the IRC server. For example, the server can change your nick (seen on most servers, which use <em>nickserv</em> authentication. You can be "forced" to join the channel, to say something, to leave a channel, to change your usermode and so on. Listen what IRC server tells you, and do so.</li></ul>
|
|
<h3><a class="anchor" name="faq2">
|
|
Why the irc_cmd_... functions does not return an error if the IRC server reports it? For example, why irc_cmd_join() returns success when I attempt to join a password-protected channel, and then the IRC server sends an error?</a></h3>
|
|
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 <a class="el" href="pagefaq.html#faq1">Why the IRC server generates all these event_numeric events, and what is their meaning?</a>.<h3><a class="anchor" name="faq3">
|
|
How to register/auth with NICKSERV?</a></h3>
|
|
There is no 'standard' way. However, knowing that all NICKSERV messages are sent via <a class="el" href="structirc__callbacks__t.html#92a5b22ba900f06fa04ea9e79462ffc6">irc_callbacks_t::event_notice</a>, you can use following algorithm: <div class="fragment"><pre class="fragment"><span class="keyword">static</span> <span class="keywordtype">void</span> event_notice (<a class="code" href="libircclient_8h.html#0030a976ab3e6a247d57e30fd5979cd5" title="A libircclient IRC session.">irc_session_t</a> * session, <span class="keyword">const</span> <span class="keywordtype">char</span> * event,
|
|
<span class="keyword">const</span> <span class="keywordtype">char</span> * origin, <span class="keyword">const</span> <span class="keywordtype">char</span> ** params, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count)
|
|
{
|
|
<span class="keywordtype">char</span> buf[256];
|
|
|
|
<span class="keywordflow">if</span> ( !origin )
|
|
<span class="keywordflow">return</span>;
|
|
|
|
<span class="keywordflow">if</span> ( strcasecmp (origin, <span class="stringliteral">"nickserv"</span>) )
|
|
<span class="keywordflow">return</span>;
|
|
|
|
<span class="keywordflow">if</span> ( strstr (params[1], <span class="stringliteral">"This nick is not registered"</span>) == params[1] )
|
|
{
|
|
sprintf (buf, <span class="stringliteral">"REGISTER %s NOMAIL"</span>, gCfg.irc_nickserv_password);
|
|
<a class="code" href="group__ircmd__msg.html#g8c2ec03f1a9ce7c739e11b64fd088ae5" title="Sends the message to the nick or to the channel.">irc_cmd_msg</a> (session, <span class="stringliteral">"nickserv"</span>, buf);
|
|
}
|
|
<span class="keywordflow">else</span> <span class="keywordflow">if</span> ( strstr (params[1], <span class="stringliteral">"This nickname is registered and protected"</span>)
|
|
== params[1] )
|
|
{
|
|
sprintf (buf, <span class="stringliteral">"IDENTIFY %s"</span>, gCfg.irc_nickserv_password);
|
|
<a class="code" href="group__ircmd__msg.html#g8c2ec03f1a9ce7c739e11b64fd088ae5" title="Sends the message to the nick or to the channel.">irc_cmd_msg</a> (session, <span class="stringliteral">"nickserv"</span>, buf);
|
|
}
|
|
<span class="keywordflow">else</span> <span class="keywordflow">if</span> ( strstr (params[1], <span class="stringliteral">"Password accepted - you are now recognized"</span>)
|
|
== params[1] )
|
|
printf (<span class="stringliteral">"Nickserv authentication succeed."</span>);
|
|
}
|
|
</pre></div><p>
|
|
The idea is to parse the messages sent from NICKSERV, and if they're matched the specific patterns, react on them appropriately.<h3><a class="anchor" name="faq4">
|
|
What is CTCP, and why do I need my own handler?</a></h3>
|
|
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.<h3><a class="anchor" name="faq5">
|
|
Why don't I receive event_umode when I am made +o (a channel operator)?</a></h3>
|
|
Because this is a channel mode, not a user mode. The user mode <code>+o</code> means that this user is an IRC network operator, not just a channel operator.<h3><a class="anchor" name="faq6">
|
|
Why do I get a LIBIRC_ERR_SOCKET error while using static library under Win32?</a></h3>
|
|
Because if you use static library, you have to initialize Winsock manually:<p>
|
|
<div class="fragment"><pre class="fragment">WORD wVersionRequested = MAKEWORD (1, 1);
|
|
WSADATA wsaData;
|
|
|
|
<span class="keywordflow">if</span> ( WSAStartup (wVersionRequested, &wsaData) != 0 )
|
|
<span class="comment">// report an error</span>
|
|
|
|
<span class="comment">// And now we can use libircclient</span>
|
|
</pre></div> </div>
|
|
<hr size="1"><address style="text-align: right;"><small>Generated on Sat Jan 10 18:19:35 2009 for libircclient by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.7.1 </small></address>
|
|
</body>
|
|
</html>
|