ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/core/m_sjoin.c
(Generate patch)

Comparing ircd-hybrid/branches/8.2.x/modules/core/m_sjoin.c (file contents):
Revision 8633 by michael, Sat Nov 3 21:24:56 2018 UTC vs.
Revision 8636 by michael, Sat Nov 3 21:53:30 2018 UTC

# Line 217 | Line 217 | ms_sjoin(struct Client *source_p, int pa
217  
218      remove_our_modes(chptr, source_p);
219  
220 <    if (dlink_list_length(&chptr->banlist))
221 <      remove_ban_list(chptr, source_p, &chptr->banlist, 'b');
222 <
223 <    if (dlink_list_length(&chptr->exceptlist))
224 <      remove_ban_list(chptr, source_p, &chptr->exceptlist, 'e');
225 <
226 <    if (dlink_list_length(&chptr->invexlist))
227 <      remove_ban_list(chptr, source_p, &chptr->invexlist, 'I');
220 >    remove_ban_list(chptr, source_p, &chptr->banlist, 'b');
221 >    remove_ban_list(chptr, source_p, &chptr->exceptlist, 'e');
222 >    remove_ban_list(chptr, source_p, &chptr->invexlist, 'I');
223  
224      clear_ban_cache_list(&chptr->members_local);
225      clear_invite_list(&chptr->invites);
# Line 696 | Line 691 | remove_a_mode(struct Channel *chptr, str
691   * side effects - given ban list is removed, modes are sent to local clients
692   */
693   static void
694 < remove_ban_list(struct Channel *chptr, struct Client *source_p,
700 <                dlink_list *list, char c)
694 > remove_ban_list(struct Channel *chptr, struct Client *source_p, dlink_list *list, char c)
695   {
696 <  char lmodebuf[MODEBUFLEN];
697 <  char lparabuf[IRCD_BUFSIZE];
698 <  dlink_node *node = NULL, *node_next = NULL;
696 >  dlink_node *node, *node_next;
697 >  char modebuf[IRCD_BUFSIZE];
698 >  char parabuf[IRCD_BUFSIZE];
699    char *mbuf;
700    char *pbuf;
701    int count = 0;
702 <  int cur_len, mlen, plen;
702 >  int cur_len, mlen;
703  
704 <  pbuf = lparabuf;
705 <  cur_len = mlen = snprintf(lmodebuf, sizeof(lmodebuf), ":%s MODE %s -",
704 >  if (dlink_list_length(list) == 0)
705 >    return;
706 >
707 >  cur_len = mlen = snprintf(modebuf, sizeof(modebuf), ":%s MODE %s -",
708                              source_p->name, chptr->name);
709 <  mbuf = lmodebuf + mlen;
709 >  mbuf = modebuf + mlen;
710 >  pbuf = parabuf;
711  
712    DLINK_FOREACH_SAFE(node, node_next, list->head)
713    {
714      struct Ban *ban = node->data;
715 <
719 <    plen = ban->len + 4;  /* another +b and "!@ " */
715 >    int plen = ban->len + 4;  /* another +b and "!@ " */
716  
717      if (count >= MAXMODEPARAMS ||
718          (cur_len + 1 /* space between */ + (plen - 1)) > IRCD_BUFSIZE - 2)
719      {
720        /* NUL-terminate and remove trailing space */
721        *mbuf = *(pbuf - 1) = '\0';
722 <      sendto_channel_local(NULL, chptr, 0, 0, 0, "%s %s", lmodebuf, lparabuf);
722 >      sendto_channel_local(NULL, chptr, 0, 0, 0, "%s %s", modebuf, parabuf);
723 >
724        cur_len = mlen;
725 <      mbuf = lmodebuf + mlen;
726 <      pbuf = lparabuf;
725 >      mbuf = modebuf + mlen;
726 >      pbuf = parabuf;
727        count = 0;
728      }
729  
# Line 739 | Line 736 | remove_ban_list(struct Channel *chptr, s
736    }
737  
738    *mbuf = *(pbuf - 1) = '\0';
739 <  sendto_channel_local(NULL, chptr, 0, 0, 0, "%s %s", lmodebuf, lparabuf);
739 >  sendto_channel_local(NULL, chptr, 0, 0, 0, "%s %s", modebuf, parabuf);
740   }
741  
742   static struct Message sjoin_msgtab =

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines