author | Tero Marttila <terom@fixme.fi> |
Thu, 12 Mar 2009 18:35:05 +0200 | |
changeset 38 | 0c2e0cb46c3a |
parent 37 | 4fe4a3c4496e |
child 45 | 71e65564afd2 |
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 |
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
|
8 |
* communications, and then takes care of sending/receiving commands, as well as updating some core state like |
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
|
9 |
* current nickname. |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
*/ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
|
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
|
12 |
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
|
13 |
|
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 |
#include "error.h" |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
#include "sock.h" |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
#include "line_proto.h" |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
17 |
#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
|
18 |
#include "irc_cmd.h" |
21 | 19 |
#include <stdbool.h> |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
|
25
56367df4ce5b
add irc_net module, and fix Makefile CFLAGS, add -Wextra
Tero Marttila <terom@fixme.fi>
parents:
23
diff
changeset
|
21 |
/** |
29
3f0f2898fea3
add sock_gnutls_destroy, and error cleanup for sock_ssl_connect. Fix various XXX's
Tero Marttila <terom@fixme.fi>
parents:
28
diff
changeset
|
22 |
* The info required to register with irc_conn_register |
25
56367df4ce5b
add irc_net module, and fix Makefile CFLAGS, add -Wextra
Tero Marttila <terom@fixme.fi>
parents:
23
diff
changeset
|
23 |
*/ |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
24 |
struct irc_conn_register_info { |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
25 |
/* Nickname to use on that server */ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
const char *nickname; |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
|
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
/* Username to supply */ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
const char *username; |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
30 |
|
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
31 |
/* Realname to supply */ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
32 |
const char *realname; |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
}; |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
34 |
|
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
|
35 |
/** |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
36 |
* 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
|
37 |
*/ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
38 |
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
|
39 |
/** |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
40 |
* irc_conn_register has completed. |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
41 |
*/ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
42 |
void (*on_registered) (struct irc_conn *conn, void *arg); |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
43 |
}; |
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 |
/* |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
46 |
* Connection state |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
47 |
*/ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
48 |
struct irc_conn { |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
49 |
/* We are a line-based protocol */ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
50 |
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
|
51 |
|
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
52 |
/** Callbacks */ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
53 |
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
|
54 |
|
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
55 |
/** 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
|
56 |
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
|
57 |
|
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
|
58 |
/** @group flags @{ */ |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
59 |
/** 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
|
60 |
bool registering; |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
61 |
|
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
|
62 |
/** 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
|
63 |
bool registered; |
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
|
64 |
|
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
|
65 |
// @} |
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
|
66 |
|
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
|
67 |
/** Our current real nickname */ |
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
|
68 |
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
|
69 |
|
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
|
70 |
/** Command handlers */ |
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
|
71 |
irc_cmd_handlers_t handlers; |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
72 |
}; |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
73 |
|
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
74 |
/** |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
75 |
* Create a new irc_conn using the given sock_stream, which should be connected to an IRC server. |
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 |
* This does not yet send any requests to the server, it only sets up the core state. Use irc_conn_register to register |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
78 |
* with the server. |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
79 |
* |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
80 |
* On success, the resulting irc_conn is returned via *conn with SUCCESS. Otherwise, -ERR_* and error info is returned |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
81 |
* 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
|
82 |
* |
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
|
83 |
* @param conn the new irc_conn structure is returned via this pointer |
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
|
84 |
* @param sock the socket connected to the IRC server |
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
|
85 |
* @param err errors are returned via this pointer |
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
|
86 |
* @return error code |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
87 |
*/ |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
88 |
err_t irc_conn_create (struct irc_conn **conn, struct sock_stream *sock, const 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
|
89 |
void *cb_arg, struct error_info *err); |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
90 |
|
20
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
91 |
/** |
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
|
92 |
* 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
|
93 |
* |
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
|
94 |
* 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
|
95 |
*/ |
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
|
96 |
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
|
97 |
|
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
|
98 |
/** |
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
|
99 |
* 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
|
100 |
* 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
|
101 |
* |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
102 |
* XXX: rename to not conflict with irc_conn_register() |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
103 |
* |
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
|
104 |
* @param chain the array of irc_cmd_handler structs, terminated with a NULL entry |
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
|
105 |
* @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
|
106 |
*/ |
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
|
107 |
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
|
108 |
|
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
|
109 |
/** |
27
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
110 |
* 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
|
111 |
* |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
112 |
* This sends the NICK/USER command sequence. |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
113 |
*/ |
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
114 |
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
|
115 |
|
e6639132bead
add irc_conn_callbacks, and delay irc_chan_join until on_registered
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
116 |
/** |
20
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
117 |
* @group Simple request functions |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
118 |
* |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
119 |
* The error handling of these functions is such that the error return code is can be used or ignored as convenient, |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
120 |
* as connection-fatal errors will be handled internally. |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
121 |
* |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
122 |
* @{ |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
123 |
*/ |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
124 |
|
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
|
125 |
/** |
21 | 126 |
* Send a generic IRC message |
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
|
127 |
* |
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
|
128 |
* @param conn the IRC protocol connection |
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
|
129 |
* @param line the irc_line protocol line to send |
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
|
130 |
* @return error code |
21 | 131 |
*/ |
132 |
err_t irc_conn_send (struct irc_conn *conn, const struct irc_line *line); |
|
133 |
||
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
|
134 |
/** |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
135 |
* Send a NICK message |
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
|
136 |
* |
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
|
137 |
* @param nickname the new nickname to use |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
138 |
*/ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
139 |
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
|
140 |
|
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
141 |
/* |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
142 |
* Send a USER message |
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
|
143 |
* |
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
|
144 |
* @param username the username to register with, may be replaced with ident reply |
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
|
145 |
* @param realname the full-name to register with |
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
146 |
*/ |
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
147 |
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
|
148 |
|
20
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
149 |
/* |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
150 |
* 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
|
151 |
* |
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
|
152 |
* @param target the PING source, aka. the target to send the PONG reply to |
20
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
153 |
*/ |
d9c4c2980a0d
irc_conn PING/PONG code, and line_proto fixups
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
154 |
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
|
155 |
|
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
|
156 |
/* |
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
|
157 |
* Send a JOIN message for the given 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
|
158 |
* |
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
|
159 |
* XXX: this doesn't implement the full command options |
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
|
160 |
* |
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
|
161 |
* @param channel the full channel name to join |
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
|
162 |
*/ |
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
|
163 |
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
|
164 |
|
21 | 165 |
// @} |
166 |
||
18
dedf137b504f
add initial irc_conn code that can register
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
167 |
#endif /* IRC_CONN_H */ |