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

Comparing ircd-hybrid/trunk/src/channel.c (file contents):
Revision 3944 by michael, Mon Jun 16 18:04:03 2014 UTC vs.
Revision 4792 by michael, Tue Oct 28 12:44:43 2014 UTC

# Line 15 | Line 15
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
18 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19   *  USA
20   */
21  
# Line 47 | Line 47
47   dlink_list channel_list;
48   mp_pool_t *ban_pool;    /*! \todo ban_pool shouldn't be a global var */
49  
50 + struct event splitmode_event =
51 + {
52 +  .name = "check_splitmode",
53 +  .handler = check_splitmode,
54 +  .when = 5
55 + };
56 +
57   static mp_pool_t *member_pool, *channel_pool;
51 – static char buf[IRCD_BUFSIZE];
58  
59  
60   /*! \brief Initializes the channel blockheap, adds known channel CAPAB
# Line 101 | Line 107 | add_user_to_channel(struct Channel *chpt
107          sendto_realops_flags(UMODE_BOTS, L_ALL, SEND_NOTICE,
108                               "Possible Join Flooder %s on %s target: %s",
109                               get_client_name(who, HIDE_IP),
110 <                             who->servptr->name, chptr->chname);
110 >                             who->servptr->name, chptr->name);
111        }
112      }
113  
# Line 109 | Line 115 | add_user_to_channel(struct Channel *chpt
115    }
116  
117    ms = mp_pool_get(member_pool);
112 –  memset(ms, 0, sizeof(*ms));
113 –
118    ms->client_p = who;
119    ms->chptr = chptr;
120    ms->flags = flags;
121  
122    dlinkAdd(ms, &ms->channode, &chptr->members);
123 +
124 +  if (MyConnect(who))
125 +    dlinkAdd(ms, &ms->locchannode, &chptr->locmembers);
126 +
127    dlinkAdd(ms, &ms->usernode, &who->channel);
128   }
129  
# Line 130 | Line 138 | remove_user_from_channel(struct Membersh
138    struct Channel *chptr = member->chptr;
139  
140    dlinkDelete(&member->channode, &chptr->members);
141 +
142 +  if (MyConnect(client_p))
143 +    dlinkDelete(&member->locchannode, &chptr->locmembers);
144 +
145    dlinkDelete(&member->usernode, &client_p->channel);
146  
147    mp_pool_release(member);
# Line 145 | Line 157 | remove_user_from_channel(struct Membersh
157   * side effects -
158   */
159   static void
160 < send_members(struct Client *client_p, struct Channel *chptr,
160 > send_members(struct Client *client_p, const struct Channel *chptr,
161               char *modebuf, char *parabuf)
162   {
163 +  char buf[IRCD_BUFSIZE] = "";
164    const dlink_node *ptr = NULL;
165    int tlen;              /* length of text to append */
166    char *t, *start;       /* temp char pointer */
167  
168    start = t = buf + snprintf(buf, sizeof(buf), ":%s SJOIN %lu %s %s %s:",
169                               me.id, (unsigned long)chptr->channelts,
170 <                             chptr->chname, modebuf, parabuf);
170 >                             chptr->name, modebuf, parabuf);
171  
172    DLINK_FOREACH(ptr, chptr->members.head)
173    {
174      const struct Membership *ms = ptr->data;
175  
176 <    tlen = strlen(ms->client_p->id) + 1;  /* nick + space */
176 >    tlen = strlen(ms->client_p->id) + 1;  /* +1 for space */
177  
178      if (ms->flags & CHFL_CHANOP)
179        ++tlen;
# Line 203 | Line 216 | send_members(struct Client *client_p, st
216   /*! \brief Sends +b/+e/+I
217   * \param client_p Client pointer to server
218   * \param chptr    Pointer to channel
219 < * \param top      Pointer to top of mode link list to send
219 > * \param list     Pointer to list of modes to send
220   * \param flag     Char flag flagging type of mode. Currently this can be 'b', e' or 'I'
221   */
222   static void
223 < send_mode_list(struct Client *client_p, struct Channel *chptr,
224 <               const dlink_list *top, char flag)
223 > send_mode_list(struct Client *client_p, const struct Channel *chptr,
224 >               const dlink_list *list, const char flag)
225   {
226    const dlink_node *ptr = NULL;
227 +  char mbuf[IRCD_BUFSIZE] = "";
228    char pbuf[IRCD_BUFSIZE] = "";
229    int tlen, mlen, cur_len;
230    char *pp = pbuf;
231  
232 <  if (top->length == 0)
232 >  if (list->length == 0)
233      return;
234  
235 <  mlen = snprintf(buf, sizeof(buf), ":%s BMASK %lu %s %c :", me.id,
236 <                  (unsigned long)chptr->channelts, chptr->chname, flag);
235 >  mlen = snprintf(mbuf, sizeof(mbuf), ":%s BMASK %lu %s %c :", me.id,
236 >                  (unsigned long)chptr->channelts, chptr->name, flag);
237    cur_len = mlen;
238  
239 <  DLINK_FOREACH(ptr, top->head)
239 >  DLINK_FOREACH(ptr, list->head)
240    {
241      const struct Ban *banptr = ptr->data;
242  
243 <    tlen = banptr->len + 3;
243 >    tlen = banptr->len + 3;  /* +3 for ! + @ + space */
244  
245      /*
246 <     * Send buffer and start over if we cannot fit another ban,
233 <     * or if the target is non-ts6 and we have too many modes in
234 <     * in this line.
246 >     * Send buffer and start over if we cannot fit another ban
247       */
248      if (cur_len + (tlen - 1) > IRCD_BUFSIZE - 2)
249      {
250        *(pp - 1) = '\0';  /* Get rid of trailing space on buffer */
251 <      sendto_one(client_p, "%s%s", buf, pbuf);
251 >      sendto_one(client_p, "%s%s", mbuf, pbuf);
252  
253        cur_len = mlen;
254        pp = pbuf;
# Line 248 | Line 260 | send_mode_list(struct Client *client_p,
260    }
261  
262    *(pp - 1) = '\0';  /* Get rid of trailing space on buffer */
263 <  sendto_one(client_p, "%s%s", buf, pbuf);
263 >  sendto_one(client_p, "%s%s", mbuf, pbuf);
264   }
265  
266   /*! \brief Send "client_p" a full list of the modes for channel chptr
# Line 330 | Line 342 | free_channel_list(dlink_list *list)
342    assert(list->tail == NULL && list->head == NULL);
343   }
344  
345 < /*! \brief Get Channel block for chname (and allocate a new channel
345 > /*! \brief Get Channel block for name (and allocate a new channel
346   *         block, if it didn't exist before)
347 < * \param chname Channel name
347 > * \param name Channel name
348   * \return Channel block
349   */
350   struct Channel *
351 < make_channel(const char *chname)
351 > make_channel(const char *name)
352   {
353    struct Channel *chptr = NULL;
354  
355 <  assert(!EmptyString(chname));
355 >  assert(!EmptyString(name));
356  
357    chptr = mp_pool_get(channel_pool);
358  
347 –  memset(chptr, 0, sizeof(*chptr));
348 –
359    /* Doesn't hurt to set it here */
360    chptr->channelts = CurrentTime;
361    chptr->last_join_time = CurrentTime;
362  
363 <  strlcpy(chptr->chname, chname, sizeof(chptr->chname));
363 >  strlcpy(chptr->name, name, sizeof(chptr->name));
364    dlinkAdd(chptr, &chptr->node, &channel_list);
365  
366    hash_add_channel(chptr);
# Line 405 | Line 415 | channel_member_names(struct Client *sour
415                       int show_eon)
416   {
417    const dlink_node *ptr = NULL;
418 <  char lbuf[IRCD_BUFSIZE + 1] = "";
418 >  char buf[IRCD_BUFSIZE + 1] = "";
419    char *t = NULL, *start = NULL;
420    int tlen = 0;
421    int is_member = IsMember(source_p, chptr);
# Line 414 | Line 424 | channel_member_names(struct Client *sour
424  
425    if (PubChannel(chptr) || is_member)
426    {
427 <    t = lbuf + snprintf(lbuf, sizeof(lbuf), numeric_form(RPL_NAMREPLY),
428 <                        me.name, source_p->name,
429 <                        channel_pub_or_secret(chptr), chptr->chname);
427 >    t = buf + snprintf(buf, sizeof(buf), numeric_form(RPL_NAMREPLY),
428 >                       me.name, source_p->name,
429 >                       channel_pub_or_secret(chptr), chptr->name);
430      start = t;
431  
432      DLINK_FOREACH(ptr, chptr->members.head)
# Line 427 | Line 437 | channel_member_names(struct Client *sour
437          continue;
438  
439        if (!uhnames)
440 <        tlen = strlen(ms->client_p->name) + 1;  /* nick + space */
440 >        tlen = strlen(ms->client_p->name) + 1;  /* +1 for space */
441        else
442          tlen = strlen(ms->client_p->name) + strlen(ms->client_p->username) +
443 <               strlen(ms->client_p->host) + 3;
443 >               strlen(ms->client_p->host) + 3;  /* +3 for ! + @ + space */
444  
445        if (!multi_prefix)
446        {
# Line 447 | Line 457 | channel_member_names(struct Client *sour
457            ++tlen;
458        }
459  
460 <      if (t + tlen - lbuf > IRCD_BUFSIZE - 2)
460 >      if (t + tlen - buf > IRCD_BUFSIZE - 2)
461        {
462          *(t - 1) = '\0';
463 <        sendto_one(source_p, "%s", lbuf);
463 >        sendto_one(source_p, "%s", buf);
464          t = start;
465        }
466  
# Line 466 | Line 476 | channel_member_names(struct Client *sour
476      if (tlen)
477      {
478        *(t - 1) = '\0';
479 <      sendto_one(source_p, "%s", lbuf);
479 >      sendto_one(source_p, "%s", buf);
480      }
481    }
482  
483    if (show_eon)
484 <    sendto_one_numeric(source_p, &me, RPL_ENDOFNAMES, chptr->chname);
484 >    sendto_one_numeric(source_p, &me, RPL_ENDOFNAMES, chptr->name);
485   }
486  
487   /*! \brief Adds client to invite list
# Line 486 | Line 496 | add_invite(struct Channel *chptr, struct
496    /*
497     * Delete last link in chain if the list is max length
498     */
499 <  if (dlink_list_length(&who->localClient->invited) >=
499 >  if (dlink_list_length(&who->connection->invited) >=
500        ConfigChannel.max_channels)
501 <    del_invite(who->localClient->invited.tail->data, who);
501 >    del_invite(who->connection->invited.tail->data, who);
502  
503    /* Add client to channel invite list */
504    dlinkAdd(who, make_dlink_node(), &chptr->invites);
505  
506    /* Add channel to the end of the client invite list */
507 <  dlinkAdd(chptr, make_dlink_node(), &who->localClient->invited);
507 >  dlinkAdd(chptr, make_dlink_node(), &who->connection->invited);
508   }
509  
510   /*! \brief Delete Invite block from channel invite list
# Line 507 | Line 517 | del_invite(struct Channel *chptr, struct
517   {
518    dlink_node *ptr = NULL;
519  
520 <  if ((ptr = dlinkFindDelete(&who->localClient->invited, chptr)))
520 >  if ((ptr = dlinkFindDelete(&who->connection->invited, chptr)))
521      free_dlink_node(ptr);
522  
523    if ((ptr = dlinkFindDelete(&chptr->invites, who)))
# Line 528 | Line 538 | del_invite(struct Channel *chptr, struct
538   const char *
539   get_member_status(const struct Membership *ms, const int combine)
540   {
541 <  static char buffer[4];
541 >  static char buffer[4];  /* 4 for @%+\0 */
542    char *p = buffer;
543  
544    if (ms->flags & CHFL_CHANOP)
# Line 576 | Line 586 | find_bmask(const struct Client *who, con
586              return 1;
587            break;
588          case HM_IPV4:
589 <          if (who->localClient->aftype == AF_INET)
590 <            if (match_ipv4(&who->localClient->ip, &bp->addr, bp->bits))
589 >          if (who->connection->aftype == AF_INET)
590 >            if (match_ipv4(&who->connection->ip, &bp->addr, bp->bits))
591                return 1;
592            break;
583 – #ifdef IPV6
593          case HM_IPV6:
594 <          if (who->localClient->aftype == AF_INET6)
595 <            if (match_ipv6(&who->localClient->ip, &bp->addr, bp->bits))
594 >          if (who->connection->aftype == AF_INET6)
595 >            if (match_ipv6(&who->connection->ip, &bp->addr, bp->bits))
596                return 1;
597            break;
589 – #endif
598          default:
599            assert(0);
600        }
# Line 619 | Line 627 | is_banned(const struct Channel *chptr, c
627   *         or 0 if allowed to join.
628   */
629   int
630 < can_join(struct Client *source_p, struct Channel *chptr, const char *key)
630 > can_join(struct Client *source_p, const struct Channel *chptr, const char *key)
631   {
632    if ((chptr->mode.mode & MODE_SSLONLY) && !HasUMode(source_p, UMODE_SSL))
633      return ERR_SSLONLYCHAN;
# Line 631 | Line 639 | can_join(struct Client *source_p, struct
639      return ERR_OPERONLYCHAN;
640  
641    if (chptr->mode.mode & MODE_INVITEONLY)
642 <    if (!dlinkFind(&source_p->localClient->invited, chptr))
642 >    if (!dlinkFind(&source_p->connection->invited, chptr))
643        if (!find_bmask(source_p, &chptr->invexlist))
644          return ERR_INVITEONLYCHAN;
645  
# Line 678 | Line 686 | find_channel_link(struct Client *client_
686    return NULL;
687   }
688  
689 < /*! Tests if a client can send to a channel
689 > /*! Checks if a message contains control codes
690   * \param message The actual message string the client wants to send
691   * \return 1 if the message does contain any control codes, 0 otherwise
692   */
# Line 690 | Line 698 | msg_has_ctrls(const char *message)
698    for (; *p; ++p)
699    {
700      if (*p > 31 || *p == 1)
701 <      continue;  /* CTCP or no control code */
701 >      continue;  /* No control code or CTCP */
702  
703      if (*p == 27)  /* Escape */
704      {
# Line 706 | Line 714 | msg_has_ctrls(const char *message)
714      return 1;  /* Control code */
715    }
716  
717 <  return 0;
717 >  return 0;  /* No control code found */
718   }
719  
720   /*! Tests if a client can send to a channel
# Line 722 | Line 730 | int
730   can_send(struct Channel *chptr, struct Client *source_p,
731           struct Membership *ms, const char *message)
732   {
733 <  struct MaskItem *conf = NULL;
733 >  const struct MaskItem *conf = NULL;
734  
735    if (IsServer(source_p) || HasFlag(source_p, FLAGS_SERVICE))
736      return CAN_SEND_OPV;
737  
738    if (MyClient(source_p) && !IsExemptResv(source_p))
739 <    if (!(HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.oper_pass_resv))
740 <      if ((conf = match_find_resv(chptr->chname)) && !resv_find_exempt(source_p, conf))
739 >    if (!(HasUMode(source_p, UMODE_OPER) && ConfigGeneral.oper_pass_resv))
740 >      if ((conf = match_find_resv(chptr->name)) && !resv_find_exempt(source_p, conf))
741          return ERR_CANNOTSENDTOCHAN;
742  
743    if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(message))
# Line 783 | Line 791 | check_spambot_warning(struct Client *sou
791    int decrement_count = 0;
792  
793    if ((GlobalSetOptions.spam_num &&
794 <       (source_p->localClient->join_leave_count >=
794 >       (source_p->connection->join_leave_count >=
795          GlobalSetOptions.spam_num)))
796    {
797 <    if (source_p->localClient->oper_warn_count_down > 0)
798 <      source_p->localClient->oper_warn_count_down--;
797 >    if (source_p->connection->oper_warn_count_down > 0)
798 >      source_p->connection->oper_warn_count_down--;
799      else
800 <      source_p->localClient->oper_warn_count_down = 0;
800 >      source_p->connection->oper_warn_count_down = 0;
801  
802 <    if (source_p->localClient->oper_warn_count_down == 0)
802 >    if (source_p->connection->oper_warn_count_down == 0)
803      {
804        /* It's already known as a possible spambot */
805        if (name)
# Line 804 | Line 812 | check_spambot_warning(struct Client *sou
812                               "User %s (%s@%s) is a possible spambot",
813                               source_p->name, source_p->username,
814                               source_p->host);
815 <      source_p->localClient->oper_warn_count_down = OPER_SPAM_COUNTDOWN;
815 >      source_p->connection->oper_warn_count_down = OPER_SPAM_COUNTDOWN;
816      }
817    }
818    else
819    {
820 <    if ((t_delta = (CurrentTime - source_p->localClient->last_leave_time)) >
820 >    if ((t_delta = (CurrentTime - source_p->connection->last_leave_time)) >
821           JOIN_LEAVE_COUNT_EXPIRE_TIME)
822      {
823        decrement_count = (t_delta / JOIN_LEAVE_COUNT_EXPIRE_TIME);
824 <      if (decrement_count > source_p->localClient->join_leave_count)
825 <        source_p->localClient->join_leave_count = 0;
824 >      if (decrement_count > source_p->connection->join_leave_count)
825 >        source_p->connection->join_leave_count = 0;
826        else
827 <        source_p->localClient->join_leave_count -= decrement_count;
827 >        source_p->connection->join_leave_count -= decrement_count;
828      }
829      else
830      {
831 <      if ((CurrentTime - (source_p->localClient->last_join_time)) <
831 >      if ((CurrentTime - (source_p->connection->last_join_time)) <
832            GlobalSetOptions.spam_time)
833 <        source_p->localClient->join_leave_count++;  /* It's a possible spambot */
833 >        source_p->connection->join_leave_count++;  /* It's a possible spambot */
834      }
835  
836      if (name)
837 <      source_p->localClient->last_join_time = CurrentTime;
837 >      source_p->connection->last_join_time = CurrentTime;
838      else
839 <      source_p->localClient->last_leave_time = CurrentTime;
839 >      source_p->connection->last_leave_time = CurrentTime;
840    }
841   }
842  
# Line 842 | Line 850 | check_splitmode(void *unused)
850    if (splitchecking && (ConfigChannel.no_join_on_split ||
851                          ConfigChannel.no_create_on_split))
852    {
853 <    const unsigned int server = dlink_list_length(&global_serv_list);
853 >    const unsigned int server = dlink_list_length(&global_server_list);
854  
855      if (!splitmode && ((server < split_servers) || (Count.total < split_users)))
856      {
# Line 850 | Line 858 | check_splitmode(void *unused)
858  
859        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
860                             "Network split, activating splitmode");
861 <      eventAddIsh("check_splitmode", check_splitmode, NULL, 10);
861 >      event_add(&splitmode_event, NULL);
862      }
863 <    else if (splitmode && (server > split_servers) && (Count.total > split_users))
863 >    else if (splitmode && (server >= split_servers) && (Count.total >= split_users))
864      {
865        splitmode = 0;
866  
867        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
868                             "Network rejoined, deactivating splitmode");
869 <      eventDelete(check_splitmode, NULL);
869 >      event_delete(&splitmode_event);
870      }
871    }
872   }
# Line 875 | Line 883 | channel_set_topic(struct Channel *chptr,
883                    const char *topic_info, time_t topicts, int local)
884   {
885    if (local)
886 <    strlcpy(chptr->topic, topic, IRCD_MIN(sizeof(chptr->topic), ServerInfo.max_topic_length + 1));
886 >    strlcpy(chptr->topic, topic, IRCD_MIN(sizeof(chptr->topic), ConfigServerInfo.max_topic_length + 1));
887    else
888      strlcpy(chptr->topic, topic, sizeof(chptr->topic));
889  
# Line 906 | Line 914 | channel_do_join_0(struct Client *source_
914      struct Channel *chptr = ((struct Membership *)ptr->data)->chptr;
915  
916      sendto_server(source_p, NOCAPS, NOCAPS, ":%s PART %s",
917 <                  source_p->id, chptr->chname);
917 >                  source_p->id, chptr->name);
918      sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s PART %s",
919                           source_p->name, source_p->username,
920 <                         source_p->host, chptr->chname);
920 >                         source_p->host, chptr->name);
921  
922      remove_user_from_channel(ptr->data);
923    }
# Line 924 | Line 932 | channel_find_last0(struct Client *source
932    {
933      if (*p == '0' && (*(p + 1) == ',' || *(p + 1) == '\0'))
934      {
935 <      if ((*p + 1) == ',')
935 >      if (*(p + 1) == ',')
936          ++p;
937  
938        chanlist = p + 1;
# Line 954 | Line 962 | channel_do_join(struct Client *source_p,
962    char *chan_list = NULL;
963    struct Channel *chptr = NULL;
964    struct MaskItem *conf = NULL;
965 <  const struct ClassItem *class = get_class_ptr(&source_p->localClient->confs);
965 >  const struct ClassItem *const class = get_class_ptr(&source_p->connection->confs);
966    int i = 0;
967    unsigned int flags = 0;
968  
# Line 980 | Line 988 | channel_do_join(struct Client *source_p,
988      }
989  
990      if (!IsExemptResv(source_p) &&
991 <        !(HasUMode(source_p, UMODE_OPER) && ConfigFileEntry.oper_pass_resv) &&
991 >        !(HasUMode(source_p, UMODE_OPER) && ConfigGeneral.oper_pass_resv) &&
992          ((conf = match_find_resv(chan)) && !resv_find_exempt(source_p, conf)))
993      {
994        ++conf->count;
995        sendto_one_numeric(source_p, &me, ERR_CHANBANREASON,
996                           chan, conf->reason ? conf->reason : "Reserved channel");
997 <      sendto_realops_flags(UMODE_SPY, L_ALL, SEND_NOTICE,
997 >      sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE,
998                             "Forbidding reserved channel %s from user %s",
999                             chan, get_client_name(source_p, HIDE_IP));
1000        continue;
# Line 1007 | Line 1015 | channel_do_join(struct Client *source_p,
1015        if (splitmode && !HasUMode(source_p, UMODE_OPER) &&
1016            ConfigChannel.no_join_on_split)
1017        {
1018 <        sendto_one_numeric(source_p, &me, ERR_UNAVAILRESOURCE, chptr->chname);
1018 >        sendto_one_numeric(source_p, &me, ERR_UNAVAILRESOURCE, chptr->name);
1019          continue;
1020        }
1021  
# Line 1016 | Line 1024 | channel_do_join(struct Client *source_p,
1024         */
1025        if ((i = can_join(source_p, chptr, key)))
1026        {
1027 <        sendto_one_numeric(source_p, &me, i, chptr->chname);
1027 >        sendto_one_numeric(source_p, &me, i, chptr->name);
1028          continue;
1029        }
1030  
# Line 1043 | Line 1051 | channel_do_join(struct Client *source_p,
1051      }
1052  
1053      if (!HasUMode(source_p, UMODE_OPER))
1054 <      check_spambot_warning(source_p, chptr->chname);
1054 >      check_spambot_warning(source_p, chptr->name);
1055  
1056      add_user_to_channel(chptr, source_p, flags, 1);
1057  
# Line 1058 | Line 1066 | channel_do_join(struct Client *source_p,
1066  
1067        sendto_server(source_p, NOCAPS, NOCAPS, ":%s SJOIN %lu %s +nt :@%s",
1068                      me.id, (unsigned long)chptr->channelts,
1069 <                    chptr->chname, source_p->id);
1069 >                    chptr->name, source_p->id);
1070  
1071        /*
1072         * Notify all other users on the new channel
1073         */
1074 <      sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s JOIN :%s",
1075 <                           source_p->name, source_p->username,
1076 <                           source_p->host, chptr->chname);
1074 >      sendto_channel_local_butone(NULL, CAP_EXTENDED_JOIN, 0, chptr, ":%s!%s@%s JOIN %s %s :%s",
1075 >                                  source_p->name, source_p->username,
1076 >                                  source_p->host, chptr->name,
1077 >                                  (!IsDigit(source_p->svid[0]) && source_p->svid[0] != '*') ? source_p->svid : "*",
1078 >                                  source_p->info);
1079 >      sendto_channel_local_butone(NULL, 0, CAP_EXTENDED_JOIN, chptr, ":%s!%s@%s JOIN :%s",
1080 >                                  source_p->name, source_p->username,
1081 >                                  source_p->host, chptr->name);
1082        sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s +nt",
1083 <                           me.name, chptr->chname);
1083 >                           me.name, chptr->name);
1084  
1085        if (source_p->away[0])
1086 <        sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, chptr,
1086 >        sendto_channel_local_butone(source_p, CAP_AWAY_NOTIFY, 0, chptr,
1087                                      ":%s!%s@%s AWAY :%s",
1088                                      source_p->name, source_p->username,
1089                                      source_p->host, source_p->away);
# Line 1079 | Line 1092 | channel_do_join(struct Client *source_p,
1092      {
1093        sendto_server(source_p, NOCAPS, NOCAPS, ":%s JOIN %lu %s +",
1094                      source_p->id, (unsigned long)chptr->channelts,
1095 <                    chptr->chname);
1096 <      sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s JOIN :%s",
1097 <                           source_p->name, source_p->username,
1098 <                           source_p->host, chptr->chname);
1095 >                    chptr->name);
1096 >
1097 >      sendto_channel_local_butone(NULL, CAP_EXTENDED_JOIN, 0, chptr, ":%s!%s@%s JOIN %s %s :%s",
1098 >                                  source_p->name, source_p->username,
1099 >                                  source_p->host, chptr->name,
1100 >                                  (!IsDigit(source_p->svid[0]) && source_p->svid[0] != '*') ? source_p->svid : "*",
1101 >                                  source_p->info);
1102 >      sendto_channel_local_butone(NULL, 0, CAP_EXTENDED_JOIN, chptr, ":%s!%s@%s JOIN :%s",
1103 >                                  source_p->name, source_p->username,
1104 >                                  source_p->host, chptr->name);
1105  
1106        if (source_p->away[0])
1107 <        sendto_channel_local_butone(source_p, 0, CAP_AWAY_NOTIFY, chptr,
1107 >        sendto_channel_local_butone(source_p, CAP_AWAY_NOTIFY, 0, chptr,
1108                                      ":%s!%s@%s AWAY :%s",
1109                                      source_p->name, source_p->username,
1110                                      source_p->host, source_p->away);
# Line 1095 | Line 1114 | channel_do_join(struct Client *source_p,
1114  
1115      if (chptr->topic[0])
1116      {
1117 <      sendto_one_numeric(source_p, &me, RPL_TOPIC, chptr->chname, chptr->topic);
1118 <      sendto_one_numeric(source_p, &me, RPL_TOPICWHOTIME, chptr->chname,
1117 >      sendto_one_numeric(source_p, &me, RPL_TOPIC, chptr->name, chptr->topic);
1118 >      sendto_one_numeric(source_p, &me, RPL_TOPICWHOTIME, chptr->name,
1119                           chptr->topic_info, chptr->topic_time);
1120      }
1121  
1122      channel_member_names(source_p, chptr, 1);
1123  
1124 <    source_p->localClient->last_join_time = CurrentTime;
1124 >    source_p->connection->last_join_time = CurrentTime;
1125    }
1126   }
1127  
# Line 1125 | Line 1144 | channel_part_one_client(struct Client *s
1144  
1145    if ((ms = find_channel_link(source_p, chptr)) == NULL)
1146    {
1147 <    sendto_one_numeric(source_p, &me, ERR_NOTONCHANNEL, chptr->chname);
1147 >    sendto_one_numeric(source_p, &me, ERR_NOTONCHANNEL, chptr->name);
1148      return;
1149    }
1150  
# Line 1138 | Line 1157 | channel_part_one_client(struct Client *s
1157     */
1158    if (*reason && (!MyConnect(source_p) ||
1159        ((can_send(chptr, source_p, ms, reason) &&
1160 <       (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time)
1160 >       (source_p->connection->firsttime + ConfigGeneral.anti_spam_exit_message_time)
1161          < CurrentTime))))
1162    {
1163      sendto_server(source_p, NOCAPS, NOCAPS, ":%s PART %s :%s",
1164 <                  source_p->id, chptr->chname, reason);
1164 >                  source_p->id, chptr->name, reason);
1165      sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s PART %s :%s",
1166                           source_p->name, source_p->username,
1167 <                         source_p->host, chptr->chname, reason);
1167 >                         source_p->host, chptr->name, reason);
1168    }
1169    else
1170    {
1171      sendto_server(source_p, NOCAPS, NOCAPS, ":%s PART %s",
1172 <                  source_p->id, chptr->chname);
1172 >                  source_p->id, chptr->name);
1173      sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s!%s@%s PART %s",
1174                           source_p->name, source_p->username,
1175 <                         source_p->host, chptr->chname);
1175 >                         source_p->host, chptr->name);
1176    }
1177  
1178    remove_user_from_channel(ms);
1179   }
1180  
1181   void
1182 < channel_do_part(struct Client *source_p, char *channel, char *reason)
1182 > channel_do_part(struct Client *source_p, char *channel, const char *reason)
1183   {
1184    char *p = NULL, *name = NULL;
1185 <  char reasonbuf[KICKLEN + 1] = "";
1185 >  char buf[KICKLEN + 1] = "";
1186  
1187    if (!EmptyString(reason))
1188 <    strlcpy(reasonbuf, reason, sizeof(reasonbuf));
1188 >    strlcpy(buf, reason, sizeof(buf));
1189  
1190    for (name = strtoken(&p, channel, ","); name;
1191         name = strtoken(&p,    NULL, ","))
1192 <    channel_part_one_client(source_p, name, reasonbuf);
1192 >    channel_part_one_client(source_p, name, buf);
1193   }

Diff Legend

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