Fix VERSION and RPL_MYINFO to only show modes that are enabled. Also fix up some errors from the last commit.

This commit is contained in:
B.Greenham 2010-10-11 16:35:18 -04:00
parent b7262e0cce
commit 07db71cda0
7 changed files with 33 additions and 8 deletions

View File

@ -747,6 +747,7 @@ channel {
* remote servers/users (ex: services) from setting them. Make sure
* your services and remote servers are properly configured when
* using this option!
* Valid parameters are: CLPFQITDENGJKMrczgqefj
*/
#disabledmodes = "ME";

View File

@ -87,5 +87,6 @@ extern void cflag_orphan(char c);
extern void construct_cflags_strings(void);
extern char cflagsbuf[256];
extern char cflagsmyinfo[256];
extern char cflagsparaminfo[256];
#endif

View File

@ -43,6 +43,7 @@
#include "chmode.h"
#include "irc_dictionary.h"
/* bitmasks for error returns, so we send once per call */
#define SM_ERR_NOTS 0x00000001 /* No TS on channel */
#define SM_ERR_NOOPS 0x00000002 /* No chan ops */
@ -69,6 +70,7 @@ static int no_override_deop;
char cflagsbuf[256];
char cflagsmyinfo[256];
char cflagsparaminfo[256];
int chmode_flags[256];
@ -120,14 +122,17 @@ construct_cflags_strings(void)
break;
default:
if(chmode_flags[i] != 0)
if(chmode_flags[i] != 0 && !(chmode_table[i].set_func == chm_orphaned))
{
*ptr++ = (char) i;
}
}
/* Should we leave orphaned check here? -- dwr */
if(!(chmode_table[i].set_func == chm_nosuch) && !(chmode_table[i].set_func == chm_orphaned))
if( !(chmode_table[i].set_func == chm_nosuch) &&
!(chmode_table[i].set_func == chm_orphaned) &&
!(chmode_table[i].set_func == chm_admin && !ConfigChannel.use_admin) &&
!(chmode_table[i].set_func == chm_halfop && !ConfigChannel.use_halfop))
{
*ptr2++ = (char) i;
}
@ -137,6 +142,21 @@ construct_cflags_strings(void)
*ptr2++ = '\0';
}
void
construct_cflag_param_string(void)
{
*cflagsparaminfo = '\0';
rb_snprintf(cflagsparaminfo, sizeof cflagsparaminfo, "%sb%s%s%s%sklov%s%s",
ConfigChannel.use_admin ? "a" : "",
ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_forward ? "f" : "",
ConfigChannel.use_halfop ? "h" : "",
strcasecmp(ConfigChannel.disabledmodes, "j") ? "" : "j",
strcasecmp(ConfigChannel.disabledmodes, "q") ? "" : "q",
ConfigChannel.use_invex ? "I" : "");
}
/*
* find_umode_slot
*

View File

@ -24,7 +24,7 @@ static const char * replies[] = {
/* 001 RPL_WELCOME, */ ":Welcome to the %s Internet Relay Chat Network %s",
/* 002 RPL_YOURHOST,*/ ":Your host is %s, running version %s",
/* 003 RPL_CREATED, */ ":This server was created %s",
/* 004 RPL_MYINFO, */ "%s %s %s %s bkloveqjfI",
/* 004 RPL_MYINFO, */ "%s %s %s %s %s",
/* 005 RPL_ISUPPORT, */ "%s :are supported by this server",
/* 006 */ NULL,
/* 007 */ NULL,

View File

@ -1005,19 +1005,19 @@ validate_conf(void)
if(*dm == 'I')
{
cflag_orphan('I');
ConfigChannel.use_invex = "NO";
ConfigChannel.use_invex = 0;
continue;
}
if(*dm == 'e')
{
cflag_orphan('e');
ConfigChannel.use_except = "NO";
ConfigChannel.use_except = 0;
continue;
}
if(*dm == 'f')
{
cflag_orphan('f');
ConfigChannel.use_forward = "NO";
ConfigChannel.use_forward = 0;
continue;
}
if(*dm == 'j')
@ -1067,6 +1067,7 @@ validate_conf(void)
}
}
}
construct_cflag_param_string();
startup = 0;
}

View File

@ -1293,7 +1293,7 @@ user_welcome(struct Client *source_p)
sendto_one_numeric(source_p, RPL_YOURHOST, form_str(RPL_YOURHOST),
get_listener_name(source_p->localClient->listener), ircd_version);
sendto_one_numeric(source_p, RPL_CREATED, form_str(RPL_CREATED), creation);
sendto_one_numeric(source_p, RPL_MYINFO, form_str(RPL_MYINFO), me.name, ircd_version, umodebuf, cflagsmyinfo);
sendto_one_numeric(source_p, RPL_MYINFO, form_str(RPL_MYINFO), me.name, ircd_version, umodebuf, cflagsmyinfo, cflagsparaminfo);
show_isupport(source_p);

View File

@ -235,10 +235,12 @@ isupport_chanmodes(const void *ptr)
{
static char result[80];
rb_snprintf(result, sizeof result, "%s%sbq,k,%slj,%s",
rb_snprintf(result, sizeof result, "%s%sb%s,k,%sl%s,%s",
ConfigChannel.use_except ? "e" : "",
ConfigChannel.use_invex ? "I" : "",
strcasecmp(ConfigChannel.disabledmodes, "q") ? "" : "q",
ConfigChannel.use_forward ? "f" : "",
strcasecmp(ConfigChannel.disabledmodes, "j") ? "" : "j",
cflagsbuf);
return result;
}