sync with 0.8.11cvs20
authorPaul Mangan <paul@claws-mail.org>
Tue, 8 Apr 2003 09:48:12 +0000 (09:48 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 8 Apr 2003 09:48:12 +0000 (09:48 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/inc.c
src/messageview.c
src/pop.c
src/pop.h
src/procmsg.c
src/procmsg.h
src/summaryview.c

index ed973f7..2bd1693 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2003-04-08
+
+       * src/procmsg.[ch]: procmsg_get_filter_keyword(): new. It returns
+         filter keyword for messages.
+       * src/summaryview.c: summary_filter_open(): use
+         procmsg_get_filter_keyword().
+       * src/messageview.c: create_filter_cb(): implemented.
+
+2003-04-07
+
+       * src/inc.c:
+         inc_start()
+         inc_put_error(): display server responses on error.
+       * src/pop.[ch]: added Pop3Session::error_msg, and set server responses
+         on error.
+
 2003-04-04
 
        * src/messageview.[ch]: separated the forced charset of message view
index 1899a8a..f59cb64 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-08 [paul]      0.8.11claws77
+
+       * sync with 0.8.11cvs20
+               see ChangeLog 2003-04-07 and 2003-04-08
+
 2003-04-07 [christoph] 0.8.11claws76
 
        * src/filtering.[ch]
index 363a628..f8b88b5 100644 (file)
@@ -1,3 +1,19 @@
+2003-04-08
+
+       * src/procmsg.[ch]: procmsg_get_filter_keyword(): ¿·µ¬¡£¥á¥Ã¥»¡¼¥¸¤Î
+         ¥Õ¥£¥ë¥¿ÍÑ¥­¡¼¥ï¡¼¥É¤òÊÖ¤¹¡£
+       * src/summaryview.c: summary_filter_open():
+         procmsg_get_filter_keyword() ¤ò»ÈÍÑ¡£
+       * src/messageview.c: create_filter_cb(): ¼ÂÁõ¡£
+
+2003-04-07
+
+       * src/inc.c:
+         inc_start()
+         inc_put_error(): ¥¨¥é¡¼»þ¤Ë¥µ¡¼¥Ð¤Î±þÅú¤òɽ¼¨¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * src/pop.[ch]: Pop3Session::error_msg ¤òÄɲä·¡¢¥¨¥é¡¼»þ¤Ë
+         ¥µ¡¼¥Ð¤Î±þÅú¤ò¥»¥Ã¥È¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
 2003-04-04
 
        * src/messageview.[ch]: ÊÌ¥¦¥£¥ó¥É¥¦¤Î¥á¥Ã¥»¡¼¥¸¥Ó¥å¡¼¤Îʸ»ú¥³¡¼¥É
index ec9c2a7..548581e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws76
+EXTRA_VERSION=claws77
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 42d7a19..eff804f 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 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
@@ -103,7 +103,8 @@ static gint inc_recv_message                (Session        *session,
                                         const gchar    *msg,
                                         gpointer        data);
 
-static void inc_put_error              (IncState        istate);
+static void inc_put_error              (IncState        istate,
+                                        const gchar    *msg);
 
 static void inc_cancel_cb              (GtkWidget      *widget,
                                         gpointer        data);
@@ -604,14 +605,18 @@ static gint inc_start(IncProgressDialog *inc_dialog)
 
                if (inc_state != INC_SUCCESS && inc_state != INC_CANCEL) {
                        error_num++;
-                       if (inc_state == INC_ERROR    ||
-                           inc_state == INC_IO_ERROR ||
-                           inc_state == INC_SOCKET_ERROR) {
-                               inc_put_error(inc_state);
-                       } else if (inc_state == INC_NO_SPACE) {
-                               inc_put_error(inc_state);
+                       if (inc_dialog->show_dialog)
+                               manage_window_focus_in
+                                       (inc_dialog->dialog->window,
+                                        NULL, NULL);
+                       inc_put_error(inc_state, pop3_session->error_msg);
+                       if (inc_dialog->show_dialog)
+                               manage_window_focus_out
+                                       (inc_dialog->dialog->window,
+                                        NULL, NULL);
+                       if (inc_state == INC_NO_SPACE ||
+                           inc_state == INC_IO_ERROR)
                                break;
-                       }
                }
 
                inc_session_destroy(session);
@@ -879,13 +884,16 @@ gint inc_drop_message(const gchar *file, Pop3Session *session)
        return 0;
 }
 
-static void inc_put_error(IncState istate)
+static void inc_put_error(IncState istate, const gchar *msg)
 {
        switch (istate) {
        case INC_ERROR:
-               if (!prefs_common.no_recv_err_panel)
-                       alertpanel_error
-                               (_("Error occurred while processing mail."));
+               if (prefs_common.no_recv_err_panel)
+                       break;
+               if (msg)
+                       alertpanel_error(_("Error occurred while processing mail:\n%s"), msg);
+               else
+                       alertpanel_error(_("Error occurred while processing mail."));
                break;
        case INC_NO_SPACE:
                alertpanel_error(_("No disk space left."));
@@ -894,12 +902,27 @@ static void inc_put_error(IncState istate)
                alertpanel_error(_("Can't write file."));
                break;
        case INC_SOCKET_ERROR:
+               if (prefs_common.no_recv_err_panel)
+                       break;
                alertpanel_error(_("Socket error."));
                break;
        case INC_LOCKED:
-               if (!prefs_common.no_recv_err_panel)
+               if (prefs_common.no_recv_err_panel)
+                       break;
+               if (msg)
+                       alertpanel_error(_("Mailbox is locked:\n%s"), msg);
+               else
                        alertpanel_error(_("Mailbox is locked."));
                break;
+       case INC_AUTH_FAILED:
+               if (prefs_common.no_recv_err_panel)
+                       break;
+               if (msg)
+                       alertpanel_error(_("Authentication failed:\n%s"),
+                                        msg);
+               else
+                       alertpanel_error(_("Authentication failed."));
+               break;
        default:
                break;
        }
index 707fe94..de2ce30 100644 (file)
@@ -1397,6 +1397,18 @@ static void add_address_cb(gpointer data, guint action, GtkWidget *widget)
 
 static void create_filter_cb(gpointer data, guint action, GtkWidget *widget)
 {
+       MessageView *messageview = (MessageView *)data;
+       gchar *header = NULL;
+       gchar *key = NULL;
+
+       if (!messageview->msginfo) return;
+
+       procmsg_get_filter_keyword(messageview->msginfo, &header, &key,
+                                  (PrefsFilterType)action);
+       prefs_filtering_open(NULL, header, key);
+
+       g_free(header);
+       g_free(key);
 }
 
 static void about_cb(gpointer data, guint action, GtkWidget *widget)
index ef738a7..2fb7e9c 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -390,6 +390,7 @@ Session *pop3_session_new(PrefsAccount *account)
        session->uidl_table = pop3_get_uidl_table(account);
        session->current_time = time(NULL);
        session->error_val = PS_SUCCESS;
+       session->error_msg = NULL;
 
        return SESSION(session);
 }
@@ -413,6 +414,7 @@ static void pop3_session_destroy(Session *session)
        g_free(pop3_session->greeting);
        g_free(pop3_session->user);
        g_free(pop3_session->pass);
+       g_free(pop3_session->error_msg);
 }
 
 GHashTable *pop3_get_uidl_table(PrefsAccount *ac_prefs)
