Show key icon for encrypted mails in summary view.
authorDarko Koruga <darko@users.sourceforge.net>
Thu, 27 Dec 2001 07:17:19 +0000 (07:17 +0000)
committerDarko Koruga <darko@users.sourceforge.net>
Thu, 27 Dec 2001 07:17:19 +0000 (07:17 +0000)
15 files changed:
ChangeLog.claws
configure.in
src/filtering.c
src/mbox_folder.c
src/messageview.c
src/mh.c
src/pixmaps/clip.xpm
src/pixmaps/clipkey.xpm [new file with mode: 0644]
src/pixmaps/key.xpm [new file with mode: 0644]
src/procheader.c
src/procheader.h
src/procmsg.h
src/stock_pixmap.c
src/stock_pixmap.h
src/summaryview.c

index 7a52723..4cb88b3 100644 (file)
@@ -1,3 +1,20 @@
+2001-12-27 [darko]     0.6.6claws26
+
+       * src/filtering.c
+       * src/mbox_folder.c
+       * src/messageview.c
+       * src/mh.c
+       * src/procheader.[ch]
+       * src/procmsg.h
+       * src/stock_pixmap.[ch]
+       * src/summaryview.c
+               Show key icon for encrypted mails in summary view
+
+       * src/pixmaps/clip.xpm
+       * src/pixmaps/clipkey.xpm
+       * src/pixmaps/key.xpm
+               New/modified icons for the above
+
 2001-12-27 [melvin]    0.6.6claws25
 
        * src/prefs_common.c
index a225753..4905c1e 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws25
+EXTRA_VERSION=claws26
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 4dd3cb9..b144a3a 100644 (file)
@@ -382,7 +382,7 @@ void filter_message(GSList *filtering_list, FolderItem *inbox,
                return;
        }
 
-       msginfo = procheader_parse(filename, msgflags, TRUE);
+       msginfo = procheader_parse(filename, msgflags, TRUE, FALSE);
        
        g_free(filename);
 
index e125383..c69b08b 100644 (file)
@@ -693,7 +693,7 @@ static MsgInfo *mbox_parse_msg(FILE * fp, struct _message * msg,
                }
        }
 
-       msginfo = procheader_file_parse(fp, flags, FALSE);
+       msginfo = procheader_file_parse(fp, flags, FALSE, FALSE);
 
        if (!msginfo) return NULL;
 
index 3abff4a..0358b45 100644 (file)
@@ -431,7 +431,9 @@ void messageview_show(MessageView *messageview, MsgInfo *msginfo)
         * in any case, checking tmpmsginfo->flags for MSG_UNREAD
         * fixes the return-receipt-request bug */
 
-       tmpmsginfo = procheader_parse(file, msginfo->flags, TRUE);
+       tmpmsginfo = procheader_parse(file, msginfo->flags, TRUE, TRUE);
+       if (MSG_IS_MIME(tmpmsginfo->flags))
+               MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MIME);
 
        if (prefs_common.return_receipt
            && (tmpmsginfo->dispositionnotificationto
index b999681..4f166f3 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -958,7 +958,7 @@ static MsgInfo *mh_parse_msg(const gchar *file, FolderItem *item)
                MSG_SET_TMP_FLAGS(flags, MSG_DRAFT);
        }
 
-       msginfo = procheader_parse(file, flags, FALSE);
+       msginfo = procheader_parse(file, flags, FALSE, FALSE);
        if (!msginfo) return NULL;
 
        msginfo->msgnum = atoi(file);
index c425d20..6a555bd 100644 (file)
@@ -1,17 +1,17 @@
 /* XPM */
 static char * clip_xpm[] = {
-"6 12 2 1",
+"11 12 2 1",
 "      c None",
 ".     c #000000",
-"  ... ",
-" .   .",
-" .   .",
-"..  ..",
-"..  ..",
-"..  ..",
-"..  ..",
-". .. .",
-".    .",
-".    .",
-" .... ",
-"      "};
+"    ...    ",
+"   .   .   ",
+"   .   .   ",
+"  ..  ..   ",
+"  ..  ..   ",
+"  ..  ..   ",
+"  ..  ..   ",
+"  . .. .   ",
+"  .    .   ",
+"  .    .   ",
+"   ....    ",
+"           "};
diff --git a/src/pixmaps/clipkey.xpm b/src/pixmaps/clipkey.xpm
new file mode 100644 (file)
index 0000000..d7f556d
--- /dev/null
@@ -0,0 +1,18 @@
+/* XPM */
+static char * clipkey_xpm[] = {
+"11 12 3 1",
+"o      c #040204",
+".      c #fcfe04",
+"       c None",
+"    ooo    ",
+"   o   o   ",
+"   o   o   ",
+"  oo  oo   ",
+"  oo  oo   ",
+"  oo  oooo ",
+"  oo  o...o",
+" ooooo....o",
+"o.......o.o",
+" o.o.o....o",
+"  ooooo...o",
+"       ooo "};
diff --git a/src/pixmaps/key.xpm b/src/pixmaps/key.xpm
new file mode 100644 (file)
index 0000000..d667d46
--- /dev/null
@@ -0,0 +1,18 @@
+/* XPM */
+static char * key_xpm[] = {
+"11 12 3 1",
+"o      c #040204",
+".      c #fcfe04",
+"       c None",
+"           ",
+"           ",
+"           ",
+"           ",
+"           ",
+"       ooo ",
+"      o...o",
+" ooooo....o",
+"o.......o.o",
+" o.o.o....o",
+"  o o o...o",
+"       ooo "};
index af91904..4e450a2 100644 (file)
@@ -437,7 +437,8 @@ enum
        H_RETURN_RECEIPT_TO = 16
 };
 
