diff options
-rw-r--r-- | src/modules/m_banredirect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_conn_join.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_operjoin.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_redirect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sajoin.cpp | 33 | ||||
-rw-r--r-- | src/modules/m_sapart.cpp | 35 |
6 files changed, 49 insertions, 27 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 6150c5193..2d9deedc6 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -294,7 +294,7 @@ class ModuleBanRedirect : public Module { user->WriteServ("470 %s :You are banned from %s. You are being automatically redirected to %s", user->nick, chan->name, redir->targetchan.c_str()); nofollow = true; - chanrec::JoinUser(Srv, user, redir->targetchan.c_str(), false, ""); + chanrec::JoinUser(Srv, user, redir->targetchan.c_str(), false, "", ServerInstance->Time(true)); nofollow = false; return 1; } diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index 75415d6a5..2cc6274a2 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -88,7 +88,7 @@ class ModuleConnJoin : public Module for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++) if (ServerInstance->IsChannel(it->c_str())) - chanrec::JoinUser(ServerInstance, user, it->c_str(), false, ""); + chanrec::JoinUser(ServerInstance, user, it->c_str(), false, "", ServerInstance->Time(true)); } }; diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 4308068e3..518eeb009 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -89,7 +89,7 @@ class ModuleOperjoin : public Module for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++) if (ServerInstance->IsChannel(it->c_str())) - chanrec::JoinUser(ServerInstance, user, it->c_str(), false, ""); + chanrec::JoinUser(ServerInstance, user, it->c_str(), false, "", ServerInstance->Time(true)); } }; diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 9cba183fe..e09c9b33b 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -137,7 +137,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()); - chanrec::JoinUser(ServerInstance, user, channel.c_str(), false, ""); + chanrec::JoinUser(ServerInstance, user, channel.c_str(), false, "", ServerInstance->Time(true)); return 1; } } diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index ad5aef213..b91b1a2f0 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -49,27 +49,38 @@ class cmd_sajoin : public command_t return CMD_FAILURE; } - chanrec::JoinUser(ServerInstance, dest, parameters[1], true, ""); - - /* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propogate */ - chanrec* n = ServerInstance->FindChan(parameters[1]); - if (n) + /* For local users, we send the JoinUser which may create a channel and set its TS. + * For non-local users, we just return CMD_SUCCESS, knowing this will propogate it where it needs to be + * and then that server will generate the users JOIN or FJOIN instead. + */ + if (IS_LOCAL(dest)) { - if (n->HasUser(dest)) + chanrec::JoinUser(ServerInstance, dest, parameters[1], true, "", ServerInstance->Time(true)); + /* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propogate */ + chanrec* n = ServerInstance->FindChan(parameters[1]); + if (n) { - ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]); - return CMD_SUCCESS; + if (n->HasUser(dest)) + { + ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]); + return CMD_SUCCESS; + } + else + { + user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(dest->nick)+" to "+parameters[1]+" (User is probably banned, or blocking modes)"); + return CMD_FAILURE; + } } else { - user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(dest->nick)+" to "+parameters[1]+" (User is probably banned, or blocking modes)"); + user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(dest->nick)+" to "+parameters[1]); return CMD_FAILURE; } } else { - user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Could not join "+std::string(dest->nick)+" to "+parameters[1]); - return CMD_FAILURE; + ServerInstance->WriteOpers("*** "+std::string(user->nick)+" sent remote SAJOIN to make "+std::string(dest->nick)+" join "+parameters[1]); + return CMD_SUCCESS; } } else diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index b341b4c28..01df5c1be 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -43,27 +43,38 @@ class cmd_sapart : public command_t return CMD_FAILURE; } - if (!channel->PartUser(dest, dest->nick)) - delete channel; - chanrec* n = ServerInstance->FindChan(parameters[1]); - if (!n) + /* For local clients, directly part them generating a PART message. For remote clients, + * just return CMD_SUCCESS knowing the protocol module will route the SAPART to the users + * local server and that will generate the PART instead + */ + if (IS_LOCAL(dest)) { - ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]); - return CMD_SUCCESS; - } - else - { - if (!n->HasUser(dest)) + if (!channel->PartUser(dest, dest->nick)) + delete channel; + chanrec* n = ServerInstance->FindChan(parameters[1]); + if (!n) { ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]); return CMD_SUCCESS; } else { - user->WriteServ("NOTICE %s :*** Unable to make %s part %s",user->nick, dest->nick, parameters[1]); - return CMD_FAILURE; + if (!n->HasUser(dest)) + { + ServerInstance->WriteOpers("*** "+std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]); + return CMD_SUCCESS; + } + else + { + user->WriteServ("NOTICE %s :*** Unable to make %s part %s",user->nick, dest->nick, parameters[1]); + return CMD_FAILURE; + } } } + else + { + ServerInstance->WriteOpers("*** "+std::string(user->nick)+" sent remote SAPART to make "+dest->nick+" part "+parameters[1]); + } return CMD_SUCCESS; } |