diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-04-01 18:00:17 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-04-13 15:34:11 +0200 |
commit | d71b6a8b273ae6efc823ffe79130e6a85b6a1534 (patch) | |
tree | 887827c70168b74321b030b573eb5887d3d8d38b /src | |
parent | 551d687ec6d7ce44be35fae0dd7345fe73c4f63a (diff) |
Remove the deprecated invite API
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 4 | ||||
-rw-r--r-- | src/commands/cmd_invite.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_override.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_uninvite.cpp | 4 | ||||
-rw-r--r-- | src/users.cpp | 32 |
5 files changed, 19 insertions, 35 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 7138880ff..b8406a65a 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -319,7 +319,7 @@ Channel* Channel::JoinUser(User* user, std::string cname, bool override, const s else if (MOD_RESULT == MOD_RES_PASSTHRU) { std::string ckey = Ptr->GetModeParameter('k'); - bool invited = IS_LOCAL(user)->IsInvited(Ptr->name.c_str()); + bool invited = IS_LOCAL(user)->IsInvited(Ptr); bool can_bypass = ServerInstance->Config->InvBypassModes && invited; if (!ckey.empty()) @@ -366,7 +366,7 @@ Channel* Channel::JoinUser(User* user, std::string cname, bool override, const s */ if (invited) { - IS_LOCAL(user)->RemoveInvite(Ptr->name.c_str()); + IS_LOCAL(user)->RemoveInvite(Ptr); } } } diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 11cb549af..6e5aead12 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -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; diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index ea9d11c94..29996fc8f 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -124,8 +124,7 @@ class ModuleOverride : public Module { if (chan->IsModeSet('i') && (CanOverride(user,"INVITE"))) { - irc::string x(chan->name.c_str()); - if (!IS_LOCAL(user)->IsInvited(x)) + if (!IS_LOCAL(user)->IsInvited(chan)) { if (RequireKey && keygiven != "override") { diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 683976885..f429f75b9 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -70,15 +70,13 @@ class CommandUninvite : public Command LocalUser* lu = IS_LOCAL(u); if (lu) { - irc::string xname(c->name.c_str()); - if (!lu->IsInvited(xname)) + if (!lu->RemoveInvite(c)) { user->SendText(":%s 505 %s %s %s :Is not invited to channel %s", user->server.c_str(), user->nick.c_str(), u->nick.c_str(), c->name.c_str(), c->name.c_str()); return CMD_FAILURE; } user->SendText(":%s 494 %s %s %s :Uninvited", user->server.c_str(), user->nick.c_str(), c->name.c_str(), u->nick.c_str()); - lu->RemoveInvite(xname); lu->WriteNumeric(493, "%s :You were uninvited from %s by %s", u->nick.c_str(), c->name.c_str(), user->nick.c_str()); std::string msg = "*** " + user->nick + " uninvited " + u->nick + "."; diff --git a/src/users.cpp b/src/users.cpp index fb7c46d6b..c53fb7853 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -332,40 +332,22 @@ const std::string& User::GetFullRealHost() return this->cached_fullrealhost; } -bool LocalUser::IsInvited(const irc::string &channel) -{ - Channel* chan = ServerInstance->FindChan(channel.c_str()); - if (!chan) - return false; - - return (Invitation::Find(chan, this) != NULL); -} - InviteList& LocalUser::GetInviteList() { RemoveExpiredInvites(); return invites; } -void LocalUser::InviteTo(const irc::string &channel, time_t invtimeout) -{ - Channel* chan = ServerInstance->FindChan(channel.c_str()); - if (chan) - Invitation::Create(chan, this, invtimeout); -} - -void LocalUser::RemoveInvite(const irc::string &channel) +bool LocalUser::RemoveInvite(Channel* chan) { - Channel* chan = ServerInstance->FindChan(channel.c_str()); - if (chan) + Invitation* inv = Invitation::Find(chan, this); + if (inv) { - Invitation* inv = Invitation::Find(chan, this); - if (inv) - { - inv->cull(); - delete inv; - } + inv->cull(); + delete inv; + return true; } + return false; } void LocalUser::RemoveExpiredInvites() |