author | Tero Marttila <terom@fixme.fi> |
Wed, 27 May 2009 23:57:48 +0300 | |
branch | new-lib-errors |
changeset 217 | 7728d6ec3abf |
parent 171 | b54f393c3df0 |
permissions | -rw-r--r-- |
26 | 1 |
#ifndef IRC_CHAN_H |
2 |
#define IRC_CHAN_H |
|
3 |
||
4 |
/** |
|
5 |
* @file |
|
6 |
* |
|
7 |
* Support for IRC channels, including tracking their state and actions on them. |
|
8 |
*/ |
|
9 |
struct irc_chan_info; |
|
10 |
struct irc_chan; |
|
11 |
||
12 |
#include "irc_net.h" |
|
72
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
13 |
#include "irc_user.h" |
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:
26
diff
changeset
|
14 |
#include "irc_cmd.h" |
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:
38
diff
changeset
|
15 |
#include "irc_proto.h" |
26 | 16 |
#include "error.h" |
17 |
#include <sys/queue.h> |
|
18 |
||
19 |
/** |
|
20 |
* IRC channel info, as required to create an irc_chan |
|
21 |
*/ |
|
22 |
struct irc_chan_info { |
|
23 |
/** Channel name, with the [#&!] prefix */ |
|
24 |
const char *channel; |
|
25 |
||
26 |
}; |
|
27 |
||
28 |
/** |
|
89 | 29 |
* Per-channel-user state. This is used to store the list of irc_user's on an irc_chan. |
30 |
* |
|
31 |
* The nickname is accessible via user->nickname. |
|
32 |
*/ |
|
33 |
struct irc_chan_user { |
|
34 |
/** The per-network user info */ |
|
35 |
struct irc_user *user; |
|
36 |
||
37 |
/** The irc_chan list */ |
|
38 |
LIST_ENTRY(irc_chan_user) chan_users; |
|
39 |
}; |
|
40 |
||
41 |
/** |
|
87 | 42 |
* High-level IRC channel callbacks for convenience. |
43 |
* |
|
44 |
* These are based on the normal irc_chan::handlers interface, and you can use both freely. |
|
45 |
* |
|
46 |
* The on_self_* handlers are for actions that affect our own status on the channel, the rest are only for actions |
|
47 |
* done by other users. |
|
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:
38
diff
changeset
|
48 |
* |
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:
38
diff
changeset
|
49 |
* Where callbacks have irc_nm arguments, these are MAY be given as NULL if the prefix could not be parsed. |
26 | 50 |
*/ |
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:
26
diff
changeset
|
51 |
struct irc_chan_callbacks { |
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:
26
diff
changeset
|
52 |
/** Joined the channel */ |
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:
26
diff
changeset
|
53 |
void (*on_self_join) (struct irc_chan *chan, void *arg); |
38
0c2e0cb46c3a
implement irc_chan_callbacks, and add on_msg
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
54 |
|
74
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
55 |
/** We parted the channel */ |
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
56 |
void (*on_self_part) (struct irc_chan *chan, void *arg); |
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
57 |
|
89 | 58 |
/** We were kicked from the channel */ |
59 |
void (*on_self_kicked) (struct irc_chan *chan, const struct irc_nm *source, const char *msg, void *arg); |
|
60 |
||
152
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
61 |
/** We sent a message to the channel using irc_chan_PRIVMSG */ |
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
62 |
void (*on_self_msg) (struct irc_chan *chan, const char *msg, void *arg); |
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
63 |
|
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
64 |
/** We sent a notice to the channel using irc_chan_NOTICE */ |
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
65 |
void (*on_self_notice) (struct irc_chan *chan, const char *msg, void *arg); |
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
66 |
|
72
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
67 |
/** Someone joined the channel */ |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
68 |
void (*on_join) (struct irc_chan *chan, const struct irc_nm *source, void *arg); |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
69 |
|
74
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
70 |
/** Someone parted the channel. The irc_chan_user is still present */ |
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
71 |
void (*on_part) (struct irc_chan *chan, const struct irc_nm *source, const char *msg, void *arg); |
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
72 |
|
89 | 73 |
/** Someone was kicked from the channel. The irc_chan_user is still present */ |
74 |
void (*on_kick) (struct irc_chan *chan, const struct irc_nm *source, struct irc_chan_user *target, const char *msg, void *arg); |
|
75 |
||
78
941bb8379d3d
implement NICK/QUIT handling for irc_net/irc_chan
Tero Marttila <terom@fixme.fi>
parents:
74
diff
changeset
|
76 |
/** Someone quit the channel. The irc_chan_user is still present */ |
941bb8379d3d
implement NICK/QUIT handling for irc_net/irc_chan
Tero Marttila <terom@fixme.fi>
parents:
74
diff
changeset
|
77 |
void (*on_quit) (struct irc_chan *chan, const struct irc_nm *source, const char *msg, void *arg); |
941bb8379d3d
implement NICK/QUIT handling for irc_net/irc_chan
Tero Marttila <terom@fixme.fi>
parents:
74
diff
changeset
|
78 |
|
38
0c2e0cb46c3a
implement irc_chan_callbacks, and add on_msg
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
79 |
/** Someone sent a message to the channel */ |
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:
38
diff
changeset
|
80 |
void (*on_msg) (struct irc_chan *chan, const struct irc_nm *source, const char *msg, void *arg); |
26 | 81 |
}; |
82 |
||
83 |
/** |
|
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:
152
diff
changeset
|
84 |
* Callback storage struct |
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:
152
diff
changeset
|
85 |
*/ |
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:
152
diff
changeset
|
86 |
struct irc_chan_callback_item { |
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:
152
diff
changeset
|
87 |
CHAIN_ITEM_HEADER(irc_chan_callback_item); |
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:
152
diff
changeset
|
88 |
|
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:
152
diff
changeset
|
89 |
const struct irc_chan_callbacks *callbacks; |
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:
152
diff
changeset
|
90 |
|
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:
152
diff
changeset
|
91 |
void *arg; |
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:
152
diff
changeset
|
92 |
}; |
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:
152
diff
changeset
|
93 |
|
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:
152
diff
changeset
|
94 |
/** |
87 | 95 |
* Persistent IRC channel state, part of irc_net. |
96 |
* |
|
97 |
* This stores the channel's info, status flags, users list, and handlers/callbacks. |
|
98 |
* |
|
99 |
* Create/get channels using the irc_net_add_chan()/irc_net_get_chan() interface, and then attach your own |
|
100 |
* callbacks/handlers using irc_chan_add_callbacks()/irc_chan::handlers and irc_cmd_add(). |
|
101 |
* |
|
102 |
* Note that irc_net will propagate all relevant events for each channel. |
|
26 | 103 |
*/ |
104 |
struct irc_chan { |
|
87 | 105 |
/** The network we're part of */ |
26 | 106 |
struct irc_net *net; |
107 |
||
108 |
/** Our identifying info */ |
|
109 |
struct irc_chan_info info; |
|
110 |
||
72
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
111 |
/** |
87 | 112 |
* @defgroup irc_chan_state State flags |
72
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
113 |
* @{ |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
114 |
*/ |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
115 |
/** JOIN request sent, waiting for reply */ |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
116 |
bool joining; |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
117 |
|
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
118 |
/** Currently joined to channel */ |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
119 |
bool joined; |
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:
26
diff
changeset
|
120 |
|
74
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
121 |
/** We PART'd the channel */ |
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
122 |
bool parted; |
11ec458d1cbf
add irc_chan_on_PART, irc_net_put_user and test_irc_chan_user_part
Tero Marttila <terom@fixme.fi>
parents:
72
diff
changeset
|
123 |
|
89 | 124 |
/** We were KICK'd from the channel */ |
125 |
bool kicked; |
|
126 |
||
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:
38
diff
changeset
|
127 |
// @} |
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:
38
diff
changeset
|
128 |
|
72
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
129 |
/** List of users on channel */ |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
130 |
LIST_HEAD(irc_chan_users_list, irc_chan_user) users; |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
131 |
|
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:
26
diff
changeset
|
132 |
/** General command handlers */ |
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:
152
diff
changeset
|
133 |
struct irc_cmd_handlers handlers; |
38
0c2e0cb46c3a
implement irc_chan_callbacks, and add on_msg
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
134 |
|
0c2e0cb46c3a
implement irc_chan_callbacks, and add on_msg
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
135 |
/** High-level user callbacks */ |
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:
152
diff
changeset
|
136 |
CHAIN_HEAD_TYPE(irc_chan_callback_list, irc_chan_callback_item) callbacks; |
87 | 137 |
|
138 |
/** The irc_net::channels list */ |
|
139 |
TAILQ_ENTRY(irc_chan) net_channels; |
|
26 | 140 |
}; |
141 |
||
142 |
/** |
|
143 |
* Return the channel's name |
|
144 |
*/ |
|
145 |
const char* irc_chan_name (struct irc_chan *chan); |
|
146 |
||
147 |
/** |
|
148 |
* Build/initialize a new irc_chan struct. This does not have any external side-effects. |
|
149 |
* |
|
150 |
* The channel will be in the IRC_CHAN_INIT state after this. |
|
151 |
* |
|
148
2d8dec363f9e
fix irc_chan to copy the irc_chan_info strings
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
152 |
* The contents of \a info will be copied. |
2d8dec363f9e
fix irc_chan to copy the irc_chan_info strings
Tero Marttila <terom@fixme.fi>
parents:
127
diff
changeset
|
153 |
* |
26 | 154 |
* @param chan_ptr the new irc_chan is returned via this pointer |
155 |
* @param net the irc_net this channel is on |
|
156 |
* @param info the channel's identifying information |
|
157 |
* @param err error codes are returned via this |
|
158 |
*/ |
|
217 | 159 |
err_t irc_chan_create (struct irc_chan **chan_ptr, struct irc_net *net, const struct irc_chan_info *info, error_t *err); |
26 | 160 |
|
161 |
/** |
|
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:
26
diff
changeset
|
162 |
* Destroy irc_chan state, without doing anything to the network |
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:
26
diff
changeset
|
163 |
*/ |
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:
26
diff
changeset
|
164 |
void irc_chan_destroy (struct irc_chan *chan); |
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:
26
diff
changeset
|
165 |
|
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:
26
diff
changeset
|
166 |
/** |
87 | 167 |
* Add a set of high-level irc_chan callbacks. Not all callbacks need to be implemented. |
38
0c2e0cb46c3a
implement irc_chan_callbacks, and add on_msg
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
168 |
*/ |
0c2e0cb46c3a
implement irc_chan_callbacks, and add on_msg
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
169 |
err_t irc_chan_add_callbacks (struct irc_chan *chan, const struct irc_chan_callbacks *callbacks, void *arg); |
0c2e0cb46c3a
implement irc_chan_callbacks, and add on_msg
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
170 |
|
0c2e0cb46c3a
implement irc_chan_callbacks, and add on_msg
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
171 |
/** |
69
6f298b6e0d5f
create irc_log_chan function to log a new irc_log_chan, and irc_log_chan_destroy to remove the added callbacks/command handlers
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
172 |
* Remove high-level irc_chan callbacks. |
6f298b6e0d5f
create irc_log_chan function to log a new irc_log_chan, and irc_log_chan_destroy to remove the added callbacks/command handlers
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
173 |
*/ |
6f298b6e0d5f
create irc_log_chan function to log a new irc_log_chan, and irc_log_chan_destroy to remove the added callbacks/command handlers
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
174 |
void irc_chan_remove_callbacks (struct irc_chan *chan, const struct irc_chan_callbacks *callbacks, void *arg); |
6f298b6e0d5f
create irc_log_chan function to log a new irc_log_chan, and irc_log_chan_destroy to remove the added callbacks/command handlers
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
175 |
|
6f298b6e0d5f
create irc_log_chan function to log a new irc_log_chan, and irc_log_chan_destroy to remove the added callbacks/command handlers
Tero Marttila <terom@fixme.fi>
parents:
45
diff
changeset
|
176 |
/** |
72
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
177 |
* Look up an irc_chan_user struct by nickname for this channel, returning NULL if no such chan_user exists. |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
178 |
* |
87 | 179 |
* Be careful not to hold on to this, as the irc_chan_user struct may be released if the user leaves the channel. |
180 |
* |
|
72
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
181 |
* @param chan the channel context |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
182 |
* @param nickname the user's current nickname |
87 | 183 |
* @return the irc_chan_user state, or NULL if nickname not found |
72
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
184 |
*/ |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
185 |
struct irc_chan_user* irc_chan_get_user (struct irc_chan *chan, const char *nickname); |
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
186 |
|
43084f103c2a
add irc_user module for irc_chan to track users on a channel
Tero Marttila <terom@fixme.fi>
parents:
69
diff
changeset
|
187 |
/** |
26 | 188 |
* Send the initial JOIN message. |
189 |
* |
|
190 |
* @param chan the channel to JOIN |
|
191 |
*/ |
|
192 |
err_t irc_chan_join (struct irc_chan *chan); |
|
193 |
||
97
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
194 |
/** |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
195 |
* Send a normal PRIVMSG to the channel. If we're being pedantic, one should use NOTICE instead for messages sent in |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
196 |
* reply to PRIVMSG's, but the real world is different. |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
197 |
* |
152
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
198 |
* This also invokes any self_msg callbacks. |
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
199 |
* |
97
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
200 |
* @param chan the IRC channel |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
201 |
* @param message the message to send |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
202 |
*/ |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
203 |
err_t irc_chan_PRIVMSG (struct irc_chan *chan, const char *message); |
d3bc82ee76cb
add irc_conn_PRIVMSG/irc_chan_PRIVMSG and lua bindings
Tero Marttila <terom@fixme.fi>
parents:
89
diff
changeset
|
204 |
|
127
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
205 |
/** |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
206 |
* Send a NOTICE message to the channel. |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
207 |
* |
152
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
208 |
* This also invokes any self_notice callbacks. |
dae7bcf08474
implement irc_chan_callbacks::on_self_msg/on_self_notice, and add code for mod_irc_log to use them
Tero Marttila <terom@fixme.fi>
parents:
148
diff
changeset
|
209 |
* |
127
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
210 |
* @param chan the IRC channel |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
211 |
* @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
|
212 |
*/ |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
213 |
err_t irc_chan_NOTICE (struct irc_chan *chan, const char *message); |
94e6c3b4230f
implement logwatch_on_line/logwatch_filter_apply, along with irc_*_NOTICE
Tero Marttila <terom@fixme.fi>
parents:
97
diff
changeset
|
214 |
|
26 | 215 |
#endif |