author | Tero Marttila <terom@fixme.fi> |
Wed, 27 May 2009 23:57:48 +0300 | |
branch | new-lib-errors |
changeset 217 | 7728d6ec3abf |
parent 171 | b54f393c3df0 |
child 219 | cefec18b8268 |
permissions | -rw-r--r-- |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#ifndef IRC_CONN_H |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
#define IRC_CONN_H |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
4 |
/** |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
5 |
* @file |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
6 |
* |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
7 |
* Support for connections to IRC servers, a rather fundamental thing. This holds the line_proto to handle the network |
84 | 8 |
* communications, and then takes care of sending/receiving commands, as well as some core functionality like |
9 |
* responding to PING requests, and tracking our current nickname. |
|
217 | 10 |
* |
11 |
* XXX: split into irc_proto and irc_client |
|
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
12 |
*/ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
14 |
struct irc_conn; |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
15 |
|
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
16 |
#include "error.h" |
155
c59d3eaff0fb
most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
150
diff
changeset
|
17 |
#include "transport.h" |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
18 |
#include "line_proto.h" |
91
bca23cbe1dce
implement irc_queue for irc_conn, and add missing irc_queue_destroy, fix irc_conn_destroy
Tero Marttila <terom@fixme.fi>
parents:
88
diff
changeset
|
19 |
#include "irc_queue.h" |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
#include "irc_line.h" |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
21 |
#include "irc_cmd.h" |
21 | 22 |
#include <stdbool.h> |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
23 |
|
25
56367df4ce5b
add irc_net module, and fix Makefile CFLAGS, add -Wextra
Tero Marttila <terom@fixme.fi>
parents:
23
diff
changeset
|
24 |
/** |
84 | 25 |
* The info required to register using irc_conn_register() |
25
56367df4ce5b
add irc_net module, and fix Makefile CFLAGS, add -Wextra
Tero Marttila <terom@fixme.fi>
parents:
23
diff
changeset
|
26 |
*/ |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
27 |
struct irc_conn_register_info { |
84 | 28 |
/** Nickname to use on that server */ |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
const char *nickname; |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
30 |
|
84 | 31 |
/** Username to supply */ |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
32 |
const char *username; |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
|
84 | 34 |
/** Realname to supply */ |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
35 |
const char *realname; |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
36 |
}; |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
37 |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
38 |
/** |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
39 |
* Connection state callbacks |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
40 |
*/ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
41 |
struct irc_conn_callbacks { |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
42 |
/** |
84 | 43 |
* Recieved RPL_WELCOME, so irc_conn_register has completed, and we are now registered. |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
44 |
*/ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
45 |
void (*on_registered) (struct irc_conn *conn, void *arg); |
45
71e65564afd2
remove irc_chan.state, modify irc_chan_callbacks.on_msg to take a irc_nm, improve error handling a bit further (up to irc_net now)
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
46 |
|
71e65564afd2
remove irc_chan.state, modify irc_chan_callbacks.on_msg to take a irc_nm, improve error handling a bit further (up to irc_net now)
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
47 |
/** |
71e65564afd2
remove irc_chan.state, modify irc_chan_callbacks.on_msg to take a irc_nm, improve error handling a bit further (up to irc_net now)
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
48 |
* The connection has failed in some way, and can not be considered useable anymore. Sending messages won't work, |
84 | 49 |
* and no more messages will be received. The connection should be destroyed, probably directly from this callback. |
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
50 |
* |
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
51 |
* NOTE: Implementing this callback is mandatory |
45
71e65564afd2
remove irc_chan.state, modify irc_chan_callbacks.on_msg to take a irc_nm, improve error handling a bit further (up to irc_net now)
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
52 |
*/ |
217 | 53 |
void (*on_error) (struct irc_conn *conn, error_t *err, void *arg); |
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
54 |
|
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
55 |
/** |
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
56 |
* The connection was closed cleanly after irc_conn_QUIT. |
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
57 |
* |
84 | 58 |
* You probably want to destroy the irc_conn now to clean up. |
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
59 |
*/ |
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
60 |
void (*on_quit) (struct irc_conn *conn, void *arg); |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
61 |
}; |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
62 |
|
84 | 63 |
/** |
64 |
* A single sock_stream connection to a single IRC server, providing a nice interface to the low-level IRC protocol. |
|
65 |
* |
|
66 |
* Create a irc_conn from a connected sock_stream using irc_conn_create(), providing the high-level callbacks. Then, |
|
67 |
* register handlers for the IRC protocol messages recieved from the server using irc_conn_add_cmd_handlers() or |
|
68 |
* irc_cmd_add and irc_conn::handlers/irc_conn::ctcp_handlers. |
|
69 |
* |
|
70 |
* You can then perform the registration step using irc_conn_register(), providing a irc_conn_register_info struct with |
|
71 |
* the relevant info. |
|
72 |
* |
|
73 |
* Once you have succesfully registered (RPL_WELCOME recieved, irc_conn_callbacks::on_registered called, |
|
74 |
* irc_conn::registered set), you can then send messages to the server in the form of irc_line's using the set of |
|
75 |
* irc_conn_send functions. |
|
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
76 |
*/ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
77 |
struct irc_conn { |
84 | 78 |
/** We are a line-based protocol, this wraps the given sock_stream */ |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
79 |
struct line_proto *lp; |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
80 |
|
91
bca23cbe1dce
implement irc_queue for irc_conn, and add missing irc_queue_destroy, fix irc_conn_destroy
Tero Marttila <terom@fixme.fi>
parents:
88
diff
changeset
|
81 |
/** Outgoing line queue */ |
bca23cbe1dce
implement irc_queue for irc_conn, and add missing irc_queue_destroy, fix irc_conn_destroy
Tero Marttila <terom@fixme.fi>
parents:
88
diff
changeset
|
82 |
struct irc_queue *out_queue; |
bca23cbe1dce
implement irc_queue for irc_conn, and add missing irc_queue_destroy, fix irc_conn_destroy
Tero Marttila <terom@fixme.fi>
parents:
88
diff
changeset
|
83 |
|
84 | 84 |
/** High-level callbacks */ |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
85 |
struct irc_conn_callbacks callbacks; |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
86 |
|
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
87 |
/** Opaque argument for callbacks */ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
88 |
void *cb_arg; |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
89 |
|
84 | 90 |
/** @defgroup irc_conn_status Status flags |
91 |
* @{ |
|
92 |
*/ |
|
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
93 |
/** Registration request sent */ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
94 |
bool registering; |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
95 |
|
84 | 96 |
/** Registered (as in, we have a working nickname) */ |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
97 |
bool registered; |
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
98 |
|
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
99 |
/** Quit message sent, waiting for server to close connection */ |
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
100 |
bool quitting; |
49
96e0f703a58c
update irc_conn status, and add tests for irc_conn_QUIT
Tero Marttila <terom@fixme.fi>
parents:
48
diff
changeset
|
101 |
|
96e0f703a58c
update irc_conn status, and add tests for irc_conn_QUIT
Tero Marttila <terom@fixme.fi>
parents:
48
diff
changeset
|
102 |
/** Quit message sent, connection closed, we're done */ |
96e0f703a58c
update irc_conn status, and add tests for irc_conn_QUIT
Tero Marttila <terom@fixme.fi>
parents:
48
diff
changeset
|
103 |
bool quit; |
37
4fe4a3c4496e
change irc_chan.state into bool fields, move irc_cmd implementation from irc_conn.c into irc_cmd.c, remove irc_conn arg from irc_cmd_handler, add irc_conn.nickname tracking, and handle irc_chan JOINs
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
104 |
|
4fe4a3c4496e
change irc_chan.state into bool fields, move irc_cmd implementation from irc_conn.c into irc_cmd.c, remove irc_conn arg from irc_cmd_handler, add irc_conn.nickname tracking, and handle irc_chan JOINs
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
105 |
// @} |
4fe4a3c4496e
change irc_chan.state into bool fields, move irc_cmd implementation from irc_conn.c into irc_cmd.c, remove irc_conn arg from irc_cmd_handler, add irc_conn.nickname tracking, and handle irc_chan JOINs
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
106 |
|
84 | 107 |
/** |
108 |
* Our current, actual nickname. This is set to NULL while we are still registering, but is then initialized when we |
|
109 |
* get the first RPL_WELCOME message, and then kept up-to-date by handling relevant NICK messages. |
|
110 |
*/ |
|
37
4fe4a3c4496e
change irc_chan.state into bool fields, move irc_cmd implementation from irc_conn.c into irc_cmd.c, remove irc_conn arg from irc_cmd_handler, add irc_conn.nickname tracking, and handle irc_chan JOINs
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
111 |
char *nickname; |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
112 |
|
84 | 113 |
/** |
114 |
* General IRC command handlers. These handlers are invoked directly for all irc_line's recieved from the IRC |
|
115 |
* server, everything including core PING/NICK/RPL_WELCOME handling is implemented using these. You should add |
|
116 |
* your own handlers using irc_conn_add_cmd_handlers() to implement whatever functionality it is that you want; |
|
117 |
* see irc_cmd.h for more info about how these work. The "command" field is the literal IRC command as received |
|
118 |
* from the server itself. |
|
119 |
* |
|
120 |
* So for example, the following line: |
|
121 |
* \verbatim :nick!user@host PRIVMSG #foo :Hello everyone! \endverbatim |
|
122 |
* |
|
123 |
* results in the following irc_line: |
|
124 |
* \code |
|
125 |
* { { "nick", "user", "host" }, "PRIVMSG", { "#foo", "Hello everyone!", NULL } } |
|
126 |
* \endcode |
|
127 |
* |
|
128 |
* As with all rules, there are exceptions - CTCP messages are handled differently. PRIVMSG's which contain |
|
129 |
* CTCP extended messages are trapped before these handlers are invoked, and are instead processed using |
|
130 |
* irc_conn::ctcp_handlers. Some built-in CTCP message handlers are provided that then submit these messages back |
|
131 |
* to this main irc_conn::handlers list, as pseudo-irc_line's with a command field like "CTCP ACTION". These |
|
132 |
* include: |
|
133 |
* |
|
134 |
* CTCP ACTION - { { "nick", "user", "host" }, "CTCP ACTION", "#foo", "sends an action message" } |
|
135 |
* |
|
136 |
* @see irc_cmd.h |
|
137 |
* @see irc_line |
|
138 |
* @see irc_conn::ctcp_handlers |
|
139 |
*/ |
|
171
b54f393c3df0
evil chain.h macro magic, fix irc_conn_set_nickname bug, misc. test bugs (mem leaks, missing #includes)
Tero Marttila <terom@fixme.fi>
parents:
155
diff
changeset
|
140 |
struct irc_cmd_handlers handlers; |
84 | 141 |
|
142 |
/** |
|
143 |
* CTCP command handlers. These handlers are invoked for all PRIVMSG's recieved from the IRC server which begin |
|
144 |
* with the CTCP X-DELIM char (in other words, a simplified CTCP spec is implemented). These PRIVMSG's will not be |
|
145 |
* seen using irc_conn::handlers. These CTCP messages are then parsed, and a pseudo-irc_line is created, with the |
|
146 |
* same source as the real message, the command set to the CTCP extended message tag, args[0] as the PRIVMSG's |
|
147 |
* destination, and args[1] as the rest of the CTCP extended message payload. |
|
148 |
* |
|
149 |
* So for example, the following line: |
|
88
233916a00429
implement CTCP-ACTION for irc_log and test
Tero Marttila <terom@fixme.fi>
parents:
84
diff
changeset
|
150 |
* \verbatim :nick!user@host PRIVMSG #foo :\001ACTION does something lame\001 \endverbatim |
84 | 151 |
* |
152 |
* results in the following irc_line: |
|
153 |
* \code |
|
154 |
* { { "nick", "user", "host" }, "ACTION", "#foo", "does something lame" } |
|
155 |
* \endcode |
|
156 |
* |
|
157 |
* Internally, some of these CTCP messages are then redirected back to handlers for convenience; currently only |
|
158 |
* "ACTION". |
|
159 |
* |
|
160 |
* @see irc_cmd.h |
|
161 |
* @see irc_line |
|
162 |
* @see irc_conn::handlers |
|
163 |
*/ |
|
171
b54f393c3df0
evil chain.h macro magic, fix irc_conn_set_nickname bug, misc. test bugs (mem leaks, missing #includes)
Tero Marttila <terom@fixme.fi>
parents:
155
diff
changeset
|
164 |
struct irc_cmd_handlers ctcp_handlers; |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
165 |
}; |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
166 |
|
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
167 |
/** |
84 | 168 |
* Create a new irc_conn using the given sock_stream, which should be connected to an IRC server (i.e. ready for |
169 |
* read/write). |
|
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
170 |
* |
84 | 171 |
* This does not yet send any requests to the server, it only sets up the core state. Use irc_conn_register() to |
172 |
* actually register with the server. |
|
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
173 |
* |
84 | 174 |
* On success, the resulting irc_conn is returned via *conn_ptr with SUCCESS. Otherwise, ERR_* with error info returned |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
175 |
* via *err. |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
176 |
* |
84 | 177 |
* @param conn_ptr returned new irc_conn structure |
155
c59d3eaff0fb
most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
150
diff
changeset
|
178 |
* @param transport connected transport |
84 | 179 |
* @param callbacks the high-level status callbacks, required |
180 |
* @param cb_arg opqaue context argument for callbacks |
|
181 |
* @param err returned error info |
|
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
182 |
*/ |
155
c59d3eaff0fb
most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
150
diff
changeset
|
183 |
err_t irc_conn_create (struct irc_conn **conn_ptr, transport_t *transport, const struct irc_conn_callbacks *callbacks, |
c59d3eaff0fb
most of the new transport/sock code compiles, but things are still missing
Tero Marttila <terom@fixme.fi>
parents:
150
diff
changeset
|
184 |
void *cb_arg, error_t *err); |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
185 |
|
20
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
186 |
/** |
28
9c1050bc8709
add sock_stream_release/line_proto_release/irc_conn_release functions, and add proper cleanup to irc_net_create
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
187 |
* Destroy the irc_conn state, terminating any connection and releasing all resources. |
9c1050bc8709
add sock_stream_release/line_proto_release/irc_conn_release functions, and add proper cleanup to irc_net_create
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
188 |
* |
9c1050bc8709
add sock_stream_release/line_proto_release/irc_conn_release functions, and add proper cleanup to irc_net_create
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
189 |
* This does not end the session cleanly, and is intended mainly to be used after clean exit, or to clean up after errors. |
9c1050bc8709
add sock_stream_release/line_proto_release/irc_conn_release functions, and add proper cleanup to irc_net_create
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
190 |
*/ |
9c1050bc8709
add sock_stream_release/line_proto_release/irc_conn_release functions, and add proper cleanup to irc_net_create
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
191 |
void irc_conn_destroy (struct irc_conn *conn); |
9c1050bc8709
add sock_stream_release/line_proto_release/irc_conn_release functions, and add proper cleanup to irc_net_create
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
192 |
|
9c1050bc8709
add sock_stream_release/line_proto_release/irc_conn_release functions, and add proper cleanup to irc_net_create
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
193 |
/** |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
194 |
* Add a new chain of command handler callbacks to be used to handle irc_lines from the server. The given arg will be |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
195 |
* passed to the callbacks as the context argument. The chain will be appended to the end of the current list of chains. |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
196 |
* |
84 | 197 |
* @param conn the connection to use |
198 |
* @param handlers the array of irc_cmd_handler structs, terminated with a NULL entry |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
199 |
* @param arg the context argument to use for the callbacks |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
200 |
*/ |
37
4fe4a3c4496e
change irc_chan.state into bool fields, move irc_cmd implementation from irc_conn.c into irc_cmd.c, remove irc_conn arg from irc_cmd_handler, add irc_conn.nickname tracking, and handle irc_chan JOINs
Tero Marttila <terom@fixme.fi>
parents:
29
diff
changeset
|
201 |
err_t irc_conn_add_cmd_handlers (struct irc_conn *conn, struct irc_cmd_handler *handlers, void *arg); |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
202 |
|
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
203 |
/** |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
204 |
* Register with the IRC server using the given registration info (initial nickname etc.) |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
205 |
* |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
206 |
* This sends the NICK/USER command sequence. |
84 | 207 |
* |
208 |
* @param conn the connection to use |
|
209 |
* @param info the information required to register, including nickname/username/etc |
|
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
210 |
*/ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
211 |
err_t irc_conn_register (struct irc_conn *conn, const struct irc_conn_register_info *info); |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
212 |
|
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
213 |
/** |
150
e8018446b336
special-case recieved user-mode messages, add irc_conn_self function
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
214 |
* Compare the given nickname against our current nickname, returning true if it represents ourselves. |
e8018446b336
special-case recieved user-mode messages, add irc_conn_self function
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
215 |
* |
e8018446b336
special-case recieved user-mode messages, add irc_conn_self function
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
216 |
* As a convenience function, this is NULL-safe - it can safely be called with a NULL conn, NULL nickname, or a |
e8018446b336
special-case recieved user-mode messages, add irc_conn_self function
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
217 |
* conn that doesn't yet have a nickname, and it will simply return false. |
e8018446b336
special-case recieved user-mode messages, add irc_conn_self function
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
218 |
*/ |
e8018446b336
special-case recieved user-mode messages, add irc_conn_self function
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
219 |
bool irc_conn_self (struct irc_conn *conn, const char *nickname); |
e8018446b336
special-case recieved user-mode messages, add irc_conn_self function
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
220 |
|
e8018446b336
special-case recieved user-mode messages, add irc_conn_self function
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
221 |
/** |
84 | 222 |
* Send a generic IRC message by formatting the given irc_line and sending it as a line. |
20
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
223 |
* |
84 | 224 |
* Use the irc_conn_COMMAND functions defined below for a more convenient interface. |
225 |
* |
|
226 |
* An error is returned if the line contains invalid data or writing the line to the sock_stream fails. Possible socket |
|
227 |
* failures will also be reported using irc_conn_callbacks::on_error, so ignoring return values from this is usually |
|
228 |
* OK... |
|
229 |
* |
|
230 |
* @param conn the IRC protocol connection |
|
231 |
* @param line the irc_line protocol line to send |
|
232 |
*/ |
|
233 |
err_t irc_conn_send (struct irc_conn *conn, const struct irc_line *line); |
|
234 |
||
235 |
/** |
|
236 |
* @defgroup irc_conn_COMMAND Simple request functions |
|
237 |
* |
|
238 |
* These functions all simply build the corresponding irc_line struct, and then pass it on to irc_conn_send(). |
|
20
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
239 |
* |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
240 |
* @{ |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
241 |
*/ |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
242 |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
243 |
/** |
84 | 244 |
* Send a NICK message. Usually either called indirectly via irc_conn_register, or used to change to a new nickname. |
245 |
* |
|
246 |
* If succesfull, this will result in a NICK message for our current nickname; irc_conn will handle this to update |
|
247 |
* irc_conn::nickname. |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
248 |
* |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
249 |
* @param conn the IRC protocol connection |
84 | 250 |
* @param nickname the new nickname to use |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
251 |
* |
84 | 252 |
* Possible errors (from RFC2812): |
253 |
* ERR_NONICKNAMEGIVEN |
|
254 |
* ERR_NICKNAMEINUSE |
|
255 |
* ERR_UNAVAILRESOURCE |
|
256 |
* ERR_ERRONEUSNICKNAME |
|
257 |
* ERR_NICKCOLLISION |
|
258 |
* ERR_RESTRICTED |
|
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
259 |
*/ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
260 |
err_t irc_conn_NICK (struct irc_conn *conn, const char *nickname); |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
261 |
|
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
262 |
/** |
84 | 263 |
* Send a USER message. Usually called indirectly via irc_conn_register. |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
264 |
* |
84 | 265 |
* @param conn the IRC protocol connection |
266 |
* @param username the username to register with, may be replaced with username from ident reply |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
267 |
* @param realname the full-name to register with |
84 | 268 |
* |
269 |
* Possible errors (from RFC2812): |
|
270 |
* ERR_NEEDMOREPARAMS |
|
271 |
* ERR_ALREADYREGISTRED |
|
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
272 |
*/ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
273 |
err_t irc_conn_USER (struct irc_conn *conn, const char *username, const char *realname); |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
274 |
|
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
275 |
/** |
84 | 276 |
* Send a PONG message to the given target. |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
277 |
* |
84 | 278 |
* Note that you do not need to handle the normal PING/PONG cycle, irc_conn does this for you. |
279 |
* |
|
280 |
* @param conn the IRC protocol connection |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
281 |
* @param target the PING source, aka. the target to send the PONG reply to |
84 | 282 |
* |
283 |
* Possible errors (from RFC2812): |
|
284 |
* ERR_NOORIGIN |
|
285 |
* ERR_NOSUCHSERVER |
|
20
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
286 |
*/ |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
287 |
err_t irc_conn_PONG (struct irc_conn *conn, const char *target); |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
288 |
|
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
289 |
/** |
84 | 290 |
* Send a simple JOIN message for the given channel. Note that this does not implement all possible arguments. |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
291 |
* |
84 | 292 |
* If succesfull, this will result in a JOIN message for us on the given channel, plus a series of |
293 |
* RPL_NAMREPLY/RPL_ENDOFNAMES/RPL_TOPIC/etc messages. |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
294 |
* |
84 | 295 |
* @param conn the IRC protocol connection |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
296 |
* @param channel the full channel name to join |
84 | 297 |
* |
298 |
* Possible errors (from RFC2812): |
|
299 |
* ERR_NEEDMOREPARAMS ERR_BANNEDFROMCHAN |
|
300 |
* ERR_INVITEONLYCHAN ERR_BADCHANNELKEY |
|
301 |
* ERR_CHANNELISFULL ERR_BADCHANMASK |
|
302 |
* ERR_NOSUCHCHANNEL ERR_TOOMANYCHANNELS |
|
303 |
* ERR_TOOMANYTARGETS ERR_UNAVAILRESOURCE |
|
304 |
* |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
305 |
*/ |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
306 |
err_t irc_conn_JOIN (struct irc_conn *conn, const char *channel); |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
307 |
|
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
308 |
/** |
97
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
309 |
* Send a PRIVMSG message to some target, usually a channel or another user (nickname). |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
310 |
* |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
311 |
* Note that the protocol limits messages to 512 bytes in length (total, including other protocol stuff), and messages |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
312 |
* can't contain newlines or NULs - this will return an ERR_IRC_LINE_* in both cases. |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
313 |
* |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
314 |
* If succesfull, this won't result in any reply. If the target is a nickname, the server supports AWAY, and the target |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
315 |
* has marked themselves as away, this may result in an RPL_AWAY reply. |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
316 |
* |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
317 |
* @param conn the IRC protocol connection |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
318 |
* @param target the message target, usually either a channel name or a nickname |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
319 |
* @param message the message to send |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
320 |
* |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
321 |
* Possible errors (from RFC2812): |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
322 |
* ERR_NORECIPIENT ERR_NOTEXTTOSEND |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
323 |
* ERR_CANNOTSENDTOCHAN ERR_NOTOPLEVEL |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
324 |
* ERR_WILDTOPLEVEL ERR_TOOMANYTARGETS |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
325 |
* ERR_NOSUCHNICK |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
326 |
* |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
327 |
*/ |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
328 |
err_t irc_conn_PRIVMSG (struct irc_conn *conn, const char *target, const char *message); |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
329 |
|
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
91
diff
changeset
|
330 |
/** |
127
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
331 |
* Send a NOTICE messaeg to some target, usually a channel or another user (nickname). |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
332 |
* |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
333 |
* The same limitations on message length and data apply as for irc_conn_PRIVMSG. |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
334 |
* |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
335 |
* The only difference between PRIVMSG and NOTICE is that NOTICE messages should never generate an automated reply, |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
336 |
* hence, they are used for e.g. CTCP replies, and ideally, for IRC bot output. |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
337 |
* |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
338 |
* @param conn the IRC protocol connection |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
339 |
* @param target the message target, usually either a channel name or a nickname |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
340 |
* @param message the message to send |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
341 |
* |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
342 |
* Possible errors (from RFC2812): |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
343 |
* None. Servers do not ever reply to NOTICE messages. |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
344 |
*/ |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
345 |
err_t irc_conn_NOTICE (struct irc_conn *conn, const char *target, const char *message); |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
346 |
|
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
347 |
/** |
84 | 348 |
* Send a QUIT message to the server. The server will reply with an ERROR message and close the connection. |
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
349 |
* |
84 | 350 |
* This updates our state as disconnecting, and once EOF is recieved, the irc_conn_callbacks::on_quit callback is |
351 |
* called. |
|
352 |
* |
|
353 |
* @param conn the IRC protocol connection |
|
354 |
* @param message the quit message, which may be displayed to other clients |
|
48
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
355 |
*/ |
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
356 |
err_t irc_conn_QUIT (struct irc_conn *conn, const char *message); |
4841f4398fd2
add irc_net_quit and signal handling
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
357 |
|
21 | 358 |
// @} |
359 |
||
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
360 |
#endif /* IRC_CONN_H */ |