]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_invite.cpp
m_spanningtree Remove unneeded #includes
[user/henk/code/inspircd.git] / src / commands / cmd_invite.cpp
index e12b8244f11cf3cd115008b95dfc3f4bd92d2e76..11cb549af5a9a7866de8eca8e590c254e2c2d58b 100644 (file)
@@ -61,7 +61,7 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
                if (parameters.size() == 3)
                {
                        if (IS_LOCAL(user))
-                               timeout = ServerInstance->Time() + ServerInstance->Duration(parameters[2]);
+                               timeout = ServerInstance->Time() + InspIRCd::Duration(parameters[1]);
                        else
                                timeout = ConvToInt(parameters[2]);
                }
@@ -110,23 +110,29 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
                        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)
+               if (ServerInstance->Config->AnnounceInvites != ServerConfig::INVITE_ANNOUNCE_NONE)
                {
-                       case ServerConfig::INVITE_ANNOUNCE_ALL:
-                               c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
-                       break;
-                       case ServerConfig::INVITE_ANNOUNCE_OPS:
-                               c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
-                       break;
-                       case ServerConfig::INVITE_ANNOUNCE_DYNAMIC:
-                               if (c->IsModeSet('i'))
-                                       c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
-                               else
-                                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
-                       break;
-                       default:
-                               /* Nobody */
-                       break;
+                       char prefix;
+                       switch (ServerInstance->Config->AnnounceInvites)
+                       {
+                               case ServerConfig::INVITE_ANNOUNCE_OPS:
+                               {
+                                       prefix = '@';
+                                       break;
+                               }
+                               case ServerConfig::INVITE_ANNOUNCE_DYNAMIC:
+                               {
+                                       ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL);
+                                       prefix = (mh && mh->name == "halfop" ? mh->GetPrefix() : '@');
+                                       break;
+                               }
+                               default:
+                               {
+                                       prefix = 0;
+                                       break;
+                               }
+                       }
+                       c->WriteAllExceptSender(user, true, prefix, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str());
                }
                FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c,timeout));
        }