- if (!IsBurstOrBurstAck(sptr) && 0 != chanTS && MAGIC_REMOTE_JOIN_TS != chanTS)
- sptr->user->server->serv->lag = TStime() - chanTS;
-
- *cbuf = '\0'; /* Start with empty buffer */
-
- /* For each channel in the comma seperated list: */
- for (name = ircd_strtok(&p, parv[1], ","); name; name = ircd_strtok(&p, 0, ","))
- {
- badop = 0; /* Default is to accept the op */
- if ((chptr = FindChannel(name)))
- {
- name = chptr->chname;
- if (TStime() - chanTS > TS_LAG_TIME)
- {
- /* A bounce would not be accepted anyway - if we get here something
- is wrong with the TS clock syncing (or we have more then
- TS_LAG_TIME lag, or an admin is hacking */
- badop = 2;
- /* This causes a HACK notice on all upstream servers: */
- sendto_one(cptr, "%s " TOK_MODE " %s -o %s%s 0", NumServ(&me), name, NumNick(sptr));
- /* This causes a WALLOPS on all downstream servers and a notice to our
- own opers: */
- parv[1] = name; /* Corrupt parv[1], it is not used anymore anyway */
- send_hack_notice(cptr, sptr, parc, parv, badop, 2);
- }
- else if (chptr->creationtime && chanTS > chptr->creationtime &&
- chptr->creationtime != MAGIC_REMOTE_JOIN_TS)
- {
- /* We (try) to bounce the mode, because the CREATE is used on an older
- channel, probably a net.ride */
- badop = 1;
- /* Send a deop upstream: */
- sendto_one(cptr, "%s " TOK_MODE " %s -o %s%s " TIME_T_FMT, NumServ(&me),
- name, NumNick(sptr), chptr->creationtime);
- }
- }
- else /* Channel doesn't exist: create it */
- chptr = get_channel(sptr, name, CGT_CREATE);
-
- /* Add and mark ops */
- add_user_to_channel(chptr, sptr,
- (badop || IsModelessChannel(name)) ? CHFL_DEOPPED : CHFL_CHANOP);
-
- /* Send user join to the local clients (if any) */
- sendto_channel_butserv(chptr, sptr, ":%s " MSG_JOIN " :%s", parv[0], name);
-
- if (badop) /* handle badop: convert CREATE into JOIN */
- sendto_serv_butone(cptr, "%s%s " TOK_JOIN " %s " TIME_T_FMT,
- NumNick(sptr), name, chptr->creationtime);
- else
- {
- /* Send the op to local clients:
- (if any; extremely unlikely, but it CAN happen) */
- if (!IsModelessChannel(name))
- sendto_channel_butserv(chptr, sptr, ":%s MODE %s +o %s",
- sptr->user->server->name, name, parv[0]);
-
- /* Set/correct TS and add the channel to the
- buffer for accepted channels: */
- chptr->creationtime = chanTS;
- if (*cbuf)
- strcat(cbuf, ",");
- strcat(cbuf, name);
- }
- }