diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-19 10:56:51 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-19 10:56:51 +0000 |
commit | 5d03b5379f474a70f40f165707dde93161fb3d59 (patch) | |
tree | 3d7c889bbb57894148fe1935aa08ef8e2c751d73 | |
parent | d3a50da5c09fd7f726ebe0b55bc79bbf8e5783c0 (diff) |
Too many small tweaks to list. Most notably tidy up info, note that /trace is crap, and improve efficiency of cmd_nick
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6601 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/cmd_info.cpp | 56 | ||||
-rw-r--r-- | src/cmd_kill.cpp | 4 | ||||
-rw-r--r-- | src/cmd_nick.cpp | 28 | ||||
-rw-r--r-- | src/cmd_trace.cpp | 21 | ||||
-rw-r--r-- | src/cmd_user.cpp | 6 |
5 files changed, 58 insertions, 57 deletions
diff --git a/src/cmd_info.cpp b/src/cmd_info.cpp index 733afeca3..9f719e883 100644 --- a/src/cmd_info.cpp +++ b/src/cmd_info.cpp @@ -25,10 +25,10 @@ extern "C" command_t* init_command(InspIRCd* Instance) */ CmdResult cmd_info::Handle (const char** parameters, int pcnt, userrec *user) { - user->WriteServ( "371 %s :. o O ( The Inspire Internet Relay Chat Server ) O o .", user->nick); - user->WriteServ( "371 %s : ( Putting the ricer into ircer since 2007 )", user->nick); + user->WriteServ( "371 %s :. o O ( \2The Inspire Internet Relay Chat Server\2 ) O o .", user->nick); + user->WriteServ( "371 %s : ( \2Putting the ricer into ircer since 2007\2 )", user->nick); user->WriteServ( "371 %s : ", user->nick); - user->WriteServ( "371 %s :Core Developers:", user->nick); + user->WriteServ( "371 %s :\2Core Developers\2:", user->nick); user->WriteServ( "371 %s : Craig Edwards (Brain)", user->nick); user->WriteServ( "371 %s : Craig McLure", user->nick); user->WriteServ( "371 %s : w00t", user->nick); @@ -37,44 +37,34 @@ CmdResult cmd_info::Handle (const char** parameters, int pcnt, userrec *user) user->WriteServ( "371 %s : pippijn", user->nick); user->WriteServ( "371 %s : peavey", user->nick); user->WriteServ( "371 %s : ", user->nick); - user->WriteServ( "371 %s :Contributors:", user->nick); - user->WriteServ( "371 %s : typobox43", user->nick); - user->WriteServ( "371 %s : Jazza", user->nick); - user->WriteServ( "371 %s : jamie", user->nick); - user->WriteServ( "371 %s : LeaChim", user->nick); - user->WriteServ( "371 %s : satmd", user->nick); - user->WriteServ( "371 %s : nenolod", user->nick); + user->WriteServ( "371 %s :\2Contributors\2:", user->nick); + user->WriteServ( "371 %s : typobox43 Jazza", user->nick); + user->WriteServ( "371 %s : jamie LeaChim", user->nick); + user->WriteServ( "371 %s : satmd nenolod", user->nick); user->WriteServ( "371 %s : ", user->nick); - user->WriteServ( "371 %s :Testers:", user->nick); - user->WriteServ( "371 %s : CC", user->nick); - user->WriteServ( "371 %s : Piggles", user->nick); - user->WriteServ( "371 %s : Foamy", user->nick); - user->WriteServ( "371 %s : Hart", user->nick); - user->WriteServ( "371 %s : RageD", user->nick); - user->WriteServ( "371 %s : [ed]", user->nick); - user->WriteServ( "371 %s : Azhrarn", user->nick); - user->WriteServ( "371 %s : nenolod", user->nick); - user->WriteServ( "371 %s : luigiman", user->nick); - user->WriteServ( "371 %s : Chu", user->nick); - user->WriteServ( "371 %s : aquanight", user->nick); - user->WriteServ( "371 %s : xptek", user->nick); - user->WriteServ( "371 %s : Grantlinks", user->nick); - user->WriteServ( "371 %s : Rob", user->nick); - user->WriteServ( "371 %s : angelic", user->nick); - user->WriteServ( "371 %s : Jason", user->nick); - user->WriteServ( "371 %s : ThaPrince", user->nick); - user->WriteServ( "371 %s : eggy", user->nick); - user->WriteServ( "371 %s : skenmy", user->nick); + user->WriteServ( "371 %s :\2Quality Assurance\2:", user->nick); + user->WriteServ( "371 %s : Bricker ownine", user->nick); + user->WriteServ( "371 %s : dmb", user->nick); + user->WriteServ( "371 %s :\2Testers\2:", user->nick); + user->WriteServ( "371 %s : CC Piggles", user->nick); + user->WriteServ( "371 %s : Foamy Hart", user->nick); + user->WriteServ( "371 %s : RageD [ed]", user->nick); + user->WriteServ( "371 %s : Azhrarn luigiman", user->nick); + user->WriteServ( "371 %s : Chu aquanight", user->nick); + user->WriteServ( "371 %s : xptek Grantlinks", user->nick); + user->WriteServ( "371 %s : Rob angelic", user->nick); + user->WriteServ( "371 %s : Jason ThaPrince", user->nick); + user->WriteServ( "371 %s : eggy skenmy", user->nick); user->WriteServ( "371 %s : ", user->nick); - user->WriteServ( "371 %s :Contains portions of FireDNS written by", user->nick); + user->WriteServ( "371 %s :Contains portions of \2FireDNS\2 written by", user->nick); user->WriteServ( "371 %s :Ian Gulliver, (c) 2002.", user->nick); user->WriteServ( "371 %s : ", user->nick); - user->WriteServ( "371 %s :Thanks to irc-junkie and searchirc", user->nick); + user->WriteServ( "371 %s :Thanks to \2irc-junkie\2 and \2SearchIRC\2", user->nick); user->WriteServ( "371 %s :for the nice comments and the help", user->nick); user->WriteServ( "371 %s :you gave us in attracting users to", user->nick); user->WriteServ( "371 %s :this software.", user->nick); user->WriteServ( "371 %s : ", user->nick); - user->WriteServ( "371 %s :Best experienced with: An IRC client.", user->nick); + user->WriteServ( "371 %s :Best experienced with: \2An IRC client\2.", user->nick); FOREACH_MOD(I_OnInfo,OnInfo(user)); user->WriteServ( "374 %s :End of /INFO list", user->nick); return CMD_SUCCESS; diff --git a/src/cmd_kill.cpp b/src/cmd_kill.cpp index ae327166d..49f05d6c2 100644 --- a/src/cmd_kill.cpp +++ b/src/cmd_kill.cpp @@ -49,8 +49,8 @@ CmdResult cmd_kill::Handle (const char** parameters, int pcnt, userrec *user) snprintf(killreason, MAXQUIT,"[%s] Killed (%s (%s))", ServerInstance->Config->ServerName, user->nick, parameters[1]); u->WriteCommonExcept("QUIT :%s", killreason); FOREACH_MOD(I_OnRemoteKill, OnRemoteKill(user, u, killreason)); - - userrec::QuitUser(ServerInstance, u, parameters[1]); + + userrec::QuitUser(ServerInstance, u, killreason); } else { diff --git a/src/cmd_nick.cpp b/src/cmd_nick.cpp index 3d74e591a..4e2c4936c 100644 --- a/src/cmd_nick.cpp +++ b/src/cmd_nick.cpp @@ -18,21 +18,21 @@ #include "xline.h" #include "commands/cmd_nick.h" - - extern "C" command_t* init_command(InspIRCd* Instance) { return new cmd_nick(Instance); } +/** Handle nick changes from users. + * NOTE: If you are used to ircds based on ircd2.8, and are looking + * for the client introduction code in here, youre in the wrong place. + * You need to look in the spanningtree module for this! + */ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) { char oldnick[NICKMAX]; - if (!*parameters[0]) - return CMD_FAILURE; - - if (!*user->nick) + if (!*parameters[0] || !*user->nick) return CMD_FAILURE; if (irc::string(user->nick) == irc::string(parameters[0])) @@ -66,13 +66,24 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) user->WriteServ("432 %s %s :Invalid nickname: %s",user->nick,parameters[0], mq->reason); return CMD_FAILURE; } - if ((ServerInstance->FindNick(parameters[0])) && (ServerInstance->FindNick(parameters[0]) != user) && (ServerInstance->IsNick(parameters[0]))) + /* Check for nickname overruled - + * This happens when one user has connected and sent only NICK, and is essentially + * "camping" upon a nickname. To give the new user connecting a fair chance of having + * the nickname too, we force a nickchange on the older user (Simply the one who was + * here first, no TS checks need to take place here) + */ + userrec* InUse = ServerInstance->FindNick(parameters[0]); + if (InUse && (InUse != user) && (ServerInstance->IsNick(parameters[0]))) { - userrec* InUse = ServerInstance->FindNick(parameters[0]); if (InUse->registered != REG_ALL) { /* change the nick of the older user to nnn-overruled, * where nnn is their file descriptor. We know this to be unique. + * NOTE: We must do this and not quit the user, even though we do + * not have UID support yet. This is because if we set this user + * as quitting and then introduce the new user before the old one + * has quit, then the user hash gets totally buggered. + * (Yes, that is a technical term). -- Brain */ std::string changeback = ConvToStr(InUse->GetFd()) + "-overruled"; InUse->WriteTo(InUse, "NICK %s", changeback.c_str()); @@ -150,7 +161,6 @@ CmdResult cmd_nick::Handle (const char** parameters, int pcnt, userrec *user) { /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */ FOREACH_MOD(I_OnUserRegister,OnUserRegister(user)); - //ConnectUser(user,NULL); } if (user->registered == REG_ALL) { diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp index 23a72f199..1c968c8a8 100644 --- a/src/cmd_trace.cpp +++ b/src/cmd_trace.cpp @@ -22,28 +22,27 @@ extern "C" command_t* init_command(InspIRCd* Instance) return new cmd_trace(Instance); } +/** XXX: This is crap. someone fix this when you have time, to be more useful. + */ CmdResult cmd_trace::Handle (const char** parameters, int pcnt, userrec *user) { for (user_hash::iterator i = ServerInstance->clientlist->begin(); i != ServerInstance->clientlist->end(); i++) { - if (i->second) + if (i->second->registered == REG_ALL) { - if (ServerInstance->IsNick(i->second->nick)) + if (*i->second->oper) { - if (*i->second->oper) - { - user->WriteServ("205 %s :Oper 0 %s",user->nick,i->second->nick); - } - else - { - user->WriteServ("204 %s :User 0 %s",user->nick,i->second->nick); - } + user->WriteServ("205 %s :Oper 0 %s",user->nick,i->second->nick); } else { - user->WriteServ("203 %s :???? 0 [%s]",user->nick,i->second->host); + user->WriteServ("204 %s :User 0 %s",user->nick,i->second->nick); } } + else + { + user->WriteServ("203 %s :???? 0 [%s]",user->nick,i->second->host); + } } return CMD_SUCCESS; } diff --git a/src/cmd_user.cpp b/src/cmd_user.cpp index b889455fd..82949a665 100644 --- a/src/cmd_user.cpp +++ b/src/cmd_user.cpp @@ -24,7 +24,8 @@ extern "C" command_t* init_command(InspIRCd* Instance) CmdResult cmd_user::Handle (const char** parameters, int pcnt, userrec *user) { - if (user->registered < REG_NICKUSER) + /* A user may only send the USER command once */ + if (!(user->registered & REG_USER)) { if (!ServerInstance->IsIdent(parameters[0])) { // This kinda Sucks, According to the RFC thou, its either this, @@ -32,7 +33,8 @@ CmdResult cmd_user::Handle (const char** parameters, int pcnt, userrec *user) user->WriteServ("461 %s USER :Not enough parameters",user->nick); return CMD_FAILURE; } - else { + else + { /* We're not checking ident, but I'm not sure I like the idea of '~' prefixing.. */ /* XXX - The ident field is IDENTMAX+2 in size to account for +1 for the optional * ~ character, and +1 for null termination, therefore we can safely use up to |