@@ -648,6 +650,8 @@ static Pop3ErrorValue pop3_ok(Pop3Session *session, const gchar *msg)
                        }
                }
 
+               g_free(session->error_msg);
+               session->error_msg = g_strdup(msg);
                fprintf(stderr, "POP3: %s\n", msg);
        } else
                ok = PS_PROTOCOL;
index 3cc15a3..5f99893 100644 (file)
--- a/src/pop.h
+++ b/src/pop.h
@@ -130,6 +130,7 @@ struct _Pop3Session
        time_t current_time;
 
        Pop3ErrorValue error_val;
+       gchar *error_msg;
 
        gpointer data;
 };
index e38abfa..3ff3b69 100644 (file)
@@ -31,6 +31,8 @@
 #include "send_message.h"
 #include "procmime.h"
 #include "statusbar.h"
+#include "prefs_filtering.h"
+#include "filtering.h"
 #include "folder.h"
 #include "prefs_common.h"
 #include "account.h"
@@ -41,7 +43,6 @@
 #include "news.h"
 #include "hooks.h"
 #include "msgcache.h"
-#include "filtering.h"
 
 typedef struct _FlagInfo       FlagInfo;
 
@@ -453,6 +454,102 @@ gboolean procmsg_msg_exist(MsgInfo *msginfo)
        return ret;
 }
 
