]> jfr.im git - irc/xchat.git/commitdiff
fix per-channel logging when global is OFF.
authorzed <redacted>
Sun, 25 May 2008 06:25:31 +0000 (06:25 +0000)
committerzed <redacted>
Sun, 25 May 2008 06:25:31 +0000 (06:25 +0000)
git-svn-id: svn://svn.code.sf.net/p/xchat/svn@1298 893a96be-7f27-4fdf-9d1e-6aeec9d3cce1

src/common/text.c

index db2a48ee3549ec08b497d02ebc2f01012980e6ba..d5ece3501b368bf3d90bc51eee64ef9540939d29 100644 (file)
@@ -629,39 +629,50 @@ log_write (session *sess, char *text)
        char *file;
        int len;
 
-       if (sess->logfd != -1 && prefs.logging)
+       if (sess->text_logging == SET_DEFAULT)
+       {
+               if (!prefs.logging)
+                       return;
+       }
+       else
+       {
+               if (sess->text_logging != SET_ON)
+                       return;
+       }
+
+       if (sess->logfd == -1)
+               log_open (sess);
+
+       /* change to a different log file? */
+       file = log_create_pathname (sess->server->servername, sess->channel,
+                                                                                server_get_network (sess->server, FALSE));
+       if (file)
        {
-               /* change to a different log file? */
-               file = log_create_pathname (sess->server->servername, sess->channel,
-                                                                                        server_get_network (sess->server, FALSE));
-               if (file)
+               if (access (file, F_OK) != 0)
                {
-                       if (access (file, F_OK) != 0)
-                       {
-                               close (sess->logfd);
-                               sess->logfd = log_open_file (sess->server->servername, sess->channel,
-                                                                                                         server_get_network (sess->server, FALSE));
-                       }
-                       g_free (file);
+                       close (sess->logfd);
+                       sess->logfd = log_open_file (sess->server->servername, sess->channel,
+                                                                                                 server_get_network (sess->server, FALSE));
                }
+               g_free (file);
+       }
 
-               if (prefs.timestamp_logs)
+       if (prefs.timestamp_logs)
+       {
+               len = get_stamp_str (prefs.timestamp_log_format, time (0), &stamp);
+               if (len)
                {
-                       len = get_stamp_str (prefs.timestamp_log_format, time (0), &stamp);
-                       if (len)
-                       {
-                               write (sess->logfd, stamp, len);
-                               g_free (stamp);
-                       }
+                       write (sess->logfd, stamp, len);
+                       g_free (stamp);
                }
-               temp = strip_color (text, -1, STRIP_ALL);
-               len = strlen (temp);
-               write (sess->logfd, temp, len);
-               /* lots of scripts/plugins print without a \n at the end */
-               if (temp[len - 1] != '\n')
-                       write (sess->logfd, "\n", 1);   /* emulate what xtext would display */
-               g_free (temp);
        }
+       temp = strip_color (text, -1, STRIP_ALL);
+       len = strlen (temp);
+       write (sess->logfd, temp, len);
+       /* lots of scripts/plugins print without a \n at the end */
+       if (temp[len - 1] != '\n')
+               write (sess->logfd, "\n", 1);   /* emulate what xtext would display */
+       g_free (temp);
 }
 
 /* converts a CP1252/ISO-8859-1(5) hybrid to UTF-8                           */