0.8.6claws49
authorChristoph Hohmann <reboot@gmx.ch>
Mon, 2 Dec 2002 17:41:39 +0000 (17:41 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Mon, 2 Dec 2002 17:41:39 +0000 (17:41 +0000)
* doc-src/ui_seperation.txt     ** NEW **
        information for ui seperation

* src/Makefile.am
        remove files that were moved to common
        include common directory by default for the header files

* src/inc.c
* src/common/socket.c
* src/automaton.[ch]
        implement automaton using g_io_*-functions instead of
        gdk_input_add to make it ui independent

* src/codeconv.c
* src/compose.c
* src/ldif.c
* src/pgptext.c
* src/procmime.c
* src/rfc2015.c
* src/smtp.c
* src/unmime.c
        remove common/ prefix because directory is now in
        include path

* src/compose.c
* src/folder.c
* src/folderview.c
* src/mainwindow.c
* src/messageview.c
* src/prefs_common.c
* src/procmsg.c
* src/rfc2015.c
        fix warnings

* src/imap.c
* src/inc.c
* src/news.c
* src/pop.c
* src/send.c
* src/smtp.c
* src/ssl_certificate.c
        add log.h header file for logging functions

* src/main.c
* src/common/utils.c
* src/summaryview.c
* src/xml.c
        o move debug_mode to commno/utils.c
        o add functions to set and get debug_mode

* src/defs.h                    ** REMOVE **
* src/intl.h                    ** REMOVE **
* src/socket.[ch]               ** REMOVE **
* src/ssl.[ch]                  ** REMOVE **
* src/utils.[ch]                ** REMOVE **
        replaced by new files in src/common/

* src/common/Makefile.am
        add new files in src/common/

* src/common/defs.h             ** NEW **
* src/common/intl.h             ** NEW **
* src/common/log.[ch]           ** NEW **
* src/common/socket.[ch]        ** NEW **
* src/common/ssl.[ch]           ** NEW **
* src/common/utils.[ch]         ** NEW **
        replacement for files in src/

40 files changed:
ChangeLog.claws
configure.in
doc/src/ui_seperation.txt [new file with mode: 0644]
src/Makefile.am
src/automaton.c
src/automaton.h
src/codeconv.c
src/common/Makefile.am
src/common/defs.h [moved from src/defs.h with 100% similarity]
src/common/intl.h [moved from src/intl.h with 100% similarity]
src/common/log.c [new file with mode: 0644]
src/common/log.h [new file with mode: 0644]
src/common/socket.c [moved from src/socket.c with 97% similarity]
src/common/socket.h [moved from src/socket.h with 93% similarity]
src/common/ssl.c [moved from src/ssl.c with 95% similarity]
src/common/ssl.h [moved from src/ssl.h with 100% similarity]
src/common/utils.c [moved from src/utils.c with 95% similarity]
src/common/utils.h [moved from src/utils.h with 96% similarity]
src/compose.c
src/folder.c
src/folderview.c
src/imap.c
src/inc.c
src/ldif.c
src/main.c
src/mainwindow.c
src/messageview.c
src/news.c
src/pgptext.c
src/pop.c
src/prefs_common.c
src/procmime.c
src/procmsg.c
src/rfc2015.c
src/send.c
src/smtp.c
src/ssl_certificate.c
src/summaryview.c
src/unmime.c
src/xml.c

index 674f4c742cb2ff3de0ccc6ffa0bcdcef399fba7f..87093f42ea05b0314bc331c5cc3e73075c967138 100644 (file)
@@ -1,3 +1,73 @@
+2002-11-30 [christoph] 0.8.6claws49
+
+       * doc-src/ui_seperation.txt     ** NEW **
+               information for ui seperation
+
+       * src/Makefile.am
+               remove files that were moved to common
+               include common directory by default for the header files
+
+       * src/inc.c
+       * src/common/socket.c
+       * src/automaton.[ch]
+               implement automaton using g_io_*-functions instead of
+               gdk_input_add to make it ui independent
+
+       * src/codeconv.c
+       * src/compose.c
+       * src/ldif.c
+       * src/pgptext.c
+       * src/procmime.c
+       * src/rfc2015.c
+       * src/smtp.c
+       * src/unmime.c
+               remove common/ prefix because directory is now in
+               include path
+
+       * src/compose.c
+       * src/folder.c
+       * src/folderview.c
+       * src/mainwindow.c
+       * src/messageview.c
+       * src/prefs_common.c
+       * src/procmsg.c
+       * src/rfc2015.c
+               fix warnings
+
+       * src/imap.c
+       * src/inc.c
+       * src/news.c
+       * src/pop.c
+       * src/send.c
+       * src/smtp.c
+       * src/ssl_certificate.c
+               add log.h header file for logging functions
+
+       * src/main.c
+       * src/common/utils.c
+       * src/summaryview.c
+       * src/xml.c
+               o move debug_mode to commno/utils.c
+               o add functions to set and get debug_mode
+
+       * src/defs.h                    ** REMOVE **
+       * src/intl.h                    ** REMOVE **
+       * src/socket.[ch]               ** REMOVE **
+       * src/ssl.[ch]                  ** REMOVE **
+       * src/utils.[ch]                ** REMOVE **
+               replaced by new files in src/common/
+       
+       * src/common/Makefile.am
+               add new files in src/common/
+
+       * src/common/defs.h             ** NEW **
+       * src/common/intl.h             ** NEW **
+       * src/common/log.[ch]           ** NEW **
+       * src/common/socket.[ch]        ** NEW **
+       * src/common/ssl.[ch]           ** NEW **
+       * src/common/utils.[ch]         ** NEW **
+               replacement for files in src/
+
 2002-11-30 [colin]     0.8.6claws48
 
        * src/folderview.c
index a7dfe69db184dc558ade7a1cc504a8e4c63ed3ca..0e885db41a3df3f1fb0431ac58247c3227cdf9a0 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws48
+EXTRA_VERSION=claws49
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
diff --git a/doc/src/ui_seperation.txt b/doc/src/ui_seperation.txt
new file mode 100644 (file)
index 0000000..e4f4381
--- /dev/null
@@ -0,0 +1,19 @@
+This is a table of old and new files to find functions when
+files have been splitted into several files for seperation
+
+old                    new                     state
+
+base64.[ch]            common/base64.[ch]      ok
+
+uuencode.[ch]          common/uuencode.[ch]    ok
+
+utils.[ch]             common/utils.[ch]       ok
+                       common/log.[ch]         FIXME
+
+socket.[ch]            common/socket.[ch]      ok
+
+ssl.[ch]               common/ssl.[ch]         FIXME
+
+intl.h                 common/intl.h           ok
+
+defs.h                 common/defs.h           ok
index fb864254b27165a38b880531937bebc8d9fb7cac..04e73d7ae024cbbc247026877eaffe01eed01260 100644 (file)
@@ -86,13 +86,10 @@ sylpheed_SOURCES = \
        grouplistdialog.c grouplistdialog.h \
        about.c about.h \
        setup.c setup.h \
-       utils.c utils.h \
        gtkutils.c gtkutils.h \
        codeconv.c codeconv.h \
        unmime.c unmime.h \
        md5.c md5.h \
-       socket.c socket.h \
-       ssl.c ssl.h \
        ssl_certificate.c ssl_certificate.h \
        ssl_manager.c ssl_manager.h \
        automaton.c automaton.h \
@@ -219,6 +216,7 @@ EXTRA_DIST = \
        pixmaps/quicksearch.xpm
 
 INCLUDES = \
+       -Icommon \
        -DG_LOG_DOMAIN=\"Sylpheed\" \
        -I$(top_srcdir)/intl \
         $(ASPELL_CFLAGS)    \
index d6f0808b6f8ca27d887f10b5ebcb3ef6fba09b42..b71a5fb97e781e1ee652d10b486f5ad58b0ac6c7 100644 (file)
@@ -44,8 +44,9 @@ void automaton_destroy(Automaton *atm)
        g_free(atm);
 }
 