+void procmsg_get_filter_keyword(MsgInfo *msginfo, gchar **header, gchar **key,
+                               PrefsFilterType type)
+{
+       static HeaderEntry hentry[] = {{"X-BeenThere:",    NULL, FALSE},
+                                      {"X-ML-Name:",      NULL, FALSE},
+                                      {"X-List:",         NULL, FALSE},
+                                      {"X-Mailing-list:", NULL, FALSE},
+                                      {"List-Id:",        NULL, FALSE},
+                                      {NULL,              NULL, FALSE}};
+
+       enum
+       {
+               H_X_BEENTHERE    = 0,
+               H_X_ML_NAME      = 1,
+               H_X_LIST         = 2,
+               H_X_MAILING_LIST = 3,
+               H_LIST_ID        = 4
+       };
+
+       FILE *fp;
+       int header_offset;
+       int hentry_offset;
+
+       g_return_if_fail(msginfo != NULL);
+       g_return_if_fail(header != NULL);
+       g_return_if_fail(key != NULL);
+
+       *header = NULL;
+       *key = NULL;
+
+       header_offset = 1;
+       hentry_offset = 5;
+
+       switch (type) {
+       case FILTER_BY_NONE:
+               return;
+       case FILTER_BY_AUTO:
+               if ((fp = procmsg_open_message(msginfo)) == NULL)
+                       return;
+               procheader_get_header_fields(fp, hentry);
+               fclose(fp);
+
+               if (hentry[H_X_BEENTHERE].body != NULL) {
+                       *header = g_strdup("header \"X-BeenThere\"");
+                       *key = hentry[H_X_BEENTHERE].body;
+                       hentry[H_X_BEENTHERE].body = NULL;
+               } else if (hentry[H_X_ML_NAME].body != NULL) {
+                       *header = g_strdup("header \"X-ML-Name\"");
+                       *key = hentry[H_X_ML_NAME].body;
+                       hentry[H_X_ML_NAME].body = NULL;
+               } else if (hentry[H_X_LIST].body != NULL) {
+                       *header = g_strdup("header \"X-List\"");
+                       *key = hentry[H_X_LIST].body;
+                       hentry[H_X_LIST].body = NULL;
+               } else if (hentry[H_X_MAILING_LIST].body != NULL) {
+                       *header = g_strdup("header \"X-Mailing-List\"");
+                       *key = hentry[H_X_MAILING_LIST].body;
+                       hentry[H_X_MAILING_LIST].body = NULL;
+               } else if (hentry[H_LIST_ID].body != NULL) {
+                       *header = g_strdup("header \"List-Id\"");
+                       *key = hentry[H_LIST_ID].body;
+                       hentry[H_LIST_ID].body = NULL;
+               } else if (msginfo->subject) {
+                       *header = g_strdup("subject");
+                       *key = g_strdup(msginfo->subject);
+               }
+
+               g_free(hentry[H_X_BEENTHERE].body);
+               hentry[H_X_BEENTHERE].body = NULL;
+               g_free(hentry[H_X_ML_NAME].body);
+               hentry[H_X_ML_NAME].body = NULL;
+               g_free(hentry[H_X_LIST].body);
+               hentry[H_X_LIST].body = NULL;
+               g_free(hentry[H_X_MAILING_LIST].body);
+               hentry[H_X_MAILING_LIST].body = NULL;
+               g_free(hentry[H_LIST_ID].body);
+               hentry[H_LIST_ID].body = NULL;
+
+               break;
+       case FILTER_BY_FROM:
+               *header = g_strdup("from");
+               *key = g_strdup(msginfo->from);
+               break;
+       case FILTER_BY_TO:
+               *header = g_strdup("to");
+               *key = g_strdup(msginfo->to);
+               break;
+       case FILTER_BY_SUBJECT:
+               *header = g_strdup("subject");
+               *key = g_strdup(msginfo->subject);
+               break;
+       default:
+               break;
+       }
+}
+
 void procmsg_empty_trash(void)
 {
        FolderItem *trash;
index d5216e7..8964c2d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2002 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 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
@@ -157,6 +157,8 @@ struct _MsgFlags
        MsgTmpFlags  tmp_flags;
 };
 
