summaryrefslogtreecommitdiff
path: root/src/inspircd.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-15 19:29:20 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-15 19:29:20 +0000
commit517dd987a78aafda52057f1f6b763a278e3384b2 (patch)
treec9d4894203c0ac7f5ae30aa433f275e2a6f7efcd /src/inspircd.cpp
parent157ee45b8e75d948279af8895a623ff11e4a5d69 (diff)
Added new API methods:
int Module::OnRawMode(userrec* user, char mode, std::string param, bool adding, int pcnt); int Module::OnCheckInvite(userrec* user, chanrec* chan); int Module::OnCheckKey(userrec* user, chanrec* chan, std::string keygiven); int Module::OnCheckLimit(userrec* user, chanrec* chan); int Module::OnCheckBan(userrec* user, chanrec* chan); void Module::OnStats(char symbol); int Module::OnChangeLocalUserHost(userrec* user, std::string newhost); int Module::OnChangeLocalUserGECOS(userrec* user, std::string newhost); int Module::OnLocalTopicChange(userrec* user, chanrec* chan, std::string topic); git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1105 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r--src/inspircd.cpp98
1 files changed, 56 insertions, 42 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 3e70d27f5..a4fcdf749 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -1527,72 +1527,86 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri
if (!MOD_RESULT)
{
log(DEBUG,"add_channel: checking key, invite, etc");
- if (strcmp(Ptr->key,""))
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(OnCheckKey(user, Ptr, key ? key : ""));
+ if (MOD_RESULT == 0)
{
- log(DEBUG,"add_channel: %s has key %s",Ptr->name,Ptr->key);
- if (!key)
+ if (strcmp(Ptr->key,""))
{
- log(DEBUG,"add_channel: no key given in JOIN");
- WriteServ(user->fd,"475 %s %s :Cannot join channel (Requires key)",user->nick, Ptr->name);
- return NULL;
- }
- else
- {
- log(DEBUG,"key at %p is %s",key,key);
- if (strcasecmp(key,Ptr->key))
+ log(DEBUG,"add_channel: %s has key %s",Ptr->name,Ptr->key);
+ if (!key)
{
- log(DEBUG,"add_channel: bad key given in JOIN");
- WriteServ(user->fd,"475 %s %s :Cannot join channel (Incorrect key)",user->nick, Ptr->name);
+ log(DEBUG,"add_channel: no key given in JOIN");
+ WriteServ(user->fd,"475 %s %s :Cannot join channel (Requires key)",user->nick, Ptr->name);
return NULL;
}
+ else
+ {
+ if (strcasecmp(key,Ptr->key))
+ {
+ log(DEBUG,"add_channel: bad key given in JOIN");
+ WriteServ(user->fd,"475 %s %s :Cannot join channel (Incorrect key)",user->nick, Ptr->name);
+ return NULL;
+ }
+ }
}
+ log(DEBUG,"add_channel: no key");
}
- log(DEBUG,"add_channel: no key");
-
- if (Ptr->inviteonly)
+ MOD_RESULT = 0;
+ FOREACH_RESULT(OnCheckInvite(user, Ptr));
+ if (MOD_RESULT == 0)
{
- log(DEBUG,"add_channel: channel is +i");
- if (user->IsInvited(Ptr->name))
+ if (Ptr->inviteonly)
{
- /* user was invited to channel */
- /* there may be an optional channel NOTICE here */
- }
- else
- {
- WriteServ(user->fd,"473 %s %s :Cannot join channel (Invite only)",user->nick, Ptr->name);
- return NULL;
+ log(DEBUG,"add_channel: channel is +i");
+ if (user->IsInvited(Ptr->name))
+ {
+ /* user was invited to channel */
+ /* there may be an optional channel NOTICE here */
+ }
+ else
+ {
+ WriteServ(user->fd,"473 %s %s :Cannot join channel (Invite only)",user->nick, Ptr->name);
+ return NULL;
+ }
}
+ log(DEBUG,"add_channel: channel is not +i");
}
- log(DEBUG,"add_channel: channel is not +i");
-
- if (Ptr->limit)
+ MOD_RESULT = 0;
+ FOREACH_RESULT(OnCheckLimit(user, Ptr));
+ if (MOD_RESULT == 0)
{
- if (usercount(Ptr) >= Ptr->limit)
+ if (Ptr->limit)
{
- WriteServ(user->fd,"471 %s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name);
- return NULL;
+ if (usercount(Ptr) >= Ptr->limit)
+ {
+ WriteServ(user->fd,"471 %s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name);
+ return NULL;
+ }
}
}
-
log(DEBUG,"add_channel: about to walk banlist");
-
- /* check user against the channel banlist */
- if (Ptr)
+ MOD_RESULT = 0;
+ FOREACH_RESULT(OnCheckBan(user, Ptr));
+ if (MOD_RESULT == 0)
{
- if (Ptr->bans.size())
+ /* check user against the channel banlist */
+ if (Ptr)
{
- for (BanList::iterator i = Ptr->bans.begin(); i != Ptr->bans.end(); i++)
+ if (Ptr->bans.size())
{
- if (match(user->GetFullHost(),i->data))
+ for (BanList::iterator i = Ptr->bans.begin(); i != Ptr->bans.end(); i++)
{
- WriteServ(user->fd,"474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name);
- return NULL;
+ if (match(user->GetFullHost(),i->data))
+ {
+ WriteServ(user->fd,"474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name);
+ return NULL;
+ }
}
}
}
+ log(DEBUG,"add_channel: bans checked");
}
-
- log(DEBUG,"add_channel: bans checked");
}