diff options
author | jantje_85 <jantje_85@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-01-29 02:02:44 +0000 |
---|---|---|
committer | jantje_85 <jantje_85@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-01-29 02:02:44 +0000 |
commit | 308d7937ef6feb4dc543bd871979e03f1d6d6fd3 (patch) | |
tree | 6846770c6a0a93b7f9dac828654c4b50b1234d6d | |
parent | 9c2591c20a27391ce5345f67252535d129168520 (diff) |
Bug 1001: Added support for internal tracking of +j channel mode (throttling).
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/stable@1940 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes | 10 | ||||
-rw-r--r-- | docs/IRCD | 5 | ||||
-rw-r--r-- | include/extern.h | 7 | ||||
-rw-r--r-- | include/services.h | 5 | ||||
-rw-r--r-- | src/channels.c | 28 | ||||
-rw-r--r-- | src/chanserv.c | 54 | ||||
-rw-r--r-- | src/ircd.c | 13 | ||||
-rw-r--r-- | src/protocol/bahamut.c | 2 | ||||
-rw-r--r-- | src/protocol/charybdis.c | 4 | ||||
-rw-r--r-- | src/protocol/dreamforge.c | 2 | ||||
-rw-r--r-- | src/protocol/hybrid.c | 2 | ||||
-rw-r--r-- | src/protocol/inspircd10.c | 2 | ||||
-rw-r--r-- | src/protocol/inspircd11.c | 29 | ||||
-rwxr-xr-x | src/protocol/inspircd11.h | 3 | ||||
-rw-r--r-- | src/protocol/plexus2.c | 2 | ||||
-rw-r--r-- | src/protocol/plexus3.c | 2 | ||||
-rw-r--r-- | src/protocol/ptlink.c | 2 | ||||
-rw-r--r-- | src/protocol/rageircd.c | 2 | ||||
-rw-r--r-- | src/protocol/ratbox.c | 2 | ||||
-rw-r--r-- | src/protocol/shadowircd.c | 2 | ||||
-rw-r--r-- | src/protocol/solidircd.c | 2 | ||||
-rw-r--r-- | src/protocol/ultimate2.c | 2 | ||||
-rw-r--r-- | src/protocol/ultimate3.c | 2 | ||||
-rw-r--r-- | src/protocol/unreal31.c | 2 | ||||
-rw-r--r-- | src/protocol/unreal32.c | 28 | ||||
-rw-r--r-- | src/protocol/unreal32.h | 2 | ||||
-rw-r--r-- | src/protocol/viagra.c | 2 | ||||
-rw-r--r-- | version.log | 2 |
28 files changed, 211 insertions, 9 deletions
@@ -1,9 +1,13 @@ Anope Version 1.8 SVN ------------------- Provided by Anope Dev. <team@anope.org> - 2009 -01/03 F Updated install.js url for windows build help. [ #00] -01/17 F Fixed MySQL DB saving failing due to unsafe queries. [#994] -01/18 F Fixed check for backtrace() in configure. [ #00] +01/03 F Updated install.js url for windows build help. [ #00] +01/17 F Fixed MySQL DB saving failing due to unsafe queries. [ #994] +01/18 F Fixed check for backtrace() in configure. [ #00] +01/22 F Do not allow invalied nicks to be grouped. [#1000] +01/26 F Do not allow empty vIdent when loading from MySQL. [ #00] +01/26 F Readonly/noexpire are now checked before saving on shutdown. [ #00] +01/28 F Added internal support for +j channelmodes. [#1001] Anope Version 1.8.0 ------------------- @@ -446,6 +446,11 @@ How To Add IRCd Support Contact the anope Dev Team if this is the case. Set to 0 if CIDR's are not supported by your IRCd. + 88) Throttle Mode: The IRCd has a channelmode for throttling joins per-user. + Use 1 for yes, 0 for no. + + 89) CMode j: CMODE_ that defines throttle mode. Use 0 for no support. + So we've had this long list. Now there's a second struct to fill. This struct isn't as long as the previous one though, so we'll handle it quite quick compared to the previous one. diff --git a/include/extern.h b/include/extern.h index 600db4ac2..8e6c61ed7 100644 --- a/include/extern.h +++ b/include/extern.h @@ -92,6 +92,7 @@ E void chan_adduser2(User * user, Channel * c); E void add_invite(Channel * chan, char *mask); E void chan_delete(Channel * c); E void del_ban(Channel * chan, char *mask); +E void chan_set_throttle(Channel * chan, char *value); E void chan_set_key(Channel * chan, char *value); E void set_limit(Channel * chan, char *value); E void del_invite(Channel * chan, char *mask); @@ -104,6 +105,8 @@ E void add_exception(Channel * chan, char *mask); E void del_exception(Channel * chan, char *mask); E char *get_flood(Channel * chan); E void set_flood(Channel * chan, char *value); +E char *get_throttle(Channel * chan); +E void set_throttle(Channel * chan, char *value); E char *get_redirect(Channel * chan); E void set_redirect(Channel * chan, char *value); @@ -204,6 +207,8 @@ E void stick_mask(ChannelInfo * ci, AutoKick * akick); E void stick_all(ChannelInfo * ci); E char *cs_get_flood(ChannelInfo * ci); E void cs_set_flood(ChannelInfo * ci, char *value); +E char *cs_get_throttle(ChannelInfo * ci); +E void cs_set_throttle(ChannelInfo * ci, char *value); E char *cs_get_key(ChannelInfo * ci); E void cs_set_key(ChannelInfo * ci, char *value); E char *cs_get_limit(ChannelInfo * ci); @@ -702,6 +707,7 @@ E void pmodule_secret_cmode(int mode); E void pmodule_private_cmode(int mode); E void pmodule_key_mode(int mode); E void pmodule_limit_mode(int mode); +E void pmodule_jointhrottle_mode_check(int (*func) (char *value)); E int anope_get_secret_mode(); E int anope_get_invite_mode(); @@ -1369,6 +1375,7 @@ E void anope_cmd_svid_umode2(User *u, char *ts); E void anope_cmd_svid_umode3(User *u, char *ts); E void anope_cmd_nc_change(User *u); E int anope_flood_mode_check(char *value); +E int anope_jointhrottle_mode_check(char *value); E void anope_cmd_jupe(char *jserver, char *who, char *reason); diff --git a/include/services.h b/include/services.h index 3780b18c5..11a909c40 100644 --- a/include/services.h +++ b/include/services.h @@ -361,6 +361,8 @@ struct ircdvars_ { int cidrchanbei; /* channel bans/excepts/invites support CIDR (syntax: +b *!*@192.168.0.0/15) * 0 for no support, 1 for strict cidr support, anything else * for ircd specific support (nefarious only cares about first /mask) */ + int jmode; /* +j join throttle */ + uint32 chan_jmode; /* Mode */ }; struct ircdcapab_ { @@ -668,6 +670,7 @@ struct chaninfo_ { char *mlock_key; /* NULL if no key */ char *mlock_flood; /* NULL if no +f */ char *mlock_redirect; /* NULL if no +L */ + char *mlock_throttle; /* NULL if no +j */ char *entry_message; /* Notice sent on entering channel */ @@ -990,6 +993,7 @@ struct channel_ { char *key; /* NULL if none */ char *redirect; /* +L; NULL if none */ char *flood; /* +f; NULL if none */ + char *throttle; /* +j: NULL if none */ EList *bans; EList *excepts; EList *invites; @@ -1208,6 +1212,7 @@ typedef struct ircd_proto_ { int (*ircd_valid_nick)(char *nick); int (*ircd_valid_chan)(char *chan); int (*ircd_flood_mode_check)(char *value); + int (*ircd_jointhrottle_mode_check)(char *value); } IRCDProto; typedef struct ircd_modes_ { diff --git a/src/channels.c b/src/channels.c index 97ba83d3b..f16c56388 100644 --- a/src/channels.c +++ b/src/channels.c @@ -445,6 +445,10 @@ void get_channel_stats(long *nrec, long *memuse) if (chan->redirect) mem += strlen(chan->redirect) + 1; } + if (ircd->jmode) { + if (chan->throttle) + mem += strlen(chan->throttle) + 1; + } mem += get_memuse(chan->bans); if (ircd->except) { mem += get_memuse(chan->excepts); @@ -1648,6 +1652,10 @@ void chan_delete(Channel * c) if (c->redirect) free(c->redirect); } + if (ircd->jmode) { + if (c->throttle) + free (c->throttle); + } if (c->bans && c->bans->count) { while (c->bans->entries) { @@ -1759,6 +1767,13 @@ char *get_flood(Channel * chan) /*************************************************************************/ +char *get_throttle(Channel * chan) +{ + return chan->throttle; +} + +/*************************************************************************/ + char *get_key(Channel * chan) { return chan->key; @@ -1825,6 +1840,19 @@ void set_flood(Channel * chan, char *value) /*************************************************************************/ +void chan_set_throttle(Channel * chan, char *value) +{ + if (chan->throttle) + free(chan->throttle); + chan->throttle = value ? sstrdup(value) : NULL; + + if (debug) + alog("debug: Throttle mode for channel %s set to %s", chan->name, + chan->throttle ? chan->throttle : "none"); +} + +/*************************************************************************/ + void chan_set_key(Channel * chan, char *value) { if (chan->key) diff --git a/src/chanserv.c b/src/chanserv.c index 2584d71f8..79a4edb05 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -342,6 +342,10 @@ void get_chanserv_stats(long *nrec, long *memuse) if (ci->mlock_redirect) mem += strlen(ci->mlock_redirect) + 1; } + if (ircd->jmode) { + if (ci->mlock_throttle) + mem += strlen(ci->mlock_throttle) + 1; + } if (ci->last_topic) mem += strlen(ci->last_topic) + 1; if (ci->entry_message) @@ -675,6 +679,16 @@ void load_cs_dbase(void) if (s) free(s); } + /* We added support for channelmode +j tracking, + * however unless for some other reason we need to + * change the DB format, it is being saved to DB. ~ Viper + if (ircd->jmode) { + SAFE(read_string(&ci->mlock_throttle, f)); + } else { + SAFE(read_string(&s, f)); + if (s) + free(s); + }*/ } SAFE(read_int16(&tmp16, f)); @@ -934,6 +948,13 @@ void save_cs_dbase(void) } else { SAFE(write_string(NULL, f)); } + /* Current DB format does not hold +j yet.. ~ Viper + if (ircd->jmode) { + SAFE(write_string(ci->mlock_throttle, f)); + } else { + SAFE(write_string(NULL, f)); + } + */ SAFE(write_int16(ci->memos.memocount, f)); SAFE(write_int16(ci->memos.memomax, f)); memos = ci->memos.memos; @@ -2139,6 +2160,10 @@ int delchan(ChannelInfo * ci) if (ci->mlock_redirect) free(ci->mlock_redirect); } + if (ircd->jmode) { + if (ci->mlock_throttle) + free(ci->mlock_throttle); + } if (ci->last_topic) free(ci->last_topic); if (ci->forbidby) @@ -2410,6 +2435,17 @@ char *cs_get_flood(ChannelInfo * ci) /*************************************************************************/ +char *cs_get_throttle(ChannelInfo * ci) +{ + if (!ci) { + return NULL; + } else { + return ci->mlock_throttle; + } +} + +/*************************************************************************/ + char *cs_get_key(ChannelInfo * ci) { if (!ci) { @@ -2470,6 +2506,24 @@ void cs_set_flood(ChannelInfo * ci, char *value) /*************************************************************************/ +void cs_set_throttle(ChannelInfo * ci, char *value) +{ + if (!ci) + return; + + if (ci->mlock_throttle) + free(ci->mlock_throttle); + + if (anope_jointhrottle_mode_check(value)) { + ci->mlock_throttle = sstrdup(value); + } else { + ci->mlock_on &= ~ircd->chan_jmode; + ci->mlock_throttle = NULL; + } +} + +/*************************************************************************/ + void cs_set_key(ChannelInfo * ci, char *value) { if (!ci) { diff --git a/src/ircd.c b/src/ircd.c index 27435993e..d6c777f05 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -113,6 +113,7 @@ void initIrcdProto() ircdproto.ircd_valid_nick = NULL; ircdproto.ircd_valid_chan = NULL; ircdproto.ircd_cmd_ctcp = NULL; + ircdproto.ircd_jointhrottle_mode_check = NULL; } /* Special function, returns 1 if executed, 0 if not */ @@ -639,6 +640,13 @@ int anope_flood_mode_check(char *value) return ircdproto.ircd_flood_mode_check(value); } +int anope_jointhrottle_mode_check(char *value) +{ + if (ircd->jmode) + return ircdproto.ircd_jointhrottle_mode_check(value); + return 0; +} + void anope_cmd_jupe(char *jserver, char *who, char *reason) { ircdproto.ircd_cmd_jupe(jserver, who, reason); @@ -1137,6 +1145,11 @@ void pmodule_ircd_csmodes(char mode[128]) } } +void pmodule_jointhrottle_mode_check(int (*func) (char *value)) +{ + ircdproto.ircd_jointhrottle_mode_check = func; +} + void pmodule_ircd_useTSMode(int use) { UseTSMODE = use; diff --git a/src/protocol/bahamut.c b/src/protocol/bahamut.c index 5d84590ed..1d3169fed 100644 --- a/src/protocol/bahamut.c +++ b/src/protocol/bahamut.c @@ -108,6 +108,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/charybdis.c b/src/protocol/charybdis.c index 3440b03a3..2ec7d7f05 100644 --- a/src/protocol/charybdis.c +++ b/src/protocol/charybdis.c @@ -36,7 +36,7 @@ IRCDVar myIrcd[] = { "+oiS", /* Global alias mode */ "+oiS", /* Used by BotServ Bots */ 2, /* Chan Max Symbols */ - "-cilmnpstrgzQF", /* Modes to Remove */ + "-cijlmnpstrgzQF", /* Modes to Remove */ "+o", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -105,6 +105,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 1, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j Mode */ } , {NULL} diff --git a/src/protocol/dreamforge.c b/src/protocol/dreamforge.c index 5dfb1e53d..ba669dd0a 100644 --- a/src/protocol/dreamforge.c +++ b/src/protocol/dreamforge.c @@ -106,6 +106,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/hybrid.c b/src/protocol/hybrid.c index ffea0a085..aa05506f1 100644 --- a/src/protocol/hybrid.c +++ b/src/protocol/hybrid.c @@ -106,6 +106,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/inspircd10.c b/src/protocol/inspircd10.c index 4b7977515..f5644b343 100644 --- a/src/protocol/inspircd10.c +++ b/src/protocol/inspircd10.c @@ -125,6 +125,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/inspircd11.c b/src/protocol/inspircd11.c index 66e64523f..a94c70d7c 100644 --- a/src/protocol/inspircd11.c +++ b/src/protocol/inspircd11.c @@ -56,7 +56,7 @@ IRCDVar myIrcd[] = { "+ioI", /* Global alias mode */ "+sI", /* Used by BotServ Bots */ 5, /* Chan Max Symbols */ - "-cilmnpstuzACGHKNOQRSV", /* Modes to Remove */ + "-cijlmnpstuzACGHKNOQRSV", /* Modes to Remove */ "+ao", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -125,6 +125,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 1, /* CIDR channelbans */ + 1, /* +j */ + CMODE_j, /* +j Mode */ } , {NULL} @@ -284,7 +286,7 @@ CBMode myCbmodes[128] = { {0}, /* g */ {0}, /* h */ {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ + {CMODE_j, CBM_MINUS_NO_ARG | CBM_NO_MLOCK, chan_set_throttle, cs_set_throttle}, /* j */ {CMODE_k, 0, chan_set_key, cs_set_key}, {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, {CMODE_m, 0, NULL, NULL}, @@ -308,6 +310,7 @@ CBModeInfo myCbmodeinfos[] = { {'f', CMODE_f, 0, NULL, NULL}, {'c', CMODE_c, 0, NULL, NULL}, {'i', CMODE_i, 0, NULL, NULL}, + {'j', CMODE_j, 0, get_throttle, cs_get_throttle}, {'k', CMODE_k, 0, get_key, cs_get_key}, {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, {'m', CMODE_m, 0, NULL, NULL}, @@ -1806,6 +1809,27 @@ void inspircd_cmd_ctcp(char *source, char *dest, char *buf) } +int inspircd_jointhrottle_mode_check(char *value) +{ + char *tempValue, *one, *two; + int param1, param2; + + if (!value) + return 0; + + tempValue = sstrdup(value); + one = strtok(tempValue, ":"); + two = strtok(NULL, ""); + if (one && two) { + param1 = atoi(one); + param2 = atoi(two); + } + if ((param1 >= 1) && (param1 <= 255) && (param2 >= 1) && (param2 <= 999)) + return 1; + return 0; +} + + /** * Tell anope which function we want to perform each task inside of anope. * These prototypes must match what anope expects. @@ -1886,6 +1910,7 @@ void moduleAddAnopeCmds() pmodule_valid_chan(inspircd_valid_chan); pmodule_cmd_ctcp(inspircd_cmd_ctcp); pmodule_set_umode(inspircd_set_umode); + pmodule_jointhrottle_mode_check(inspircd_jointhrottle_mode_check); } /** diff --git a/src/protocol/inspircd11.h b/src/protocol/inspircd11.h index 3391db3c0..540fc6394 100755 --- a/src/protocol/inspircd11.h +++ b/src/protocol/inspircd11.h @@ -48,6 +48,7 @@ #define CMODE_N 0x01000000 #define CMODE_R 0x00000100 /* Only identified users can join */ #define CMODE_r 0x00000200 /* Set for all registered channels */ +#define CMODE_j 0x02000000 #define DEFAULT_MLOCK CMODE_n | CMODE_t | CMODE_r @@ -121,6 +122,8 @@ int inspircd_flood_mode_check(char *value); void inspircd_cmd_jupe(char *jserver, char *who, char *reason); int inspircd_valid_nick(char *nick); void inspircd_cmd_ctcp(char *source, char *dest, char *buf); +int inspircd_jointhrottle_mode_check(char *value); + int anope_event_fjoin(char *source, int ac, char **av); int anope_event_fmode(char *source, int ac, char **av); int anope_event_ftopic(char *source, int ac, char **av); diff --git a/src/protocol/plexus2.c b/src/protocol/plexus2.c index 323482d02..1f01924f5 100644 --- a/src/protocol/plexus2.c +++ b/src/protocol/plexus2.c @@ -104,6 +104,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/plexus3.c b/src/protocol/plexus3.c index 463ae320c..375687ae1 100644 --- a/src/protocol/plexus3.c +++ b/src/protocol/plexus3.c @@ -104,6 +104,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/ptlink.c b/src/protocol/ptlink.c index 6479f8ee4..cd5f57c9c 100644 --- a/src/protocol/ptlink.c +++ b/src/protocol/ptlink.c @@ -106,6 +106,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/rageircd.c b/src/protocol/rageircd.c index 52662ce8b..a6d444db9 100644 --- a/src/protocol/rageircd.c +++ b/src/protocol/rageircd.c @@ -106,6 +106,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/ratbox.c b/src/protocol/ratbox.c index 3a43a01dd..5ec2a1919 100644 --- a/src/protocol/ratbox.c +++ b/src/protocol/ratbox.c @@ -106,6 +106,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/shadowircd.c b/src/protocol/shadowircd.c index 5dc263c17..c23c51400 100644 --- a/src/protocol/shadowircd.c +++ b/src/protocol/shadowircd.c @@ -107,6 +107,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/solidircd.c b/src/protocol/solidircd.c index f2eccccaa..4c20de1c0 100644 --- a/src/protocol/solidircd.c +++ b/src/protocol/solidircd.c @@ -108,6 +108,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/ultimate2.c b/src/protocol/ultimate2.c index a0839a457..88d7d0a4f 100644 --- a/src/protocol/ultimate2.c +++ b/src/protocol/ultimate2.c @@ -106,6 +106,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/ultimate3.c b/src/protocol/ultimate3.c index 57ea90527..9daaa5bab 100644 --- a/src/protocol/ultimate3.c +++ b/src/protocol/ultimate3.c @@ -106,6 +106,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/unreal31.c b/src/protocol/unreal31.c index 303e90e8a..0159be396 100644 --- a/src/protocol/unreal31.c +++ b/src/protocol/unreal31.c @@ -108,6 +108,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 0, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/src/protocol/unreal32.c b/src/protocol/unreal32.c index ed3ea9a98..373a595c8 100644 --- a/src/protocol/unreal32.c +++ b/src/protocol/unreal32.c @@ -39,7 +39,7 @@ IRCDVar myIrcd[] = { "+ioS", /* Global alias mode */ "+qS", /* Used by BotServ Bots */ 5, /* Chan Max Symbols */ - "-cilmnpstuzACGHKMNOQRSTV", /* Modes to Remove */ + "-cijlmnpstuzACGKMNOQRSTV", /* Modes to Remove */ "+ao", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ @@ -108,6 +108,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 1, /* +j */ + CMODE_j, /* +j Mode */ } , {NULL} @@ -316,7 +318,7 @@ CBMode myCbmodes[128] = { {0}, /* g */ {0}, /* h */ {CMODE_i, 0, NULL, NULL}, - {0}, /* j */ + {CMODE_j, CBM_MINUS_NO_ARG | CBM_NO_MLOCK, chan_set_throttle, cs_set_throttle}, /* j */ {CMODE_k, 0, chan_set_key, cs_set_key}, {CMODE_l, CBM_MINUS_NO_ARG, set_limit, cs_set_limit}, {CMODE_m, 0, NULL, NULL}, @@ -340,6 +342,7 @@ CBModeInfo myCbmodeinfos[] = { {'c', CMODE_c, 0, NULL, NULL}, {'f', CMODE_f, 0, get_flood, cs_get_flood}, {'i', CMODE_i, 0, NULL, NULL}, + {'j', CMODE_j, 0, get_throttle, cs_get_throttle}, {'k', CMODE_k, 0, get_key, cs_get_key}, {'l', CMODE_l, CBM_MINUS_NO_ARG, get_limit, cs_get_limit}, {'m', CMODE_m, 0, NULL, NULL}, @@ -1854,6 +1857,26 @@ void unreal_cmd_ctcp(char *source, char *dest, char *buf) free(s); } +int unreal_jointhrottle_mode_check(char *value) +{ + char *tempValue, *one, *two; + int param1, param2; + + if (!value) + return 0; + + tempValue = sstrdup(value); + one = strtok(tempValue, ":"); + two = strtok(NULL, ""); + if (one && two) { + param1 = atoi(one); + param2 = atoi(two); + } + if ((param1 >= 1) && (param1 <= 255) && (param2 >= 1) && (param2 <= 999)) + return 1; + return 0; +} + /* *INDENT-OFF* */ void moduleAddIRCDMsgs(void) { Message *m; @@ -2192,6 +2215,7 @@ void moduleAddAnopeCmds() pmodule_valid_chan(unreal_valid_chan); pmodule_cmd_ctcp(unreal_cmd_ctcp); pmodule_set_umode(unreal_set_umode); + pmodule_jointhrottle_mode_check(unreal_jointhrottle_mode_check); } /** diff --git a/src/protocol/unreal32.h b/src/protocol/unreal32.h index 72fa091a5..dd09a043a 100644 --- a/src/protocol/unreal32.h +++ b/src/protocol/unreal32.h @@ -74,6 +74,7 @@ #define CMODE_N 0x01000000 #define CMODE_T 0x02000000 #define CMODE_M 0x04000000 +#define CMODE_j 0x08000000 /* Default Modes with MLOCK */ @@ -150,4 +151,5 @@ int unreal_flood_mode_check(char *value); void unreal_cmd_jupe(char *jserver, char *who, char *reason); int unreal_valid_nick(char *nick); void unreal_cmd_ctcp(char *source, char *dest, char *buf); +int unreal_jointhrottle_mode_check(char *value); diff --git a/src/protocol/viagra.c b/src/protocol/viagra.c index a536da401..e53d38b2f 100644 --- a/src/protocol/viagra.c +++ b/src/protocol/viagra.c @@ -107,6 +107,8 @@ IRCDVar myIrcd[] = { NULL, /* character set */ 1, /* reports sync state */ 0, /* CIDR channelbans */ + 0, /* +j */ + 0, /* +j mode */ } , {NULL} diff --git a/version.log b/version.log index a0e93a019..4e0e28481 100644 --- a/version.log +++ b/version.log @@ -9,7 +9,7 @@ VERSION_MAJOR="1" VERSION_MINOR="8" VERSION_PATCH="0" VERSION_EXTRA="-svn" -VERSION_BUILD="1924" +VERSION_BUILD="1939" # $Log$ # |