+#include "prefs_filtering.h"
+
 struct _MsgInfo
 {
        guint refcnt;
@@ -239,6 +241,11 @@ FILE   *procmsg_open_message_decrypted     (MsgInfo        *msginfo,
 #endif
 gboolean procmsg_msg_exist             (MsgInfo        *msginfo);
 
+void   procmsg_get_filter_keyword      (MsgInfo          *msginfo,
+                                        gchar           **header,
+                                        gchar           **key,
+                                        PrefsFilterType   type);
+
 void   procmsg_empty_trash             (void);
 gint   procmsg_send_queue              (FolderItem     *queue,
                                         gboolean        save_msgs);
index d1c6140..d48a0f5 100644 (file)
@@ -3958,42 +3958,9 @@ static void summary_filter_func(GtkCTree *ctree, GtkCTreeNode *node,
 
 void summary_filter_open(SummaryView *summaryview, PrefsFilterType type)
 {
-       static HeaderEntry hentry[] = {{"X-BeenThere:",    NULL, FALSE},
-                                      {"X-ML-Name:",      NULL, FALSE},
-                                      {"X-List:",         NULL, FALSE},
-                                      {"X-Mailing-list:", NULL, FALSE},
-                                      {"List-Id:",        NULL, FALSE},
-                                      {NULL,              NULL, FALSE}};
-
-       static gchar *header_strs[] = {"From", "from", "To", "to", "Subject", "subject"};
-
-       static gchar *hentry_strs[]   = {"X-BeenThere", "X-ML-Name", "X-List",
-                                        "X-Mailing-List", "List-Id",
-                                        "header \"X-BeenThere\"", "header \"X-ML-Name\"",
-                                        "header \"X-List\"", "header \"X-Mailing-List\"",
-                                        "header \"List-Id\""};
-       enum
-       {
-               H_X_BEENTHERE    = 0,
-               H_X_ML_NAME      = 1,
-               H_X_LIST         = 2,
-               H_X_MAILING_LIST = 3,
-               H_LIST_ID        = 4
-       };
-
-       enum
-       {
-               H_FROM    = 0,
-               H_TO      = 2,
-               H_SUBJECT = 4
-       };
-
        MsgInfo *msginfo;
        gchar *header = NULL;
        gchar *key = NULL;
-       FILE *fp;
-       int header_offset;
-       int hentry_offset;
 
        if (!summaryview->selected) return;
 
@@ -4001,72 +3968,11 @@ void summary_filter_open(SummaryView *summaryview, PrefsFilterType type)
                                              summaryview->selected);
        if (!msginfo) return;
 
-       header_offset = 1;
-       hentry_offset = 5;
-
-       switch (type) {
-       case FILTER_BY_NONE:
-               break;
-       case FILTER_BY_AUTO:
-               if ((fp = procmsg_open_message(msginfo)) == NULL) return;
-               procheader_get_header_fields(fp, hentry);
-               fclose(fp);
-
-               if (hentry[H_X_BEENTHERE].body != NULL) {
-                       header = hentry_strs[H_X_BEENTHERE + hentry_offset];
-                       Xstrdup_a(key, hentry[H_X_BEENTHERE].body, );
-               } else if (hentry[H_X_ML_NAME].body != NULL) {
-                       header = hentry_strs[H_X_ML_NAME + hentry_offset];
-                       Xstrdup_a(key, hentry[H_X_ML_NAME].body, );
-               } else if (hentry[H_X_LIST].body != NULL) {
-                       header = hentry_strs[H_X_LIST + hentry_offset];
-                       Xstrdup_a(key, hentry[H_X_LIST].body, );
-               } else if (hentry[H_X_MAILING_LIST].body != NULL) {
-                       header = hentry_strs[H_X_MAILING_LIST + hentry_offset];
-                       Xstrdup_a(key, hentry[H_X_MAILING_LIST].body, );
-               } else if (hentry[H_LIST_ID].body != NULL) {
-                       header = hentry_strs[H_LIST_ID + hentry_offset];
-                       Xstrdup_a(key, hentry[H_LIST_ID].body, );
-               } else if (msginfo->subject) {
-                       header = header_strs[H_SUBJECT + header_offset];
-                       key = msginfo->subject;
-               }
-
-               g_free(hentry[H_X_BEENTHERE].body);
-               hentry[H_X_BEENTHERE].body = NULL;
-               g_free(hentry[H_X_ML_NAME].body);
-               hentry[H_X_ML_NAME].body = NULL;
-               g_free(hentry[H_X_LIST].body);
-               hentry[H_X_LIST].body = NULL;
-               g_free(hentry[H_X_MAILING_LIST].body);
-               hentry[H_X_MAILING_LIST].body = NULL;
-               g_free(hentry[H_LIST_ID].body);
-               hentry[H_LIST_ID].body = NULL;
-
-               break;
-       case FILTER_BY_FROM:
-               header = header_strs[H_FROM + header_offset];
-               key = msginfo->from;
-               break;
-       case FILTER_BY_TO:
-               header = header_strs[H_TO + header_offset];
-               key = msginfo->to;
-               break;
-       case FILTER_BY_SUBJECT:
-               header = header_strs[H_SUBJECT + header_offset];
-               key = msginfo->subject;
-               break;
-       default:
-               break;
-       }
-
-       /*
-        * NOTE: key may be allocated on the stack, so 
-        * prefs_filter[ing]_open() should have completed 
-        * and have set entries. Otherwise we're hosed.  
-        */
-
+       procmsg_get_filter_keyword(msginfo, &header, &key, type);
        prefs_filtering_open(NULL, header, key);
+
+       g_free(header);
+       g_free(key);
 }
 
 /* color label */