+ /* Check if there is a config thread which has finished executing but has not yet been freed */
+ if (this->ConfigThread && this->ConfigThread->IsDone())
+ {
+ /* Rehash has completed */
+ this->Logs->Log("CONFIG",DEBUG,"Detected ConfigThread exiting, tidying up...");
+
+ /* Switch over logfiles */
+ Logs->CloseLogs();
+ Logs->OpenFileLogs();
+
+ /*
+ * Apply the changed configuration from the rehash. This is not done within the
+ * configuration thread becasuse they may invoke functions that are not threadsafe.
+ *
+ * XXX: The order of these is IMPORTANT, do not reorder them without testing
+ * thoroughly!!!
+ */
+ this->ConfigThread->Finish();
+ this->XLines->CheckELines();
+ this->XLines->ApplyLines();
+ this->Res->Rehash();
+ this->ResetMaxBans();
+ InitializeDisabledCommands(Config->DisabledCommands, this);
+ User* user = ConfigThread->TheUserUID.empty() ? FindNick(ConfigThread->TheUserUID) : NULL;
+ FOREACH_MOD_I(this, I_OnRehash, OnRehash(user));
+ this->BuildISupport();
+
+ delete ConfigThread;
+ ConfigThread = NULL;
+ }
+