1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #include "inspircd_config.h"
18 #include "configreader.h"
20 #include "connection.h"
24 #include "inspstring.h"
26 #include "helperfuncs.h"
28 #include "socketengine.h"
33 #include "cull_list.h"
35 extern InspIRCd* ServerInstance;
36 extern int WHOWAS_STALE;
37 extern int WHOWAS_MAX;
38 extern std::vector<Module*> modules;
39 extern std::vector<ircd_module*> factory;
40 extern std::vector<InspSocket*> module_sockets;
42 extern InspSocket* socket_ref[MAX_DESCRIPTORS];
44 extern userrec* fd_ref_table[MAX_DESCRIPTORS];
45 extern ServerConfig *Config;
46 extern user_hash clientlist;
47 extern Server* MyServer;
51 extern std::vector<userrec*> local_users;
53 std::vector<userrec*> all_opers;
55 typedef std::map<irc::string,char*> opertype_t;
56 typedef opertype_t operclass_t;
59 operclass_t operclass;
61 bool InitTypes(const char* tag)
63 for (opertype_t::iterator n = opertypes.begin(); n != opertypes.end(); n++)
73 bool InitClasses(const char* tag)
75 for (operclass_t::iterator n = operclass.begin(); n != operclass.end(); n++)
85 bool DoType(const char* tag, char** entries, void** values, int* types)
87 char* TypeName = (char*)values[0];
88 char* Classes = (char*)values[1];
90 opertypes[TypeName] = strdup(Classes);
91 log(DEBUG,"Read oper TYPE '%s' with classes '%s'",TypeName,Classes);
95 bool DoClass(const char* tag, char** entries, void** values, int* types)
97 char* ClassName = (char*)values[0];
98 char* CommandList = (char*)values[1];
100 operclass[ClassName] = strdup(CommandList);
101 log(DEBUG,"Read oper CLASS '%s' with commands '%s'",ClassName,CommandList);
105 bool DoneClassesAndTypes(const char* tag)
110 bool userrec::ProcessNoticeMasks(const char *sm)
126 if ((*c >= 'A') && (*c <= 'z'))
127 this->SetNoticeMask(*c, adding);
137 void userrec::StartDNSLookup()
139 log(DEBUG,"Commencing reverse lookup");
142 res_reverse = new UserResolver(this, insp_ntoa(this->ip4), false);
143 MyServer->AddResolver(res_reverse);
145 catch (ModuleException& e)
147 log(DEBUG,"Error in resolver: %s",e.GetReason());
151 UserResolver::UserResolver(userrec* user, std::string to_resolve, bool forward) : Resolver(to_resolve, forward), bound_user(user)
153 this->bound_fd = user->fd;
156 void UserResolver::OnLookupComplete(const std::string &result)
158 if ((!this->fwd) && (fd_ref_table[this->bound_fd] == this->bound_user))
160 log(DEBUG,"Commencing forward lookup");
161 this->bound_user->stored_host = result;
164 bound_user->res_forward = new UserResolver(this->bound_user, result, true);
165 MyServer->AddResolver(bound_user->res_forward);
167 catch (ModuleException& e)
169 log(DEBUG,"Error in resolver: %s",e.GetReason());
172 else if ((this->fwd) && (fd_ref_table[this->bound_fd] == this->bound_user))
174 /* Both lookups completed */
175 if (insp_ntoa(this->bound_user->ip4) == result)
177 std::string hostname = this->bound_user->stored_host;
178 if (hostname.length() < 65)
180 WriteServ(this->bound_fd, "NOTICE Auth :*** Found your hostname (%s)", this->bound_user->stored_host.c_str());
181 this->bound_user->dns_done = true;
182 strlcpy(this->bound_user->dhost, hostname.c_str(),64);
183 strlcpy(this->bound_user->host, hostname.c_str(),64);
187 WriteServ(this->bound_fd, "NOTICE Auth :*** Your hostname is longer than the maximum of 64 characters, using your IP address (%s) instead.", insp_ntoa(this->bound_user->ip4));
192 WriteServ(this->bound_fd, "NOTICE Auth :*** Your hostname does not match up with your IP address. Sorry, using your IP address (%s) instead.", insp_ntoa(this->bound_user->ip4));
197 void UserResolver::OnError(ResolverError e, const std::string &errormessage)
199 if (fd_ref_table[this->bound_fd] == this->bound_user)
201 /* Error message here */
202 WriteServ(this->bound_fd, "NOTICE Auth :*** Could not resolve your hostname, using your IP address (%s) instead.", insp_ntoa(this->bound_user->ip4));
203 this->bound_user->dns_done = true;
208 bool userrec::IsNoticeMaskSet(unsigned char sm)
210 return (snomasks[sm-65]);
213 void userrec::SetNoticeMask(unsigned char sm, bool value)
215 snomasks[sm-65] = value;
218 const char* userrec::FormatNoticeMasks()
220 static char data[MAXBUF];
223 for (int n = 0; n < 64; n++)
226 data[offset++] = n+65;
235 bool userrec::IsModeSet(unsigned char m)
237 return (modes[m-65]);
240 void userrec::SetMode(unsigned char m, bool value)
245 const char* userrec::FormatModes()
247 static char data[MAXBUF];
249 for (int n = 0; n < 64; n++)
252 data[offset++] = n+65;
260 // the PROPER way to do it, AVOID bzero at *ALL* costs
261 *password = *nick = *ident = *host = *dhost = *fullname = *awaymsg = *oper = 0;
262 server = (char*)FindServerNamePtr(Config->ServerName);
264 lines_in = fd = lastping = signon = idle_lastmsg = nping = registered = 0;
265 timeout = flood = port = bytes_in = bytes_out = cmds_in = cmds_out = 0;
266 haspassed = dns_done = false;
269 res_forward = res_reverse = NULL;
272 chans.resize(MAXCHANS);
273 memset(modes,0,sizeof(modes));
275 for (unsigned int n = 0; n < MAXCHANS; n++)
277 ucrec* x = new ucrec();
286 for (std::vector<ucrec*>::iterator n = chans.begin(); n != chans.end(); n++)
288 ucrec* x = (ucrec*)*n;
293 /* XXX - minor point, other *Host functions return a char *, this one creates it. Might be nice to be consistant? */
294 void userrec::MakeHost(char* nhost)
296 /* This is much faster than snprintf */
298 for(char* n = ident; *n; n++)
301 for(char* n = host; *n; n++)
306 void userrec::CloseSocket()
308 shutdown(this->fd,2);
312 char* userrec::GetFullHost()
314 static char result[MAXBUF];
316 for(char* n = nick; *n; n++)
319 for(char* n = ident; *n; n++)
322 for(char* n = dhost; *n; n++)
328 char* userrec::MakeWildHost()
330 static char nresult[MAXBUF];
332 *t++ = '*'; *t++ = '!';
333 *t++ = '*'; *t++ = '@';
334 for(char* n = dhost; *n; n++)
340 int userrec::ReadData(void* buffer, size_t size)
344 return read(this->fd, buffer, size);
351 char* userrec::GetFullRealHost()
353 static char fresult[MAXBUF];
355 for(char* n = nick; *n; n++)
358 for(char* n = ident; *n; n++)
361 for(char* n = host; *n; n++)
367 bool userrec::IsInvited(irc::string &channel)
369 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
371 irc::string compare = i->channel;
373 if (compare == channel)
381 InvitedList* userrec::GetInviteList()
386 void userrec::InviteTo(irc::string &channel)
390 invites.push_back(i);
393 void userrec::RemoveInvite(irc::string &channel)
395 log(DEBUG,"Removing invites");
399 for (InvitedList::iterator i = invites.begin(); i != invites.end(); i++)
401 irc::string compare = i->channel;
403 if (compare == channel)
412 bool userrec::HasPermission(const std::string &command)
419 * users on remote servers can completely bypass all permissions based checks.
420 * This prevents desyncs when one server has different type/class tags to another.
421 * That having been said, this does open things up to the possibility of source changes
422 * allowing remote kills, etc - but if they have access to the src, they most likely have
423 * access to the conf - so it's an end to a means either way.
428 // are they even an oper at all?
431 opertype_t::iterator iter_opertype = opertypes.find(this->oper);
432 if (iter_opertype != opertypes.end())
434 char* Classes = strdup(iter_opertype->second);
435 char* myclass = strtok_r(Classes," ",&savept);
438 operclass_t::iterator iter_operclass = operclass.find(myclass);
439 if (iter_operclass != operclass.end())
441 char* CommandList = strdup(iter_operclass->second);
442 mycmd = strtok_r(CommandList," ",&savept2);
445 if ((!strcasecmp(mycmd,command.c_str())) || (*mycmd == '*'))
451 mycmd = strtok_r(NULL," ",&savept2);
455 myclass = strtok_r(NULL," ",&savept);
464 bool userrec::AddBuffer(const std::string &a)
468 /* NB: std::string is arsey about \r and \n and tries to translate them
469 * somehow, so we CANNOT use std::string::find() here :(
471 for (std::string::const_iterator i = a.begin(); i != a.end(); i++)
480 if (recvq.length() > (unsigned)this->recvqmax)
482 this->SetWriteError("RecvQ exceeded");
483 WriteOpers("*** User %s RecvQ of %d exceeds connect class maximum of %d",this->nick,recvq.length(),this->recvqmax);
490 bool userrec::BufferIsReady()
492 return (recvq.find('\n') != std::string::npos);
495 void userrec::ClearBuffer()
500 std::string userrec::GetBuffer()
505 /* Strip any leading \r or \n off the string.
506 * Usually there are only one or two of these,
507 * so its is computationally cheap to do.
509 while ((*recvq.begin() == '\r') || (*recvq.begin() == '\n'))
510 recvq.erase(recvq.begin());
512 for (std::string::iterator x = recvq.begin(); x != recvq.end(); x++)
514 /* Find the first complete line, return it as the
515 * result, and leave the recvq as whats left
519 std::string ret = std::string(recvq.begin(), x);
520 recvq.erase(recvq.begin(), x + 1);
527 void userrec::AddWriteBuf(const std::string &data)
529 if (*this->GetWriteError())
532 if (sendq.length() + data.length() > (unsigned)this->sendqmax)
535 * Fix by brain - Set the error text BEFORE calling writeopers, because
536 * if we dont it'll recursively call here over and over again trying
537 * to repeatedly add the text to the sendq!
539 this->SetWriteError("SendQ exceeded");
540 WriteOpers("*** User %s SendQ of %d exceeds connect class maximum of %d",this->nick,sendq.length() + data.length(),this->sendqmax);
544 if (data.length() > 512)
546 std::string newdata(data);
548 newdata.append("\r\n");
549 sendq.append(newdata);
557 // send AS MUCH OF THE USERS SENDQ as we are able to (might not be all of it)
558 void userrec::FlushWriteBuf()
560 if ((sendq.length()) && (this->fd != FD_MAGIC_NUMBER))
562 const char* tb = this->sendq.c_str();
563 int n_sent = write(this->fd,tb,this->sendq.length());
567 this->SetWriteError(strerror(errno));
574 // update the user's stats counters
575 this->bytes_out += n_sent;
581 void userrec::SetWriteError(const std::string &error)
583 // don't try to set the error twice, its already set take the first string.
584 if (!this->WriteError.length())
586 log(DEBUG,"Setting error string for %s to '%s'",this->nick,error.c_str());
587 this->WriteError = error;
591 const char* userrec::GetWriteError()
593 return this->WriteError.c_str();
596 void AddOper(userrec* user)
598 log(DEBUG,"Oper added to optimization list");
599 all_opers.push_back(user);
602 void DeleteOper(userrec* user)
604 for (std::vector<userrec*>::iterator a = all_opers.begin(); a < all_opers.end(); a++)
608 log(DEBUG,"Oper removed from optimization list");
615 void kill_link(userrec *user,const char* r)
617 user_hash::iterator iter = clientlist.find(user->nick);
620 * I'm pretty sure returning here is causing a desync when part of the net thinks a user is gone,
621 * and another part doesn't. We want to broadcast the quit/kill before bailing so the net stays in sync.
623 * I can't imagine this blowing up, so I'm commenting it out. We still check
624 * before playing with a bad iterator below in our if(). DISCUSS THIS BEFORE YOU DO ANYTHING. --w00t
626 * if (iter == clientlist.end())
632 strlcpy(reason,r,MAXQUIT-1);
633 log(DEBUG,"kill_link: %s %d '%s'",user->nick,user->fd,reason);
636 Write(user->fd,"ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,reason);
638 if (user->registered == REG_ALL)
640 purge_empty_chans(user);
641 FOREACH_MOD(I_OnUserQuit,OnUserQuit(user,reason));
642 WriteCommonExcept(user,"QUIT :%s",reason);
646 user->FlushWriteBuf();
648 FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(user));
652 if (Config->GetIOHook(user->port))
656 Config->GetIOHook(user->port)->OnRawSocketClose(user->fd);
658 catch (ModuleException& modexcept)
660 log(DEBUG,"Module exception cought: %s",modexcept.GetReason());
664 ServerInstance->SE->DelFd(user->fd);
669 * this must come before the WriteOpers so that it doesnt try to fill their buffer with anything
670 * if they were an oper with +s.
673 * In the current implementation, we only show local quits, as we only show local connects. With
674 * the proposed implmentation of snomasks however, this will likely change in the (near?) future.
676 if (user->registered == REG_ALL)
679 WriteOpers("*** Client exiting: %s!%s@%s [%s]",user->nick,user->ident,user->host,reason);
683 if (iter != clientlist.end())
685 log(DEBUG,"deleting user hash value %lx",(unsigned long)user);
688 fd_ref_table[user->fd] = NULL;
689 if (find(local_users.begin(),local_users.end(),user) != local_users.end())
691 local_users.erase(find(local_users.begin(),local_users.end(),user));
692 log(DEBUG,"Delete local user");
695 clientlist.erase(iter);
700 WhoWasGroup::WhoWasGroup(userrec* user) : host(NULL), dhost(NULL), ident(NULL), server(NULL), gecos(NULL), signon(user->signon)
702 this->host = strdup(user->host);
703 this->dhost = strdup(user->dhost);
704 this->ident = strdup(user->ident);
705 this->server = user->server;
706 this->gecos = strdup(user->fullname);
709 WhoWasGroup::~WhoWasGroup()
721 /* adds or updates an entry in the whowas list */
722 void AddWhoWas(userrec* u)
724 whowas_users::iterator iter = whowas.find(u->nick);
726 if (iter == whowas.end())
728 whowas_set* n = new whowas_set;
729 WhoWasGroup *a = new WhoWasGroup(u);
735 whowas_set* group = (whowas_set*)iter->second;
737 if (group->size() > 10)
739 WhoWasGroup *a = (WhoWasGroup*)*(group->begin());
744 WhoWasGroup *a = new WhoWasGroup(u);
749 /* every hour, run this function which removes all entries over 3 days */
750 void MaintainWhoWas(time_t TIME)
752 for (whowas_users::iterator iter = whowas.begin(); iter != whowas.end(); iter++)
754 whowas_set* n = (whowas_set*)iter->second;
757 while ((n->begin() != n->end()) && ((*n->begin())->signon < TIME - 259200)) // 3 days
759 WhoWasGroup *a = *(n->begin());
761 n->erase(n->begin());
767 /* add a client connection to the sockets list */
768 void AddClient(int socket, int port, bool iscached, insp_inaddr ip4)
770 std::string tempnick = ConvToStr(socket) + "-unknown";
771 user_hash::iterator iter = clientlist.find(tempnick);
772 const char *ipaddr = insp_ntoa(ip4);
778 * as these nicknames are 'RFC impossible', we can be sure nobody is going to be
779 * using one as a registered connection. As they are per fd, we can also safely assume
780 * that we wont have collisions. Therefore, if the nick exists in the list, its only
781 * used by a dead socket, erase the iterator so that the new client may reclaim it.
782 * this was probably the cause of 'server ignores me when i hammer it with reconnects'
783 * issue in earlier alphas/betas
785 if (iter != clientlist.end())
787 userrec* goner = iter->second;
789 clientlist.erase(iter);
792 log(DEBUG,"AddClient: %d %d %s",socket,port,ipaddr);
794 _new = new userrec();
795 clientlist[tempnick] = _new;
797 strlcpy(_new->nick,tempnick.c_str(),NICKMAX-1);
799 /* Smarter than your average bear^H^H^H^Hset of strlcpys. */
800 for (const char* temp = ipaddr; *temp && j < 64; temp++, j++)
801 _new->dhost[j] = _new->host[j] = *temp;
802 _new->dhost[j] = _new->host[j] = 0;
804 _new->server = FindServerNamePtr(Config->ServerName);
805 /* We don't need range checking here, we KNOW 'unknown\0' will fit into the ident field. */
806 strcpy(_new->ident, "unknown");
808 _new->registered = REG_NONE;
809 _new->signon = TIME + Config->dns_timeout;
814 // set the registration timeout for this user
815 unsigned long class_regtimeout = 90;
817 long class_threshold = 5;
818 long class_sqmax = 262144; // 256kb
819 long class_rqmax = 4096; // 4k
821 for (ClassVector::iterator i = Config->Classes.begin(); i != Config->Classes.end(); i++)
823 if ((i->type == CC_ALLOW) && (match(ipaddr,i->host.c_str())))
825 class_regtimeout = (unsigned long)i->registration_timeout;
826 class_flood = i->flood;
827 _new->pingmax = i->pingtime;
828 class_threshold = i->threshold;
829 class_sqmax = i->sendqmax;
830 class_rqmax = i->recvqmax;
835 _new->nping = TIME + _new->pingmax + Config->dns_timeout;
836 _new->timeout = TIME+class_regtimeout;
837 _new->flood = class_flood;
838 _new->threshold = class_threshold;
839 _new->sendqmax = class_sqmax;
840 _new->recvqmax = class_rqmax;
842 fd_ref_table[socket] = _new;
843 local_users.push_back(_new);
845 if (local_users.size() > Config->SoftLimit)
847 kill_link(_new,"No more connections allowed");
851 if (local_users.size() >= MAXCLIENTS)
853 kill_link(_new,"No more connections allowed");
859 * this is done as a safety check to keep the file descriptors within range of fd_ref_table.
860 * its a pretty big but for the moment valid assumption:
861 * file descriptors are handed out starting at 0, and are recycled as theyre freed.
862 * therefore if there is ever an fd over 65535, 65536 clients must be connected to the
863 * irc server at once (or the irc server otherwise initiating this many connections, files etc)
864 * which for the time being is a physical impossibility (even the largest networks dont have more
865 * than about 10,000 users on ONE server!)
867 if ((unsigned)socket >= MAX_DESCRIPTORS)
869 kill_link(_new,"Server is full");
872 char* e = matches_exception(ipaddr);
875 char* r = matches_zline(ipaddr);
879 snprintf(reason,MAXBUF,"Z-Lined: %s",r);
880 kill_link(_new,reason);
887 ServerInstance->SE->AddFd(socket,true,X_ESTAB_CLIENT);
890 WriteServ(_new->fd,"NOTICE Auth :*** Looking up your hostname...");
893 long FindMatchingGlobal(userrec* user)
896 for (user_hash::const_iterator a = clientlist.begin(); a != clientlist.end(); a++)
899 /* I dont think theres any faster way of matching two ipv6 addresses than memcmp
900 * Let me know if you think of one.
902 if (!memcmp(a->second->ip4.s6_addr, user->ip4.s6_addr, sizeof(in6_addr)))
905 if (a->second->ip4.s_addr == user->ip4.s_addr)
912 long FindMatchingLocal(userrec* user)
915 for (std::vector<userrec*>::const_iterator a = local_users.begin(); a != local_users.end(); a++)
919 /* I dont think theres any faster way of matching two ipv6 addresses than memcmp */
920 if (!memcmp(comp->ip4.s6_addr, user->ip4.s6_addr, sizeof(in6_addr)))
923 if (comp->ip4.s_addr == user->ip4.s_addr)
930 void FullConnectUser(userrec* user, CullList* Goners)
932 ServerInstance->stats->statsConnects++;
933 user->idle_lastmsg = TIME;
934 log(DEBUG,"ConnectUser: %s",user->nick);
936 ConnectClass a = GetClass(user);
938 if (a.type == CC_DENY)
940 Goners->AddItem(user,"Unauthorised connection");
944 if ((*(a.pass.c_str())) && (!user->haspassed))
946 Goners->AddItem(user,"Invalid password");
950 if (FindMatchingLocal(user) > a.maxlocal)
952 Goners->AddItem(user,"No more connections allowed from your host via this connect class (local)");
953 WriteOpers("*** WARNING: maximum LOCAL connections (%ld) exceeded for IP %s",a.maxlocal,insp_ntoa(user->ip4));
956 else if (FindMatchingGlobal(user) > a.maxglobal)
958 Goners->AddItem(user,"No more connections allowed from your host via this connect class (global)");
959 WriteOpers("*** WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s",a.maxglobal,insp_ntoa(user->ip4));
963 char match_against[MAXBUF];
964 snprintf(match_against,MAXBUF,"%s@%s",user->ident,user->host);
965 char* e = matches_exception(match_against);
969 char* r = matches_gline(match_against);
974 snprintf(reason,MAXBUF,"G-Lined: %s",r);
975 Goners->AddItem(user,reason);
979 r = matches_kline(match_against);
984 snprintf(reason,MAXBUF,"K-Lined: %s",r);
985 Goners->AddItem(user,reason);
991 WriteServ(user->fd,"NOTICE Auth :Welcome to \002%s\002!",Config->Network);
992 WriteServ(user->fd,"001 %s :Welcome to the %s IRC Network %s!%s@%s",user->nick,Config->Network,user->nick,user->ident,user->host);
993 WriteServ(user->fd,"002 %s :Your host is %s, running version %s",user->nick,Config->ServerName,VERSION);
994 WriteServ(user->fd,"003 %s :This server was created %s %s",user->nick,__TIME__,__DATE__);
995 WriteServ(user->fd,"004 %s %s %s iowghrasxRVSCWBG lvhopsmntikrcaqbegIOLQRSKVHGCNT vhobeIaqglk",user->nick,Config->ServerName,VERSION);
997 // anfl @ #ratbox, efnet reminded me that according to the RFC this cant contain more than 13 tokens per line...
998 // so i'd better split it :)
999 std::stringstream out(Config->data005);
1000 std::string token = "";
1001 std::string line5 = "";
1002 int token_counter = 0;
1007 line5 = line5 + token + " ";
1010 if ((token_counter >= 13) || (out.eof() == true))
1012 WriteServ(user->fd,"005 %s %s:are supported by this server",user->nick,line5.c_str());
1021 * fix 3 by brain, move registered = 7 below these so that spurious modes and host
1022 * changes dont go out onto the network and produce 'fake direction'.
1024 FOREACH_MOD(I_OnUserConnect,OnUserConnect(user));
1025 FOREACH_MOD(I_OnGlobalConnect,OnGlobalConnect(user));
1026 user->registered = REG_ALL;
1027 WriteOpers("*** Client connecting on port %lu: %s!%s@%s [%s]",(unsigned long)user->port,user->nick,user->ident,user->host,insp_ntoa(user->ip4));
1031 * re-allocates a nick in the user_hash after they change nicknames,
1032 * returns a pointer to the new user as it may have moved
1034 userrec* ReHashNick(const char* Old, const char* New)
1036 //user_hash::iterator newnick;
1037 user_hash::iterator oldnick = clientlist.find(Old);
1039 log(DEBUG,"ReHashNick: %s %s",Old,New);
1041 if (!strcasecmp(Old,New))
1043 log(DEBUG,"old nick is new nick, skipping");
1044 return oldnick->second;
1047 if (oldnick == clientlist.end())
1048 return NULL; /* doesnt exist */
1050 log(DEBUG,"ReHashNick: Found hashed nick %s",Old);
1052 userrec* olduser = oldnick->second;
1053 clientlist[New] = olduser;
1054 clientlist.erase(oldnick);
1056 log(DEBUG,"ReHashNick: Nick rehashed as %s",New);
1058 return clientlist[New];
1061 void force_nickchange(userrec* user,const char* newnick)
1068 FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,newnick));
1072 ServerInstance->stats->statsCollisions++;
1073 kill_link(user,"Nickname collision");
1077 if (matches_qline(newnick))
1079 ServerInstance->stats->statsCollisions++;
1080 kill_link(user,"Nickname collision");
1088 strlcpy(nick,newnick,MAXBUF-1);
1091 if (user->registered == REG_ALL)
1093 const char* pars[1];
1095 std::string cmd = "NICK";
1097 ServerInstance->Parser->CallHandler(cmd,pars,1,user);