1 #ifndef __IRC_H
2 #define __IRC_H
3 
4 typedef struct _IRC_CHATNET_REC IRC_CHATNET_REC;
5 typedef struct _IRC_SERVER_CONNECT_REC IRC_SERVER_CONNECT_REC;
6 typedef struct _IRC_SERVER_REC IRC_SERVER_REC;
7 typedef struct _IRC_CHANNEL_REC IRC_CHANNEL_REC;
8 typedef struct _REDIRECT_REC REDIRECT_REC;
9 
10 /* From ircd 2.9.5:
11      none    I line with ident
12      ^       I line with OTHER type ident
13      ~       I line, no ident
14      +       i line with ident
15      =       i line with OTHER type ident
16      -       i line, no ident
17 */
18 #define ishostflag(a) \
19 	((a) == '^' || (a) == '~' || \
20 	(a) == '+' || (a) == '=' || (a) == '-')
21 
22 #define isnickflag(server, a) \
23 	(server->prefix[(int)(unsigned char) a] != '\0')
24 
25 #define IS_IRC_ITEM(rec) (IS_IRC_CHANNEL(rec) || IS_IRC_QUERY(rec))
26 #define IRC_PROTOCOL (chat_protocol_lookup("IRC"))
27 
28 extern char *current_server_event; /* current server event being processed */
29 
30 /* Send command to IRC server */
31 void irc_send_cmd(IRC_SERVER_REC *server, const char *cmd);
32 void irc_send_cmdv(IRC_SERVER_REC *server, const char *cmd, ...) G_GNUC_PRINTF (2, 3);
33 /* Send command to IRC server, split to multiple commands if necessary so
34    that command will never have more target nicks than `max_nicks'. Nicks
35    are separated with commas. (works with /msg, /kick, ...) */
36 void irc_send_cmd_split(IRC_SERVER_REC *server, const char *cmd,
37 			int nickarg, int max_nicks);
38 /* Send command to server immediately bypassing all flood protections
39    and queues. */
40 void irc_send_cmd_now(IRC_SERVER_REC *server, const char *cmd);
41 /* Send command to server putting it at the beginning of the queue of
42     commands to send -- it will go out as soon as possible in accordance
43     to the flood protection settings. */
44 void irc_send_cmd_first(IRC_SERVER_REC *server, const char *cmd);
45 /* The core of the irc_send_cmd* functions. If `raw' is TRUE, the `cmd'
46    won't be checked at all if it's 512 bytes or not, or if it contains
47    line feeds or not. Use with extreme caution! */
48 void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd,
49 		       int send_now, int immediate, int raw);
50 
51 /* Get count parameters from data */
52 #include "commands.h"
53 char *event_get_param(char **data);
54 char *event_get_params(const char *data, int count, ...);
55 
56 void irc_irc_init(void);
57 void irc_irc_deinit(void);
58 
59 #endif
60