From: Jochen Meesters Date: Tue, 12 Aug 2003 09:41:17 +0000 (+0000) Subject: Author: beware (by Spike) X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=1e2b7e3d8432d52b6e7fd2bf486edc35b2e58e7b Author: beware (by Spike) Log message: A bunch of patches done by beware, check ChangeLog for more info. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@966 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 567301d..a2d82f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +2003-07-07 Bas Steendijk + + * ircd/s_user.c: invalidate ban cache for user on host hiding/account + +2003-07-04 Bas Steendijk + + * include/client.h, ircd/m_userhost.c, ircd/m_userip.c, ircd/m_who.c, + ircd/m_whois.c, ircd/whocmds.c: the same code, for "can user A see user + B is an oper", appeared in a lot of places. made it a define SeeOper. + +2003-07-04 Bas Steendijk + * ircd/s_user.c: umode_str (user modes in N token) internal flags var + was not initialized to the user's flags, returned a string with + random modes set. + +2003-07-01 Bas Steendijk + + * ircd/m_names.c: length counter being incremented one too many + for each nick, resulting names reply messages are about 50 chars + shorter than possible. fixed. + +2003-06-29 Bas Steendijk + + * ircd/channel.c: don't ever send mode changes for local channels to + servers. + +2003-06-27 Bas Steendijk + + * include/channel.h, include/client.h, ircd/s_user.c, ircd/s_err.c: + moved the supported channel/user mode strings of the 004 reply from + s_err.c to the header files where the channels/user modes are + defined, and show or hide +Au based on OPLEVELS setting. + +2003-06-25 Bas Steendijk + + * ircd/m_burst.c: Clear topic set by netrider on burst. + 2003-08-05 Diane Bruce * ircd/parse.c: Fixed the typo the fix of the typo created diff --git a/include/channel.h b/include/channel.h index a3ae4e8..aafcb3c 100644 --- a/include/channel.h +++ b/include/channel.h @@ -100,6 +100,9 @@ struct Client; */ #define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS) +#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "Abiklmnopstuvr" : "biklmnopstvr" +#define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? "Abklouv" : "bklov" + #define HoldChannel(x) (!(x)) /* name invisible */ #define SecretChannel(x) ((x) && ((x)->mode.mode & MODE_SECRET)) diff --git a/include/client.h b/include/client.h index ec918b0..18e03a2 100644 --- a/include/client.h +++ b/include/client.h @@ -81,6 +81,8 @@ typedef unsigned long flagpage_t; #define FLAGSET_SET(set, flag) (set).bits[FLAGSET_INDEX(flag)] |= FLAGSET_MASK(flag) #define FLAGSET_CLEAR(set, flag) (set).bits[FLAGSET_INDEX(flag)] &= ~FLAGSET_MASK(flag) +#define infousermodes "dioswkgx" + enum Priv { PRIV_CHAN_LIMIT, /* no channel limit on oper */ @@ -453,6 +455,9 @@ struct Client { #define SetHiddenHost(x) SetFlag(x, FLAG_HIDDENHOST) #define SetPingSent(x) SetFlag(x, FLAG_PINGSENT) +#define SeeOper(sptr,acptr) (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) \ + || HasPriv(sptr, PRIV_SEE_OPERS))) + #define ClearAccess(x) ClrFlag(x, FLAG_CHKACCESS) #define ClearBurst(x) ClrFlag(x, FLAG_BURST) #define ClearBurstAck(x) ClrFlag(x, FLAG_BURST_ACK) diff --git a/ircd/channel.c b/ircd/channel.c index fbbf535..b477c6c 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -1856,6 +1856,8 @@ modebuf_init(struct ModeBuf *mbuf, struct Client *source, assert(0 != chan); assert(0 != dest); + if (IsLocalChannel(chan->chname)) dest &= ~MODEBUF_DEST_SERVER; + mbuf->mb_add = 0; mbuf->mb_rem = 0; mbuf->mb_source = source; diff --git a/ircd/m_burst.c b/ircd/m_burst.c index 7726e7d..289c93e 100644 --- a/ircd/m_burst.c +++ b/ircd/m_burst.c @@ -245,6 +245,15 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) /* mark bans for wipeout */ for (lp = chptr->banlist; lp; lp = lp->next) lp->flags |= CHFL_BURST_BAN_WIPEOUT; + + /* clear topic set by netrider (if set) */ + if (*chptr->topic) { + *chptr->topic = '\0'; + *chptr->topic_nick = '\0'; + chptr->topic_time = 0; + sendcmdto_channel_butserv_butone(&me, CMD_TOPIC, chptr, NULL, + "%H :%s", chptr, chptr->topic); + } } else if (chptr->creationtime == timestamp) { modebuf_init(mbuf = &modebuf, &me, cptr, chptr, MODEBUF_DEST_CHANNEL | MODEBUF_DEST_NOKEY); diff --git a/ircd/m_names.c b/ircd/m_names.c index b15f105..02e80d2 100644 --- a/ircd/m_names.c +++ b/ircd/m_names.c @@ -176,7 +176,7 @@ void do_names(struct Client* sptr, struct Channel* chptr, int filter) idx++; } strcat(buf, cli_name(c2ptr)); - idx += strlen(cli_name(c2ptr)) + 1; + idx += strlen(cli_name(c2ptr)); flag = 1; if (mlen + idx + NICKLEN + 5 > BUFSIZE) /* space, modifier, nick, \r \n \0 */ diff --git a/ircd/m_userhost.c b/ircd/m_userhost.c index 07f9ca6..04055d3 100644 --- a/ircd/m_userhost.c +++ b/ircd/m_userhost.c @@ -95,7 +95,7 @@ static void userhost_formatter(struct Client* cptr, struct Client *sptr, struct { assert(IsUser(cptr)); msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr), - HasPriv(cptr, PRIV_DISPLAY) ? "*" : "", + SeeOper(sptr,cptr) ? "*" : "", cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username, HasHiddenHost(cptr) && !IsAnOper(sptr) ? cli_user(cptr)->host : cli_user(cptr)->realhost); diff --git a/ircd/m_userip.c b/ircd/m_userip.c index 27be218..52a9db7 100644 --- a/ircd/m_userip.c +++ b/ircd/m_userip.c @@ -96,7 +96,7 @@ static void userip_formatter(struct Client* cptr, struct Client *sptr, struct Ms { assert(IsUser(cptr)); msgq_append(0, mb, "%s%s=%c%s@%s", cli_name(cptr), - HasPriv(cptr, PRIV_DISPLAY) ? "*" : "", + SeeOper(sptr,cptr) ? "*" : "", cli_user(cptr)->away ? '-' : '+', cli_user(cptr)->username, HasHiddenHost(cptr) && !IsAnOper(sptr) ? feature_str(FEAT_HIDDEN_IP) : diff --git a/ircd/m_who.c b/ircd/m_who.c index a9e68e2..473509e 100644 --- a/ircd/m_who.c +++ b/ircd/m_who.c @@ -321,9 +321,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) for (member = chptr->members; member; member = member->next_member) { acptr = member->user; - if ((bitsel & WHOSELECT_OPER) && - !(IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) || - HasPriv(sptr, PRIV_SEE_OPERS)))) + if ((bitsel & WHOSELECT_OPER) && !SeeOper(sptr,acptr)) continue; if ((acptr != sptr) && (member->status & CHFL_ZOMBIE)) continue; @@ -340,9 +338,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) else { if ((acptr = FindUser(nick)) && - ((!(bitsel & WHOSELECT_OPER)) || - (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) || - HasPriv(sptr, PRIV_SEE_OPERS)))) && + ((!(bitsel & WHOSELECT_OPER)) || SeeOper(sptr,acptr)) && Process(acptr) && SHOW_MORE(sptr, counter)) { do_who(sptr, acptr, 0, fields, qrt); @@ -386,9 +382,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) if (!(IsUser(acptr) && Process(acptr))) continue; /* Now Process() is at the beginning, if we fail we'll never have to show this acptr in this query */ - if ((bitsel & WHOSELECT_OPER) && - !(IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) || - HasPriv(sptr, PRIV_SEE_OPERS)))) + if ((bitsel & WHOSELECT_OPER) && !SeeOper(sptr,acptr)) continue; if ((mask) && ((!(matchsel & WHO_FIELD_NIC)) @@ -424,9 +418,7 @@ int m_who(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { if (!(IsUser(acptr) && Process(acptr))) continue; - if ((bitsel & WHOSELECT_OPER) && - !(IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) || - HasPriv(sptr, PRIV_SEE_OPERS)))) + if ((bitsel & WHOSELECT_OPER) && !SeeOper(sptr,acptr)) continue; if (!(SEE_USER(sptr, acptr, bitsel))) continue; diff --git a/ircd/m_whois.c b/ircd/m_whois.c index b817e3a..319ea1d 100644 --- a/ircd/m_whois.c +++ b/ircd/m_whois.c @@ -196,8 +196,7 @@ static void do_whois(struct Client* sptr, struct Client *acptr, int parc) if (user->away) send_reply(sptr, RPL_AWAY, name, user->away); - if (IsAnOper(acptr) && (HasPriv(acptr, PRIV_DISPLAY) || - HasPriv(sptr, PRIV_SEE_OPERS))) + if (SeeOper(sptr,acptr)) send_reply(sptr, RPL_WHOISOPERATOR, name); if (IsAccount(acptr)) diff --git a/ircd/s_err.c b/ircd/s_err.c index 66a2cd7..20f5bf1 100644 --- a/ircd/s_err.c +++ b/ircd/s_err.c @@ -36,7 +36,7 @@ static Numeric replyTable[] = { /* 003 */ { RPL_CREATED, ":This server was created %s", "003" }, /* 004 */ - { RPL_MYINFO, "%s %s dioswkgx Abiklmnopstuvr Abklouv", "004" }, + { RPL_MYINFO, "%s %s %s %s %s", "004" }, /* 005 */ { RPL_ISUPPORT, "%s :are supported by this server", "005" }, /* 006 */ diff --git a/ircd/s_user.c b/ircd/s_user.c index ce5ea55..f922eb9 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -551,7 +551,8 @@ int register_user(struct Client *cptr, struct Client *sptr, */ send_reply(sptr, RPL_YOURHOST, cli_name(&me), version); send_reply(sptr, RPL_CREATED, creation); - send_reply(sptr, RPL_MYINFO, cli_name(&me), version); + send_reply(sptr, RPL_MYINFO, cli_name(&me), infousermodes, infochanmodes, + infochanmodeswithparams, version); send_supported(sptr); m_lusers(sptr, sptr, 1, parv); update_load(); @@ -1057,6 +1058,11 @@ hide_hostmask(struct Client *cptr, unsigned int flag) flag == FLAG_HIDDENHOST) return 0; +/* Invalidate all bans against the user so we check them again */ + for (chan = (cli_user(cptr))->channel; chan; + chan = chan->next_channel) + ClearBanValid(chan); + SetFlag(cptr, flag); if (!HasFlag(cptr, FLAG_HIDDENHOST) || !HasFlag(cptr, FLAG_ACCOUNT)) return 0; @@ -1339,7 +1345,7 @@ char *umode_str(struct Client *cptr) /* Maximum string size: "owidgrx\0" */ char *m = umodeBuf; int i; - struct Flags c_flags; + struct Flags c_flags = cli_flags(cptr); if (HasPriv(cptr, PRIV_PROPAGATE)) FlagSet(&c_flags, FLAG_OPER); diff --git a/ircd/whocmds.c b/ircd/whocmds.c index 87f7626..8a2f963 100644 --- a/ircd/whocmds.c +++ b/ircd/whocmds.c @@ -159,8 +159,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan, *(p1++) = 'G'; else *(p1++) = 'H'; - if (IsAnOper(acptr) && - (HasPriv(acptr, PRIV_DISPLAY) || HasPriv(sptr, PRIV_SEE_OPERS))) + if SeeOper(sptr,acptr) *(p1++) = '*'; if (fields) { /* If you specified flags then we assume you know how to parse