0.9.6claws79
authorChristoph Hohmann <reboot@gmx.ch>
Tue, 18 Nov 2003 22:15:05 +0000 (22:15 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Tue, 18 Nov 2003 22:15:05 +0000 (22:15 +0000)
* src/mimeview.[ch]
        check parent MimeInfos for signatures and display the
        result of the parent when found

* src/pgpmime.c
        o avoid NULL pointer warnings
        o use procmime_mimeinfo_get_parameter()

* src/sgpgme.c
        small text changes

ChangeLog.claws
TODO.claws
configure.ac
src/mimeview.c
src/mimeview.h
src/pgpmime.c
src/sgpgme.c

index 95d184e..f7ae340 100644 (file)
@@ -1,4 +1,18 @@
+2003-11-18 [christoph] 0.9.6claws79
+
+       * src/mimeview.[ch]
+               check parent MimeInfos for signatures and display the
+               result of the parent when found
+
+       * src/pgpmime.c
+               o avoid NULL pointer warnings
+               o use procmime_mimeinfo_get_parameter()
+
+       * src/sgpgme.c
+               small text changes
+
 2003-11-17 [luke]      0.9.6claws78
+
         * src/textview.c
                 add check for disguised URLs, fixing bug 57
                 "Hidden URL in HTML Mails"
index 37b62c3..a6bacbf 100644 (file)
@@ -24,11 +24,8 @@ win32 0.8.0claws+
 [christoph]
 
        o Maildir support
-       o complete UIDPLUS IMAP support
        o make summaryview display any list of messages,
          fix processing rules by score
-       o privacy api that is independent from the crypto system
-       o rewrite mime message parsing (maybe required for privacy stuff)
        o PEM support (S/MIME)
        o add new messages to the summaryview without reloading the
          whole list
index 9a68834..05de364 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=78
+EXTRA_VERSION=79
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 98601fb..f31eee6 100644 (file)
@@ -619,52 +619,50 @@ static void display_full_info_cb(GtkWidget *widget, gpointer user_data);
 
 static void update_signature_noticeview(MimeView *mimeview, MimeInfo *mimeinfo)
 {
-       if (privacy_mimeinfo_is_signed(mimeinfo)) {
-               gchar *text = NULL, *button_text = NULL;
-               GtkSignalFunc func = NULL;
-               StockPixmap icon = STOCK_PIXMAP_PRIVACY_SIGNED;
-               
-               switch (privacy_mimeinfo_get_sig_status(mimeinfo)) {
-               case SIGNATURE_UNCHECKED:
-                       button_text = _("Check");
-                       func = check_signature_cb;
-                       icon = STOCK_PIXMAP_PRIVACY_SIGNED;
-                       break;
-               case SIGNATURE_OK:
-                       button_text = _("Full info");
-                       func = display_full_info_cb;
-                       icon = STOCK_PIXMAP_PRIVACY_PASSED;
-                       break;
-               case SIGNATURE_WARN:
-                       button_text = _("Full info");
-                       func = display_full_info_cb;
-                       icon = STOCK_PIXMAP_PRIVACY_WARN;
-                       break;
-               case SIGNATURE_INVALID:
-                       button_text = _("Full info");
-                       func = display_full_info_cb;
-                       icon = STOCK_PIXMAP_PRIVACY_FAILED;
-                       break;
-               case SIGNATURE_CHECK_FAILED:
-                       button_text = _("Check again");
-                       func = check_signature_cb;
-                       icon = STOCK_PIXMAP_PRIVACY_UNKNOWN;
-               default:
-                       break;
-               }
-               text = privacy_mimeinfo_sig_info_short(mimeinfo);
-               noticeview_set_text(mimeview->siginfoview, text);
-               g_free(text);
-               noticeview_set_button_text(mimeview->siginfoview, button_text);
-               noticeview_set_button_press_callback(
-                       mimeview->siginfoview,
-                       func,
-                       (gpointer) mimeview);
-               noticeview_set_icon(mimeview->siginfoview, icon);
-               noticeview_show(mimeview->siginfoview);
-       } else {
-               noticeview_hide(mimeview->siginfoview);
+       gchar *text = NULL, *button_text = NULL;
+       GtkSignalFunc func = NULL;
+       StockPixmap icon = STOCK_PIXMAP_PRIVACY_SIGNED;
+
+       g_return_if_fail(mimeview != NULL);
+       g_return_if_fail(mimeinfo != NULL);
+       
+       switch (privacy_mimeinfo_get_sig_status(mimeinfo)) {
+       case SIGNATURE_UNCHECKED:
+               button_text = _("Check");
+               func = check_signature_cb;
+               icon = STOCK_PIXMAP_PRIVACY_SIGNED;
+               break;
+       case SIGNATURE_OK:
+               button_text = _("Full info");
+               func = display_full_info_cb;
+               icon = STOCK_PIXMAP_PRIVACY_PASSED;
+               break;
+       case SIGNATURE_WARN:
+               button_text = _("Full info");
+               func = display_full_info_cb;
+               icon = STOCK_PIXMAP_PRIVACY_WARN;
+               break;
+       case SIGNATURE_INVALID:
+               button_text = _("Full info");
+               func = display_full_info_cb;
+               icon = STOCK_PIXMAP_PRIVACY_FAILED;
+               break;
+       case SIGNATURE_CHECK_FAILED:
+               button_text = _("Check again");
+               func = check_signature_cb;
+               icon = STOCK_PIXMAP_PRIVACY_UNKNOWN;
+       default:
+               break;
        }
+       text = privacy_mimeinfo_sig_info_short(mimeinfo);
+       noticeview_set_text(mimeview->siginfoview, text);
+       g_free(text);
+       noticeview_set_button_text(mimeview->siginfoview, button_text);
+       noticeview_set_button_press_callback(
+               mimeview->siginfoview,
+               func,
+               (gpointer) mimeview);
+       noticeview_set_icon(mimeview->siginfoview, icon);
 }
 
 static void check_signature_cb(GtkWidget *widget, gpointer user_data)
@@ -673,7 +671,7 @@ static void check_signature_cb(GtkWidget *widget, gpointer user_data)
        MimeInfo *mimeinfo = mimeview_get_selected_part(mimeview);
        
        privacy_mimeinfo_check_signature(mimeinfo);
-       update_signature_noticeview(mimeview, mimeinfo);
+       update_signature_noticeview(mimeview, mimeview->siginfo);
 }
 
 static void display_full_info_cb(GtkWidget *widget, gpointer user_data)
@@ -681,10 +679,35 @@ static void display_full_info_cb(GtkWidget *widget, gpointer user_data)
        MimeView *mimeview = (MimeView *) user_data;
        MimeInfo *mimeinfo = mimeview_get_selected_part(mimeview);
        gchar *siginfo;
-       
-       siginfo = privacy_mimeinfo_sig_info_full(mimeinfo);
+
+       siginfo = privacy_mimeinfo_sig_info_full(mimeview->siginfo);
        textview_set_text(mimeview->textview, siginfo);
        g_free(siginfo);
+       noticeview_set_button_text(mimeview->siginfoview, NULL);
+}
+
+static void update_signature_info(MimeView *mimeview, MimeInfo *selected)
+{
+       MimeInfo *siginfo;
+
+       g_return_if_fail(mimeview != NULL);
+       g_return_if_fail(selected != NULL);
+       
+       siginfo = selected;
+       while (siginfo != NULL) {
+               if (privacy_mimeinfo_is_signed(siginfo))
+                       break;
+               siginfo = procmime_mimeinfo_parent(siginfo);
+       }
+       mimeview->siginfo = siginfo;
+       
+       if (siginfo == NULL) {
+               noticeview_hide(mimeview->siginfoview);
+               return;
+       }
+       
+       update_signature_noticeview(mimeview, siginfo);
+       noticeview_show(mimeview->siginfoview);
 }
 
 static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column,
