- this->RemoveStatus(ServerInstance->Config->GetSID(), param_list);
- }
- else
- {
- /* Timestamp equal. Apply the user modes always */
- apply_other_sides_umodes = true;
- /*
- * If the server is bursting, then the channel modes need to be applied;
- * it is expected that servers will resync modes at this time. Otherwise,
- * the mode string sent along with the FJOIN could be out-of-date, and
- * applying the mode change could cause modes to be unexpectedly bounced.
- */
- TreeServer *s = Utils->FindServer(source);
- apply_other_sides_cmodes = s->bursting;
+ this->RemoveStatus(ServerInstance->FakeClient, param_list);
+
+ // XXX: If the channel does not exist in the chan hash at this point, create it so the remote modes can be applied on it.
+ // This happens to 0-user permanent channels on the losing side, because those are removed (from the chan hash, then
+ // deleted later) as soon as the permchan mode is removed from them.
+ if (ServerInstance->FindChan(channel) == NULL)
+ {
+ chan = new Channel(channel, TS);
+ }