Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / include / send.h
1 /*
2  * send.h
3  *
4  * $Id$
5  */
6 #ifndef INCLUDED_send_h
7 #define INCLUDED_send_h
8 #ifndef INCLUDED_stdarg_h
9 #include <stdarg.h>         /* va_list */
10 #define INCLUDED_stdarg_h 
11 #endif
12
13 struct Channel;
14 struct Client;
15 struct DBuf;
16
17
18 /*
19  * Prototypes
20  */
21 extern void send_buffer(struct Client* to, char* buf);
22 extern void flush_sendq_except(const struct DBuf* one);
23
24 extern void sendto_one(struct Client *to, const char* fmt, ...);
25 extern void sendbufto_one(struct Client *to);
26 extern void sendto_ops(const char* fmt, ...);
27 extern void sendto_channel_butserv(struct Channel *chptr, struct Client *from,
28                                    const char* fmt, ...);
29 extern void sendto_serv_butone(struct Client *one, const char* fmt, ...);
30 extern void sendto_lowprot_butone(struct Client *cptr, int p,
31                                   const char* fmt, ...);
32 extern void sendto_highprot_butone(struct Client *cptr, int p,
33                                    const char* fmt, ...);
34 extern void sendto_prefix_one(struct Client *to, struct Client *from,
35                               const char* fmt, ...);
36 extern void flush_connections(struct Client* cptr);
37 extern void send_queued(struct Client *to);
38 extern void vsendto_one(struct Client *to, const char* fmt, va_list vl);
39 extern void sendmsgto_channel_butone(struct Client *one, struct Client *from,
40                                   struct Channel *chptr, const char *sender,
41                                   const char *cmd, const char *chname, const char *msg);
42 extern void sendto_lchanops_butone(struct Client *one, struct Client *from,
43                                    struct Channel *chptr, const char* fmt, ...);
44 extern void sendto_chanopsserv_butone(struct Client *one, struct Client *from,
45                                    struct Channel *chptr, const char* fmt, ...);
46 extern void sendto_common_channels(struct Client *user, const char* fmt, ...);
47 extern void sendto_match_butone(struct Client *one, struct Client *from,
48                                 const char *mask, int what, const char* fmt, ...);
49 extern void vsendto_ops(const char *pattern, va_list vl);
50 extern void sendto_ops_butone(struct Client *one, struct Client *from,
51                               const char* fmt, ...);
52 extern void sendto_g_serv_butone(struct Client *one, const char* fmt, ...);
53 extern void sendto_realops(const char* fmt, ...);
54 extern void vsendto_op_mask(unsigned int mask,
55                             const char* fmt, va_list vl);
56 extern void sendto_op_mask(unsigned int mask, const char* fmt, ...);
57 extern void sendbufto_op_mask(unsigned int mask);
58 extern void sendbufto_serv_butone(struct Client *one);
59
60 extern char sendbuf[2048];
61
62 #define IRC_BUFSIZE     512
63
64 /* Send a raw message to one client; USE ONLY IF YOU MUST SEND SOMETHING
65  * WITHOUT A PREFIX!
66  */
67 extern void sendrawto_one(struct Client *to, const char *pattern, ...);
68
69 /* Send a command to one client */
70 extern void sendcmdto_one(struct Client *from, const char *cmd,
71                           const char *tok, struct Client *to,
72                           const char *pattern, ...);
73
74
75 /* Same as above, except it takes a va_list */
76 extern void vsendcmdto_one(struct Client *from, const char *cmd,
77                            const char *tok, struct Client *to,
78                            const char *pattern, va_list vl);
79
80 /* Send command to all servers except one */
81 extern void sendcmdto_serv_butone(struct Client *from, const char *cmd,
82                                   const char *tok, struct Client *one,
83                                   const char *pattern, ...);
84
85 /* Send command to all channels user is on */
86 extern void sendcmdto_common_channels(struct Client *from, const char *cmd,
87                                       const char *tok, const char *pattern,
88                                       ...);
89
90
91 /* Send command to all channel users on this server */
92 extern void sendcmdto_channel_butserv(struct Client *from, const char *cmd,
93                                       const char *tok, struct Channel *to,
94                                       const char *pattern, ...);
95
96 /* Send command to all interested channel users */
97 extern void sendcmdto_channel_butone(struct Client *from, const char *cmd,
98                                      const char *tok, struct Channel *to,
99                                      struct Client *one, unsigned int skip,
100                                      const char *pattern, ...);
101
102 #define SKIP_DEAF       0x01    /* skip users that are +d */
103 #define SKIP_BURST      0x02    /* skip users that are bursting */
104 #define SKIP_NONOPS     0x04    /* skip users that aren't chanops */
105
106 /* Send command to all users having a particular flag set */
107 extern void sendcmdto_flag_butone(struct Client *from, const char *cmd,
108                                   const char *tok, struct Client *one,
109                                   unsigned int flag, const char *pattern, ...);
110
111 /* Send command to all matching clients */
112 extern void sendcmdto_match_butone(struct Client *from, const char *cmd,
113                                    const char *tok, const char *to,
114                                    struct Client *one, unsigned int who,
115                                    const char *pattern, ...);
116
117 /* Send server notice to opers but one--one can be NULL */
118 extern void sendto_opmask_butone(struct Client *one, unsigned int mask,
119                                  const char *pattern, ...);
120
121 /* Same as above, but with variable argument list */
122 extern void vsendto_opmask_butone(struct Client *one, unsigned int mask,
123                                   const char *pattern, va_list vl);
124
125 #endif /* INCLUDED_send_h */