Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Thu, 27 Apr 2000 02:08:38 +0000 (02:08 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Thu, 27 Apr 2000 02:08:38 +0000 (02:08 +0000)
Log message:

more conversions, update write_log, fix a bug in sendcmdto_channel_butserv

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@207 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/channel.c
ircd/gline.c
ircd/jupe.c
ircd/send.c
ircd/support.c

index 35e6154740bfca53cfb8cdeded11daeb9e5b0aaf..937103a8dd4e0e82d1d29140687be35169ab6987 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2000-04-26  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/channel.c: convert as much as possible to new send
+       semantics
+
+       * ircd/send.c (sendcmdto_common_channels): fix a subtle bug --
+       test member->user->from->fd, not from->fd
+
+       * ircd/gline.c (gline_add): go ahead and add badchans; we just
+       won't look for them in m_gline; this way, they always work...
+
+       * ircd/jupe.c: use ircd_vsnprintf conversion specifiers
+
+       * ircd/gline.c: since write_log now uses ircd_vsnprintf, use
+       ircd_vsnprintf conversion specifiers
+
+       * ircd/support.c (write_log): use ircd_vsnprintf for write_log, so
+       I have my conversion specifiers
+
+       * ircd/gline.c (do_gline): use send_reply for ERR_YOUREBANNEDCREEP
+
        * ircd/send.c (sendcmdto_flag_butone): explicitly send WALLOPS to
        local users
 
 #
 # ChangeLog for ircu2.10.11
 #
-# $Id: ChangeLog,v 1.104 2000-04-26 20:58:37 kev Exp $
+# $Id: ChangeLog,v 1.105 2000-04-27 02:08:37 kev Exp $
 #
 # Insert new changes at beginning of the change list.
 #
index 31011730600bc82988728926c9c3d425e0afae53..9c5d22371a1fde0362ad4b79d21bc1e5d413c929 100644 (file)
@@ -142,7 +142,7 @@ struct Client* find_chasing(struct Client* sptr, const char* user, int* chasing)
     return who;
 
   if (!(who = get_history(user, KILLCHASETIMELIMIT))) {
-    sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name, sptr->name, user);
+    send_reply(sptr, ERR_NOSUCHNICK, user);
     return 0;
   }
   if (chasing)
@@ -361,8 +361,7 @@ int add_banid(struct Client *cptr, struct Channel *chptr, char *banid,
   }
   if (MyUser(cptr) && !removed_bans && (len > MAXBANLENGTH || (cnt >= MAXBANS)))
   {
-    sendto_one(cptr, err_str(ERR_BANLISTFULL), me.name, cptr->name,
-        chptr->chname, banid);
+    send_reply(cptr, ERR_BANLISTFULL, chptr->chname, banid);
     return -1;
   }
   if (change)
@@ -1077,11 +1076,10 @@ static void send_ban_list(struct Client* cptr, struct Channel* chptr)
   assert(0 != chptr);
 
   for (lp = chptr->banlist; lp; lp = lp->next)
