+++ /dev/null
-show usermode +h to clients (/mode +h spoof .. and /mode -h is allowed by clients)
-
-diff -r 4c7b03099b6f include/client.h
---- a/include/client.h
-+++ b/include/client.h
-@@ -90,7 +90,7 @@
- #define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag))
-
- /** String containing valid user modes, in no particular order. */
--#define infousermodes "dioOswkgxRXInPq"
-+#define infousermodes "dioOswkghxRXInPq"
-
- /** Character to indicate no oper name available */
- #define NOOPERNAMECHARACTER '-'
-diff -r 4c7b03099b6f include/s_user.h
---- a/include/s_user.h
-+++ b/include/s_user.h
-@@ -79,7 +79,7 @@
- extern int set_nick_name(struct Client* cptr, struct Client* sptr,
- const char* nick, int parc, char* parv[]);
- extern void send_umode_out(struct Client* cptr, struct Client* sptr,
-- struct Flags* old, int prop);
-+ struct Flags* old, int prop, int alreadyh);
- extern int whisper(struct Client* source, const char* nick,
- const char* channel, const char* text, int is_notice);
- extern void send_user_info(struct Client* to, char* names, int rpl,
-@@ -102,7 +102,7 @@
- extern struct Client* next_client(struct Client* next, const char* ch);
- extern char *umode_str(struct Client *cptr, int type);
- extern void send_umode(struct Client *cptr, struct Client *sptr,
-- struct Flags *old, int sendset, int opernames);
-+ struct Flags *old, int sendset, int opernames, int alreadyh);
- extern void set_snomask(struct Client *, unsigned int, int);
- extern int is_snomask(char *);
- extern int check_target_limit(struct Client *sptr, void *target, const char *name,
-diff -r 4c7b03099b6f ircd/m_oper.c
---- a/ircd/m_oper.c
-+++ b/ircd/m_oper.c
-@@ -189,7 +189,7 @@
-
- set_snomask(sptr, SNO_OPERDEFAULT, SNO_ADD);
- cli_max_sendq(sptr) = 0; /* Get the sendq from the oper's class */
-- send_umode_out(cptr, sptr, &old_mode, HasPriv(sptr, PRIV_PROPAGATE));
-+ send_umode_out(cptr, sptr, &old_mode, HasPriv(sptr, PRIV_PROPAGATE), 0);
- send_reply(sptr, RPL_YOUREOPER);
-
- sendto_opmask_butone(0, SNO_OLDSNO, "%s (%s@%s) is now operator (%c)",
-diff -r 4c7b03099b6f ircd/m_sethost.c
---- a/ircd/m_sethost.c
-+++ b/ircd/m_sethost.c
-@@ -114,11 +114,16 @@
- */
- int m_sethost(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
- {
-+ int alreadyh = 0;
- char hostmask[USERLEN + HOSTLEN + 2];
- char curhostmask[USERLEN + HOSTLEN + 2];
-
- struct Flags setflags;
-
-+ /* user already +h, save */
-+ if (IsSetHost(sptr))
-+ alreadyh = 1;
-+
- /* Back up the flags first */
- setflags = cli_flags(sptr);
-
-@@ -161,7 +166,7 @@
- }
- }
-
-- send_umode_out(cptr, sptr, &setflags, 0);
-+ send_umode_out(cptr, sptr, &setflags, 0, alreadyh);
- return 0;
- }
-
-@@ -176,6 +181,7 @@
- */
- int ms_sethost(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
- {
-+ int alreadyh = 0;
- struct Client *target;
- char hostmask[USERLEN + HOSTLEN + 2];
- struct Membership *chan;
-@@ -204,6 +210,10 @@
- return 0;
- }
-
-+ /* target already +h, save */
-+ if (IsSetHost(target))
-+ alreadyh = 1;
-+
- /* Back up the flags first */
- setflags = cli_flags(target);
- FlagClr(&setflags, FLAG_SETHOST);
-@@ -256,6 +266,6 @@
- }
- }
-
-- send_umode_out(target, target, &setflags, 0);
-+ send_umode_out(target, target, &setflags, 0, alreadyh);
- return 0;
- }
-diff -r 4c7b03099b6f ircd/s_user.c
---- a/ircd/s_user.c
-+++ b/ircd/s_user.c
-@@ -521,7 +521,7 @@
- else
- FlagClr(&flags, FLAG_ACCOUNT);
- client_set_privs(sptr, NULL);
-- send_umode(cptr, sptr, &flags, ALL_UMODES, 0);
-+ send_umode(cptr, sptr, &flags, ALL_UMODES, 0, 0);
- if ((cli_snomask(sptr) != SNO_DEFAULT) && HasFlag(sptr, FLAG_SERVNOTICE))
- send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
- }
-@@ -880,14 +880,15 @@
- * @param[in] sptr Client who sent us the mode change message.
- * @param[in] old Prior set of user flags.
- * @param[in] prop If non-zero, also include FLAG_OPER.
-+ * @param[in] alreadyh Client is already +h, do not show +h change
- */
- void send_umode_out(struct Client *cptr, struct Client *sptr,
-- struct Flags *old, int prop)
-+ struct Flags *old, int prop, int alreadyh)
- {
- int i;
- struct Client *acptr;
-
-- send_umode(NULL, sptr, old, prop ? SEND_UMODES : SEND_UMODES_BUT_OPER, 0);
-+ send_umode(NULL, sptr, old, prop ? SEND_UMODES : SEND_UMODES_BUT_OPER, 0, 0);
-
- for (i = HighestFd; i >= 0; i--)
- {
-@@ -896,7 +897,7 @@
- sendcmdto_one(sptr, CMD_MODE, acptr, "%s %s", cli_name(sptr), umodeBuf);
- }
-
-- send_umode(NULL, sptr, old, prop ? SEND_UMODES : SEND_UMODES_BUT_OPER, 1);
-+ send_umode(NULL, sptr, old, prop ? SEND_UMODES : SEND_UMODES_BUT_OPER, 1, 0);
-
- for (i = HighestFd; i >= 0; i--)
- {
-@@ -906,7 +907,7 @@
- }
-
- if (cptr && MyUser(cptr))
-- send_umode(cptr, sptr, old, ALL_UMODES, 0);
-+ send_umode(cptr, sptr, old, ALL_UMODES, 0, alreadyh);
- }
-
-
-@@ -1212,6 +1213,7 @@
- int prop = 0;
- int do_host_hiding = 0;
- int do_set_host = 0;
-+ int alreadyh = 0;
- size_t opernamelen;
- char *opername = 0;
- char* account = NULL;
-@@ -1226,8 +1228,7 @@
- for (i = 0; i < USERMODELIST_SIZE; i++)
- {
- if (HasFlag(sptr, userModeList[i].flag) &&
-- ((userModeList[i].flag != FLAG_ACCOUNT) &&
-- (userModeList[i].flag != FLAG_SETHOST)))
-+ userModeList[i].flag != FLAG_ACCOUNT)
- *m++ = userModeList[i].c;
- }
- *m = '\0';
-@@ -1239,6 +1240,9 @@
- return 0;
- }
-
-+ if (IsSetHost(sptr))
-+ alreadyh = 1;
-+
- /*
- * find flags already set for user
- * why not just copy them?
-@@ -1569,7 +1573,7 @@
- }
- assert(UserStats.opers <= UserStats.clients + UserStats.unknowns);
- assert(UserStats.inv_clients <= UserStats.clients + UserStats.unknowns);
-- send_umode_out(cptr, sptr, &setflags, prop);
-+ send_umode_out(cptr, sptr, &setflags, prop, alreadyh);
- }
-
- return 0;
-@@ -1644,9 +1648,11 @@
- * @param[in] old Pre-change set of modes for \a sptr.
- * @param[in] sendset One of ALL_UMODES, SEND_UMODES_BUT_OPER,
- * SEND_UMODES, to select which changed user modes to send.
-+ * @param[in] opernames Include opername parameter.
-+ * @param[in] alreadyh Client already has +h set, do not show +h change.
- */
- void send_umode(struct Client *cptr, struct Client *sptr, struct Flags *old,
-- int sendset, int opernames)
-+ int sendset, int opernames, int alreadyh)
- {
- int i;
- int flag;
-@@ -1689,12 +1695,15 @@
- }
- /* Special case for SETHOST.. */
- if (flag == FLAG_SETHOST) {
-- /* Don't send to users */
-- if (cptr && MyUser(cptr))
-- continue;
--
-- /* If we're setting +h, add the parameter later */
-- if (!FlagHas(old, flag))
-+
-+ /* do not show +h if client already had it */
-+ if (cptr && MyUser(cptr) && IsSetHost(cptr) && alreadyh)
-+ continue;
-+
-+ /* If we're setting +h, add the parameter later,
-+ * but not when showing to the user
-+ */
-+ if (!FlagHas(old, flag) && (!cptr || !MyUser(cptr)))
- needhost++;
- }
- if (FlagHas(old, flag))