From 6147944c7207082239972619086c785bf96aad61 Mon Sep 17 00:00:00 2001 From: pk910 Date: Wed, 2 Nov 2011 06:27:46 +0100 Subject: [PATCH] keep in sync with OGN upstream (SVN-317) http://websvn.onlinegamesnet.net/revision.php?repname=ircu&path=%2F&rev=317 also documented some undocumented already build in features --- doc/example.conf | 12 +++++++++++- doc/readme.features | 41 +++++++++++++++++++++++++++++++++-------- include/ircd_features.h | 9 ++++++++- ircd/ircd_features.c | 10 +++++++++- ircd/m_join.c | 27 +++++++++++++++++---------- ircd/m_relay.c | 2 +- ircd/s_err.c | 12 ++++++------ 7 files changed, 85 insertions(+), 28 deletions(-) diff --git a/doc/example.conf b/doc/example.conf index 473efb9..235bd31 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -928,12 +928,22 @@ features # "HIS_REWRITE" = "TRUE"; # "HIS_REMOTE" = "TRUE"; # "HIS_NETSPLIT" = "TRUE"; +# "ERR_CHANNELISFULL" = "Cannot join channel, channel is full (+l)"; +# "ERR_INVITEONLYCHAN" = "Cannot join channel, you must be invited (+i)"; +# "ERR_BANNEDFROMCHAN" = "Cannot join channel, you are banned (+b)"; +# "ERR_BADCHANNELKEY" = "Cannot join channel, you need the correct key (+k)"; +# "ERR_NEEDREGGEDNICK" = "Cannot join channel, you must be authed to join (+r)"; +# "ERR_JOINACCESS" = "Cannot join channel, you don't have enough ChanServ access (+a)"; # "HIS_SERVERNAME" = "*.undernet.org"; # "HIS_SERVERINFO" = "The Undernet Underworld"; # "HIS_URLSERVERS" = "http://www.undernet.org/servers.php"; -# "URLREG" = "http://cservice.undernet.org/live/"; # "LOC_ENABLE" = "FALSE"; # "LOC_TARGET" = "somenick"; +# "CHMODE_A_ENABLE" = "TRUE"; +# "CHMODE_A_TARGET" = "ChanServ"; +# "CHMODE_F_ENABLE" = "TRUE"; +# "UNKNOWN_CMD_ENABLE" = "TRUE"; +# "UNKNOWN_CMD_TARGET" = "OpServ"; # "NOAMSG_TIME" = "0"; # "NOAMSG_NUM" = "1"; }; diff --git a/doc/readme.features b/doc/readme.features index 587ad76..7723b88 100644 --- a/doc/readme.features +++ b/doc/readme.features @@ -765,14 +765,6 @@ URL_CLIENTS This defines a URL that users may visit to find compatible IRC clients. -URLREG - * Type: string - * Default: "http://cservice.undernet.org/live/" - -This defines a URL that is used in server response 477 (ERR_NEEDREGGEDNICK) to -let users know which website they must visit to obtain a proper account for -authentication. - NICKLEN * Type: integer * Default: 12 @@ -916,6 +908,26 @@ If LOC_ENABLE is on, this is the target nick where to send the requests to. If the nick is not online or has not umode +S or is not on a services server, the LOC request is discarded. +CHMODE_A_ENABLE + * Type: boolean + * Default: FALSE + +Enable ChannelMode +a (ChanServ access). + +CHMODE_A_TARGET + * Type: string + * Default: NULL + +If CHMODE_A_ENABLE is on, this is the target nick where to send the requests +to. If the nick is not online or has not umode +S or is not on a +services server, the JOIN request is discarded. + +CHMODE_F_ENABLE + * Type: boolean + * Default: FALSE + +Enable ChannelMode +F (Foreward Channel). + NOAMSG_TIME * Type: integer * Default: 0 @@ -927,3 +939,16 @@ NOAMSG_NUM * Default: 1 The number the same message must occur to be blocked in channels that block multi target messages. + +ERR_CHANNELISFULL +ERR_INVITEONLYCHAN +ERR_BANNEDFROMCHAN +ERR_BADCHANNELKEY +ERR_NEEDREGGEDNICK +ERR_JOINACCESS + * Type: string + * Default: Standard error messages + +This allows network admins to set custom (friendly) error messages for several +reasons a user is not able to join a channel. Defaults are the standard errors +from vanilla. diff --git a/include/ircd_features.h b/include/ircd_features.h index d85b873..1373888 100644 --- a/include/ircd_features.h +++ b/include/ircd_features.h @@ -69,6 +69,14 @@ enum Feature { FEAT_NOAMSG_TIME, FEAT_NOAMSG_NUM, + /* friendly error messages */ + FEAT_ERR_CHANNELISFULL, + FEAT_ERR_INVITEONLYCHAN, + FEAT_ERR_BANNEDFROMCHAN, + FEAT_ERR_BADCHANNELKEY, + FEAT_ERR_NEEDREGGEDNICK, + FEAT_ERR_JOINACCESS, + /* features that probably should not be touched */ FEAT_KILLCHASETIMELIMIT, FEAT_MAXCHANNELSPERUSER, @@ -163,7 +171,6 @@ enum Feature { /* Misc. random stuff */ FEAT_NETWORK, FEAT_URL_CLIENTS, - FEAT_URLREG, FEAT_UNKNOWN_CMD_ENABLE, FEAT_UNKNOWN_CMD_TARGET, diff --git a/ircd/ircd_features.c b/ircd/ircd_features.c index d3bd41f..5c57b89 100644 --- a/ircd/ircd_features.c +++ b/ircd/ircd_features.c @@ -333,6 +333,15 @@ static struct FeatureDesc { F_I(NOAMSG_TIME, 0, 0, 0), F_I(NOAMSG_NUM, 0, 1, 0), + /* friendly error messages + * The errors below are the default */ + F_S(ERR_CHANNELISFULL, FEAT_CASE, "Cannot join channel (+l)", 0), + F_S(ERR_INVITEONLYCHAN, FEAT_CASE, "Cannot join channel (+i)", 0), + F_S(ERR_BANNEDFROMCHAN, FEAT_CASE, "Cannot join channel (+b)", 0), + F_S(ERR_BADCHANNELKEY, FEAT_CASE, "Cannot join channel (+k)", 0), + F_S(ERR_NEEDREGGEDNICK, FEAT_CASE, "Cannot join channel (+r)", 0), + F_S(ERR_JOINACCESS, FEAT_CASE, "Cannot join channel (+a)", 0), + /* features that probably should not be touched */ F_I(KILLCHASETIMELIMIT, 0, 30, 0), F_I(MAXCHANNELSPERUSER, 0, 10, 0), @@ -427,7 +436,6 @@ static struct FeatureDesc { /* Misc. random stuff */ F_S(NETWORK, 0, "UnderNet", 0), F_S(URL_CLIENTS, 0, "ftp://ftp.undernet.org/pub/irc/clients", 0), - F_S(URLREG, 0, "http://cservice.undernet.org/live/", 0), F_B(UNKNOWN_CMD_ENABLE, 0, 0, 0), F_S(UNKNOWN_CMD_TARGET, FEAT_NULL, 0, 0), diff --git a/ircd/m_join.c b/ircd/m_join.c index db04f67..66c4379 100644 --- a/ircd/m_join.c +++ b/ircd/m_join.c @@ -320,17 +320,24 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) } if (err) { - switch(err) { - case ERR_NEEDREGGEDNICK: - send_reply(sptr, - ERR_NEEDREGGEDNICK, - chptr->chname, - feature_str(FEAT_URLREG)); - break; - default: + const char *error = NULL; + if (err == ERR_CHANNELISFULL) + error = feature_str(FEAT_ERR_CHANNELISFULL); + else if (err == ERR_INVITEONLYCHAN) + error = feature_str(FEAT_ERR_INVITEONLYCHAN); + else if (err == ERR_BANNEDFROMCHAN) + error = feature_str(FEAT_ERR_BANNEDFROMCHAN); + else if (err == ERR_BADCHANNELKEY) + error = feature_str(FEAT_ERR_BADCHANNELKEY); + else if (err == ERR_NEEDREGGEDNICK) + error = feature_str(FEAT_ERR_NEEDREGGEDNICK); + else if (err == ERR_JOINACCESS) + error = feature_str(FEAT_ERR_JOINACCESS); + + if (error) + send_reply(sptr, err, chptr->chname, error); + else send_reply(sptr, err, chptr->chname); - break; - } continue; } diff --git a/ircd/m_relay.c b/ircd/m_relay.c index 209d65a..ed8a758 100644 --- a/ircd/m_relay.c +++ b/ircd/m_relay.c @@ -235,7 +235,7 @@ signed int ms_relay(struct Client* cptr, struct Client* sptr, signed int parc, c IsChannelName(chptr->mode.altchan) && strIsIrcCh(chptr->mode.altchan)) { mode_a_check_altchan(acptr,chptr->mode.altchan); } - send_reply(acptr, ERR_JOINACCESS, parv[3]); + send_reply(acptr, ERR_JOINACCESS, parv[3], feature_str(FEAT_ERR_JOINACCESS)); } } diff --git a/ircd/s_err.c b/ircd/s_err.c index 49f8a8a..ede3c24 100644 --- a/ircd/s_err.c +++ b/ircd/s_err.c @@ -972,21 +972,21 @@ static Numeric replyTable[] = { /* 469 */ { 0 }, /* 470 */ - { ERR_JOINACCESS, "%s :Cannot join channel (+a)", "470" }, + { ERR_JOINACCESS, "%s :%s", "470" }, /* 471 */ - { ERR_CHANNELISFULL, "%s :Cannot join channel (+l)", "471" }, + { ERR_CHANNELISFULL, "%s :%s", "471" }, /* 472 */ { ERR_UNKNOWNMODE, "%c :is unknown mode char to me", "472" }, /* 473 */ - { ERR_INVITEONLYCHAN, "%s :Cannot join channel (+i)", "473" }, + { ERR_INVITEONLYCHAN, "%s :%s", "473" }, /* 474 */ - { ERR_BANNEDFROMCHAN, "%s :Cannot join channel (+b)", "474" }, + { ERR_BANNEDFROMCHAN, "%s :%s", "474" }, /* 475 */ - { ERR_BADCHANNELKEY, "%s :Cannot join channel (+k)", "475" }, + { ERR_BADCHANNELKEY, "%s :%s", "475" }, /* 476 */ { ERR_BADCHANMASK, "%s :Bad Channel Mask", "476" }, /* 477 */ - { ERR_NEEDREGGEDNICK, "%s :Cannot join channel (+r): this channel requires authentication -- you can obtain an account from %s", "477" }, + { ERR_NEEDREGGEDNICK, "%s :%s", "477" }, /* 478 */ { ERR_BANLISTFULL, "%s %s :Channel ban/ignore list is full", "478" }, /* 479 */ -- 2.20.1