-    sendto_one(cptr, rpl_str(RPL_BANLIST), me.name, cptr->name,
-               chptr->chname, lp->value.ban.banstr, lp->value.ban.who,
-               lp->value.ban.when);
-  sendto_one(cptr, rpl_str(RPL_ENDOFBANLIST), me.name, cptr->name,
-             chptr->chname);
+    send_reply(cptr, RPL_BANLIST, chptr->chname, lp->value.ban.banstr,
+              lp->value.ban.who, lp->value.ban.when);
+
+  send_reply(cptr, RPL_ENDOFBANLIST, chptr->chname);
 }
 
 /*
@@ -1222,8 +1220,7 @@ int set_mode(struct Client* cptr, struct Client* sptr,
         if (!(member_x = find_member_link(chptr, who)) ||
             (MyUser(sptr) && IsZombie(member_x)))
         {
-          sendto_one(cptr, err_str(ERR_USERNOTINCHANNEL),
-              me.name, cptr->name, who->name, chptr->chname);
+         send_reply(cptr, ERR_USERNOTINCHANNEL, who->name, chptr->chname);
           break;
         }
         /*
@@ -1234,8 +1231,7 @@ int set_mode(struct Client* cptr, struct Client* sptr,
            * XXX - CHECKME
            */
           if (MyUser(cptr)) {
-            sendto_one(cptr, err_str(ERR_ISCHANSERVICE), me.name,
-                       cptr->name, parv[0], chptr->chname);
+           send_reply(cptr, ERR_ISCHANSERVICE, parv[0], chptr->chname);
             break;
            }
            else {
@@ -1251,8 +1247,7 @@ int set_mode(struct Client* cptr, struct Client* sptr,
         if (whatt == MODE_DEL && IsOperOnLocalChannel(who, chptr->chname) &&
             (who != sptr) && MyUser(cptr) && *curr == 'o')
         {
-          sendto_one(cptr, err_str(ERR_ISOPERLCHAN), me.name,
-                     cptr->name, parv[0], chptr->chname);
+         send_reply(cptr, ERR_ISOPERLCHAN, parv[0], chptr->chname);
           break;
         }
 #endif
@@ -1299,8 +1294,7 @@ int set_mode(struct Client* cptr, struct Client* sptr,
         if (whatt == MODE_ADD)
         {
           if (*mode->key && !IsServer(cptr))
-            sendto_one(cptr, err_str(ERR_KEYSET),
-                me.name, cptr->name, chptr->chname);
+           send_reply(cptr, ERR_KEYSET, chptr->chname);
           else if (!*mode->key || IsServer(cptr))
           {
             lp = &chops[opcnt++];
@@ -1413,8 +1407,7 @@ int set_mode(struct Client* cptr, struct Client* sptr,
             newmode &= ~*ip;
         }
         else if (!IsServer(cptr))
-          sendto_one(cptr, err_str(ERR_UNKNOWNMODE),
-              me.name, cptr->name, *curr);
+         send_reply(cptr, ERR_UNKNOWNMODE, *curr);
         break;
     }
     curr++;
@@ -1957,9 +1950,8 @@ int set_mode(struct Client* cptr, struct Client* sptr,
   /* Bounce here */
   if (!hacknotice && *bmodebuf && chptr->creationtime)
   {
-    sendto_one(cptr, "%s " TOK_MODE " %s %s %s " TIME_T_FMT,
-               NumServ(&me), chptr->chname, bmodebuf, nbparambuf,
-               *badop == 2 ? (time_t) 0 : chptr->creationtime);
+    sendcmdto_one(&me, CMD_MODE, cptr, "%H %s %s %Tu", chptr, bmodebuf,
+                 nbparambuf, *badop == 2 ? (time_t) 0 : chptr->creationtime);
   }
   /* If there are possibly bans to re-add, bounce them now */
   if (add_banid_called && bounce)
@@ -1971,6 +1963,7 @@ int set_mode(struct Client* cptr, struct Client* sptr,
     {
       len[0] = strlen(ban[0]->value.ban.banstr);
       cnt = 1;                  /* We already got one ban :) */
+      /* XXX sendbuf used to send ban bounces! */
       sblen = sprintf_irc(sendbuf, ":%s MODE %s +b",
           me.name, chptr->chname) - sendbuf;
       total_len = sblen + 1 + len[0];   /* 1 = ' ' */
@@ -2008,6 +2001,7 @@ int set_mode(struct Client* cptr, struct Client* sptr,
     struct Membership* member_z;
     struct Client *acptr;
     if (IsServer(sptr))
+      /* XXX sendbuf used to send ban bounces! */
       psblen = sprintf_irc(sendbuf, ":%s MODE %s -b",
           sptr->name, chptr->chname) - sendbuf;
     else                        /* We rely on IsRegistered(sptr) being true for MODE */
@@ -2279,9 +2273,8 @@ void list_next_channels(struct Client *cptr, int nr)
           chptr->topic_time < args->max_topic_time)))
       {
         if (ShowChannel(cptr,chptr))
-          sendto_one(cptr, rpl_str(RPL_LIST), me.name, cptr->name,
-            chptr->chname,
-            chptr->users, chptr->topic);
+         send_reply(cptr, RPL_LIST, chptr->chname, chptr->users,
+                    chptr->topic);
         chptr = chptr->next;
         break;
       }
@@ -2290,7 +2283,7 @@ void list_next_channels(struct Client *cptr, int nr)
     {
       MyFree(cptr->listing);
       cptr->listing = NULL;
-      sendto_one(cptr, rpl_str(RPL_LISTEND), me.name, cptr->name);
+      send_reply(cptr, RPL_LISTEND);
       break;
     }
   }
@@ -2301,7 +2294,7 @@ void list_next_channels(struct Client *cptr, int nr)
   }
 }
 
-
+/* XXX AIEEEE! sendbuf is an institution here :( */
 void add_token_to_sendbuf(char *token, size_t *sblenp, int *firstp,
     int *send_itp, char is_a_ban, int mode)
 {
@@ -2366,6 +2359,7 @@ void cancel_mode(struct Client *sptr, struct Channel *chptr, char m,
   
   if (*count == -1)             /* initialize ? */
   {
+    /* XXX sendbuf used! */
     sbp = sbpi =
         sprintf_irc(sendbuf, ":%s MODE %s -", sptr->name, chptr->chname);
     pb = parabuf;
@@ -2475,7 +2469,7 @@ void make_zombie(struct Membership* member, struct Client* who, struct Client* c
   if (MyUser(who))      /* server 4 */
   {
     if (IsServer(cptr)) /* Case b) ? */
-      sendto_one(cptr, PartFmt1, who->name, chptr->chname);
+      sendcmdto_one(who, CMD_PART, cptr, "%H", chptr);
     remove_user_from_channel(who, chptr);
     return;
   }
@@ -2510,6 +2504,7 @@ int number_of_zombies(struct Channel *chptr)
   return count;
 }
 
+/* XXX we can probably get rid of send_user_joins */
 void send_user_joins(struct Client *cptr, struct Client *user)
 {
   struct Membership* chan;
@@ -2573,7 +2568,7 @@ void send_user_joins(struct Client *cptr, struct Client *user)
  * This function prepares sendbuf with the server notices and wallops
  *   to be sent for all hacks.  -Ghostwolf 18-May-97
  */
-
+/* XXX let's get rid of this if we can */
 void send_hack_notice(struct Client *cptr, struct Client *sptr, int parc,
                       char *parv[], int badop, int mtype)
 {
@@ -2841,53 +2836,46 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
     /* send the messages off to their destination */
     if (mbuf->mb_dest & MODEBUF_DEST_HACK2) {
-      sendto_op_mask(SNO_HACK2, "HACK(2): %s MODE %s %s%s%s%s%s%s [" TIME_T_FMT
-                    "]", app_source->name, mbuf->mb_channel->chname,
-                    rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", addbuf,
-                    remstr, addstr, mbuf->mb_channel->creationtime);
-      sendto_serv_butone(mbuf->mb_connect, "%s " TOK_DESYNCH
-                        " :HACK: %s MODE %s %s%s%s%s%s%s [" TIME_T_FMT "]",
-                        NumServ(&me), app_source->name,
-                        mbuf->mb_channel->chname, rembuf_i ? "-" : "", rembuf,
-                        addbuf_i ? "+" : "", addbuf, remstr, addstr,
-                        mbuf->mb_channel->creationtime);
+      sendto_opmask_butone(0, SNO_HACK2, "HACK(2): %s MODE %s %s%s%s%s%s%s "
+                          "[%Tu]", app_source->name, mbuf->mb_channel->chname,
+                          rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
+                          addbuf, remstr, addstr,
+                          mbuf->mb_channel->creationtime);
+      sendcmdto_serv_butone(&me, CMD_DESYNCH, mbuf->mb_connect,
+                           ":HACK: %s MODE %s %s%s%s%s%s%s [%Tu]",
+                           app_source->name, mbuf->mb_channel->chname,
+                           rembuf_i ? "-" : "", rembuf,
+                           addbuf_i ? "+" : "", addbuf, remstr, addstr,
+                           mbuf->mb_channel->creationtime);
     }
 
     if (mbuf->mb_dest & MODEBUF_DEST_HACK3)
-      sendto_op_mask(SNO_HACK3, "BOUNCE or HACK(3): %s MODE %s %s%s%s%s%s%s ["
-                    TIME_T_FMT "]", app_source->name,
-                    mbuf->mb_channel->chname, rembuf_i ? "-" : "", rembuf,
-                    addbuf_i ? "+" : "", addbuf, remstr, addstr,
-                    mbuf->mb_channel->creationtime);
+      sendto_opmask_butone(0, SNO_HACK3, "BOUNCE or HACK(3): %s MODE %s "
+                          "%s%s%s%s%s%s [%Tu]", app_source->name,
+                          mbuf->mb_channel->chname, rembuf_i ? "-" : "",
+                          rembuf, addbuf_i ? "+" : "", addbuf, remstr, addstr,
+                          mbuf->mb_channel->creationtime);
 
     if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
-      sendto_op_mask(SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s [" TIME_T_FMT
-                    "]", app_source->name, mbuf->mb_channel->chname,
-                    rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", addbuf,
-                    remstr, addstr, mbuf->mb_channel->creationtime);
+      sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s "
+                          "[%Tu]", app_source->name, mbuf->mb_channel->chname,
+                          rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
+                          addbuf, remstr, addstr,
+                          mbuf->mb_channel->creationtime);
 
 #ifdef OPATH
     if (mbuf->mb_dest & MODEBUF_DEST_LOG) {
-      if (IsServer(mbuf->mb_source))
-       write_log(OPATH, TIME_T_FMT " %s OPMODE %s %s%s%s%s%s%s\n", TStime(),
-                 mbuf->mb_source->name, mbuf->mb_channel->chname,
-                 rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "", addbuf,
-                 remstr, addstr);
-      else
-       write_log(OPATH, TIME_T_FMT " %s!%s@%s OPMODE %s %s%s%s%s%s%s\n",
-                 TStime(), mbuf->mb_source->name,
-                 mbuf->mb_source->user->username, mbuf->mb_source->user->host,
-                 mbuf->mb_channel->chname, rembuf_i ? "-" : "", rembuf,
-                 addbuf_i ? "+" : "", addbuf, remstr, addstr);
+      write_log(OPATH, "%Tu %#C OPMODE %H %s%s%s%s%s%s\n", TStime(),
+               mbuf->mb_source, mbuf->mb_channel, rembuf_i ? "-" : "", rembuf,
+               addbuf_i ? "+" : "", addbuf, remstr, addstr);
     }
 #endif
 
     if (mbuf->mb_dest & MODEBUF_DEST_CHANNEL)
-      sendto_channel_butserv(mbuf->mb_channel, app_source,
-                            ":%s MODE %s %s%s%s%s%s%s", app_source->name,
-                            mbuf->mb_channel->chname, rembuf_i ? "-" : "",
-                            rembuf, addbuf_i ? "+" : "", addbuf, remstr,
-                            addstr);
+      sendcmdto_channel_butserv(app_source, CMD_MODE, mbuf->mb_channel,
+                               "%H %s%s%s%s%s%s", mbuf->mb_channel,
+                               rembuf_i ? "-" : "", rembuf,
+                               addbuf_i ? "+" : "", addbuf, remstr, addstr);
   }
 
   /* Now are we supposed to propagate to other servers? */
@@ -2945,46 +2933,37 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
     if (mbuf->mb_dest & MODEBUF_DEST_OPMODE) {
       /* If OPMODE was set, we're propagating the mode as an OPMODE message */
-      if (IsServer(mbuf->mb_source))
-       sendto_serv_butone(mbuf->mb_connect, "%s " TOK_OPMODE
-                          " %s %s%s%s%s%s%s", NumServ(mbuf->mb_source),
-                          mbuf->mb_channel->chname, rembuf_i ? "-" : "",
-                          rembuf, addbuf_i ? "+" : "", addbuf, remstr,
-                          addstr);
-      else
-       sendto_serv_butone(mbuf->mb_connect, "%s%s " TOK_OPMODE
-                          " %s %s%s%s%s%s%s", NumNick(mbuf->mb_source),
-                          mbuf->mb_channel->chname, rembuf_i ? "-" : "",
-                          rembuf, addbuf_i ? "+" : "", addbuf, remstr,
-                          addstr);
+      sendcmdto_serv_butone(mbuf->mb_source, CMD_OPMODE, mbuf->mb_connect,
+                           "%H %s%s%s%s%s%s", mbuf->mb_channel,
+                           rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
+                           addbuf, remstr, addstr);
     } else if (mbuf->mb_dest & MODEBUF_DEST_BOUNCE) {
       /*
        * If HACK2 was set, we're bouncing; we send the MODE back to the
        * connection we got it from with the senses reversed and a TS of 0;
        * origin is us
        */
-      sendto_one(mbuf->mb_connect, "%s " TOK_MODE " %s %s%s%s%s%s%s "
-                TIME_T_FMT, NumServ(&me), mbuf->mb_channel->chname,
-                addbuf_i ? "-" : "", addbuf, rembuf_i ? "+" : "", rembuf,
-                addstr, remstr, mbuf->mb_channel->creationtime);
+      sendcmdto_one(&me, CMD_MODE, mbuf->mb_connect, "%H %s%s%s%s%s%s %Tu",
+                   mbuf->mb_channel, addbuf_i ? "-" : "", addbuf,
+                   rembuf_i ? "+" : "", rembuf, addstr, remstr,
+                   mbuf->mb_channel->creationtime);
     } else {
       /*
        * We're propagating a normal MODE command to the rest of the network;
        * we send the actual channel TS unless this is a HACK3 or a HACK4
        */
       if (IsServer(mbuf->mb_source))
-       sendto_serv_butone(mbuf->mb_connect, "%s " TOK_MODE " %s %s%s%s%s%s%s "
-                          TIME_T_FMT, NumServ(mbuf->mb_source),
-                          mbuf->mb_channel->chname, rembuf_i ? "-" : "",
-                          rembuf, addbuf_i ? "+" : "", addbuf, remstr,
-                          addstr, (mbuf->mb_dest & MODEBUF_DEST_HACK4) ? 0 :
-                          mbuf->mb_channel->creationtime);
+       sendcmdto_serv_butone(mbuf->mb_source, CMD_MODE, mbuf->mb_connect,
+                             "%H %s%s%s%s%s%s %Tu", mbuf->mb_channel,
+                             rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
+                             addbuf, remstr, addstr,
+                             (mbuf->mb_dest & MODEBUF_DEST_HACK4) ? 0 :
+                             mbuf->mb_channel->creationtime);
       else
-       sendto_serv_butone(mbuf->mb_connect, "%s%s " TOK_MODE
-                          " %s %s%s%s%s%s%s", NumNick(mbuf->mb_source),
-                          mbuf->mb_channel->chname, rembuf_i ? "-" : "",
-                          rembuf, addbuf_i ? "+" : "", addbuf, remstr,
-                          addstr);
+       sendcmdto_serv_butone(mbuf->mb_source, CMD_MODE, mbuf->mb_connect,
+                             "%H %s%s%s%s%s%s", mbuf->mb_channel,
+                             rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
+                             addbuf, remstr, addstr);
     }
   }
 
@@ -3198,9 +3177,8 @@ send_notoper(struct ParseState *state)
   if (state->done & DONE_NOTOPER)
     return;
 
-  sendto_one(state->sptr, err_str(state->flags & MODE_PARSE_NOTOPER ?
-                                 ERR_CHANOPRIVSNEEDED : ERR_NOTONCHANNEL),
-            me.name, state->sptr->name, state->chptr->chname);
+  send_reply(state->sptr, (state->flags & MODE_PARSE_NOTOPER) ?
+            ERR_CHANOPRIVSNEEDED : ERR_NOTONCHANNEL, state->chptr->chname);
 
   state->done |= DONE_NOTOPER;
 }
@@ -3310,8 +3288,7 @@ mode_parse_key(struct ParseState *state, int *flag_p)
     if ((state->dir == MODE_ADD && *state->chptr->mode.key) ||
        (state->dir == MODE_DEL &&
         ircd_strcmp(state->chptr->mode.key, t_str))) {
-      sendto_one(state->sptr, err_str(ERR_KEYSET), me.name, state->sptr->name,
-                state->chptr->chname);
+      send_reply(state->sptr, ERR_KEYSET, state->chptr->chname);
       return;
     }
 
@@ -3515,8 +3492,8 @@ mode_process_bans(struct ParseState *state)
       } else {
        if (state->flags & MODE_PARSE_SET && MyUser(state->sptr) &&
            (len > MAXBANLENGTH || count >= MAXBANS)) {
-         send_error_to_client(state->sptr, ERR_BANLISTFULL,
-                              state->chptr->chname, ban->value.ban.banstr);
+         send_reply(state->sptr, ERR_BANLISTFULL, state->chptr->chname,
+                    ban->value.ban.banstr);
          count--;
          len -= banlen;
 
@@ -3616,9 +3593,8 @@ mode_process_clients(struct ParseState *state)
                                    state->cli_change[i].client)) ||
        (MyUser(state->sptr) && IsZombie(member))) {
       if (MyUser(state->sptr))
-       sendto_one(state->sptr, err_str(ERR_USERNOTINCHANNEL), me.name,
-                  state->sptr->name, state->cli_change[i].client->name,
-                  state->chptr->chname);
+       send_reply(state->sptr, ERR_USERNOTINCHANNEL,
+                  state->cli_change[i].client->name, state->chptr->chname);
       continue;
     }
 
@@ -3634,15 +3610,14 @@ mode_process_clients(struct ParseState *state)
       /* prevent +k users from being deopped */
       if (IsChannelService(state->cli_change[i].client)) {
        if (state->flags & MODE_PARSE_FORCE) /* it was forced */
-         sendto_op_mask(SNO_HACK4, "Deop of +k user on %s by %s",
-                        state->chptr->chname,
-                        (IsServer(state->sptr) ? state->sptr->name :
-                         state->sptr->user->server->name));
+         sendto_opmask_butone(0, SNO_HACK4, "Deop of +k user on %H by %s",
+                              state->chptr,
+                              (IsServer(state->sptr) ? state->sptr->name :
+                               state->sptr->user->server->name));
 
        else if (MyUser(state->sptr) && state->flags & MODE_PARSE_SET) {
-         sendto_one(state->sptr, err_str(ERR_ISCHANSERVICE), me.name,
-                    state->sptr->name, state->cli_change[i].client->name,
-                    state->chptr->chname);
+         send_reply(state->sptr, ERR_ISCHANSERVICE,
+                    state->cli_change[i].client->name, state->chptr->chname);
          continue;
        }
       }
@@ -3652,9 +3627,8 @@ mode_process_clients(struct ParseState *state)
       if (MyUser(state->sptr) && state->cli_change[i].client != state->sptr &&
          IsOperOnLocalChannel(state->cli_change[i].client,
                               state->chptr->chname)) {
-       sendto_one(state->sptr, err_str(ERR_ISOPERLCHAN), me.name,
-                  state->sptr->name, state->cli_change[i].client->name,
-                  state->chptr->chname);
+       send_reply(state->sptr, ERR_ISOPERLCHAN,
+                  state->cli_change[i].client->name, state->chptr->chname);
        continue;
       }
 #endif
@@ -3798,8 +3772,7 @@ mode_parse(struct ModeBuf *mbuf, struct Client *cptr, struct Client *sptr,
 
       if (!flag_p[0]) { /* didn't find it?  complain and continue */
        if (MyUser(state.sptr))
-         sendto_one(state.sptr, err_str(ERR_UNKNOWNMODE), me.name,
-                    state.sptr->name, *modestr);
+         send_reply(state.sptr, ERR_UNKNOWNMODE, *modestr);
        continue;
       }
 
index 93a0587f5cd8549a46c2d8fc03365f97a40397a3..86017fc0fddc56e2060279cee828c05e766beb1d 100644 (file)
@@ -152,9 +152,8 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline)
          (!acptr->user->username ||
           match(gline->gl_user, acptr->user->username) == 0)) {
        /* ok, here's one that got G-lined */
-       /* XXX sendto_one used for K-line reason */
-       sendto_one(acptr, ":%s %d %s :*** %s.", me.name, ERR_YOUREBANNEDCREEP,
-                  acptr->name, gline->gl_reason);
+       send_reply(acptr, RPL_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s",
+                  gline->gl_reason);
 
        /* let the ops know about it */
        sendto_opmask_butone(0, SNO_GLINE, "G-line active for %s",
@@ -214,7 +213,6 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
   expire += CurrentTime; /* convert from lifetime to timestamp */
 
   /* NO_OLD_GLINE allows *@#channel to work correctly */
-#ifdef BADCHAN
   if (*userhost == '#' || *userhost == '&' || *userhost == '+'
 # ifndef NO_OLD_GLINE
       || userhost[2] == '#' || userhost[2] == '&' || userhost[2] == '+'
@@ -226,7 +224,6 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
 # endif
     flags |= GLINE_BADCHAN;
   }
-#endif /* BADCHAN */
 
   /* Inform ops... */
   sendto_opmask_butone(0, SNO_GLINE, "%s adding %s %s for %s, expiring at "
@@ -238,19 +235,10 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
 
 #ifdef GPATH
   /* and log it */
-  if (IsServer(sptr))
-    write_log(GPATH, "# " TIME_T_FMT " %s adding %s %s for %s, expiring at "
-             TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             flags & GLINE_LOCAL ? "local" : "global",
-             flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
-             expire + TSoffset, reason);
-  else
-    write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s adding %s %s for %s, "
-             "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             sptr->user->username, sptr->user->host,
-             flags & GLINE_LOCAL ? "local" : "global",
-             flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
-             expire + TSoffset, reason);
+  write_log(GPATH, "# %Tu %C adding %s %s for %s, expiring at %Tu: %s\n",
+           TStime(), sptr, flags & GLINE_LOCAL ? "local" : "global",
+           flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
+           expire + TSoffset, reason);
 #endif /* GPATH */
 
   /* make the gline */
@@ -308,21 +296,12 @@ gline_activate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
                       gline->gl_expire + TSoffset, gline->gl_reason);
 
 #ifdef GPATH
-  if (IsServer(sptr))
-    write_log(GPATH, "# " TIME_T_FMT " %s activating global %s for %s%s%s, "
-             "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
-             gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-             GlineIsBadChan(gline) ? "" : gline->gl_host,
-             gline->gl_expire + TSoffset, gline->gl_reason);
-  else
-    write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s activating %s for "
-             "%s%s%s, expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             sptr->user->username, sptr->user->host,
-             GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
-             gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-             GlineIsBadChan(gline) ? "" : gline->gl_host,
-             gline->gl_expire + TSoffset, gline->gl_reason);
+  write_log(GPATH, "# %Tu %C activating global %s for %s%s%s, expiring at "
+           "%Tu: %s\n", TStime(), sptr,
+           GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+           gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
+           GlineIsBadChan(gline) ? "" : gline->gl_host,
+           gline->gl_expire + TSoffset, gline->gl_reason);
 #endif /* GPATH */
 
   propagate_gline(cptr, sptr, gline);
@@ -368,23 +347,13 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
                       gline->gl_expire + TSoffset, gline->gl_reason);
 
 #ifdef GPATH
