]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_invite.cpp
ISupportManager: Tidy-up, expand comments
[user/henk/code/inspircd.git] / src / commands / cmd_invite.cpp
index 11cb549af5a9a7866de8eca8e590c254e2c2d58b..7221521de5e1a0b145882d396d83ed3e04ecbdf3 100644 (file)
@@ -72,16 +72,16 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
                        return CMD_FAILURE;
                }
 
-               if (c->HasUser(u))
-               {
-                       user->WriteNumeric(ERR_USERONCHANNEL, "%s %s %s :is already on channel",user->nick.c_str(),u->nick.c_str(),c->name.c_str());
-                       return CMD_FAILURE;
-               }
-
                if ((IS_LOCAL(user)) && (!c->HasUser(user)))
-               {
+               {
                        user->WriteNumeric(ERR_NOTONCHANNEL, "%s %s :You're not on that channel!",user->nick.c_str(), c->name.c_str());
-                       return CMD_FAILURE;
+                       return CMD_FAILURE;
+               }
+
+               if (c->HasUser(u))
+               {
+                       user->WriteNumeric(ERR_USERONCHANNEL, "%s %s %s :is already on channel",user->nick.c_str(),u->nick.c_str(),c->name.c_str());
+                       return CMD_FAILURE;
                }
 
                FIRST_MOD_RESULT(OnUserPreInvite, MOD_RESULT, (user,u,c,timeout));
@@ -107,9 +107,14 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
                }
 
                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());
+               {
+                       Invitation::Create(c, IS_LOCAL(u), timeout);
+                       u->WriteFrom(user,"INVITE %s :%s",u->nick.c_str(),c->name.c_str());
+               }
+
+               if (IS_LOCAL(user))
+                       user->WriteNumeric(RPL_INVITING, "%s %s %s",user->nick.c_str(),u->nick.c_str(),c->name.c_str());
+
                if (ServerInstance->Config->AnnounceInvites != ServerConfig::INVITE_ANNOUNCE_NONE)
                {
                        char prefix;