-MsgInfo *procheader_parse(const gchar *file, MsgFlags flags, gboolean full)
+MsgInfo *procheader_parse(const gchar *file, MsgFlags flags,
+                         gboolean full, gboolean decrypted)
 {
        FILE *fp;
        MsgInfo *msginfo;
@@ -447,7 +448,7 @@ MsgInfo *procheader_parse(const gchar *file, MsgFlags flags, gboolean full)
                return NULL;
        }
 
-       msginfo = procheader_file_parse(fp, flags, full);
+       msginfo = procheader_file_parse(fp, flags, full, decrypted);
 
        fclose(fp);
 
@@ -462,7 +463,7 @@ MsgInfo *procheader_parse(const gchar *file, MsgFlags flags, gboolean full)
 #define ALLOW_HEADER_HINT
 
 MsgInfo *procheader_file_parse(FILE * fp, MsgFlags flags,
-                              gboolean full)
+                              gboolean full, gboolean decrypted)
 {
        static HeaderEntry hentry_full[] = {{"Date:",           NULL, FALSE},
                                           {"From:",            NULL, TRUE},
@@ -521,6 +522,9 @@ MsgInfo *procheader_file_parse(FILE * fp, MsgFlags flags,
        else 
                MSG_SET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
        
+       if (decrypted)
+               MSG_UNSET_TMP_FLAGS(msginfo->flags, MSG_MIME);
+
        msginfo->inreplyto = NULL;
 
        while ((hnum = procheader_get_one_field(buf, sizeof(buf), fp, hentry))
@@ -598,7 +602,18 @@ MsgInfo *procheader_file_parse(FILE * fp, MsgFlags flags,
                        }
                        break;
                case H_CONTENT_TYPE:
-                       if (!strncasecmp(hp, "multipart", 9))
+                       if (decrypted) {
+                               if (!strncasecmp(hp, "multipart", 9) &&
+                                   strncasecmp(hp, "multipart/signed", 16)) {
+                                       MSG_SET_TMP_FLAGS(msginfo->flags,
+                                                         MSG_MIME);
+                               }
+                       }
+                       else if (!strncasecmp(hp, "multipart/encrypted", 19)) {
+                               MSG_SET_TMP_FLAGS(msginfo->flags,
+                                                 MSG_ENCRYPTED);
+                       }
+                       else if (!strncasecmp(hp, "multipart", 9))
                                MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MIME);
                        break;
 #ifdef ALLOW_HEADER_HINT                       
index 70383e5..90f7b47 100644 (file)
@@ -62,9 +62,12 @@ void procheader_get_header_fields    (FILE           *fp,
                                         HeaderEntry     hentry[]);
 MsgInfo *procheader_parse              (const gchar    *file,
                                         MsgFlags        flags,
-                                        gboolean        full);
-MsgInfo *procheader_file_parse(FILE * fp, MsgFlags flags,
-                              gboolean full);
+                                        gboolean        full,
+                                        gboolean        decrypted);
+MsgInfo *procheader_file_parse         (FILE           *fp,
+                                        MsgFlags        flags,
+                                        gboolean        full,
+                                        gboolean        decrypted);
 
 gchar *procheader_get_fromname         (const gchar    *str);
 
index c5bc738..5b92d89 100644 (file)
@@ -90,7 +90,7 @@ typedef enum
        MSG_CACHED      = 1 << 31
 } MsgTmpFlags;
 
-#define MSG_CACHED_FLAG_MASK   (MSG_MIME)
+#define MSG_CACHED_FLAG_MASK   (MSG_MIME | MSG_ENCRYPTED)
 
 #define MSG_SET_FLAGS(msg, flags)      { (msg) |= (flags); }
 #define MSG_UNSET_FLAGS(msg, flags)    { (msg) &= ~(flags); }
index 96fef6d..f2f1536 100644 (file)
@@ -30,6 +30,7 @@
 #include "pixmaps/checkbox_off.xpm"
 #include "pixmaps/checkbox_on.xpm"
 #include "pixmaps/clip.xpm"
+#include "pixmaps/clipkey.xpm"
 #include "pixmaps/complete.xpm"
 #include "pixmaps/continue.xpm"
 #include "pixmaps/deleted.xpm"
@@ -41,6 +42,7 @@
 #include "pixmaps/inbox.xpm"
 #include "pixmaps/interface.xpm"
 #include "pixmaps/jpilot.xpm"
+#include "pixmaps/key.xpm"
 #include "pixmaps/ldap.xpm"
 #include "pixmaps/linewrap.xpm"
 #include "pixmaps/mark.xpm"
@@ -90,6 +92,7 @@ static StockPixmapData pixmaps[] =
        {checkbox_off_xpm               , NULL, NULL},
        {checkbox_on_xpm                , NULL, NULL},
        {clip_xpm                       , NULL, NULL},
+       {clipkey_xpm                    , NULL, NULL},
        {complete_xpm                   , NULL, NULL},
        {continue_xpm                   , NULL, NULL},
        {deleted_xpm                    , NULL, NULL},
@@ -101,6 +104,7 @@ static StockPixmapData pixmaps[] =
        {inbox_xpm                      , NULL, NULL},
        {interface_xpm                  , NULL, NULL},
        {jpilot_xpm                     , NULL, NULL},
+       {key_xpm                        , NULL, NULL},
        {ldap_xpm                       , NULL, NULL},
        {linewrap_xpm                   , NULL, NULL},
        {mark_xpm                       , NULL, NULL},
index 0fbbc31..ed8b06b 100644 (file)
@@ -31,6 +31,7 @@ typedef enum
        STOCK_PIXMAP_CHECKBOX_OFF,
        STOCK_PIXMAP_CHECKBOX_ON,
        STOCK_PIXMAP_CLIP,
+       STOCK_PIXMAP_CLIP_KEY,
        STOCK_PIXMAP_COMPLETE,
        STOCK_PIXMAP_CONTINUE,
        STOCK_PIXMAP_DELETED,
@@ -42,6 +43,7 @@ typedef enum
        STOCK_PIXMAP_INBOX,
        STOCK_PIXMAP_INTERFACE,
        STOCK_PIXMAP_JPILOT,
+       STOCK_PIXMAP_KEY,
        STOCK_PIXMAP_LDAP,
        STOCK_PIXMAP_LINEWRAP,
        STOCK_PIXMAP_MARK,
index 8cb9ab3..367b002 100644 (file)
 #define SUMMARY_COL_MARK_WIDTH         10
 #define SUMMARY_COL_UNREAD_WIDTH       13
 #define SUMMARY_COL_LOCKED_WIDTH       13
-#define SUMMARY_COL_MIME_WIDTH         10
+#define SUMMARY_COL_MIME_WIDTH         11
 
 static GdkFont *boldfont;
 static GdkFont *smallfont;
@@ -132,6 +132,10 @@ static GdkBitmap *lockedxpmmask;
 
 static GdkPixmap *clipxpm;
 static GdkBitmap *clipxpmmask;
+static GdkPixmap *keyxpm;
+static GdkBitmap *keyxpmmask;
+static GdkPixmap *clipkeyxpm;
+static GdkBitmap *clipkeyxpmmask;
 
 static void summary_free_msginfo_func  (GtkCTree               *ctree,
                                         GtkCTreeNode           *node,
@@ -544,6 +548,10 @@ void summary_init(SummaryView *summaryview)
                         &lockedxpm, &lockedxpmmask);
        stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_IGNORETHREAD,
                         &ignorethreadxpm, &ignorethreadxpmmask);