-  if (IsServer(sptr))
-    write_log(GPATH, "# " TIME_T_FMT " %s %s %s for %s%s%s, "
-             "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             GlineIsLocal(gline) ? "removing local" : "deactivating global",
-             GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
-             gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-             GlineIsBadChan(gline) ? "" : gline->gl_host,
-             gline->gl_expire + TSoffset, gline->gl_reason);
-  else
-    write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s %s %s for "
-             "%s%s%s, expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             sptr->user->username, sptr->user->host,
-             GlineIsLocal(gline) ? "removing local" : "deactivating global",
-             GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
-             gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
-             GlineIsBadChan(gline) ? "" : gline->gl_host,
-             gline->gl_expire + TSoffset, gline->gl_reason);
+  write_log(GPATH, "# %Tu %C %s %s for %s%s%s, expiring at %Tu: %s\n",
+           TStime(), sptr,
+           GlineIsLocal(gline) ? "removing local" : "deactivating global",
+           GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
+           gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
+           GlineIsBadChan(gline) ? "" : gline->gl_host,
+           gline->gl_expire + TSoffset, gline->gl_reason);
 #endif /* GPATH */
 
   if (GlineIsLocal(gline))
index ca4d06e3af689ca011e0b400d41a6fadc4fa79c7..9c0f3446bb6b2703a438d9faf73c56606e3d83ce 100644 (file)
@@ -124,16 +124,9 @@ jupe_add(struct Client *cptr, struct Client *sptr, char *server, char *reason,
                       expire + TSoffset, reason);
 
 #ifdef JPATH
