0.9.6claws72
authorChristoph Hohmann <reboot@gmx.ch>
Mon, 10 Nov 2003 19:22:14 +0000 (19:22 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Mon, 10 Nov 2003 19:22:14 +0000 (19:22 +0000)
* src/mimeview.c
* src/pgpmime.c
* src/privacy.[ch]
* src/sgpgme.[ch]
* src/textview.[ch]
        o add code to view full signature info
        o do automatic signature checks

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

index 7e2d0b0b246c8ac7c8aebf20a84ecfc754f63889..c363682684e09f2fee491bfa03fdfdefc3dc0de7 100644 (file)
@@ -1,4 +1,14 @@
-2003-11-01 [alfons]    0.9.6claws71
+2003-11-10 [christoph] 0.9.6claws72
+
+       * src/mimeview.c
+       * src/pgpmime.c
+       * src/privacy.[ch]
+       * src/sgpgme.[ch]
+       * src/textview.[ch]
+               o add code to view full signature info
+               o do automatic signature checks
+
+2003-11-10 [alfons]    0.9.6claws71
 
        * src/summaryview.c
                don't crash when gtkut_font_load() returns invalid font (has
 
        * src/summaryview.c
                don't crash when gtkut_font_load() returns invalid font (has
index ef8fb415e547addb20482e57c992e8717e6b1455..dad22ad7390ba82421be4b792c8a7f1ab096928a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=71
+EXTRA_VERSION=72
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 68b206b0cab3b11e616f7bedbf92ccf6ac412549..937277d2b9cd130662d9041ec38412153159d42e 100644 (file)
@@ -615,6 +615,7 @@ void mimeview_clear(MimeView *mimeview)
 }
 
 static void check_signature_cb(GtkWidget *widget, gpointer user_data);
 }
 
 static void check_signature_cb(GtkWidget *widget, gpointer user_data);
+static void display_full_info_cb(GtkWidget *widget, gpointer user_data);
 
 static void update_signature_noticeview(MimeView *mimeview, MimeInfo *mimeinfo)
 {
 
 static void update_signature_noticeview(MimeView *mimeview, MimeInfo *mimeinfo)
 {
@@ -630,6 +631,8 @@ static void update_signature_noticeview(MimeView *mimeview, MimeInfo *mimeinfo)
                        icon = STOCK_PIXMAP_PRIVACY_SIGNED;
                        break;
                case SIGNATURE_OK:
                        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:
                        icon = STOCK_PIXMAP_PRIVACY_PASSED;
                        break;
                case SIGNATURE_WARN:
@@ -669,6 +672,17 @@ static void check_signature_cb(GtkWidget *widget, gpointer user_data)
        update_signature_noticeview(mimeview, mimeinfo);
 }
 
        update_signature_noticeview(mimeview, mimeinfo);
 }
 
+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);
+       textview_set_text(mimeview->textview, siginfo);
+       g_free(siginfo);
+}
+
 static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column,
                              MimeView *mimeview)
 {
 static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column,
                              MimeView *mimeview)
 {
index c4d6f448601fff5ed86b8dcadb93bbca6892015b..55f0a8515d0240921311c913ffd01786e647de5f 100644 (file)
@@ -32,6 +32,7 @@
 #include "procmime.h"
 #include "pgpmime.h"
 #include "sgpgme.h"
 #include "procmime.h"
 #include "pgpmime.h"
 #include "sgpgme.h"
+#include "prefs_common.h"
 
 typedef struct _PrivacyDataPGP PrivacyDataPGP;
 
 
 typedef struct _PrivacyDataPGP PrivacyDataPGP;
 
@@ -47,6 +48,8 @@ struct _PrivacyDataPGP
 
 static PrivacySystem pgpmime_system;
 
 
 static PrivacySystem pgpmime_system;
 
+static gint pgpmime_check_signature(MimeInfo *mimeinfo);
+
 static PrivacyDataPGP *pgpmime_new_privacydata()
 {
        PrivacyDataPGP *data;
 static PrivacyDataPGP *pgpmime_new_privacydata()
 {
        PrivacyDataPGP *data;
@@ -112,6 +115,9 @@ static gboolean pgpmime_is_signed(MimeInfo *mimeinfo)
        }
        data->done_sigtest = TRUE;
        data->is_signed = TRUE;
        }
        data->done_sigtest = TRUE;
        data->is_signed = TRUE;
+
+       if (prefs_common.auto_check_signatures)
+               pgpmime_check_signature(mimeinfo);
        
        return TRUE;
 }
        
        return TRUE;
 }
