]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
More fixing of irc_disconnect
authorAkari <hetors.email@gmail.com>
Thu, 10 Feb 2011 08:51:35 +0000 (10:51 +0200)
committerAkari <hetors.email@gmail.com>
Thu, 10 Feb 2011 08:51:35 +0000 (10:51 +0200)
irc.c

diff --git a/irc.c b/irc.c
index e6cc353d69c0822137dd82f7c9e6a658520df8e0..e621cc8f320f2a655c865cf915d55a29c59c3c59 100755 (executable)
--- a/irc.c
+++ b/irc.c
@@ -23,7 +23,7 @@ cvar_t irc_server = {CVAR_SAVE, "irc_server", "", "IRC server to connect to"};
 cvar_t irc_port = {CVAR_SAVE, "irc_port", "6667", "Port of the IRC server"};
 cvar_t irc_password = {CVAR_SAVE, "irc_password", "", "IRC server password"};
 cvar_t irc_nick = {CVAR_SAVE, "irc_nick", "", "Your nickname to use on IRC. Note: this cvar only defines your prefered nick, do NOT use this to change your nickname while connected, use irc_chnick instead"};
-cvar_t irc_connected = {CVAR_READONLY, "irc_connected", "0", "IRC connection state (0 = not connected, 1 = connecting, 2 = connected)"};
+cvar_t irc_connected = {CVAR_READONLY, "irc_connected", "0", "IRC connection state (0 = not connected, 1 = connecting, 2 = connected, 3 = disconnecting)"};
 cvar_t irc_msgprefix = {CVAR_SAVE, "irc_msgprefix", "^5IRC^0|^7", "What all IRC events will be prefixed with when printed to the console"};
 cvar_t irc_chatwindow = {CVAR_SAVE, "irc_chatwindow", "2", "0 = IRC messages will be printed in the console only, 1 = IRC messages will go to the chat window, 2 = Only hilights and private messages will appear in the chat window"};
 cvar_t irc_numeric_errorsonly = {CVAR_SAVE, "irc_numeric_errorsonly", "0", "If 1, any numeric event below 400 won't be printed'"};
@@ -78,6 +78,12 @@ static void IRC_Thread(void *p)
 {
     if(irc_run(irc_session_global))
     {
+        if(irc_connected.integer == 3) //irc_disconnect
+        {
+            Cvar_SetQuick(&irc_connected, "0");
+            return;
+        }
+        
         Con_Printf("%s^1Error: ^7%s\n",
             irc_msgprefix.string,
             irc_strerror(irc_errno(irc_session_global))
@@ -189,11 +195,9 @@ static void CL_Irc_Disconnect_f(void)
     }
     
     Con_Printf("^1Disconnected from the IRC server\n");
+    Cvar_SetQuick(&irc_connected, "3");
     irc_cmd_quit(irc_session_global, "Disconnected");
-    
     irc_destroy_session(irc_session_global);
-
-    Cvar_SetQuick(&irc_connected, "0");
 }
 
 static void CL_Irc_Say_Universal_f(void)