equal
deleted
inserted
replaced
7 |
7 |
8 #include "sock.h" |
8 #include "sock.h" |
9 #include "line_proto.h" |
9 #include "line_proto.h" |
10 #include "irc_line.h" |
10 #include "irc_line.h" |
11 #include "error.h" |
11 #include "error.h" |
|
12 #include <stdbool.h> |
12 |
13 |
13 /* |
14 /* |
14 * A connection to an IRC server. |
15 * A connection to an IRC server. |
15 */ |
16 */ |
16 struct irc_conn { |
17 struct irc_conn { |
17 /* We are a line-based protocol */ |
18 /* We are a line-based protocol */ |
18 struct line_proto *lp; |
19 struct line_proto *lp; |
|
20 |
|
21 /* Registered (as in, we have a working nickname)? */ |
|
22 bool registered; |
19 }; |
23 }; |
20 |
24 |
21 // XXX: this should probably be slightly reworked |
25 // XXX: this should probably be slightly reworked |
22 struct irc_conn_config { |
26 struct irc_conn_config { |
23 /* Nickname to use on that server */ |
27 /* Nickname to use on that server */ |
37 * On success, the resulting irc_conn is returned via *conn with SUCCESS. Otherwise, -ERR_* and error info is returned |
41 * On success, the resulting irc_conn is returned via *conn with SUCCESS. Otherwise, -ERR_* and error info is returned |
38 * via *err. |
42 * via *err. |
39 */ |
43 */ |
40 err_t irc_conn_create (struct irc_conn **conn, struct sock_stream *sock, const struct irc_conn_config *config, struct error_info *err); |
44 err_t irc_conn_create (struct irc_conn **conn, struct sock_stream *sock, const struct irc_conn_config *config, struct error_info *err); |
41 |
45 |
42 /* |
|
43 * Send an IRC message directly |
|
44 */ |
|
45 err_t irc_conn_send (struct irc_conn *conn, const struct irc_line *line); |
|
46 |
|
47 /** |
46 /** |
48 * @group Simple request functions |
47 * @group Simple request functions |
49 * |
48 * |
50 * The error handling of these functions is such that the error return code is can be used or ignored as convenient, |
49 * The error handling of these functions is such that the error return code is can be used or ignored as convenient, |
51 * as connection-fatal errors will be handled internally. |
50 * as connection-fatal errors will be handled internally. |
52 * |
51 * |
53 * @{ |
52 * @{ |
54 */ |
53 */ |
|
54 |
|
55 /* |
|
56 * Send a generic IRC message |
|
57 */ |
|
58 err_t irc_conn_send (struct irc_conn *conn, const struct irc_line *line); |
55 |
59 |
56 /* |
60 /* |
57 * Send a NICK message |
61 * Send a NICK message |
58 */ |
62 */ |
59 err_t irc_conn_NICK (struct irc_conn *conn, const char *nickname); |
63 err_t irc_conn_NICK (struct irc_conn *conn, const char *nickname); |
66 /* |
70 /* |
67 * Send a PONG message to the given target |
71 * Send a PONG message to the given target |
68 */ |
72 */ |
69 err_t irc_conn_PONG (struct irc_conn *conn, const char *target); |
73 err_t irc_conn_PONG (struct irc_conn *conn, const char *target); |
70 |
74 |
|
75 // @} |
|
76 |
71 #endif /* IRC_CONN_H */ |
77 #endif /* IRC_CONN_H */ |