@@ -708,7 +731,7 @@ static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column,
        
        mimeview->textview->default_text = FALSE;
 
-       update_signature_noticeview(mimeview, partinfo);
+       update_signature_info(mimeview, partinfo);
 
        if (!mimeview_show_part(mimeview, partinfo)) {
                switch (partinfo->type) {
@@ -1038,7 +1061,7 @@ static void mimeview_save_as(MimeView *mimeview)
        }                        
        g_return_if_fail(partinfo != NULL);
        
-       if (partname = procmime_mimeinfo_get_parameter(partinfo, "name")) {
+       if ((partname = procmime_mimeinfo_get_parameter(partinfo, "name")) != NULL) {
                Xstrdup_a(defname, partname, return);
                subst_for_filename(defname);
        }
index 1d0d9a8..0c44afb 100644 (file)
@@ -84,6 +84,7 @@ struct _MimeView
        gint oldsize;
 
        NoticeView *siginfoview;
+       MimeInfo *siginfo;
 };
 
 struct _MimeViewerFactory
index 57bb13b..0d28110 100644 (file)
@@ -75,7 +75,7 @@ static gboolean pgpmime_is_signed(MimeInfo *mimeinfo)
 {
        MimeInfo *parent;
        MimeInfo *signature;
-       gchar *protocol;
+       const gchar *protocol;
        PrivacyDataPGP *data = NULL;
        
        g_return_val_if_fail(mimeinfo != NULL, FALSE);
@@ -92,7 +92,7 @@ static gboolean pgpmime_is_signed(MimeInfo *mimeinfo)
        if ((parent->type != MIMETYPE_MULTIPART) ||
            g_strcasecmp(parent->subtype, "signed"))
                return FALSE;
-       protocol = g_hash_table_lookup(parent->parameters, "protocol");
+       protocol = procmime_mimeinfo_get_parameter(parent, "protocol");
        if ((protocol == NULL) || g_strcasecmp(protocol, "application/pgp-signature"))
                return FALSE;
 
@@ -206,12 +206,14 @@ static gchar *pgpmime_get_sig_info_full(MimeInfo *mimeinfo)
 static gboolean pgpmime_is_encrypted(MimeInfo *mimeinfo)
 {
        MimeInfo *tmpinfo;
+       const gchar *tmpstr;
        
        if (mimeinfo->type != MIMETYPE_MULTIPART)
                return FALSE;
        if (g_strcasecmp(mimeinfo->subtype, "encrypted"))
                return FALSE;
-       if (g_strcasecmp(procmime_mimeinfo_get_parameter(mimeinfo, "protocol"), "application/pgp-encrypted"))
+       tmpstr = procmime_mimeinfo_get_parameter(mimeinfo, "protocol");
+       if ((tmpstr == NULL) || g_strcasecmp(tmpstr, "application/pgp-encrypted"))
                return FALSE;
        if (g_node_n_children(mimeinfo->node) != 2)
                return FALSE;
index e3fcf23..258bbad 100644 (file)
@@ -118,7 +118,7 @@ gchar *sgpgme_sigstat_info_short(GpgmeCtx ctx, GpgmeSigStat status)
                        get_validity_str(validity));
        }
        case GPGME_SIG_STAT_GOOD_EXP:
-               return g_strdup(_("The signature of this part has expired"));
+               return g_strdup(_("The signature has expired"));
        case GPGME_SIG_STAT_GOOD_EXPKEY:
                return g_strdup(_("The key that was used to sign this part has expired"));
        case GPGME_SIG_STAT_DIFF:
@@ -132,7 +132,7 @@ gchar *sgpgme_sigstat_info_short(GpgmeCtx ctx, GpgmeSigStat status)
        case GPGME_SIG_STAT_ERROR:
                return g_strdup(_("An error occured"));
        case GPGME_SIG_STAT_NONE:
-               return g_strdup(_("The signature of this part has not been checked"));
+               return g_strdup(_("The signature has not been checked"));
        }
        return g_strdup(_("Error"));
 }