From ff3eef491aa9e107d09d9dd9560ef7715b37b3b3 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 21 Oct 2009 23:45:32 +0000 Subject: Move all local-only fields to LocalUser git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11944 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/commands/cmd_invite.cpp | 7 ++++--- src/commands/cmd_nick.cpp | 3 ++- src/commands/cmd_oper.cpp | 2 +- src/commands/cmd_pass.cpp | 8 ++++---- src/commands/cmd_pong.cpp | 3 ++- 5 files changed, 13 insertions(+), 10 deletions(-) (limited to 'src/commands') diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 9da6096a4..84c522754 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -90,7 +90,8 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use } } - u->InviteTo(c->name.c_str(), timeout); + if (IS_LOCAL(u)) + IS_LOCAL(u)->InviteTo(c->name.c_str(), timeout); u->WriteFrom(user,"INVITE %s :%s",u->nick.c_str(),c->name.c_str()); user->WriteNumeric(RPL_INVITING, "%s %s %s",user->nick.c_str(),u->nick.c_str(),c->name.c_str()); switch (ServerInstance->Config->AnnounceInvites) @@ -113,11 +114,11 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use } FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c,timeout)); } - else + else if (IS_LOCAL(user)) { // pinched from ircu - invite with not enough parameters shows channels // youve been invited to but haven't joined yet. - InvitedList* il = user->GetInviteList(); + InvitedList* il = IS_LOCAL(user)->GetInviteList(); for (InvitedList::iterator i = il->begin(); i != il->end(); i++) { user->WriteNumeric(RPL_INVITELIST, "%s :%s",user->nick.c_str(),i->first.c_str()); diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index ee8c4625c..489551dd1 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -202,7 +202,8 @@ CmdResult CommandNick::Handle (const std::vector& parameters, User if (user->registered == REG_ALL) { - user->IncreasePenalty(10); + if (IS_LOCAL(user)) + IS_LOCAL(user)->Penalty += 10; FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user, oldnick)); } diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index dc15a5415..428e7b109 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -124,7 +124,7 @@ CmdResult CommandOper::HandleLocal(const std::vector& parameters, L // tell them they suck, and lag them up to help prevent brute-force attacks user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick.c_str()); - user->IncreasePenalty(10); + user->Penalty += 10; snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str(), fields.c_str()); ServerInstance->SNO->WriteToSnoMask('o',std::string(broadcast)); diff --git a/src/commands/cmd_pass.cpp b/src/commands/cmd_pass.cpp index 21b5b2759..0bf1b46a4 100644 --- a/src/commands/cmd_pass.cpp +++ b/src/commands/cmd_pass.cpp @@ -18,23 +18,23 @@ * the same way, however, they can be fully unloaded, where these * may not. */ -class CommandPass : public Command +class CommandPass : public SplitCommand { public: /** Constructor for pass. */ - CommandPass ( Module* parent) : Command(parent,"PASS",1,1) { works_before_reg = true; Penalty = 0; syntax = ""; } + CommandPass (Module* parent) : SplitCommand(parent,"PASS",1,1) { works_before_reg = true; Penalty = 0; syntax = ""; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command * @param user The user issuing the command * @return A value from CmdResult to indicate command success or failure. */ - CmdResult Handle(const std::vector& parameters, User *user); + CmdResult HandleLocal(const std::vector& parameters, LocalUser *user); }; -CmdResult CommandPass::Handle (const std::vector& parameters, User *user) +CmdResult CommandPass::HandleLocal(const std::vector& parameters, LocalUser *user) { // Check to make sure they haven't registered -- Fix by FCS if (user->registered == REG_ALL) diff --git a/src/commands/cmd_pong.cpp b/src/commands/cmd_pong.cpp index 225be147a..9bff00ed2 100644 --- a/src/commands/cmd_pong.cpp +++ b/src/commands/cmd_pong.cpp @@ -36,7 +36,8 @@ class CommandPong : public Command CmdResult CommandPong::Handle (const std::vector&, User *user) { // set the user as alive so they survive to next ping - user->lastping = 1; + if (IS_LOCAL(user)) + IS_LOCAL(user)->lastping = 1; return CMD_SUCCESS; } -- cgit v1.2.3