-  if (IsServer(sptr))
-    write_log(JPATH, TIME_T_FMT " %s adding %sJUPE for %s, expiring at "
-             TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             flags & JUPE_LOCAL ? "local " : "", server, expire + TSoffset,
-             reason);
-  else
-    write_log(JPATH, TIME_T_FMT, " %s!%s@%s adding %sJUPE for %s, expiring at "
-             TIME_T_FMT ": %s\n", TStime(), sptr->name, sptr->user->username,
-             sptr->user->host, flags & JUPE_LOCAL ? "local " : "", server,
-             expire + TSoffset, reason);
+  write_log(JPATH, "%Tu %C adding %sJUPE for %s, expiring at %Tu: %s\n",
+           TStime(), sptr, flags & JUPE_LOCAL ? "local " : "", server,
+           expire + TSoffset, reason);
 #endif /* JPATH */
 
   /* make the jupe */
@@ -177,15 +170,9 @@ jupe_activate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
                       jupe->ju_reason);
 
 #ifdef JPATH
-  if (IsServer(sptr))
-    write_log(JPATH, TIME_T_FMT " %s activating JUPE for %s, expiring at "
-             TIME_T_FMT ": %s\n", TStime(), sptr->name, jupe->ju_server,
-             jupe->ju_expire + TSoffset, jupe->ju_reason);
-  else
-    write_log(JPATH, TIME_T_FMT, " %s!%s@%s activating JUPE for %s, "
-             "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             sptr->user->username, sptr->user->host, jupe->ju_server,
-             jupe->ju_expire + TSoffset, jupe->ju_reason);
+  write_log(JPATH, "%Tu %C activating JUPE for %s, expiring at %Tu: %s\n",
+           TStime(), sptr, jupe->ju_server, jupe->ju_expire + TSoffset,
+           jupe->ju_reason);
 #endif /* JPATH */
 
   propagate_jupe(cptr, sptr, jupe);
