summaryrefslogtreecommitdiff
path: root/modules/protocol/unreal32.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/protocol/unreal32.cpp')
-rw-r--r--modules/protocol/unreal32.cpp50
1 files changed, 14 insertions, 36 deletions
diff --git a/modules/protocol/unreal32.cpp b/modules/protocol/unreal32.cpp
index 1e18e92f9..ff04e87eb 100644
--- a/modules/protocol/unreal32.cpp
+++ b/modules/protocol/unreal32.cpp
@@ -214,6 +214,12 @@ class UnrealIRCdProto : public IRCDProto
send_cmd(Config->ServerName, "~ %ld %s :%s", static_cast<long>(chantime), channel.c_str(), user->nick.c_str());
}
+ void SendJoin(BotInfo *user, const ChannelContainer *cc)
+ {
+ send_cmd(Config->ServerName, "~ %ld %s :%s%s", static_cast<long>(cc->chan->creation_time), cc->chan->name.c_str(), cc->Status->BuildModePrefixList().c_str(), user->nick.c_str());
+ cc->chan->SetModes(user, false, "%s", cc->chan->GetModes(true, true).c_str());
+ }
+
/* unsqline
*/
void SendSQLineDel(const XLine *x)
@@ -988,54 +994,25 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
Channel *c = findchan(av[1]);
time_t ts = Anope::string(av[0]).is_number_only() ? convertTo<time_t>(av[0]) : 0;
bool keep_their_modes = true;
- bool was_created = false;
if (!c)
{
c = new Channel(av[1], ts);
- was_created = true;
+ c->SetFlag(CH_SYNCING);
}
/* Our creation time is newer than what the server gave us */
else if (c->creation_time > ts)
{
c->creation_time = ts;
+ c->Reset();
- for (std::list<Mode *>::const_iterator it =ModeManager::Modes.begin(), it_end = ModeManager::Modes.end(); it != it_end; ++it)
- {
- Mode *m = *it;
-
- if (m->Type != MODE_STATUS)
- continue;
-
- ChannelMode *cm = debug_cast<ChannelMode *>(m);
-
- for (CUserList::const_iterator uit = c->users.begin(), uit_end = c->users.end(); uit != uit_end; ++uit)
- {
- UserContainer *uc = *uit;
-
- c->RemoveMode(NULL, cm, uc->user->nick);
- }
- }
- if (c->ci)
- {
- /* Rejoin the bot to fix the TS */
- if (c->ci->bi)
- {
- c->ci->bi->Part(c, "TS reop");
- c->ci->bi->Join(c);
- }
- /* Reset mlock */
- check_modes(c);
- }
+ /* Reset mlock */
+ check_modes(c);
}
/* Their TS is newer than ours, our modes > theirs, unset their modes if need be */
- else
+ else if (ts > c->creation_time)
keep_their_modes = false;
- /* Mark the channel as syncing */
- if (was_created)
- c->SetFlag(CH_SYNCING);
-
/* If we need to keep their modes, and this SJOIN string contains modes */
if (keep_their_modes && ac >= 4)
{
@@ -1090,7 +1067,8 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
continue;
}
- Status.push_back(cm);
+ if (keep_their_modes)
+ Status.push_back(cm);
}
User *u = finduser(buf);
@@ -1127,7 +1105,7 @@ int anope_event_sjoin(const Anope::string &source, int ac, const char **av)
}
/* Channel is done syncing */
- if (was_created)
+ if (c->HasFlag(CH_SYNCING))
{
/* Unset the syncing flag */
c->UnsetFlag(CH_SYNCING);