void RemoveNickFromChannel(char *channel, char *nickname) { struct Channel *cptr; struct Luser *lptr; char *tmp; tmp = channel; if (IsNickPrefix(*tmp)) { if (IsNickPrefix(*(++tmp))) ++tmp; } if (!(cptr = FindChannel(tmp))) return; tmp = GetNick(nickname); if (!(lptr = FindClient(tmp))) return; RemoveFromChannel(cptr, lptr); } /* RemoveNickFromChannel() */
void KickBan(int ban, char *source, struct Channel *channel, char *nicks, char *reason) { char *mask, *tempnix, **av, *bans; char temp[MAXLINE]; int ac, ii; struct Luser *lptr; if (!source || !channel || !nicks) return; tempnix = MyStrdup(nicks); ac = SplitBuf(tempnix, &av); if (ban) { bans = (char *) MyMalloc(sizeof(char)); bans[0] = '\0'; for (ii = 0; ii < ac; ii++) { if (!(lptr = FindClient(av[ii]))) continue; mask = HostToMask(lptr->username, lptr->hostname); ircsprintf(temp, "*!%s", mask); bans = (char *) MyRealloc(bans, strlen(bans) + strlen(temp) + (2 * sizeof(char))); strcat(bans, temp); strcat(bans, " "); MyFree(mask); } SetModes(source, 1, 'b', channel, bans); MyFree(bans); } for (ii = 0; ii < ac; ii++) { toserv(":%s REMOVE %s %s :%s\n", source, channel->name, av[ii], reason ? reason : ""); RemoveFromChannel(channel, FindClient(av[ii])); } MyFree(tempnix); MyFree(av); } /* KickBan() */
void DeleteClient(struct Luser *user) { struct UserChannel *chnext; #ifdef NICKSERVICES struct NickInfo *nptr, *realptr; #ifdef CHANNELSERVICES struct aChannelPtr *fnext; #endif #endif /* NICKSERVICES */ if (user == NULL) return; SendUmode(OPERUMODE_CAPE, "*** Client exit: %s!%s@%s [%s]", user->nick, user->username, user->hostname, user->server ? user->server->name : "*unknown*"); #ifdef NICKSERVICES realptr = FindNick(user->nick); nptr = GetMaster(realptr); if (nptr && realptr) { if (LastSeenInfo && (realptr->flags & NS_IDENTIFIED)) { /* * Update last seen user@host info */ if (realptr->lastu) MyFree(realptr->lastu); if (realptr->lasth) MyFree(realptr->lasth); realptr->lastu = MyStrdup(user->username); realptr->lasth = MyStrdup(user->hostname); } /* * they're quitting - unmark them as identified */ realptr->flags &= ~NS_IDENTIFIED; } #ifdef CHANNELSERVICES while (user->founder_channels) { fnext = user->founder_channels->next; RemFounder(user, user->founder_channels->cptr); user->founder_channels = fnext; } #endif #endif /* NICKSERVICES */ #ifdef ALLOW_FUCKOVER /* check if user was a target of o_fuckover() */ CheckFuckoverTarget(user, NULL); #endif if (user->server) user->server->numusers--; while (user->firstchan) { chnext = user->firstchan->next; RemoveFromChannel(user->firstchan->chptr, user); user->firstchan = chnext; } HashDelClient(user, 0); /* keep oper count updated */ if (user->umodes & UMODE_O) { Network->TotalOperators--; if (user->server) user->server->numopers--; } #ifndef BLOCK_ALLOCATION MyFree(user->nick); MyFree(user->username); MyFree(user->hostname); MyFree(user->realname); #endif /* BLOCK_ALLOCATION */ if (user->prev) user->prev->next = user->next; else ClientList = user->next; if (user->next) user->next->prev = user->prev; #ifdef BLOCK_ALLOCATION BlockSubFree(ClientHeap, user); #else MyFree(user); #endif /* BLOCK_ALLOCATION */ Network->TotalUsers--; } /* DeleteClient() */