From 155093fda4bcf95139a4a1f501eb5fa8daf5a144 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Tue, 26 Apr 2005 03:49:33 +0000 Subject: [PATCH] Ignore invalid or nonsensical bits in default usermodes. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1387 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 6 ++++++ ircd/s_user.c | 42 ++++++++++++++++++++++++++++++++---------- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 189441f..edc8d49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-04-25 Michael Poole + + * ircd/s_user.c (register_user): Replace call with set_user_mode() + with a direct parsing of user modes. To match this, revert the + initial display of usermode to how it was done before. + 2005-04-24 Michael Poole * doc/example.conf: Document new autoconnect field of Connect. diff --git a/ircd/s_user.c b/ircd/s_user.c index f69acdf..67cfe3d 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -611,12 +611,30 @@ int register_user(struct Client *cptr, struct Client *sptr, /* * Set user's initial modes */ - parv[0] = (char*)nick; - parv[1] = (char*)nick; - parv[2] = (char*)client_get_default_umode(sptr); - parv[3] = NULL; /* needed in case of +s */ - set_user_mode(sptr, sptr, 3, parv); - ClearHiddenHost(sptr); /* just in case somebody stuck +x in there */ + for (tmpstr = (char*)client_get_default_umode(sptr); *tmpstr; ++tmpstr) { + switch (*tmpstr) { + case 's': + if (!feature_bool(FEAT_HIS_SNOTICES_OPER_ONLY)) { + SetServNotice(sptr); + set_snomask(sptr, SNO_DEFAULT, SNO_SET); + } + break; + case 'w': + if (!feature_bool(FEAT_WALLOPS_OPER_ONLY)) + SetWallops(sptr); + break; + case 'i': + SetInvisible(sptr); + break; + case 'd': + SetDeaf(sptr); + break; + case 'g': + if (!feature_bool(FEAT_HIS_DEBUG_OPER_ONLY)) + SetDebug(sptr); + break; + } + } } else /* if (IsServer(cptr)) */ @@ -676,10 +694,14 @@ int register_user(struct Client *cptr, struct Client *sptr, iptobase64(ip_base64, &cli_ip(sptr), sizeof(ip_base64), 0), NumNick(sptr), cli_info(sptr)); - /* Send server notice mask to client */ - if (MyUser(sptr) && (cli_snomask(sptr) != SNO_DEFAULT) && HasFlag(sptr, FLAG_SERVNOTICE)) - send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr)); - + /* Send user mode to client */ + if (MyUser(sptr)) + { + static struct Flags flags; /* automatically initialized to zeros */ + send_umode(cptr, sptr, &flags, ALL_UMODES); + if ((cli_snomask(sptr) != SNO_DEFAULT) && HasFlag(sptr, FLAG_SERVNOTICE)) + send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr)); + } return 0; } -- 2.20.1