diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-11-02 13:28:55 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-11-02 13:28:55 +0100 |
commit | 30fc51c6ddca487a1b89da9ab0ab59da003aee36 (patch) | |
tree | 8727403ddfdc51441db940ba77d2cce6cea3ec66 /src/coremods/core_channel/cmd_invite.cpp | |
parent | a6b53dbc3629eb329b5b77d81e81ced837d4dc66 (diff) |
Rewrite invite system
- Moved out of core, now lives entirely in core_channel
- Accessible using the provided API after including the appropriate header
- Invites are stored in an extension attached to LocalUser/Channel objects, they no longer need special handling when destroying these objects or when lowering TS
- Expiration of timed invites are implemented using Timers
- When creating a new invite let a non-timed invite override a timed one
Diffstat (limited to 'src/coremods/core_channel/cmd_invite.cpp')
-rw-r--r-- | src/coremods/core_channel/cmd_invite.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp index 7bf669b29..96f560582 100644 --- a/src/coremods/core_channel/cmd_invite.cpp +++ b/src/coremods/core_channel/cmd_invite.cpp @@ -22,9 +22,11 @@ #include "inspircd.h" #include "core_channel.h" +#include "invite.h" -CommandInvite::CommandInvite(Module* parent) +CommandInvite::CommandInvite(Module* parent, Invite::APIImpl& invapiimpl) : Command(parent, "INVITE", 0, 0) + , invapi(invapiimpl) { Penalty = 4; syntax = "[<nick> <channel>]"; @@ -109,7 +111,7 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use if (IS_LOCAL(u)) { - Invitation::Create(c, IS_LOCAL(u), timeout); + invapi.Create(IS_LOCAL(u), c, timeout); u->WriteFrom(user,"INVITE %s :%s",u->nick.c_str(),c->name.c_str()); } @@ -150,10 +152,11 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use { // pinched from ircu - invite with not enough parameters shows channels // youve been invited to but haven't joined yet. - InviteList& il = IS_LOCAL(user)->GetInviteList(); - for (InviteList::const_iterator i = il.begin(); i != il.end(); ++i) + const Invite::List* list = invapi.GetList(IS_LOCAL(user)); + if (list) { - user->WriteNumeric(RPL_INVITELIST, ":%s", (*i)->chan->name.c_str()); + for (Invite::List::const_iterator i = list->begin(); i != list->end(); ++i) + user->WriteNumeric(RPL_INVITELIST, ":%s", (*i)->chan->name.c_str()); } user->WriteNumeric(RPL_ENDOFINVITELIST, ":End of INVITE list"); } |