summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authoraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-08 23:35:39 +0000
committeraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-08 23:35:39 +0000
commit18154f4d229cf8ebdcec0dac671ad6e2e0049fee (patch)
tree884342c65c18c913dfbbfd5d26c7b81495e792a8 /src/commands
parent31b785cb03d616a7989c57279d76f05f8d9aa9c3 (diff)
Support for /invite <user> <channel> <timeout> - if the user doesn't partake in <timeout> time, the invite expires
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8854 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/cmd_invite.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp
index 978b26123..42905d9bf 100644
--- a/src/commands/cmd_invite.cpp
+++ b/src/commands/cmd_invite.cpp
@@ -25,10 +25,15 @@ CmdResult CommandInvite::Handle (const char** parameters, int pcnt, User *user)
{
int MOD_RESULT = 0;
- if (pcnt == 2)
+ if (pcnt == 2 || pcnt == 3)
{
User* u = ServerInstance->FindNick(parameters[0]);
Channel* c = ServerInstance->FindChan(parameters[1]);
+ time_t timeout = 0;
+ if (pcnt == 3)
+ {
+ timeout = time(NULL) + ServerInstance->Duration(parameters[2]);
+ }
if ((!c) || (!u))
{
@@ -65,14 +70,14 @@ CmdResult CommandInvite::Handle (const char** parameters, int pcnt, User *user)
return CMD_FAILURE;
}
- FOREACH_RESULT(I_OnUserPreInvite,OnUserPreInvite(user,u,c));
+ FOREACH_RESULT(I_OnUserPreInvite,OnUserPreInvite(user,u,c,timeout));
if (MOD_RESULT == 1)
{
return CMD_FAILURE;
}
- u->InviteTo(c->name);
+ u->InviteTo(c->name, timeout);
u->WriteFrom(user,"INVITE %s :%s",u->nick,c->name);
user->WriteServ("341 %s %s %s",user->nick,u->nick,c->name);
switch (ServerInstance->Config->AnnounceInvites)
@@ -93,7 +98,7 @@ CmdResult CommandInvite::Handle (const char** parameters, int pcnt, User *user)
/* Nobody */
break;
}
- FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c));
+ FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c,timeout));
}
else
{
@@ -102,7 +107,7 @@ CmdResult CommandInvite::Handle (const char** parameters, int pcnt, User *user)
InvitedList* il = user->GetInviteList();
for (InvitedList::iterator i = il->begin(); i != il->end(); i++)
{
- user->WriteServ("346 %s :%s",user->nick,i->c_str());
+ user->WriteServ("346 %s :%s",user->nick,i->first.c_str());
}
user->WriteServ("347 %s :End of INVITE list",user->nick);
}