summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/channels.h4
-rw-r--r--include/modules.h4
-rw-r--r--src/channels.cpp8
-rw-r--r--src/commands/cmd_join.cpp4
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_auditorium.cpp2
-rw-r--r--src/modules/m_banredirect.cpp4
-rw-r--r--src/modules/m_chancreate.cpp2
-rw-r--r--src/modules/m_conn_join.cpp2
-rw-r--r--src/modules/m_cycle.cpp2
-rw-r--r--src/modules/m_delayjoin.cpp6
-rw-r--r--src/modules/m_foobar.cpp4
-rw-r--r--src/modules/m_httpd_stats.cpp2
-rw-r--r--src/modules/m_invisible.cpp2
-rw-r--r--src/modules/m_joinflood.cpp8
-rw-r--r--src/modules/m_operjoin.cpp2
-rw-r--r--src/modules/m_redirect.cpp2
-rw-r--r--src/modules/m_sajoin.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp2
-rw-r--r--src/modules/m_spanningtree/main.h2
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
22 files changed, 41 insertions, 29 deletions
diff --git a/include/channels.h b/include/channels.h
index 0f947ac22..c49ac35d3 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -122,7 +122,7 @@ class CoreExport Channel : public Extensible
/** Connect a Channel to a User
*/
- static Channel* ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const std::string &privs);
+ static Channel* ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const std::string &privs, bool bursting);
/** Set default modes for the channel on creation
*/
@@ -375,7 +375,7 @@ class CoreExport Channel : public Extensible
* been created if the channel did not exist before the user was joined to it.
* If the user could not be joined to a channel, the return value may be NULL.
*/
- static Channel* JoinUser(InspIRCd* ServerInstance, User *user, const char* cn, bool override, const char* key, time_t TS = 0);
+ static Channel* JoinUser(InspIRCd* ServerInstance, User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS = 0);
/** Write to a channel, from a user, using va_args for text
* @param user User whos details to prefix the line with
diff --git a/include/modules.h b/include/modules.h
index 598c0b4f6..112804524 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -458,8 +458,10 @@ class CoreExport Module : public Extensible
* @param channel The channel being joined
* @param silent Change this to true if you want to conceal the JOIN command from the other users
* of the channel (useful for modules such as auditorium)
+ * @param sync This is set to true if the JOIN is the result of a network sync and the remote user is being introduced
+ * to a channel due to the network sync.
*/
- virtual void OnUserJoin(User* user, Channel* channel, bool &silent);
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent);
/** Called after a user joins a channel
* Identical to OnUserJoin, but called immediately afterwards, when any linking module has
diff --git a/src/channels.cpp b/src/channels.cpp
index cc5a2d7d5..764126891 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -198,7 +198,7 @@ void Channel::SetDefaultModes()
* add a channel to a user, creating the record for it if needed and linking
* it to the user record
*/
-Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool override, const char* key, time_t TS)
+Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool override, const char* key, bool bursting, time_t TS)
{
if (!user || !cn)
return NULL;
@@ -359,10 +359,10 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool
}
}
- return Channel::ForceChan(Instance, Ptr, user, privs);
+ return Channel::ForceChan(Instance, Ptr, user, privs, bursting);
}
-Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const std::string &privs)
+Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const std::string &privs, bool bursting)
{
std::string nick = user->nick;
bool silent = false;
@@ -405,7 +405,7 @@ Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const
}
}
- FOREACH_MOD_I(Instance,I_OnUserJoin,OnUserJoin(user, Ptr, silent));
+ FOREACH_MOD_I(Instance,I_OnUserJoin,OnUserJoin(user, Ptr, bursting, silent));
if (!silent)
Ptr->WriteChannel(user,"JOIN :%s",Ptr->name);
diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp
index b5359397d..be9b963a6 100644
--- a/src/commands/cmd_join.cpp
+++ b/src/commands/cmd_join.cpp
@@ -30,7 +30,7 @@ CmdResult CommandJoin::Handle (const char** parameters, int pcnt, User *user)
if (ServerInstance->IsChannel(parameters[0]))
{
- Channel::JoinUser(ServerInstance, user, parameters[0], false, parameters[1]);
+ Channel::JoinUser(ServerInstance, user, parameters[0], false, parameters[1], false);
return CMD_SUCCESS;
}
}
@@ -41,7 +41,7 @@ CmdResult CommandJoin::Handle (const char** parameters, int pcnt, User *user)
if (ServerInstance->IsChannel(parameters[0]))
{
- Channel::JoinUser(ServerInstance, user, parameters[0], false, "");
+ Channel::JoinUser(ServerInstance, user, parameters[0], false, "", false);
return CMD_SUCCESS;
}
}
diff --git a/src/modules.cpp b/src/modules.cpp
index d4e56f3fb..8f32e94ac 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -109,7 +109,7 @@ std::string Event::GetEventID()
void Module::OnUserConnect(User*) { }
void Module::OnUserQuit(User*, const std::string&, const std::string&) { }
void Module::OnUserDisconnect(User*) { }
-void Module::OnUserJoin(User*, Channel*, bool&) { }
+void Module::OnUserJoin(User*, Channel*, bool, bool&) { }
void Module::OnPostJoin(User*, Channel*) { }
void Module::OnUserPart(User*, Channel*, const std::string&, bool&) { }
void Module::OnRehash(User*, const std::string&) { }
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp
index d75175fed..cab6395ef 100644
--- a/src/modules/m_auditorium.cpp
+++ b/src/modules/m_auditorium.cpp
@@ -122,7 +122,7 @@ class ModuleAuditorium : public Module
return 0;
}
- virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
{
if (channel->IsModeSet('u'))
{
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index 363da21d7..80a79e25b 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -258,7 +258,7 @@ class ModuleBanRedirect : public Module
ExceptionModule = ServerInstance->Modules->Find("m_banexception.so");
}
- virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs)
+ virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, bool synching = false)
{
/* This prevents recursion when a user sets multiple ban redirects in a chain
* (thanks Potter)
@@ -307,7 +307,7 @@ class ModuleBanRedirect : public Module
user->WriteServ("474 %s %s :Cannot join channel (You are banned)", user->nick, chan->name);
user->WriteServ("470 %s :You are being automatically redirected to %s", user->nick, redir->targetchan.c_str());
nofollow = true;
- Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time(true));
nofollow = false;
return 1;
}
diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp
index 3b81799c3..fb111071a 100644
--- a/src/modules/m_chancreate.cpp
+++ b/src/modules/m_chancreate.cpp
@@ -38,7 +38,7 @@ class ModuleChanCreate : public Module
}
- virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
{
if (channel->GetUserCounter() == 1)
{
diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp
index e87a137cf..4d026aa91 100644
--- a/src/modules/m_conn_join.cpp
+++ b/src/modules/m_conn_join.cpp
@@ -82,7 +82,7 @@ class ModuleConnJoin : public Module
for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++)
if (ServerInstance->IsChannel(it->c_str()))
- Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time(true));
}
};
diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp
index d190eda3c..045ea3ad9 100644
--- a/src/modules/m_cycle.cpp
+++ b/src/modules/m_cycle.cpp
@@ -62,7 +62,7 @@ class CommandCycle : public Command
if (!channel->PartUser(user, reason.c_str()))
delete channel;
- Channel::JoinUser(ServerInstance, user, parameters[0], true, "", ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, parameters[0], true, "", false, ServerInstance->Time(true));
}
return CMD_LOCALONLY;
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp
index 435148c61..9d9a4007e 100644
--- a/src/modules/m_delayjoin.cpp
+++ b/src/modules/m_delayjoin.cpp
@@ -118,7 +118,7 @@ class ModuleDelayJoin : public Module
return 0;
}
- virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
{
if (channel->IsModeSet('D'))
{
@@ -191,6 +191,10 @@ class ModuleDelayJoin : public Module
/* Display the join to everyone else (the user who joined got it earlier) */
this->WriteCommonFrom(user, channel, "JOIN %s", channel->name);
+ std::string n = this->ServerInstance->Modes->ModeString(user, channel);
+ if (n.length() > 0)
+ this->WriteCommonFrom(user, channel, "MODE %s +%s", channel->name, n.c_str());
+
/* Shrink off the neccessary metadata for a specific channel */
user->Shrink(std::string("delayjoin_")+channel->name);
diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp
index fb3e8d736..16f2a9863 100644
--- a/src/modules/m_foobar.cpp
+++ b/src/modules/m_foobar.cpp
@@ -68,10 +68,10 @@ class ModuleFoobar : public Module
ServerInstance->Log(DEBUG,"Foobar: User quitting: "+b);
}
- virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
{
// method called when a user joins a channel
-
+
std::string c = channel->name;
std::string b = user->nick;
ServerInstance->Log(DEBUG,"Foobar: User "+b+" joined "+c);
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 9324e974d..951103271 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -186,7 +186,7 @@ class ModuleHttpStats : public Module
this->changed = true;
}
- void OnUserJoin(User* user, Channel* channel, bool &silent)
+ void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
{
StatsIter a = sh->find(channel->name);
if (a != sh->end())
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index 3b419350d..30e7ddfb0 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -186,7 +186,7 @@ class ModuleInvisible : public Module
}
- virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
{
if (user->IsModeSet('Q'))
{
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index a1f1f7a51..effe67dab 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -239,9 +239,15 @@ class ModuleJoinFlood : public Module
return 0;
}
- virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
{
joinfloodsettings *f;
+
+ /* We arent interested in JOIN events caused by a network burst */
+ if (sync)
+ return;
+
+ /* But all others are OK */
if (channel->GetExt("joinflood",f))
{
f->addjoin();
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index 243c329c8..c8b4b1eaa 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -77,7 +77,7 @@ class ModuleOperjoin : public Module
for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++)
if (ServerInstance->IsChannel(it->c_str()))
- Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time(true));
}
};
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 7827fd4ec..373ac097c 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -132,7 +132,7 @@ class ModuleRedirect : public Module
}
user->WriteServ("470 %s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str());
- Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time(true));
return 1;
}
}
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 68f4fd0c0..21bab9150 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -50,7 +50,7 @@ class CommandSajoin : public Command
*/
if (IS_LOCAL(dest))
{
- Channel::JoinUser(ServerInstance, dest, parameters[1], true, "", ServerInstance->Time(true));
+ Channel::JoinUser(ServerInstance, dest, parameters[1], true, "", false, ServerInstance->Time(true));
/* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propagate */
Channel* n = ServerInstance->FindChan(parameters[1]);
if (n)
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 5a04ba27e..3c9a9803e 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -557,7 +557,7 @@ void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
DoPingChecks(curtime);
}
-void ModuleSpanningTree::OnUserJoin(User* user, Channel* channel, bool &silent)
+void ModuleSpanningTree::OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
{
// Only do this for local users
if (IS_LOCAL(user))
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index ec2a6f849..f9b63d431 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -166,7 +166,7 @@ class ModuleSpanningTree : public Module
virtual void OnUserNotice(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list);
virtual void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list);
virtual void OnBackgroundTimer(time_t curtime);
- virtual void OnUserJoin(User* user, Channel* channel, bool &silent);
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent);
virtual void OnChangeHost(User* user, const std::string &newhost);
virtual void OnChangeName(User* user, const std::string &gecos);
virtual void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent);
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 5fbb8ee2b..78db02d8b 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -861,7 +861,7 @@ bool TreeSocket::ForceJoin(const std::string &source, std::deque<std::string> &p
for (std::string::iterator x = modes.begin(); x != modes.end(); ++x)
modestack.Push(*x, who->nick);
- Channel::JoinUser(this->Instance, who, channel.c_str(), true, "", TS);
+ Channel::JoinUser(this->Instance, who, channel.c_str(), true, "", true, TS);
}
else
{
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index b18261c52..c40dd318c 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -338,7 +338,7 @@ bool TreeSocket::ServiceJoin(const std::string &prefix, std::deque<std::string>
{
/* only join if it's local, otherwise just pass it on! */
if (IS_LOCAL(u))
- Channel::JoinUser(this->Instance, u, params[1].c_str(), false, "", Instance->Time());
+ Channel::JoinUser(this->Instance, u, params[1].c_str(), false, "", false, Instance->Time());
Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix);
}
return true;