| 1 |
pippijn |
1.1 |
/* |
| 2 |
|
|
* Copyright © 2005 William Pitcock, et al. |
| 3 |
|
|
* Rights to this code are as documented in doc/LICENSE. |
| 4 |
|
|
* |
| 5 |
|
|
* Protocol handlers, both generic and the actual declarations themselves. |
| 6 |
|
|
* |
| 7 |
|
|
* $Id: phandler.h 8165 2007-04-07 14:49:05Z jilles $ |
| 8 |
|
|
*/ |
| 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 |
|
|
struct ircd_t; |
| 40 |
|
|
|
| 41 |
|
|
/* values for type */ |
| 42 |
|
|
/* -- what the HELL are these used for? A grep reveals nothing.. --w00t |
| 43 |
|
|
* -- they are used to provide a hint to third-party module coders about what |
| 44 |
|
|
* ircd they are working with. --nenolod |
| 45 |
|
|
*/ |
| 46 |
|
|
#define PROTOCOL_ASUKA 1 |
| 47 |
|
|
#define PROTOCOL_BAHAMUT 2 |
| 48 |
|
|
#define PROTOCOL_CHARYBDIS 3 |
| 49 |
|
|
#define PROTOCOL_DREAMFORGE 4 |
| 50 |
|
|
#define PROTOCOL_HYPERION 5 |
| 51 |
|
|
#define PROTOCOL_INSPIRCD 6 |
| 52 |
|
|
#define PROTOCOL_IRCNET 7 |
| 53 |
|
|
#define PROTOCOL_MONKEY 8 /* obsolete */ |
| 54 |
|
|
#define PROTOCOL_PLEXUS 9 |
| 55 |
|
|
#define PROTOCOL_PTLINK 10 |
| 56 |
|
|
#define PROTOCOL_RATBOX 11 |
| 57 |
|
|
#define PROTOCOL_SCYLLA 12 |
| 58 |
|
|
#define PROTOCOL_SHADOWIRCD 13 |
| 59 |
|
|
#define PROTOCOL_SORCERY 14 |
| 60 |
|
|
#define PROTOCOL_ULTIMATE3 15 |
| 61 |
|
|
#define PROTOCOL_UNDERNET 16 |
| 62 |
|
|
#define PROTOCOL_UNREAL 17 |
| 63 |
|
|
#define PROTOCOL_SOLIDIRCD 18 |
| 64 |
|
|
#define PROTOCOL_NEFARIOUS 19 |
| 65 |
|
|
#define PROTOCOL_OFFICEIRC 20 |
| 66 |
|
|
|
| 67 |
|
|
#define PROTOCOL_OTHER 255 |
| 68 |
|
|
|
| 69 |
|
|
/* values for flags */ |
| 70 |
|
|
#define IRCD_CIDR_BANS 1 |
| 71 |
|
|
|
| 72 |
|
|
/* forced nick change types */ |
| 73 |
|
|
#define FNC_REGAIN 0 /* give a registered user their nick back */ |
| 74 |
|
|
#define FNC_FORCE 1 /* force a user off their nick (kill if unsupported) */ |
| 75 |
|
|
|
| 76 |
|
|
/* server login, usually sends PASS, CAPAB, SERVER and SVINFO |
| 77 |
|
|
* you can still change ircd->uses_uid at this point |
| 78 |
|
|
* set me.bursting = true |
| 79 |
|
|
* return 1 if sts() failed (by returning 1), otherwise 0 */ |
| 80 |
|
|
E unsigned int (*server_login) (void); |
| 81 |
|
|
/* introduce a client on the services server */ |
| 82 |
|
|
E void (*introduce_nick) (user_t *u); |
| 83 |
|
|
/* send an invite for a given user to a channel |
| 84 |
|
|
* the source may not be on the channel */ |
| 85 |
|
|
E void (*invite_sts) (user_t *source, user_t *target, channel_t *channel); |
| 86 |
|
|
/* quit a client on the services server with the given message */ |
| 87 |
|
|
E void (*quit_sts) (user_t *u, const char *reason); |
| 88 |
|
|
/* send wallops |
| 89 |
|
|
* use something that only opers can see if easily possible */ |
| 90 |
|
|
E void (*wallops_sts) (const char *text); |
| 91 |
|
|
/* join a channel with a client on the services server |
| 92 |
|
|
* the client should be introduced opped |
| 93 |
|
|
* isnew indicates the channel modes (and bans XXX) should be bursted |
| 94 |
|
|
* note that the channelts can still be old in this case (e.g. kills) |
| 95 |
|
|
* modes is a convenience argument giving the simple modes with parameters |
| 96 |
|
|
* do not rely upon chanuser_find(c,u) */ |
| 97 |
|
|
E void (*join_sts) (channel_t *c, user_t *u, bool isnew, char *modes); |
| 98 |
|
|
/* lower the TS of a channel, joining it with the given client on the |
| 99 |
|
|
* services server (opped), replacing the current simple modes with the |
| 100 |
|
|
* ones stored in the channel_t and clearing all other statuses |
| 101 |
|
|
* if bans are timestamped on this ircd, call chanban_clear() |
| 102 |
|
|
* if the topic is timestamped on this ircd, clear it */ |
| 103 |
|
|
E void (*chan_lowerts) (channel_t *c, user_t *u); |
| 104 |
|
|
/* kick a user from a channel |
| 105 |
|
|
* from is a client on the services server which may or may not be |
| 106 |
|
|
* on the channel */ |
| 107 |
|
|
E void (*kick) (char *from, char *channel, char *to, char *reason); |
| 108 |
|
|
/* 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 |
|
|
E unsigned int generic_server_login (void); |
| 202 |
|
|
E void generic_introduce_nick (user_t *u); |
| 203 |
|
|
E void generic_invite_sts (user_t *source, user_t *target, channel_t *channel); |
| 204 |
|
|
E void generic_quit_sts (user_t *u, const char *reason); |
| 205 |
|
|
E void generic_wallops_sts (const char *text); |
| 206 |
|
|
E void generic_join_sts (channel_t *c, user_t *u, bool isnew, char *modes); |
| 207 |
|
|
E void generic_chan_lowerts (channel_t *c, user_t *u); |
| 208 |
|
|
E void generic_kick (char *from, char *channel, char *to, char *reason); |
| 209 |
|
|
E void generic_msg (const char *from, const char *target, const char *fmt, ...); |
| 210 |
|
|
E void generic_notice_user_sts (user_t *from, user_t *target, const char *text); |
| 211 |
|
|
E void generic_notice_global_sts (user_t *from, const char *mask, const char *text); |
| 212 |
|
|
E void generic_notice_channel_sts (user_t *from, channel_t *target, const char *text); |
| 213 |
|
|
E void generic_wallchops (user_t *source, channel_t *target, const char *message); |
| 214 |
|
|
E void generic_numeric_sts (char *from, int numeric, char *target, char *fmt, ...); |
| 215 |
|
|
E void generic_skill (char *from, char *nick, char *fmt, ...); |
| 216 |
|
|
E void generic_part_sts (channel_t *c, user_t *u); |
| 217 |
|
|
E void generic_kline_sts (char *server, char *user, char *host, long duration, char *reason); |
| 218 |
|
|
E void generic_unkline_sts (char *server, char *user, char *host); |
| 219 |
|
|
E void generic_topic_sts (channel_t *c, const char *setter, time_t ts, time_t prevts, const char *topic); |
| 220 |
|
|
E void generic_mode_sts (char *sender, channel_t *target, char *modes); |
| 221 |
|
|
E void generic_ping_sts (void); |
| 222 |
|
|
E void generic_on_login (char *origin, char *user, char *wantedhost); |
| 223 |
|
|
E bool generic_on_logout (char *origin, char *user, char *wantedhost); |
| 224 |
|
|
E void generic_jupe (const char *server, const char *reason); |
| 225 |
|
|
E void generic_sethost_sts (char *source, char *target, char *host); |
| 226 |
|
|
E void generic_fnc_sts (user_t *source, user_t *u, char *newnick, int type); |
| 227 |
|
|
E void generic_holdnick_sts (user_t *source, int duration, const char *nick, myuser_t *account); |
| 228 |
|
|
E void generic_svslogin_sts (char *target, char *nick, char *user, char *host, char *login); |
| 229 |
|
|
E void generic_sasl_sts (char *target, char mode, char *data); |
| 230 |
|
|
E node_t *generic_next_matching_ban (channel_t *c, user_t *u, int type, node_t *first); |
| 231 |
|
|
E node_t *generic_next_matching_host_chanacs (mychan_t *mc, user_t *u, node_t *first); |
| 232 |
|
|
|
| 233 |
|
|
E cmode_t *mode_list; |
| 234 |
|
|
E extmode *ignore_mode_list; |
| 235 |
|
|
E cmode_t *status_mode_list; |
| 236 |
|
|
E cmode_t *prefix_mode_list; |
| 237 |
|
|
|
| 238 |
|
|
E ircd_t *ircd; |
| 239 |
|
|
|
| 240 |
|
|
#endif |