+       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_CLIP_KEY,
+                        &clipkeyxpm, &clipkeyxpmmask);
+       stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_KEY,
+                        &keyxpm, &keyxpmmask);
 
        if (!small_style) {
                small_style = gtk_style_copy
@@ -2262,6 +2270,7 @@ static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row,
 {
        GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
        MsgInfo *msginfo;
+       MsgFlags flags;
        gchar *filename;
 
        if (!new_window && summaryview->displayed == row) return;
@@ -2296,6 +2305,8 @@ static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row,
                summary_status_show(summaryview);
        }
 
+       flags = msginfo->flags;
+
        if (new_window) {
                MessageView *msgview;
 
@@ -2318,7 +2329,8 @@ static void summary_display_msg(SummaryView *summaryview, GtkCTreeNode *row,
                gtkut_ctree_node_move_if_on_the_edge(ctree, row);
        }
 
-       if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags)) {
+       if (MSG_IS_NEW(msginfo->flags) || MSG_IS_UNREAD(msginfo->flags) ||
+           (MSG_IS_MIME(msginfo->flags) - MSG_IS_MIME(flags) != 0)) {
                MSG_UNSET_PERM_FLAGS(msginfo->flags, MSG_NEW | MSG_UNREAD);
                CHANGE_FLAGS(msginfo);
                summary_set_row_marks(summaryview, row);
@@ -2575,7 +2587,13 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCTreeNode *row)
                gtk_ctree_node_set_text(ctree, row, col_pos[S_COL_LOCKED], NULL);
        }
 
-       if (MSG_IS_MIME(flags)) {
+       if (MSG_IS_MIME(flags) && MSG_IS_ENCRYPTED(flags)) {
+               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
+                                         clipkeyxpm, clipkeyxpmmask);
+       } else if (MSG_IS_ENCRYPTED(flags)) {
+               gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
+                                         keyxpm, keyxpmmask);
+       } else if (MSG_IS_MIME(flags)) {
                gtk_ctree_node_set_pixmap(ctree, row, col_pos[S_COL_MIME],
                                          clipxpm, clipxpmmask);
        } else {