-void automaton_input_cb(gpointer data, gint dummy_source,
-                       GdkInputCondition condition)
+gboolean automaton_input_cb(GIOChannel *channel,
+                       GIOCondition condition,
+                       gpointer data)
 {
        Automaton *atm = (Automaton *)data;
        SockInfo *sock;
@@ -55,7 +56,7 @@ void automaton_input_cb(gpointer data, gint dummy_source,
         * passed file descriptor because we can't map that one back
         * to the sockinfo */
        sock = atm->help_sock;
-       g_return_if_fail(sock->sock == dummy_source);
+       g_return_val_if_fail(sock->sock == g_io_channel_unix_get_fd(channel), TRUE);
 
        if (atm->timeout_tag > 0) {
                gtk_timeout_remove(atm->timeout_tag);
@@ -67,7 +68,7 @@ void automaton_input_cb(gpointer data, gint dummy_source,
 
        if (atm->cancelled) {
                atm->terminate(sock, data);
-               return;
+               return TRUE;
        }
 
        if (atm->ui_func)
@@ -75,19 +76,21 @@ void automaton_input_cb(gpointer data, gint dummy_source,
        next = atm->state[atm->num].handler(sock, atm->data);
 
        if (atm->terminated)
-               return;
+               return TRUE;
        if (atm->cancelled) {
                atm->terminate(sock, data);
-               return;
+               return TRUE;
        }
 
        if (next >= 0 && next <= atm->max && next != atm->num) {
                atm->num = next;
-               atm->tag = sock_gdk_input_add(sock,
-                                        atm->state[atm->num].condition,       
-                                        automaton_input_cb,
-                                        data);
+               atm->tag = sock_input_add(sock,
+                                         atm->state[atm->num].condition,       
+                                         automaton_input_cb,
+                                         data);
        } else {
                atm->terminate(sock, data);
        }
+
+       return TRUE;
 }
index 17e0fb8d18ab97cf6517b2e82cfe84a7d6f22bcc..97be9ffba687061c86d53e326c185dedcff3071a 100644 (file)
@@ -34,7 +34,7 @@ typedef void  (*AtmUIFunc)    (gpointer        data,
 
 struct _AtmState
 {
-       GdkInputCondition condition;
+       GIOCondition     condition;
        gint (*handler) (SockInfo       *source,
                         gpointer        data);
 };
@@ -62,8 +62,8 @@ struct _Automaton
 
 Automaton *automaton_create    (gint                    num);
 void automaton_destroy         (Automaton              *atm);
-void automaton_input_cb                (gpointer                data,
-                                gint                    dummy_source,
-                                GdkInputCondition       condition);
+gboolean automaton_input_cb    (GIOChannel             *channel,
+                                GIOCondition            condition,
+                                gpointer                data);
 
 #endif /* __AUTOMATON_H__ */
index 715383885463e8e1d77785e7f896dac9329bceec..b9d381ed710c9caba7350b93b3347c8a0b880915 100644 (file)
@@ -42,7 +42,7 @@
 #include "intl.h"
 #include "codeconv.h"
 #include "unmime.h"
-#include "common/base64.h"
+#include "base64.h"
 #include "utils.h"
 #include "prefs_common.h"
 
index 79276855fe4865ce978dedc268f319e4250c4766..6c6619d4b19f18c782cfb42316b9ddc36e014166 100644 (file)
@@ -1,8 +1,12 @@
 noinst_LTLIBRARIES = libsylpheedcommon.la
 
 libsylpheedcommon_la_SOURCES = \
+       utils.c utils.h \
        base64.c base64.h \
-       uuencode.c uuencode.h
+       uuencode.c uuencode.h \
+       socket.c socket.h \
+       ssl.c ssl.h \
+       log.c log.h
 
 INCLUDES = \
        $(GLIB_CFLAGS)
similarity index 100%
rename from src/defs.h
rename to src/common/defs.h
similarity index 100%
rename from src/intl.h
rename to src/common/intl.h
diff --git a/src/common/log.c b/src/common/log.c
new file mode 100644 (file)
index 0000000..34dc0e4
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <stdio.h>
+#include <glib.h>
+
+#include "defs.h"
+#include "utils.h"
+
+static FILE *log_fp = NULL;
+
+void set_log_file(const gchar *filename)
+{
+       if (log_fp) return;
+       log_fp = fopen(filename, "wb");
+       if (!log_fp)
+               FILE_OP_ERROR(filename, "fopen");
+}
+
+void close_log_file(void)
+{
+       if (log_fp) {
+               fclose(log_fp);
+               log_fp = NULL;
+       }
+}
+
+static guint log_verbosity_count = 0;
+
+void log_verbosity_set(gboolean verbose)
+{
+       if (verbose)
+               log_verbosity_count++;
+       else if (log_verbosity_count > 0)
+               log_verbosity_count--;
+}
+
+#define TIME_LEN       11
+
+void log_print(const gchar *format, ...)
+{
+       va_list args;
+       gchar buf[BUFFSIZE + TIME_LEN];
+       time_t t;
+
+       time(&t);
+       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+
+       va_start(args, format);
+       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       va_end(args);
+
+       if (debug_get_mode()) fputs(buf, stdout);
+/*     FIXME:
+       callback for gui logging
+
+       log_window_append(buf, LOG_NORMAL); */
+       if (log_fp) {
+               fputs(buf, log_fp);
+               fflush(log_fp);
+       }
+/*     FIXME:
+       callback for gui logging
+
+       if (log_verbosity_count)
+               statusbar_puts_all(buf + TIME_LEN); */
+}
+
+void log_message(const gchar *format, ...)
+{
+       va_list args;
+       gchar buf[BUFFSIZE + TIME_LEN];
+       time_t t;
+
+       time(&t);
+       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+
+       va_start(args, format);
+       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       va_end(args);
+
+       if (debug_get_mode()) g_message("%s", buf + TIME_LEN);
+/*     FIXME:
+       callback for gui logging
+
+       log_window_append(buf + TIME_LEN, LOG_MSG); */
+       if (log_fp) {
+               fwrite(buf, TIME_LEN, 1, log_fp);
+               fputs("* message: ", log_fp);
+               fputs(buf + TIME_LEN, log_fp);
+               fflush(log_fp);
+       }
+/*     FIXME:
+       callback for gui logging
+
+       statusbar_puts_all(buf + TIME_LEN); */
+}
+
+void log_warning(const gchar *format, ...)
+{
+       va_list args;
+       gchar buf[BUFFSIZE + TIME_LEN];
+       time_t t;
+
+       time(&t);
+       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+
+       va_start(args, format);
+       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       va_end(args);
+
+       g_warning("%s", buf);
+/*     FIXME:
+       callback for gui logging
+
+       log_window_append(buf + TIME_LEN, LOG_WARN); */
+       if (log_fp) {
+               fwrite(buf, TIME_LEN, 1, log_fp);
+               fputs("** warning: ", log_fp);
+               fputs(buf + TIME_LEN, log_fp);
+               fflush(log_fp);
+       }
+}
+
+void log_error(const gchar *format, ...)
+{
+       va_list args;
+       gchar buf[BUFFSIZE + TIME_LEN];
+       time_t t;
+
+       time(&t);
+       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+
+       va_start(args, format);
+       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       va_end(args);
+
+       g_warning("%s", buf);
+/*     FIXME:
+       callback for gui logging
+
+       log_window_append(buf + TIME_LEN, LOG_ERROR); */
+       if (log_fp) {
+               fwrite(buf, TIME_LEN, 1, log_fp);
+               fputs("*** error: ", log_fp);
+               fputs(buf + TIME_LEN, log_fp);
+               fflush(log_fp);
+       }
+}
diff --git a/src/common/log.h b/src/common/log.h
new file mode 100644 (file)
index 0000000..2523d65
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef LOG_H
+#define LOG_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <glib.h>
+
+/* logging */
+void set_log_file      (const gchar *filename);
+void close_log_file    (void);
+void log_verbosity_set (gboolean verbose);
+void log_print         (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+void log_message       (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+void log_warning       (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+void log_error         (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+
+#endif /* LOG_H */
similarity index 97%
rename from src/socket.c
rename to src/common/socket.c
index c0430a22e7c46616adf57ae80a03844ecdf82c93..e9bbef27bd7009f3f5679666fb9c775c80a97d6c 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "socket.h"
 #include "utils.h"
+#include "log.h"
 #if USE_SSL
 #  include "ssl.h"
 #endif
@@ -709,14 +710,21 @@ gint fd_close(gint fd)
        return close(fd);
 }
 
-gint sock_gdk_input_add(SockInfo *sock,
-                       GdkInputCondition condition,
-                       GdkInputFunction function,
-                       gpointer data)
+gint sock_input_add(SockInfo *sock,
+                   GIOCondition condition,
+                   GIOFunc function,
+                   gpointer data)
 {
+       GIOChannel *channel;
+       guint result;
+
        g_return_val_if_fail(sock != NULL, -1);
 
+       channel = g_io_channel_unix_new(sock->sock);
        /* :WK: We have to change some things here becuse most likey
           function() does take SockInfo * and not an gint */
-       return gdk_input_add(sock->sock, condition, function, data);
+       result = g_io_add_watch(channel, condition, function, data);
+       g_io_channel_unref(channel);
+
+       return result;
 }
similarity index 93%
rename from src/socket.h
rename to src/common/socket.h
index ba0fb1933159444b3c49bab07e6cd6585bd453ba..733eac29a251664247f61c83ee00614a0bd0cdc6 100644 (file)
@@ -25,7 +25,6 @@
 #endif
 
 #include <glib.h>
-#include <gdk/gdk.h> /* ugly, just needed for the GdkInputCondition et al. */
 #include <netdb.h>
 
 typedef struct _SockInfo       SockInfo;
@@ -79,9 +78,9 @@ gint sock_puts                (SockInfo *sock, const gchar *buf);
 gint sock_close                (SockInfo *sock);
 
 /* wrapper functions */
-gint sock_gdk_input_add          (SockInfo             *sock,
-                          GdkInputCondition     condition,
-                          GdkInputFunction      function,
+gint sock_input_add      (SockInfo             *sock,
+                          GIOCondition          condition,
+                          GIOFunc               function,
                           gpointer              data);
 
 /* Functions to directly work on FD.  They are needed for pipes */
similarity index 95%
rename from src/ssl.c
rename to src/common/ssl.c
index 7c4c07ec7c082acbdf96cd89af803dd69f4f2300..5383bcd61c419b8b42d9309d2fa36c5f7ad17a7e 100644 (file)
--- a/src/ssl.c
@@ -30,7 +30,8 @@
 #include "intl.h"
 #include "utils.h"
 #include "ssl.h"
-#include "ssl_certificate.h"
+#include "log.h"
+/* #include "ssl_certificate.h" */
 
 static SSL_CTX *ssl_ctx;
 
@@ -108,12 +109,17 @@ gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
                return FALSE;
        }
 
+/*     FIXME
+
+       gui independant certificate check and callback for
+       gui for user accepted certificates
+       
        if (!ssl_certificate_check(server_cert, sockinfo->hostname, sockinfo->port)) {
                X509_free(server_cert);
                SSL_free(ssl);
                return FALSE;
        }
-       
+*/
        X509_free(server_cert);
        sockinfo->ssl = ssl;
 
similarity index 100%
rename from src/ssl.h
rename to src/common/ssl.h
similarity index 95%
rename from src/utils.c
rename to src/common/utils.c
index 6cb751a1b442a8661435397904d3ba445300ca1c..7016e415e3d99af9a6a0f85a4067bbe2d5d1caa5 100644 (file)
 #include "intl.h"
 #include "utils.h"
 #include "socket.h"
-#include "statusbar.h"
-#include "logwindow.h"
 
 #define BUFFSIZE       8192
 
-extern gboolean debug_mode;
+static gboolean debug_mode = FALSE;
 
 static void hash_free_strings_func(gpointer key, gpointer value, gpointer data);
 
@@ -2946,32 +2944,14 @@ void get_rfc822_date(gchar *buf, gint len)
                   day, dd, mon, yyyy, hh, mm, ss, tzoffset(&t));
 }
 
-static FILE *log_fp = NULL;
-
-void set_log_file(const gchar *filename)
+void debug_set_mode(gboolean mode)
 {
-       if (log_fp) return;
-       log_fp = fopen(filename, "wb");
-       if (!log_fp)
-               FILE_OP_ERROR(filename, "fopen");
+       debug_mode = mode;
 }
 
-void close_log_file(void)
+gboolean debug_get_mode()
 {
-       if (log_fp) {
-               fclose(log_fp);
-               log_fp = NULL;
-       }
-}
-
-static guint log_verbosity_count = 0;
-
-void log_verbosity_set(gboolean verbose)
-{
-       if (verbose)
-               log_verbosity_count++;
-       else if (log_verbosity_count > 0)
-               log_verbosity_count--;
+       return debug_mode;
 }
 
 void debug_print_real(const gchar *format, ...)
@@ -2988,102 +2968,6 @@ void debug_print_real(const gchar *format, ...)
        fputs(buf, stdout);
 }
 
-#define TIME_LEN       11
-
-void log_print(const gchar *format, ...)
-{
-       va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
-       time_t t;
-
-       time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
-
-       va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
-       va_end(args);
-
-       if (debug_mode) fputs(buf, stdout);
-       log_window_append(buf, LOG_NORMAL);
-       if (log_fp) {
-               fputs(buf, log_fp);
-               fflush(log_fp);
-       }
-       if (log_verbosity_count)
-               statusbar_puts_all(buf + TIME_LEN);
-}
-
-void log_message(const gchar *format, ...)
-{
-       va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
-       time_t t;
-
-       time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
-
-       va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
-       va_end(args);
-
-       if (debug_mode) g_message("%s", buf + TIME_LEN);
-       log_window_append(buf + TIME_LEN, LOG_MSG);
-       if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
-               fputs("* message: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
-               fflush(log_fp);
-       }
-       statusbar_puts_all(buf + TIME_LEN);
-}
-
-void log_warning(const gchar *format, ...)
-{
-       va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
-       time_t t;
-
-       time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
-
-       va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
-       va_end(args);
-
-       g_warning("%s", buf);
-       log_window_append(buf + TIME_LEN, LOG_WARN);
-       if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
-               fputs("** warning: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
-               fflush(log_fp);
-       }
-}
-
-void log_error(const gchar *format, ...)
-{
-       va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
-       time_t t;
-
-       time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
-
-       va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
-       va_end(args);
-
-       g_warning("%s", buf);
-       log_window_append(buf + TIME_LEN, LOG_ERROR);
-       if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
-               fputs("*** error: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
-               fflush(log_fp);
-       }
-}
-
-
 void * subject_table_lookup(GHashTable *subject_table, gchar * subject)
 {
        if (subject == NULL)
similarity index 96%
rename from src/utils.h
rename to src/common/utils.h
index 883223a1a1cc39e067c200f37d3349c51cbdfb71..260fbb3e8b2ee6ee65b845d5b0a7377fd74d0b8d 100644 (file)
        perror(func); \
 }
 
+/* debug functions */
+void debug_set_mode            (gboolean mode);
+gboolean debug_get_mode                ();
 #define debug_print \
        debug_print_real(__FILE__ ":%d:", __LINE__), \
        debug_print_real
@@ -382,15 +385,8 @@ gchar *tzoffset                    (time_t         *now);
 void get_rfc822_date           (gchar          *buf,
                                 gint            len);
 
-/* logging */
-void set_log_file      (const gchar *filename);
-void close_log_file    (void);
-void log_verbosity_set (gboolean verbose);
+/* debugging */
 void debug_print_real  (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
-void log_print         (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
-void log_message       (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
-void log_warning       (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
-void log_error         (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
 
 /* subject threading */
 void * subject_table_lookup(GHashTable *subject_table, gchar * subject);
index b2715fd916260503feb62f7b6aabcef277e1c92a..b0dcded44362f0c8b524e4c2a860f6c9ddddb4b4 100644 (file)
@@ -91,7 +91,7 @@
 #include "procmime.h"
 #include "statusbar.h"
 #include "about.h"
-#include "common/base64.h"
+#include "base64.h"
 #include "codeconv.h"
 #include "utils.h"
 #include "gtkutils.h"
@@ -5073,7 +5073,6 @@ static void compose_toolbar_create(Compose   *compose,
        ToolbarSylpheedActions *action_item;
        GSList *cur;
        GSList *toolbar_list;
-       GList *elem;
        toolbar_tips = gtk_tooltips_new();
        
        toolbar_read_config_file(TOOLBAR_COMPOSE);
index 28770c6f65c3514385bf015fb6e36e011f0d7a99..ea04318e90610f9eb0dd4ecfb3cb805c33bdd935 100644 (file)
@@ -1590,8 +1590,8 @@ FolderItem *folder_item_move_recursive (FolderItem *src, FolderItem *dest)
 gint folder_item_move_to(FolderItem *src, FolderItem *dest, FolderItem **new_item)
 {
        FolderItem *tmp = dest->parent;
-       char * src_identifier, * dst_identifier, * new_identifier;
-       char * phys_srcpath, * phys_dstpath;
+       gchar * src_identifier, * dst_identifier;
+       gchar * phys_srcpath, * phys_dstpath;
        GNode *src_node;
        
        while (tmp) {
index 4fb7377a53298a268705099fa13458dd838e6b4c..06766fff0c972e1d46495287fbc7811a3cdd7a0f 100644 (file)
@@ -2754,10 +2754,6 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
        } else {
                /* comes from folderview */
                char *source;
-               char *buf;
-               gint status;
-               GtkCTreeNode *src_node;
-               FolderItem *new_item, *src_parent;
                
                source = data->data + 17;
                if (gtk_clist_get_selection_info
index 0cbdc9d236422c8b46bb73f871fbcea16fb5eda9..b20f6cb4e9ade59cb33eef9a0f8ec0357f4e6063 100644 (file)
@@ -48,6 +48,7 @@
 #include "codeconv.h"
 #include "utils.h"
 #include "inputdialog.h"
+#include "log.h"
 
 #define IMAP4_PORT     143
 #if USE_SSL
index 182d4682b45624c611366aaeae2d4960cd794f0e..45aa4d673e5d4a57a9848b8bb7f7adf8b4ed1fb0 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -65,6 +65,7 @@
 #include "folder.h"
 #include "filtering.h"
 #include "selective_download.h"
+#include "log.h"
 
 static GList *inc_dialog_list = NULL;
 
@@ -727,10 +728,10 @@ static IncState inc_pop3_session_do(IncSession *session)
 
        for (i = POP3_GREETING_RECV; i < N_POP3_PHASE; i++)
                atm->state[i].handler = handlers[i];
-       atm->state[POP3_GREETING_RECV].condition = GDK_INPUT_READ;
+       atm->state[POP3_GREETING_RECV].condition = (G_IO_IN | G_IO_HUP | G_IO_ERR);
        for (i = POP3_GREETING_RECV + 1; i < N_POP3_PHASE; ) {
-               atm->state[i++].condition = GDK_INPUT_WRITE;
-               atm->state[i++].condition = GDK_INPUT_READ;
+               atm->state[i++].condition = (G_IO_OUT | G_IO_ERR);
+               atm->state[i++].condition = (G_IO_IN | G_IO_HUP | G_IO_ERR);
        }
 
        atm->terminate = (AtmHandler)pop3_automaton_terminate;
@@ -798,9 +799,9 @@ static IncState inc_pop3_session_do(IncSession *session)
        */
        recv_set_ui_func(inc_pop3_recv_func, session);
 
-       atm->tag = sock_gdk_input_add(sockinfo,
-                                     atm->state[atm->num].condition,
-                                     automaton_input_cb, atm);
+       atm->tag = sock_input_add(sockinfo,
+                                 atm->state[atm->num].condition,
+                                 automaton_input_cb, atm);
 
        while (!atm->terminated && !atm->cancelled)
                gtk_main_iteration();
index f51cf82ae40c782ecc5be22cfcf358bf72dddfa5..7ad132ff97ac088a34f7e3086c6b71358b42e29d 100644 (file)
@@ -31,7 +31,7 @@
 #include "addritem.h"
 #include "addrcache.h"
 
-#include "common/base64.h"
+#include "base64.h"
 
 /*
 * Create new object.
index 4d8748ed0110194722cc85e97e52dbf13b55f647..7a7776d67d82a7e27491681c5e426bda91a56363 100644 (file)
@@ -73,6 +73,7 @@
 #include "setup.h"
 #include "utils.h"
 #include "gtkutils.h"
+#include "log.h"
 
 #if USE_GPGME
 #  include "rfc2015.h"
@@ -88,7 +89,6 @@
 gchar *prog_version;
 gchar *startup_dir;
 gchar *argv0;
-gboolean debug_mode = FALSE;
 
 static gint lock_socket = -1;
 static gint lock_socket_tag = 0;
@@ -383,7 +383,7 @@ static void parse_cmd_opt(int argc, char *argv[])
 
        for (i = 1; i < argc; i++) {
                if (!strncmp(argv[i], "--debug", 7))
-                       debug_mode = TRUE;
+                       debug_set_mode(TRUE);
                else if (!strncmp(argv[i], "--receive-all", 13))
                        cmd.receive_all = TRUE;
                else if (!strncmp(argv[i], "--receive", 9))
index 1d8d02b637112a2208d41a42ad9dd55ab6edddaa..5a4bdf05a8363658bc7142571a09b5f1f17369b5 100644 (file)
@@ -246,9 +246,6 @@ static void toolbar_reply_to_sender_cb      (GtkWidget      *widget,
 static void toolbar_forward_cb         (GtkWidget      *widget,
                                         gpointer        data);
 
-static void toolbar_delete_cb          (GtkWidget      *widget,
-                                        gpointer        data);
-
 static void toolbar_exec_cb            (GtkWidget      *widget,
                                         gpointer        data);
 
@@ -2379,14 +2376,6 @@ static void toolbar_forward_cb(GtkWidget *widget,
                reply_cb(mainwin, COMPOSE_FORWARD, NULL);
 }
 
-static void toolbar_delete_cb(GtkWidget          *widget,
-                             gpointer     data)
-{
-       MainWindow *mainwin = (MainWindow *)data;
-
-       summary_delete(mainwin->summaryview);
-}
-
 static void toolbar_exec_cb(GtkWidget  *widget,
                            gpointer     data)
 {
index 78f83cc7c6199cf19c04986acd37b6a5586618ee..1b3701e0f1a326d8e534daa2f483893c46407093 100644 (file)
@@ -90,9 +90,6 @@ static void messageview_close_cb      (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
 
-static void set_toolbar_style(MessageView *messageview);
-
-
 MessageView *messageview_create(MainWindow *mainwin)
 {
        MessageView *messageview;
@@ -832,7 +829,6 @@ static void messageview_toolbar_create(MessageView   *messageview,
        ToolbarSylpheedActions *action_item;
        GSList *cur;
        GSList *toolbar_list;
-       GList *elem;
        toolbar_tips = gtk_tooltips_new();
        
        toolbar_read_config_file(TOOLBAR_MSGVIEW);
index fd1fe876f4f39420e279c488db00d180f955df7b..0cd38d152ab6b8de897c60d9dcd8dccb3d0ad6c0 100644 (file)
@@ -47,6 +47,7 @@
 #include "prefs_account.h"
 #include "inputdialog.h"
 #include "alertpanel.h"
+#include "log.h"
 #if USE_SSL
 #  include "ssl.h"
 #endif
index 952d3d710659f87e6484acc3da946a3acb3b7369..bbfd76ded7f0a079d409fe529a68a54c738eeb1d 100644 (file)
@@ -36,8 +36,8 @@
 #include "intl.h"
 #include "procmime.h"
 #include "procheader.h"
-#include "common/base64.h"
-#include "common/uuencode.h"
+#include "base64.h"
+#include "uuencode.h"
 #include "unmime.h"
 #include "codeconv.h"
 #include "utils.h"
index 13e31c0de57be38c554071d0b3a4eb6fe34cff70..cede2ce5bed0bd5223131f219946b42522565fda 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -39,6 +39,7 @@
 #include "inc.h"
 #include "recv.h"
 #include "selective_download.h"
+#include "log.h"
 #if USE_SSL
 #  include "ssl.h"
 #endif
index 502ba01622bab80706ed5c1195ad661bd139c2c9..9f15f7b8331f04826523a7398846118ff824771b 100644 (file)
@@ -2632,10 +2632,7 @@ static void prefs_interface_create(void)
 
        GtkWidget *button_keybind;
 
-       GtkWidget *hbox2;
        GtkWidget *optmenu_nextunreadmsgdialog;
-       GtkWidget *optmenu_nextunreadmsgdialog_menu;
-       GtkWidget *nextunreadmsgdialog_menuitem;
 
        GtkWidget *frame_pixmap_theme;
        GtkWidget *vbox_pixmap_theme;
index 0e98c97fc04703cae2f131069a4d3f4deb136c4e..bb288fdd0a3803d4b8c9c228be2efe650b5ce777 100644 (file)
@@ -32,8 +32,8 @@
 #include "intl.h"
 #include "procmime.h"
 #include "procheader.h"
-#include "common/base64.h"
-#include "common/uuencode.h"
+#include "base64.h"
+#include "uuencode.h"
 #include "unmime.h"
 #include "html.h"
 #include "enriched.h"
index 85083884d04f44e31636b138cd61c236b5c787dc..0253f163bb3e1b1823f588084e9bac0797028756 100644 (file)
@@ -1488,8 +1488,8 @@ void procmsg_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmp
                        item->unreadmarked--;
                        item->need_update = TRUE;
                }
-               if ((perm_flags & MSG_MARKED) || MSG_IS_MARKED(msginfo->flags)
-               && !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
+               if ((perm_flags & MSG_MARKED) || (MSG_IS_MARKED(msginfo->flags)
+               && !MSG_IS_IGNORE_THREAD(msginfo->flags))) {
                        procmsg_update_unread_children(msginfo, FALSE);
                }
 
index 7087dc0ab8ff6e7541b39a8c371eaa5d9dd425c0..6509f554bdc824a3c2b9d6f8eaa483436d06ec35 100644 (file)
@@ -36,8 +36,8 @@
 #include "intl.h"
 #include "procmime.h"
 #include "procheader.h"
-#include "common/base64.h"
-#include "common/uuencode.h"
+#include "base64.h"
+#include "uuencode.h"
 #include "unmime.h"
 #include "codeconv.h"
 #include "utils.h"
@@ -223,7 +223,6 @@ sig_status_for_key(GString *str, GpgmeCtx ctx, GpgmeSigStat status,
 {
        gint idx = 0;
        const char *uid;
-       unsigned long exp_time;
 
        uid = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, idx);
        if (uid == NULL) {
index 1ce2082cf76156e8ef752f3a2e707c9e70660fd7..e0ee7d2780a5c5ba3d94a3c57da053e97743a6f3 100644 (file)
@@ -52,6 +52,7 @@
 #include "gtkutils.h"
 #include "statusbar.h"
 #include "inc.h"
+#include "log.h"
 
 typedef struct _SendProgressDialog     SendProgressDialog;
 
index 674425e0760a21ab1bfc86ede009114a86ef2366..b36128122ad22a3a2207940ed452453e7d37a099 100644 (file)
@@ -29,8 +29,9 @@
 #include "smtp.h"
 #include "socket.h"
 #include "md5.h"
-#include "common/base64.h"
+#include "base64.h"
 #include "utils.h"
+#include "log.h"
 
 static gint verbose = 1;
 
index 328f6f7d36bb634fc061ec17b8d9b35634c8053b..ab02fa31b23b49225da97dff913852b801686c1d 100644 (file)
@@ -31,6 +31,7 @@
 #include "intl.h"
 #include "prefs_common.h"
 #include "socket.h"
+#include "log.h"
 
 static char *ssl_certificate_check_signer (X509 *cert); 
 static SSLCertificate *ssl_certificate_new_lookup(X509 *x509_cert, gchar *host, gushort port, gboolean lookup);
index 3a335f1c08759b5d5c58dfec40834966cb33bbf1..ff87ecc68e9f2005314d79b6fab76d8b6cf0fe99 100644 (file)
@@ -2201,7 +2201,7 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
 
        debug_print("done.\n");
        STATUSBAR_POP(summaryview->mainwin);
-       if (debug_mode) {
+       if (debug_get_mode()) {
                debug_print("\tmsgid hash table size = %d\n",
                            g_hash_table_size(msgid_table));
                debug_print("\tsubject hash table size = %d\n",
index eeba2afa6c08640f6e96adf9aaf43980caf10d76..1ba54c1f20c1f018bea5c8d0e2452bda4e542205 100644 (file)
@@ -26,7 +26,7 @@
 #include <ctype.h>
 
 #include "codeconv.h"
-#include "common/base64.h"
+#include "base64.h"
 
 #define ENCODED_WORD_BEGIN     "=?"
 #define ENCODED_WORD_END       "?="
index ee8dcc3971c6d8f75163ddf485dc8c74e7ea7e03..668ee48dcf8c67562a786c9ab509b2b4c5af0fad 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -151,7 +151,7 @@ GNode *xml_parse_file(const gchar *path)
        xml_close_file(file);
 
 #if defined(SPARSE_MEMORY)
-       if (debug_mode)
+       if (debug_get_mode())
                string_table_get_stats(xml_string_table);
 #endif