@@ -228,17 +215,9 @@ jupe_deactivate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
                       jupe->ju_reason);
 
 #ifdef JPATH
-  if (IsServer(sptr))
-    write_log(JPATH, TIME_T_FMT " %s %s JUPE for %s, expiring at " TIME_T_FMT
-             ": %s\n", TStime(), sptr->name,
-             JupeIsLocal(jupe) ? "removing local" : "deactivating",
-             jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
-  else
-    write_log(JPATH, TIME_T_FMT, " %s!%s@%s %s JUPE for %s, "
-             "expiring at " TIME_T_FMT ": %s\n", TStime(), sptr->name,
-             sptr->user->username, sptr->user->host,
-             JupeIsLocal(jupe) ? "removing local" : "deactivating",
-             jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
+  write_log(JPATH, "%Tu %s %s JUPE for %s, expiring at %Tu: %s\n", TStime(),
+           sptr, JupeIsLocal(jupe) ? "removing local" : "deactivating",
+           jupe->ju_server, jupe->ju_expire + TSoffset, jupe->ju_reason);
 #endif /* JPATH */
 
   if (JupeIsLocal(jupe))
index abdab2cf1a04017bbac9082bcb55de47a165f76b..347333ef6163b68ca40135a9e34a425b3e5818a9 100644 (file)
@@ -1109,7 +1109,7 @@ void sendcmdto_common_channels(struct Client *from, const char *cmd,
   for (chan = from->user->channel; chan; chan = chan->next_channel)
     for (member = chan->channel->members; member;
         member = member->next_member)
-      if (MyConnect(member->user) && -1 < from->fd &&
+      if (MyConnect(member->user) && -1 < member->user->from->fd &&
          sentalong[member->user->from->fd] != sentalong_marker) {
        sentalong[member->user->from->fd] = sentalong_marker;
        send_buffer(member->user, sndbuf);
index 81a38c2d8499ce110a751ed08336aa16e3dfbdb9..ac1f7d49be7bb89d6e0dd7013aceea63cbdb7dd0 100644 (file)
@@ -22,6 +22,7 @@
 #include "fileio.h"
 #include "ircd.h"
 #include "ircd_chattr.h"
+#include "ircd_snprintf.h"
 #include "s_bsd.h"
 #include "s_debug.h"
 #include "send.h"
@@ -67,7 +68,7 @@ extern void write_log(const char *filename, const char *pattern, ...)
   if (logfile)
   {
     va_start(vl, pattern);
-    vsprintf_irc(logbuf, pattern, vl);
+    ircd_vsnprintf(0, logbuf, sizeof(logbuf) - 1, pattern, vl);
     va_end(vl);
 
     fbputs(logbuf, logfile);