@@ -193,6 +199,15 @@ static gchar *pgpmime_get_sig_info_short(MimeInfo *mimeinfo)
        return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
 }
 
        return sgpgme_sigstat_info_short(data->ctx, data->sigstatus);
 }
 
+static gchar *pgpmime_get_sig_info_full(MimeInfo *mimeinfo)
+{
+       PrivacyDataPGP *data = (PrivacyDataPGP *) mimeinfo->privacy;
+       
+       g_return_val_if_fail(data != NULL, g_strdup("Error"));
+
+       return sgpgme_sigstat_info_full(data->ctx, data->sigstatus);
+}
+
 static PrivacySystem pgpmime_system = {
        "PGP/Mime",                     /* name */
 
 static PrivacySystem pgpmime_system = {
        "PGP/Mime",                     /* name */
 
@@ -202,7 +217,7 @@ static PrivacySystem pgpmime_system = {
        pgpmime_check_signature,        /* check_signature(MimeInfo *) */
        pgpmime_get_sig_status,         /* get_sig_status(MimeInfo *) */
        pgpmime_get_sig_info_short,     /* get_sig_info_short(MimeInfo *) */
        pgpmime_check_signature,        /* check_signature(MimeInfo *) */
        pgpmime_get_sig_status,         /* get_sig_status(MimeInfo *) */
        pgpmime_get_sig_info_short,     /* get_sig_info_short(MimeInfo *) */
-       NULL,                           /* get_sig_info_full(MimeInfo *) */
+       pgpmime_get_sig_info_full,      /* get_sig_info_full(MimeInfo *) */
 
        /* NOT YET */
        NULL,                           /* is_encrypted(MimeInfo *) */
 
        /* NOT YET */
        NULL,                           /* is_encrypted(MimeInfo *) */
index 13059c72255d72fab2347adcecb32467360b8059..04ec5cacfdd14a7780b2d901f8838efe601ae1ff 100644 (file)
@@ -123,6 +123,25 @@ gchar *privacy_mimeinfo_sig_info_short(MimeInfo *mimeinfo)
        return system->get_sig_info_short(mimeinfo);
 }
 
        return system->get_sig_info_short(mimeinfo);
 }
 
+gchar *privacy_mimeinfo_sig_info_full(MimeInfo *mimeinfo)
+{
+       PrivacySystem *system;
+
+       g_return_val_if_fail(mimeinfo != NULL, NULL);
+
+       if (mimeinfo->privacy == NULL)
+               privacy_mimeinfo_is_signed(mimeinfo);
+       
+       if (mimeinfo->privacy == NULL)
+               return g_strdup(_("No signature found"));
+       
+       system = mimeinfo->privacy->system;
+       if (system->get_sig_info_full == NULL)
+               return g_strdup(_("No information available"));
+       
+       return system->get_sig_info_full(mimeinfo);
+}
+
 gboolean privacy_mimeinfo_is_encrypted(MimeInfo *mimeinfo)
 {
        g_return_val_if_fail(mimeinfo != NULL, FALSE);
 gboolean privacy_mimeinfo_is_encrypted(MimeInfo *mimeinfo)
 {
        g_return_val_if_fail(mimeinfo != NULL, FALSE);
index 583665c1d8c10160f2bcaf92840294b72d9e3731..c4bdaa1c8faf573d0786c4e181e1767cb343fa62 100644 (file)
@@ -44,6 +44,7 @@ gboolean privacy_mimeinfo_is_signed           (MimeInfo *);
 gint privacy_mimeinfo_check_signature          (MimeInfo *);
 SignatureStatus privacy_mimeinfo_get_sig_status        (MimeInfo *);
 gchar *privacy_mimeinfo_sig_info_short         (MimeInfo *);
 gint privacy_mimeinfo_check_signature          (MimeInfo *);
 SignatureStatus privacy_mimeinfo_get_sig_status        (MimeInfo *);
 gchar *privacy_mimeinfo_sig_info_short         (MimeInfo *);
+gchar *privacy_mimeinfo_sig_info_full          (MimeInfo *);
 
 #if 0 /* NOT YET */
 gboolean privacy_mimeinfo_is_encrypted         (MimeInfo *);
 
 #if 0 /* NOT YET */
 gboolean privacy_mimeinfo_is_encrypted         (MimeInfo *);
index 5098be048f941df4e7f802171206a041acc8b2a9..7fb63768fef3d89ce26443c946ba3c49e52490f1 100644 (file)
@@ -136,6 +136,11 @@ gchar *sgpgme_sigstat_info_short(GpgmeCtx ctx, GpgmeSigStat status)
        return g_strdup(_("Error"));
 }
 
        return g_strdup(_("Error"));
 }
 
+gchar *sgpgme_sigstat_info_full(GpgmeCtx ctx, GpgmeSigStat status)
+{
+       return g_strdup(_("Todo"));
+}
+
 void sgpgme_init()
 {
        if (gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP) != 
 void sgpgme_init()
 {
        if (gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP) != 
index 37d3dd6712c3d0d96f9649026151fd9599744d7d..021b456888da757c753e08815c026389d350f0c9 100644 (file)
@@ -34,5 +34,7 @@ SignatureStatus sgpgme_sigstat_gpgme_to_privacy
                                        (GpgmeSigStat status);
 gchar *sgpgme_sigstat_info_short       (GpgmeCtx ctx,
                                         GpgmeSigStat status);
                                        (GpgmeSigStat status);
 gchar *sgpgme_sigstat_info_short       (GpgmeCtx ctx,
                                         GpgmeSigStat status);
+gchar *sgpgme_sigstat_info_full                (GpgmeCtx ctx,
+                                        GpgmeSigStat status);
 
 #endif /* SGPGME_H */
 
 #endif /* SGPGME_H */
index 7a211fc8fb8d157a4037dda4fbac8fa65a5d1bb2..3c0d6f57bbda6bd80f38020f6bd23cebfe8f9dcb 100644 (file)
@@ -503,7 +503,7 @@ static void recursive_add_parts(TextView *textview, GNode *node)
                 
                 /*
                   text/plain : score 3
                 
                 /*
                   text/plain : score 3
-                  text/    : score 2
+                  text/ *    : score 2
                   other      : score 1
                 */
                 prefered_body = NULL;
                   other      : score 1
                 */
                 prefered_body = NULL;
@@ -1314,6 +1314,21 @@ void textview_set_font(TextView *textview, const gchar *codeset)
                spacingfont = gdk_font_load("-*-*-medium-r-normal--6-*");
 }
 
                spacingfont = gdk_font_load("-*-*-medium-r-normal--6-*");
 }
 
+void textview_set_text(TextView *textview, const gchar *text)
+{
+       GtkSText *stext;
+
+       g_return_if_fail(textview != NULL);
+       g_return_if_fail(text != NULL);
+
+       textview_clear(textview);
+
+       stext = GTK_STEXT(textview->text);
+       gtk_stext_freeze(stext);
+       gtk_stext_insert(stext, textview->msgfont, NULL, NULL, text, strlen(text));
+       gtk_stext_thaw(stext);
+}
+
 enum
 {
        H_DATE          = 0,
 enum
 {
        H_DATE          = 0,
index f786d7e89ee3151f0b4deeb7e81a6543c77da0d9..48dd20d457a0ab4b05a304552379488493b06927 100644 (file)
@@ -80,6 +80,8 @@ void textview_set_all_headers (TextView       *textview,
                                 gboolean        all_headers);
 void textview_set_font         (TextView       *textview,
                                 const gchar    *codeset);
                                 gboolean        all_headers);
 void textview_set_font         (TextView       *textview,
                                 const gchar    *codeset);
+void textview_set_text         (TextView       *textview,
+                                const gchar    *text);
 void textview_set_position     (TextView       *textview,
                                 gint            pos);
 void textview_scroll_one_line  (TextView       *textview,
 void textview_set_position     (TextView       *textview,
                                 gint            pos);
 void textview_scroll_one_line  (TextView       *textview,