summaryrefslogtreecommitdiff
path: root/src/channels.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/channels.cpp')
-rw-r--r--src/channels.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 37d04c44e..94f7d49a6 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -25,6 +25,7 @@
#include "sockets.h"
#include "language.h"
#include "uplink.h"
+#include "event.h"
channel_map ChannelList;
@@ -47,12 +48,12 @@ Channel::Channel(const Anope::string &nname, time_t ts)
if (Me && Me->IsSynced())
Log(NULL, this, "create");
- FOREACH_MOD(OnChannelCreate, (this));
+ Event::OnChannelCreate(&Event::ChannelCreate::OnChannelCreate, this);
}
Channel::~Channel()
{
- FOREACH_MOD(OnChannelDelete, (this));
+ Event::OnChannelDelete(&Event::ChannelDelete::OnChannelDelete, this);
ModeManager::StackerDel(this);
@@ -98,7 +99,7 @@ void Channel::Reset()
void Channel::Sync()
{
syncing = false;
- FOREACH_MOD(OnChannelSync, (this));
+ Event::OnChannelSync(&Event::ChannelSync::OnChannelSync, this);
CheckModes();
}
@@ -116,7 +117,7 @@ void Channel::CheckModes()
}
Reference<Channel> ref = this;
- FOREACH_MOD(OnCheckModes, (ref));
+ Event::OnCheckModes(&Event::CheckModes::OnCheckModes, ref);
}
bool Channel::CheckDelete()
@@ -132,7 +133,7 @@ bool Channel::CheckDelete()
return false;
EventReturn MOD_RESULT;
- FOREACH_RESULT(OnCheckDelete, MOD_RESULT, (this));
+ MOD_RESULT = Event::OnCheckDelete(&Event::CheckDelete::OnCheckDelete, this);
return MOD_RESULT != EVENT_STOP && this->users.empty();
}
@@ -156,7 +157,7 @@ void Channel::DeleteUser(User *user)
if (user->server && user->server->IsSynced() && !user->Quitting())
Log(user, this, "leave");
- FOREACH_MOD(OnLeaveChannel, (user, this));
+ Event::OnLeaveChannel(&Event::LeaveChannel::OnLeaveChannel, user, this);
ChanUserContainer *cu = user->FindChannel(this);
if (!this->users.erase(user))
@@ -279,7 +280,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *cm, const Anop
if (cc)
cc->status.AddMode(cm->mchar);
- FOREACH_RESULT(OnChannelModeSet, MOD_RESULT, (this, setter, cm, param));
+ MOD_RESULT = Event::OnChannelModeSet(&Event::ChannelModeSet::OnChannelModeSet, this, setter, cm, param);
/* Enforce secureops, etc */
if (enforce_mlock && MOD_RESULT != EVENT_STOP)
@@ -306,7 +307,7 @@ void Channel::SetModeInternal(MessageSource &setter, ChannelMode *cm, const Anop
cml->OnAdd(this, param);
}
- FOREACH_RESULT(OnChannelModeSet, MOD_RESULT, (this, setter, cm, param));
+ MOD_RESULT = Event::OnChannelModeSet(&Event::ChannelModeSet::OnChannelModeSet, this, setter, cm, param);
/* Check if we should enforce mlock */
if (!enforce_mlock || MOD_RESULT == EVENT_STOP)
@@ -347,7 +348,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *cm, const A
if (cc)
cc->status.DelMode(cm->mchar);
- FOREACH_RESULT(OnChannelModeUnset, MOD_RESULT, (this, setter, cm, param));
+ MOD_RESULT = Event::OnChannelModeUnset(&Event::ChannelModeUnset::OnChannelModeUnset, this, setter, cm, param);
if (enforce_mlock && MOD_RESULT != EVENT_STOP)
this->SetCorrectModes(u, false);
@@ -374,7 +375,7 @@ void Channel::RemoveModeInternal(MessageSource &setter, ChannelMode *cm, const A
cml->OnDel(this, param);
}
- FOREACH_RESULT(OnChannelModeUnset, MOD_RESULT, (this, setter, cm, param));
+ MOD_RESULT = Event::OnChannelModeUnset(&Event::ChannelModeUnset::OnChannelModeUnset, this, setter, cm, param);
if (cm->name == "PERM")
{
@@ -738,9 +739,9 @@ void Channel::KickInternal(const MessageSource &source, const Anope::string &nic
Anope::string this_name = this->name;
ChannelStatus status = cu->status;
- FOREACH_MOD(OnPreUserKicked, (source, cu, reason));
+ Event::OnPreUserKicked(&Event::PreUserKicked::OnPreUserKicked, source, cu, reason);
this->DeleteUser(target); /* This can delete this; */
- FOREACH_MOD(OnUserKicked, (source, target, this_name, status, reason));
+ Event::OnUserKicked(&Event::UserKicked::OnUserKicked, source, target, this_name, status, reason);
}
bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...)
@@ -759,7 +760,7 @@ bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...)
bi = this->ci->WhoSends();
EventReturn MOD_RESULT;
- FOREACH_RESULT(OnBotKick, MOD_RESULT, (bi, this, u, buf));
+ MOD_RESULT = Event::OnBotKick(&Event::BotKick::OnBotKick, bi, this, u, buf);
if (MOD_RESULT == EVENT_STOP)
return false;
IRCD->SendKick(bi, this, u, "%s", buf);
@@ -778,7 +779,7 @@ void Channel::ChangeTopicInternal(const Anope::string &user, const Anope::string
Log(LOG_DEBUG) << "Topic of " << this->name << " changed by " << (u ? u->nick : user) << " to " << newtopic;
- FOREACH_MOD(OnTopicUpdated, (this, user, this->topic));
+ Event::OnTopicUpdated(&Event::TopicUpdated::OnTopicUpdated, this, user, this->topic);
}
void Channel::ChangeTopic(const Anope::string &user, const Anope::string &newtopic, time_t ts)
@@ -794,7 +795,7 @@ void Channel::ChangeTopic(const Anope::string &user, const Anope::string &newtop
/* Now that the topic is set update the time set. This is *after* we set it so the protocol modules are able to tell the old last set time */
this->topic_time = Anope::CurTime;
- FOREACH_MOD(OnTopicUpdated, (this, user, this->topic));
+ Event::OnTopicUpdated(&Event::TopicUpdated::OnTopicUpdated, this, user, this->topic);
}
void Channel::SetCorrectModes(User *user, bool give_modes)
@@ -812,7 +813,7 @@ void Channel::SetCorrectModes(User *user, bool give_modes)
/* Initially only take modes if the channel is being created by a non netmerge */
bool take_modes = this->syncing && user->server->IsSynced();
- FOREACH_MOD(OnSetCorrectModes, (user, this, u_access, give_modes, take_modes));
+ Event::OnSetCorrectModes(&Event::SetCorrectModes::OnSetCorrectModes, user, this, u_access, give_modes, take_modes);
/* Never take modes from ulines */
if (user->server->IsULined())
@@ -884,7 +885,7 @@ bool Channel::CheckKick(User *user)
Anope::string mask, reason;
EventReturn MOD_RESULT;
- FOREACH_RESULT(OnCheckKick, MOD_RESULT, (user, this, mask, reason));
+ MOD_RESULT = Event::OnCheckKick(&Event::CheckKick::OnCheckKick, user, this, mask, reason);
if (MOD_RESULT != EVENT_STOP)
return false;