mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Remove the deprecated invite API
This commit is contained in:
parent
551d687ec6
commit
d71b6a8b27
@ -832,23 +832,18 @@ class CoreExport LocalUser : public User, public InviteBase
|
||||
InviteList& GetInviteList();
|
||||
|
||||
/** Returns true if a user is invited to a channel.
|
||||
* @param channel A channel name to look up
|
||||
* @param channel A channel to look up
|
||||
* @return True if the user is invited to the given channel
|
||||
*/
|
||||
bool IsInvited(const irc::string &channel);
|
||||
|
||||
/** Adds a channel to a users invite list (invites them to a channel)
|
||||
* @param channel A channel name to add
|
||||
* @param timeout When the invite should expire (0 == never)
|
||||
*/
|
||||
void InviteTo(const irc::string &channel, time_t timeout);
|
||||
bool IsInvited(Channel* chan) { return (Invitation::Find(chan, this) != NULL); }
|
||||
|
||||
/** Removes a channel from a users invite list.
|
||||
* This member function is called on successfully joining an invite only channel
|
||||
* to which the user has previously been invited, to clear the invitation.
|
||||
* @param channel The channel to remove the invite to
|
||||
* @return True if the user was invited to the channel and the invite was erased, false if the user wasn't invited
|
||||
*/
|
||||
void RemoveInvite(const irc::string &channel);
|
||||
bool RemoveInvite(Channel* chan);
|
||||
|
||||
void RemoveExpiredInvites();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
{
|
||||
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;
|
||||
|
@ -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")
|
||||
{
|
||||
|
@ -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 + ".";
|
||||
|
@ -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)
|
||||
bool LocalUser::RemoveInvite(Channel* chan)
|
||||
{
|
||||
Channel* chan = ServerInstance->FindChan(channel.c_str());
|
||||
if (chan)
|
||||
Invitation::Create(chan, this, invtimeout);
|
||||
}
|
||||
|
||||
void LocalUser::RemoveInvite(const irc::string &channel)
|
||||
{
|
||||
Channel* chan = ServerInstance->FindChan(channel.c_str());
|
||||
if (chan)
|
||||
{
|
||||
Invitation* inv = Invitation::Find(chan, this);
|
||||
if (inv)
|
||||
{
|
||||
inv->cull();
|
||||
delete inv;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void LocalUser::RemoveExpiredInvites()
|
||||
|
Loading…
x
Reference in New Issue
Block a user