ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/channel_mode.c
(Generate patch)

Comparing ircd-hybrid/trunk/src/channel_mode.c (file contents):
Revision 4800 by michael, Tue Oct 28 13:59:43 2014 UTC vs.
Revision 7006 by michael, Fri Jan 1 00:07:54 2016 UTC

# Line 1 | Line 1
1   /*
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (c) 1997-2014 ircd-hybrid development team
4 > *  Copyright (c) 1997-2016 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 63 | Line 63 | const struct mode_letter chan_modes[] =
63    { MODE_REGISTERED, 'r' },
64    { MODE_SECRET,     's' },
65    { MODE_TOPICLIMIT, 't' },
66 +  { MODE_NOCTCP,     'C' },
67    { MODE_MODREG,     'M' },
68    { MODE_OPERONLY,   'O' },
69    { MODE_REGONLY,    'R' },
70    { MODE_SSLONLY,    'S' },
71 +  { MODE_NONOTICE,   'T' },
72    { 0, '\0' }
73   };
74  
# Line 83 | Line 85 | const struct mode_letter chan_modes[] =
85   static char *
86   check_string(char *s)
87   {
88 <  char *str = s;
88 >  char *const str = s;
89    static char star[] = "*";
90  
91    if (EmptyString(str))
# Line 102 | Line 104 | check_string(char *s)
104   }
105  
106   /*
107 < * Ban functions to work with mode +b/e/d/I
107 > * Ban functions to work with mode +b/e/I
108   */
109   /* add the specified ID to the channel.
110   *   -is 8/9/00
# Line 113 | Line 115 | add_id(struct Client *client_p, struct C
115   {
116    dlink_list *list = NULL;
117    dlink_node *node = NULL;
118 <  struct Ban *banptr = NULL;
118 >  struct Ban *ban = NULL;
119    size_t len = 0;
120    char name[NICKLEN + 1] = "";
121    char user[USERLEN + 1] = "";
# Line 151 | Line 153 | add_id(struct Client *client_p, struct C
153     * Re-assemble a new n!u@h and print it back to banid for sending
154     * the mode to the channel.
155     */
156 <  len = sprintf(banid, "%s!%s@%s", name, user, host);
156 >  len = snprintf(banid, IRCD_BUFSIZE, "%s!%s@%s", name, user, host);
157  
158    switch (type)
159    {
160      case CHFL_BAN:
161        list = &chptr->banlist;
162 <      clear_ban_cache(chptr);
162 >      clear_ban_cache_channel(chptr);
163        break;
164      case CHFL_EXCEPTION:
165        list = &chptr->exceptlist;
166 <      clear_ban_cache(chptr);
166 >      clear_ban_cache_channel(chptr);
167        break;
168      case CHFL_INVEX:
169        list = &chptr->invexlist;
# Line 173 | Line 175 | add_id(struct Client *client_p, struct C
175  
176    DLINK_FOREACH(node, list->head)
177    {
178 <    banptr = node->data;
178 >    ban = node->data;
179  
180 <    if (!irccmp(banptr->name, name) &&
181 <        !irccmp(banptr->user, user) &&
182 <        !irccmp(banptr->host, host))
180 >    if (!irccmp(ban->name, name) &&
181 >        !irccmp(ban->user, user) &&
182 >        !irccmp(ban->host, host))
183        return 0;
184    }
185  
186 <  banptr = mp_pool_get(ban_pool);
187 <  banptr->name = xstrdup(name);
188 <  banptr->user = xstrdup(user);
189 <  banptr->host = xstrdup(host);
190 <  banptr->when = CurrentTime;
191 <  banptr->len = len - 2;  /* -2 for ! + @ */
192 <  banptr->type = parse_netmask(host, &banptr->addr, &banptr->bits);
186 >  ban = mp_pool_get(ban_pool);
187 >  ban->when = CurrentTime;
188 >  ban->len = len - 2;  /* -2 for ! + @ */
189 >  ban->type = parse_netmask(host, &ban->addr, &ban->bits);
190 >  strlcpy(ban->name, name, sizeof(ban->name));
191 >  strlcpy(ban->user, user, sizeof(ban->user));
192 >  strlcpy(ban->host, host, sizeof(ban->host));
193  
194    if (IsClient(client_p))
195 <  {
196 <    banptr->who = MyCalloc(strlen(client_p->name) +
197 <                           strlen(client_p->username) +
198 <                           strlen(client_p->host) + 3);
197 <    sprintf(banptr->who, "%s!%s@%s", client_p->name,
198 <            client_p->username, client_p->host);
199 <  }
200 <  else if (IsHidden(client_p) || (IsServer(client_p) && ConfigServerHide.hide_servers))
201 <    banptr->who = xstrdup(me.name);
195 >    snprintf(ban->who, sizeof(ban->who), "%s!%s@%s", client_p->name,
196 >             client_p->username, client_p->host);
197 >  else if (IsHidden(client_p) || ConfigServerHide.hide_servers)
198 >    strlcpy(ban->who, me.name, sizeof(ban->who));
199    else
200 <    banptr->who = xstrdup(client_p->name);
200 >    strlcpy(ban->who, client_p->name, sizeof(ban->who));
201  
202 <  dlinkAdd(banptr, &banptr->node, list);
202 >  dlinkAdd(ban, &ban->node, list);
203  
204    return 1;
205   }
# Line 241 | Line 238 | del_id(struct Channel *chptr, char *bani
238     * Re-assemble a new n!u@h and print it back to banid for sending
239     * the mode to the channel.
240     */
241 <  sprintf(banid, "%s!%s@%s", name, user, host);
241 >  snprintf(banid, IRCD_BUFSIZE, "%s!%s@%s", name, user, host);
242  
243    switch (type)
244    {
245      case CHFL_BAN:
246        list = &chptr->banlist;
247 <      clear_ban_cache(chptr);
247 >      clear_ban_cache_channel(chptr);
248        break;
249      case CHFL_EXCEPTION:
250        list = &chptr->exceptlist;
251 <      clear_ban_cache(chptr);
251 >      clear_ban_cache_channel(chptr);
252        break;
253      case CHFL_INVEX:
254        list = &chptr->invexlist;
# Line 263 | Line 260 | del_id(struct Channel *chptr, char *bani
260  
261    DLINK_FOREACH(node, list->head)
262    {
263 <    struct Ban *banptr = node->data;
263 >    struct Ban *ban = node->data;
264  
265 <    if (!irccmp(name, banptr->name) &&
266 <        !irccmp(user, banptr->user) &&
267 <        !irccmp(host, banptr->host))
265 >    if (!irccmp(name, ban->name) &&
266 >        !irccmp(user, ban->user) &&
267 >        !irccmp(host, ban->host))
268      {
269 <      remove_ban(banptr, list);
269 >      remove_ban(ban, list);
270        return 1;
271      }
272    }
# Line 301 | Line 298 | channel_modes(struct Channel *chptr, str
298    {
299      *mbuf++ = 'l';
300  
301 <    if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE) || IsMember(client_p, chptr))
301 >    if (IsServer(client_p) || IsMember(client_p, chptr))
302        pbuf += sprintf(pbuf, "%d ", chptr->mode.limit);
303    }
304  
# Line 309 | Line 306 | channel_modes(struct Channel *chptr, str
306    {
307      *mbuf++ = 'k';
308  
309 <    if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE) || IsMember(client_p, chptr))
309 >    if (IsServer(client_p) || IsMember(client_p, chptr))
310        sprintf(pbuf, "%s ", chptr->mode.key);
311    }
312  
# Line 347 | Line 344 | fix_key(char *arg)
344   * side effects - clear ban cache
345   */
346   void
347 < clear_ban_cache(struct Channel *chptr)
347 > clear_ban_cache_channel(struct Channel *chptr)
348   {
349    dlink_node *node = NULL;
350  
351    DLINK_FOREACH(node, chptr->locmembers.head)
352    {
353 <    struct Membership *ms = node->data;
354 <    ms->flags &= ~(CHFL_BAN_SILENCED|CHFL_BAN_CHECKED);
353 >    struct Membership *member = node->data;
354 >    member->flags &= ~(CHFL_BAN_SILENCED | CHFL_BAN_CHECKED);
355    }
356   }
357  
# Line 365 | Line 362 | clear_ban_cache_client(struct Client *cl
362  
363    DLINK_FOREACH(node, client_p->channel.head)
364    {
365 <    struct Membership *ms = node->data;
366 <    ms->flags &= ~(CHFL_BAN_SILENCED|CHFL_BAN_CHECKED);
365 >    struct Membership *member = node->data;
366 >    member->flags &= ~(CHFL_BAN_SILENCED | CHFL_BAN_CHECKED);
367    }
368   }
369  
# Line 408 | Line 405 | chm_simple(struct Client *source_p, stru
405        sendto_one_numeric(source_p, &me,
406                           alev == CHACCESS_NOTONCHAN ? ERR_NOTONCHANNEL :
407                           ERR_CHANOPRIVSNEEDED, chptr->name);
408 +
409      *errors |= SM_ERR_NOOPS;
410      return;
411    }
# Line 458 | Line 456 | chm_registered(struct Client *source_p,
456        sendto_one_numeric(source_p, &me,
457                           alev == CHACCESS_NOTONCHAN ? ERR_NOTONCHANNEL :
458                           ERR_ONLYSERVERSCANCHANGE, chptr->name);
459 +
460      *errors |= SM_ERR_ONLYSERVER;
461      return;
462    }
# Line 502 | Line 501 | static void
501   chm_operonly(struct Client *source_p, struct Channel *chptr, int parc, int *parn,
502               char **parv, int *errors, int alev, int dir, char c, unsigned int d)
503   {
504 <  if (alev < CHACCESS_CHANOP)
504 >  if (alev < CHACCESS_HALFOP)
505    {
506      if (!(*errors & SM_ERR_NOOPS))
507        sendto_one_numeric(source_p, &me,
# Line 567 | Line 566 | chm_ban(struct Client *source_p, struct
566  
567      DLINK_FOREACH(node, chptr->banlist.head)
568      {
569 <      const struct Ban *banptr = node->data;
569 >      const struct Ban *ban = node->data;
570        sendto_one_numeric(source_p, &me, RPL_BANLIST, chptr->name,
571 <                         banptr->name, banptr->user, banptr->host,
572 <                         banptr->who, banptr->when);
571 >                         ban->name, ban->user, ban->host,
572 >                         ban->who, ban->when);
573      }
574  
575      sendto_one_numeric(source_p, &me, RPL_ENDOFBANLIST, chptr->name);
# Line 583 | Line 582 | chm_ban(struct Client *source_p, struct
582        sendto_one_numeric(source_p, &me,
583                           alev == CHACCESS_NOTONCHAN ? ERR_NOTONCHANNEL :
584                           ERR_CHANOPRIVSNEEDED, chptr->name);
585 +
586      *errors |= SM_ERR_NOOPS;
587      return;
588    }
# Line 591 | Line 591 | chm_ban(struct Client *source_p, struct
591      return;
592  
593    mask = nuh_mask[*parn];
594 <  memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
594 >  strlcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
595    ++(*parn);
596  
597 <  if (!MyConnect(source_p))
598 <    if (strchr(mask, ' '))
599 <      return;
597 >  if (*mask == ':' || (!MyConnect(source_p) && strchr(mask, ' ')))
598 >    return;
599  
600    switch (dir)
601    {
# Line 635 | Line 634 | chm_except(struct Client *source_p, stru
634  
635      DLINK_FOREACH(node, chptr->exceptlist.head)
636      {
637 <      const struct Ban *banptr = node->data;
637 >      const struct Ban *ban = node->data;
638  
639        sendto_one_numeric(source_p, &me, RPL_EXCEPTLIST, chptr->name,
640 <                         banptr->name, banptr->user, banptr->host,
641 <                         banptr->who, banptr->when);
640 >                         ban->name, ban->user, ban->host,
641 >                         ban->who, ban->when);
642      }
643  
644      sendto_one_numeric(source_p, &me, RPL_ENDOFEXCEPTLIST, chptr->name);
# Line 652 | Line 651 | chm_except(struct Client *source_p, stru
651        sendto_one_numeric(source_p, &me,
652                           alev == CHACCESS_NOTONCHAN ? ERR_NOTONCHANNEL :
653                           ERR_CHANOPRIVSNEEDED, chptr->name);
654 +
655      *errors |= SM_ERR_NOOPS;
656      return;
657    }
# Line 660 | Line 660 | chm_except(struct Client *source_p, stru
660      return;
661  
662    mask = nuh_mask[*parn];
663 <  memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
663 >  strlcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
664    ++(*parn);
665  
666 <  if (!MyConnect(source_p))
667 <    if (strchr(mask, ' '))
668 <      return;
666 >  if (*mask == ':' || (!MyConnect(source_p) && strchr(mask, ' ')))
667 >    return;
668  
669    switch (dir)
670    {
# Line 704 | Line 703 | chm_invex(struct Client *source_p, struc
703  
704      DLINK_FOREACH(node, chptr->invexlist.head)
705      {
706 <      const struct Ban *banptr = node->data;
706 >      const struct Ban *ban = node->data;
707  
708        sendto_one_numeric(source_p, &me, RPL_INVEXLIST, chptr->name,
709 <                         banptr->name, banptr->user, banptr->host,
710 <                         banptr->who, banptr->when);
709 >                         ban->name, ban->user, ban->host,
710 >                         ban->who, ban->when);
711      }
712  
713      sendto_one_numeric(source_p, &me, RPL_ENDOFINVEXLIST, chptr->name);
# Line 721 | Line 720 | chm_invex(struct Client *source_p, struc
720        sendto_one_numeric(source_p, &me,
721                           alev == CHACCESS_NOTONCHAN ? ERR_NOTONCHANNEL :
722                           ERR_CHANOPRIVSNEEDED, chptr->name);
723 +
724      *errors |= SM_ERR_NOOPS;
725      return;
726    }
# Line 729 | Line 729 | chm_invex(struct Client *source_p, struc
729      return;
730  
731    mask = nuh_mask[*parn];
732 <  memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
732 >  strlcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
733    ++(*parn);
734  
735 <  if (!MyConnect(source_p))
736 <    if (strchr(mask, ' '))
737 <      return;
735 >  if (*mask == ':' || (!MyConnect(source_p) && strchr(mask, ' ')))
736 >    return;
737  
738    switch (dir)
739    {
# Line 769 | Line 768 | chm_voice(struct Client *source_p, struc
768        sendto_one_numeric(source_p, &me,
769                           alev == CHACCESS_NOTONCHAN ? ERR_NOTONCHANNEL :
770                           ERR_CHANOPRIVSNEEDED, chptr->name);
771 +
772      *errors |= SM_ERR_NOOPS;
773      return;
774    }
# Line 783 | Line 783 | chm_voice(struct Client *source_p, struc
783    {
784      if (!(*errors & SM_ERR_NOTONCHANNEL))
785        sendto_one_numeric(source_p, &me, ERR_USERNOTINCHANNEL, target_p->name, chptr->name);
786 +
787      *errors |= SM_ERR_NOTONCHANNEL;
788      return;
789    }
# Line 790 | Line 791 | chm_voice(struct Client *source_p, struc
791    if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
792      return;
793  
794 <  /* no redundant mode changes */
795 <  if (dir == MODE_ADD &&  has_member_flags(member, CHFL_VOICE))
796 <    return;
797 <  if (dir == MODE_DEL && !has_member_flags(member, CHFL_VOICE))
798 <    return;
794 >  switch (dir)
795 >  {
796 >    case MODE_ADD:
797 >      if (has_member_flags(member, CHFL_VOICE))
798 >        return;  /* No redundant mode changes */
799 >
800 >      AddMemberFlag(member, CHFL_VOICE);
801 >      break;
802 >    case MODE_DEL:
803 >      if (!has_member_flags(member, CHFL_VOICE))
804 >        return;  /* No redundant mode changes */
805 >
806 >      DelMemberFlag(member, CHFL_VOICE);
807 >      break;
808 >  }
809  
810    mode_changes[mode_count].letter = c;
811    mode_changes[mode_count].arg = target_p->name;
812    mode_changes[mode_count].id = target_p->id;
813    mode_changes[mode_count++].dir = dir;
803 –
804 –  if (dir == MODE_ADD)
805 –    AddMemberFlag(member, CHFL_VOICE);
806 –  else
807 –    DelMemberFlag(member, CHFL_VOICE);
814   }
815  
816   static void
# Line 820 | Line 826 | chm_hop(struct Client *source_p, struct
826        sendto_one_numeric(source_p, &me,
827                           alev == CHACCESS_NOTONCHAN ? ERR_NOTONCHANNEL :
828                           ERR_CHANOPRIVSNEEDED, chptr->name);
829 +
830      *errors |= SM_ERR_NOOPS;
831      return;
832    }
# Line 834 | Line 841 | chm_hop(struct Client *source_p, struct
841    {
842      if (!(*errors & SM_ERR_NOTONCHANNEL))
843        sendto_one_numeric(source_p, &me, ERR_USERNOTINCHANNEL, target_p->name, chptr->name);
844 +
845      *errors |= SM_ERR_NOTONCHANNEL;
846      return;
847    }
# Line 841 | Line 849 | chm_hop(struct Client *source_p, struct
849    if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
850      return;
851  
852 <  /* no redundant mode changes */
853 <  if (dir == MODE_ADD &&  has_member_flags(member, CHFL_HALFOP))
854 <    return;
855 <  if (dir == MODE_DEL && !has_member_flags(member, CHFL_HALFOP))
856 <    return;
852 >  switch (dir)
853 >  {
854 >    case MODE_ADD:
855 >      if (has_member_flags(member, CHFL_HALFOP))
856 >        return;  /* No redundant mode changes */
857 >
858 >      AddMemberFlag(member, CHFL_HALFOP);
859 >      break;
860 >    case MODE_DEL:
861 >      if (!has_member_flags(member, CHFL_HALFOP))
862 >        return;  /* No redundant mode changes */
863 >
864 >      DelMemberFlag(member, CHFL_HALFOP);
865 >      break;
866 >  }
867  
868    mode_changes[mode_count].letter = c;
869    mode_changes[mode_count].arg = target_p->name;
870    mode_changes[mode_count].id = target_p->id;
871    mode_changes[mode_count++].dir = dir;
854 –
855 –  if (dir == MODE_ADD)
856 –    AddMemberFlag(member, CHFL_HALFOP);
857 –  else
858 –    DelMemberFlag(member, CHFL_HALFOP);
872   }
873  
874   static void
# Line 871 | Line 884 | chm_op(struct Client *source_p, struct C
884        sendto_one_numeric(source_p, &me,
885                           alev == CHACCESS_NOTONCHAN ? ERR_NOTONCHANNEL :
886                           ERR_CHANOPRIVSNEEDED, chptr->name);
887 +
888      *errors |= SM_ERR_NOOPS;
889      return;
890    }
# Line 885 | Line 899 | chm_op(struct Client *source_p, struct C
899    {
900      if (!(*errors & SM_ERR_NOTONCHANNEL))
901        sendto_one_numeric(source_p, &me, ERR_USERNOTINCHANNEL, target_p->name, chptr->name);
902 +
903      *errors |= SM_ERR_NOTONCHANNEL;
904      return;
905    }
# Line 892 | Line 907 | chm_op(struct Client *source_p, struct C
907    if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
908      return;
909  
910 <  /* no redundant mode changes */
911 <  if (dir == MODE_ADD &&  has_member_flags(member, CHFL_CHANOP))
912 <    return;
913 <  if (dir == MODE_DEL && !has_member_flags(member, CHFL_CHANOP))
914 <    return;
910 >  switch (dir)
911 >  {
912 >    case MODE_ADD:
913 >      if (has_member_flags(member, CHFL_CHANOP))
914 >        return;  /* No redundant mode changes */
915 >
916 >      AddMemberFlag(member, CHFL_CHANOP);
917 >      break;
918 >    case MODE_DEL:
919 >      if (!has_member_flags(member, CHFL_CHANOP))
920 >        return;  /* No redundant mode changes */
921 >
922 >      DelMemberFlag(member, CHFL_CHANOP);
923 >      break;
924 >  }
925  
926    mode_changes[mode_count].letter = c;
927    mode_changes[mode_count].arg = target_p->name;
928    mode_changes[mode_count].id = target_p->id;
929    mode_changes[mode_count++].dir = dir;
905 –
906 –  if (dir == MODE_ADD)
907 –    AddMemberFlag(member, CHFL_CHANOP);
908 –  else
909 –    DelMemberFlag(member, CHFL_CHANOP);
930   }
931  
932   static void
933   chm_limit(struct Client *source_p, struct Channel *chptr, int parc, int *parn,
934            char **parv, int *errors, int alev, int dir, char c, unsigned int d)
935   {
916 –  int limit = 0;
917 –
936    if (alev < CHACCESS_HALFOP)
937    {
938      if (!(*errors & SM_ERR_NOOPS))
# Line 930 | Line 948 | chm_limit(struct Client *source_p, struc
948  
949    if (dir == MODE_ADD && parc > *parn)
950    {
951 <    char *lstr = parv[(*parn)++];
951 >    char *const lstr = parv[(*parn)++];
952 >    int limit = 0;
953  
954      if (EmptyString(lstr) || (limit = atoi(lstr)) <= 0)
955        return;
# Line 982 | Line 1001 | chm_key(struct Client *source_p, struct
1001  
1002    if (dir == MODE_ADD && parc > *parn)
1003    {
1004 <    char *key = fix_key(parv[(*parn)++]);
1004 >    char *const key = fix_key(parv[(*parn)++]);
1005  
1006      if (EmptyString(key))
1007        return;
# Line 1086 | Line 1105 | const struct ChannelMode ModeTable[256]
1105    { chm_nosuch,  0 },                   /* @ */
1106    { chm_nosuch,  0 },                   /* A */
1107    { chm_nosuch,  0 },                   /* B */
1108 <  { chm_nosuch,  0 },                   /* C */
1108 >  { chm_simple,  MODE_NOCTCP },         /* C */
1109    { chm_nosuch,  0 },                   /* D */
1110    { chm_nosuch,  0 },                   /* E */
1111    { chm_nosuch,  0 },                   /* F */
# Line 1103 | Line 1122 | const struct ChannelMode ModeTable[256]
1122    { chm_nosuch,  0 },                   /* Q */
1123    { chm_simple, MODE_REGONLY},          /* R */
1124    { chm_simple, MODE_SSLONLY},          /* S */
1125 <  { chm_nosuch,  0 },                   /* T */
1125 >  { chm_simple, MODE_NONOTICE},         /* T */
1126    { chm_nosuch,  0 },                   /* U */
1127    { chm_nosuch,  0 },                   /* V */
1128    { chm_nosuch,  0 },                   /* W */
# Line 1327 | Line 1346 | send_mode_changes_server(struct Client *
1346    parabuf[0] = '\0';
1347    parptr = parabuf;
1348  
1349 <  mbl = snprintf(modebuf, sizeof(modebuf), ":%s TMODE %lu %s ", source_p->id,
1350 <                 (unsigned long)chptr->channelts, chptr->name);
1349 >  mbl = snprintf(modebuf, sizeof(modebuf), ":%s TMODE %ju %s ", source_p->id,
1350 >                 chptr->creationtime, chptr->name);
1351  
1352    /* Loop the list of modes we have */
1353 <  for (unsigned i = 0; i < mode_count; ++i)
1353 >  for (unsigned int i = 0; i < mode_count; ++i)
1354    {
1355      if (mode_changes[i].letter == 0)
1356        continue;
# Line 1355 | Line 1374 | send_mode_changes_server(struct Client *
1374          (pbl + arglen + BAN_FUDGE) >= MODEBUFLEN)
1375      {
1376        if (nc)
1377 <        sendto_server(source_p, NOCAPS, NOCAPS, "%s %s", modebuf, parabuf);
1377 >        sendto_server(source_p, 0, 0, "%s %s", modebuf, parabuf);
1378  
1379        nc = 0;
1380        mc = 0;
1381  
1382 <      mbl = snprintf(modebuf, sizeof(modebuf), ":%s TMODE %lu %s ", source_p->id,
1383 <                     (unsigned long)chptr->channelts, chptr->name);
1382 >      mbl = snprintf(modebuf, sizeof(modebuf), ":%s TMODE %ju %s ", source_p->id,
1383 >                     chptr->creationtime, chptr->name);
1384  
1385        pbl = 0;
1386        parabuf[0] = '\0';
# Line 1392 | Line 1411 | send_mode_changes_server(struct Client *
1411      parabuf[pbl - 1] = '\0';
1412  
1413    if (nc)
1414 <    sendto_server(source_p, NOCAPS, NOCAPS, "%s %s", modebuf, parabuf);
1414 >    sendto_server(source_p, 0, 0, "%s %s", modebuf, parabuf);
1415   }
1416  
1417   /* void send_mode_changes(struct Client *client_p,
# Line 1407 | Line 1426 | send_mode_changes_server(struct Client *
1426   */
1427   /* ensure parabuf < MODEBUFLEN -db */
1428   static void
1429 < send_mode_changes(struct Client *source_p, struct Channel *chptr)
1429 > send_mode_changes_client(struct Client *source_p, struct Channel *chptr)
1430   {
1431    int mbl = 0, pbl = 0, arglen = 0, nc = 0, mc = 0;
1432    int len = 0;
# Line 1415 | Line 1434 | send_mode_changes(struct Client *source_
1434    const char *arg = NULL;
1435    char *parptr = NULL;
1436  
1418 –  /* Bail out if we have nothing to do... */
1419 –  if (!mode_count)
1420 –    return;
1421 –
1437    if (IsServer(source_p))
1438      mbl = snprintf(modebuf, sizeof(modebuf), ":%s MODE %s ", (IsHidden(source_p) ||
1439                     ConfigServerHide.hide_servers) ?
# Line 1449 | Line 1464 | send_mode_changes(struct Client *source_
1464          modebuf[mbl - 1] = '\0';
1465  
1466        if (nc)
1467 <        sendto_channel_local(0, chptr, "%s %s", modebuf, parabuf);
1467 >        sendto_channel_local(NULL, chptr, 0, 0, 0, "%s %s", modebuf, parabuf);
1468  
1469        nc = 0;
1470        mc = 0;
# Line 1491 | Line 1506 | send_mode_changes(struct Client *source_
1506      parabuf[pbl - 1] = '\0';
1507  
1508    if (nc)
1509 <    sendto_channel_local(0, chptr, "%s %s", modebuf, parabuf);
1495 <
1496 <  send_mode_changes_server(source_p, chptr);
1509 >    sendto_channel_local(NULL, chptr, 0, 0, 0, "%s %s", modebuf, parabuf);
1510   }
1511  
1512   /*
# Line 1543 | Line 1556 | set_channel_mode(struct Client *source_p
1556      }
1557    }
1558  
1559 <  send_mode_changes(source_p, chptr);
1559 >  /* Bail out if we have nothing to do... */
1560 >  if (!mode_count)
1561 >    return;
1562 >
1563 >  send_mode_changes_client(source_p, chptr);
1564 >  send_mode_changes_server(source_p, chptr);
1565   }

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)