ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/phandler.h
Revision: 1.3
Committed: Sat Jul 21 13:23:18 2007 UTC (16 years, 10 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.2: +4 -32 lines
Log Message:
- added rcsid to some files
- more documentation tweaks
- made most protocol commands local to phandler.C
- added ircd metadata (inspircd only for now)
- added inspircd swhois support

File Contents

# User Rev Content
1 pippijn 1.1 /*
2     * Copyright © 2005 William Pitcock, et al.
3 pippijn 1.2 * Rights to this code are as documented in doc/pod/license.pod.
4 pippijn 1.1 *
5     * Protocol handlers, both generic and the actual declarations themselves.
6     *
7 pippijn 1.3 * $Id: phandler.h,v 1.2 2007-07-21 01:29:07 pippijn Exp $
8 pippijn 1.1 */
9    
10     #ifndef PHANDLER_H
11     #define PHANDLER_H
12    
13     struct ircd_t
14     {
15     char *ircdname;
16     char *tldprefix;
17     bool uses_uid;
18     bool uses_rcommand;
19     bool uses_owner;
20     bool uses_protect;
21     bool uses_halfops;
22     bool uses_p10; /* Parser hackhack. */
23     bool uses_vhost; /* Do we use vHosts? */
24     unsigned int oper_only_modes;
25     unsigned int owner_mode;
26     unsigned int protect_mode;
27     unsigned int halfops_mode;
28     char *owner_mchar;
29     char *protect_mchar;
30     char *halfops_mchar;
31     unsigned int type;
32     unsigned int perm_mode; /* Modes to not disappear when empty */
33     char *ban_like_modes; /* e.g. "beI" */
34     char except_mchar;
35     char invex_mchar;
36     int flags;
37     };
38    
39     /* values for type */
40     /* -- what the HELL are these used for? A grep reveals nothing.. --w00t
41     * -- they are used to provide a hint to third-party module coders about what
42     * ircd they are working with. --nenolod
43     */
44     #define PROTOCOL_ASUKA 1
45     #define PROTOCOL_BAHAMUT 2
46     #define PROTOCOL_CHARYBDIS 3
47     #define PROTOCOL_DREAMFORGE 4
48     #define PROTOCOL_HYPERION 5
49     #define PROTOCOL_INSPIRCD 6
50     #define PROTOCOL_IRCNET 7
51     #define PROTOCOL_MONKEY 8 /* obsolete */
52     #define PROTOCOL_PLEXUS 9
53     #define PROTOCOL_PTLINK 10
54     #define PROTOCOL_RATBOX 11
55     #define PROTOCOL_SCYLLA 12
56     #define PROTOCOL_SHADOWIRCD 13
57     #define PROTOCOL_SORCERY 14
58     #define PROTOCOL_ULTIMATE3 15
59     #define PROTOCOL_UNDERNET 16
60     #define PROTOCOL_UNREAL 17
61     #define PROTOCOL_SOLIDIRCD 18
62     #define PROTOCOL_NEFARIOUS 19
63     #define PROTOCOL_OFFICEIRC 20
64    
65     #define PROTOCOL_OTHER 255
66    
67     /* values for flags */
68     #define IRCD_CIDR_BANS 1
69    
70     /* forced nick change types */
71     #define FNC_REGAIN 0 /* give a registered user their nick back */
72     #define FNC_FORCE 1 /* force a user off their nick (kill if unsupported) */
73    
74     /* server login, usually sends PASS, CAPAB, SERVER and SVINFO
75     * you can still change ircd->uses_uid at this point
76     * set me.bursting = true
77     * return 1 if sts() failed (by returning 1), otherwise 0 */
78     E unsigned int (*server_login) (void);
79     /* introduce a client on the services server */
80     E void (*introduce_nick) (user_t *u);
81     /* send an invite for a given user to a channel
82     * the source may not be on the channel */
83     E void (*invite_sts) (user_t *source, user_t *target, channel_t *channel);
84     /* quit a client on the services server with the given message */
85     E void (*quit_sts) (user_t *u, const char *reason);
86     /* send wallops
87     * use something that only opers can see if easily possible */
88     E void (*wallops_sts) (const char *text);
89     /* join a channel with a client on the services server
90     * the client should be introduced opped
91     * isnew indicates the channel modes (and bans XXX) should be bursted
92     * note that the channelts can still be old in this case (e.g. kills)
93     * modes is a convenience argument giving the simple modes with parameters
94     * do not rely upon chanuser_find(c,u) */
95     E void (*join_sts) (channel_t *c, user_t *u, bool isnew, char *modes);
96     /* lower the TS of a channel, joining it with the given client on the
97     * services server (opped), replacing the current simple modes with the
98     * ones stored in the channel_t and clearing all other statuses
99     * if bans are timestamped on this ircd, call chanban_clear()
100     * if the topic is timestamped on this ircd, clear it */
101     E void (*chan_lowerts) (channel_t *c, user_t *u);
102     /* kick a user from a channel
103     * from is a client on the services server which may or may not be
104     * on the channel */
105     E void (*kick) (char *from, char *channel, char *to, char *reason);
106 pippijn 1.3 /* change ircd metadata */
107     E void (*mdchange) (const char *target, const char *key, const char *value);
108 pippijn 1.1 /* send a privmsg
109     * here it's ok to assume the source is able to send */
110     E void (*msg) (const char *from, const char *target, const char *fmt, ...);
111     /* send a notice to a user
112     * from can be a client on the services server or the services server
113     * itself (NULL) */
114     E void (*notice_user_sts) (user_t *from, user_t *target, const char *text);
115     /* send a global notice to all users on servers matching the mask
116     * from is a client on the services server
117     * mask is either "*" or it has a non-wildcard TLD */
118     E void (*notice_global_sts) (user_t *from, const char *mask, const char *text);
119     /* send a notice to a channel
120     * from can be a client on the services server or the services server
121     * itself (NULL)
122     * if the source cannot send because it is not on the channel, send the
123     * notice from the server or join for a moment */
124     E void (*notice_channel_sts) (user_t *from, channel_t *target, const char *text);
125     /* send a notice to ops in a channel
126     * source may or may not be on channel
127     * generic_wallchops() sends an individual notice to each channel operator */
128     E void (*wallchops) (user_t *source, channel_t *target, const char *message);
129     /* send a numeric from must be me.name or ME */
130     E void (*numeric_sts) (char *from, int numeric, char *target, char *fmt, ...);
131     /* kill a user
132     * from can be a client on the services server or the services server
133     * itself (me.name or ME)
134     * it is recommended to change an invalid source to ME */
135     E void (*skill) (char *from, char *nick, char *fmt, ...);
136     /* part a channel with a client on the services server */
137     E void (*part_sts) (channel_t *c, user_t *u);
138     /* add a kline on the servers matching the given mask
139     * duration is in seconds, 0 for a permanent kline
140     * if the ircd requires klines to be sent from users, use opersvs */
141     E void (*kline_sts) (char *server, char *user, char *host, long duration, char *reason);
142     /* remove a kline on the servers matching the given mask
143     * if the ircd requires unklines to be sent from users, use opersvs */
144     E void (*unkline_sts) (char *server, char *user, char *host);
145     /* make chanserv set a topic on a channel
146     * setter and ts should be used if the ircd supports topics to be set
147     * with a given topicsetter and topicts; ts is not a channelts
148     * prevts is the topicts of the old topic or 0 if there was no topic,
149     * useful in optimizing which form of topic change to use
150     * if the given topicts was not set and topicts is used on the ircd,
151     * set c->topicts to the value used */
152     E void (*topic_sts) (channel_t *c, const char *setter, time_t ts, time_t prevts, const char *topic);
153     /* set modes on a channel by the given sender; sender must be a client
154     * on the services server; sender may or may not be on channel */
155     E void (*mode_sts) (char *sender, channel_t *target, char *modes);
156     /* ping the uplink
157     * first check if me.connected is true and bail if not */
158     E void (*ping_sts) (void);
159     /* mark user 'origin' as logged in as 'user'
160     * wantedhost is currently not used
161     * first check if me.connected is true and bail if not */
162     E void (*ircd_on_login) (char *origin, char *user, char *wantedhost);
163     /* mark user 'origin' as logged out
164     * first check if me.connected is true and bail if not
165     * return false if successful or logins are not supported
166     * return true if the user was killed to force logout (P10) */
167     E bool (*ircd_on_logout) (char *origin, char *user, char *wantedhost);
168     /* introduce a fake server
169     * it is ok to use opersvs to squit the old server
170     * if SQUIT uses kill semantics (e.g. charybdis), server_delete() the server
171     * and continue
172     * if SQUIT uses unconnect semantics (e.g. bahamut), set SF_JUPE_PENDING on
173     * the server and return; you will be called again when the server is really
174     * deleted */
175     E void (*jupe) (const char *server, const char *reason);
176     /* set a dynamic spoof on a user
177     * if the ircd does not notify the user of this, do
178     * notice(source, target, "Setting your host to \2%s\2.", host); */
179     E void (*sethost_sts) (char *source, char *target, char *host);
180     /* force a nickchange for a user
181     * possible values for type:
182     * FNC_REGAIN: give a registered user their nick back
183     * FNC_FORCE: force a user off their nick (kill if unsupported)
184     */
185     E void (*fnc_sts) (user_t *source, user_t *u, char *newnick, int type);
186     /* temporarily make a nick unavailable to users
187     * source is the responsible service
188     * duration is in seconds, 0 to remove the effect of a previous call
189     * account is an account that may still use the nick, or NULL */
190     E void (*holdnick_sts) (user_t *source, int duration, const char *nick, myuser_t *account);
191     /* change nick, user, host and/or services login name for a user
192     * target may also be a not yet fully introduced UID (for SASL) */
193     E void (*svslogin_sts) (char *target, char *nick, char *user, char *host, char *login);
194     /* send sasl message */
195     E void (*sasl_sts) (char *target, char mode, char *data);
196     /* find next channel ban (or other ban-like mode) matching user */
197     E node_t *(*next_matching_ban) (channel_t *c, user_t *u, int type, node_t *first);
198     /* find next host channel access matching user */
199     E node_t *(*next_matching_host_chanacs) (mychan_t *mc, user_t *u, node_t *first);
200    
201 pippijn 1.3 // These two are used in some protocol modules
202 pippijn 1.1 E void generic_wallchops (user_t *source, channel_t *target, const char *message);
203     E void generic_fnc_sts (user_t *source, user_t *u, char *newnick, int type);
204    
205     E cmode_t *mode_list;
206     E extmode *ignore_mode_list;
207     E cmode_t *status_mode_list;
208     E cmode_t *prefix_mode_list;
209    
210     E ircd_t *ircd;
211    
212     #endif