0.9.6claws12
authorChristoph Hohmann <reboot@gmx.ch>
Fri, 10 Oct 2003 15:34:00 +0000 (15:34 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Fri, 10 Oct 2003 15:34:00 +0000 (15:34 +0000)
* src/stock_pixmap.[ch]
* src/pixmaps/mime_message.xpm                  ** NEW **
        add a new icon for mime type "message"

* src/privacy.[ch]
* src/procmime.[ch]
        add crypto api

* src/mimeview.c
        o use crypto api
        o add icons for message type mime parts

ChangeLog.claws
configure.ac
src/Makefile.am
src/mimeview.c
src/pixmaps/mime_message.xpm [new file with mode: 0644]
src/privacy.c [new file with mode: 0644]
src/privacy.h [new file with mode: 0644]
src/procmime.c
src/procmime.h
src/stock_pixmap.c
src/stock_pixmap.h

index 6b6a1d2..deb27bc 100644 (file)
@@ -1,3 +1,17 @@
+2003-10-10 [christoph] 0.9.6claws12
+
+       * src/stock_pixmap.[ch]
+       * src/pixmaps/mime_message.xpm                  ** NEW **
+               add a new icon for mime type "message"
+
+       * src/privacy.[ch]
+       * src/procmime.[ch]
+               add crypto api
+
+       * src/mimeview.c
+               o use crypto api
+               o add icons for message type mime parts
+
 2003-10-10 [christoph] 0.9.6claws11
 
        * src/mainwindow.c
index d1873c8..92286d2 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=11
+EXTRA_VERSION=12
 if test $EXTRA_VERSION -eq 0; then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws
 else
index 4557fd9..80a93c1 100644 (file)
@@ -92,6 +92,7 @@ sylpheed_SOURCES = \
        prefs_summary_column.c \
        prefs_template.c \
        prefs_toolbar.c \
+       privacy.c \
        procheader.c \
        procmime.c \
        procmsg.c \
@@ -213,6 +214,7 @@ sylpheedinclude_HEADERS = \
        prefs_summary_column.h \
        prefs_template.h \
        prefs_toolbar.h \
+       privacy.h \
        procheader.h \
        procmime.h \
        procmsg.h \
index 31e97e2..8a52bee 100644 (file)
@@ -322,7 +322,6 @@ void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
 {
        GtkCTree *ctree = GTK_CTREE(mimeview->ctree);
        GtkCTreeNode *node;
-       FILE *fp;
 
        mimeview_clear(mimeview);
 
@@ -342,20 +341,7 @@ void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
        gtk_signal_handler_unblock_by_func(GTK_OBJECT(ctree),
                                           mimeview_selected, mimeview);
 
-       /* search first text part */
-       for (node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
-            node != NULL; node = GTK_CTREE_NODE_NEXT(node)) {
-               MimeInfo *partinfo;
-
-               partinfo = gtk_ctree_node_get_row_data(ctree, node);
-               if (partinfo &&
-                   (partinfo->type == MIMETYPE_TEXT))
-                       break;
-       }
-
-       if (!node)
-               node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
-
+       node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
        if (node) {
                gtk_ctree_select(ctree, node);
                icon_list_toggle_by_mime_info
@@ -651,6 +637,13 @@ static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column,
        
        mimeview->textview->default_text = FALSE;
 
+       if (privacy_mimeinfo_is_signed(partinfo)) {
+               noticeview_set_text(mimeview->siginfoview, "Signed Part");
+               noticeview_show(mimeview->siginfoview);
+       } else {
+               noticeview_hide(mimeview->siginfoview);
+       }
+
        if (!mimeview_show_part(mimeview, partinfo)) {
                switch (partinfo->type) {
                case MIMETYPE_TEXT:
@@ -1316,7 +1309,7 @@ static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo)
                        stockp = STOCK_PIXMAP_MIME_TEXT_PLAIN;
                break;
        case MIMETYPE_MESSAGE:
-               stockp = STOCK_PIXMAP_MIME_TEXT_PLAIN;
+               stockp = STOCK_PIXMAP_MIME_MESSAGE;
                break;
        case MIMETYPE_APPLICATION:
                if (mimeinfo->subtype && !g_strcasecmp(mimeinfo->subtype, "octet-stream"))
@@ -1460,14 +1453,11 @@ static void icon_list_create(MimeView *mimeview, MimeInfo *mimeinfo)
        gint           width;
        g_return_if_fail(mimeinfo != NULL);
 
-       if (mimeinfo->children)
-               mimeinfo = mimeinfo->children;
-
        while (mimeinfo != NULL) {
-               if (mimeinfo->children)
-                       icon_list_create(mimeview, mimeinfo);
-               else 
+               if (mimeinfo->type != MIMETYPE_MULTIPART)
                        icon_list_append_icon(mimeview, mimeinfo);
+               if (mimeinfo->children != NULL)
+                       icon_list_create(mimeview, mimeinfo->children);
                mimeinfo = mimeinfo->next;
        }
        gtk_widget_size_request(mimeview->icon_vbox, &size);
diff --git a/src/pixmaps/mime_message.xpm b/src/pixmaps/mime_message.xpm
new file mode 100644 (file)
index 0000000..651337b
--- /dev/null
@@ -0,0 +1,60 @@
+/* XPM */
+static char * mime_message_xpm[] = {
+"14 18 39 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #000000",
+"#     c #2828D5",
+"$     c #CECFF5",
+"%     c #D0D0F5",
+"&     c #CECEF5",
+"*     c #1B1B92",
+"=     c #CBCBF4",
+"-     c #CDCDF5",
+";     c #8888E7",
+">     c #BAB8F1",
+",     c #CFCEF5",
+"'     c #BDBAF1",
+")     c #7572E3",
+"!     c #2222B7",
+"~     c #C5C2F3",
+"{     c #CBC9F4",
+"]     c #C3C2F3",
+"^     c #2323BE",
+"/     c #2727D0",
+"(     c #CECDF5",
+"_     c #8881E6",
+":     c #CCCBF4",
+"<     c #A29CEB",
+"[     c #7068E1",
+"}     c #CDCBF4",
+"|     c #867FE6",
+"1     c #1B1B90",
+"2     c #B9B7F0",
+"3     c #6B6BE2",
+"4     c #5E5ADF",
+"5     c #8984E7",
+"6     c #A6A1EC",
+"7     c #9692E9",
+"8     c #746EE3",
+"9     c #9C99EA",
+"0     c #141469",
+"..............",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".+@@@@@@@@@@+.",
+".@#$%%&%%&&*@.",
+".@&#&&%&=-#;@.",
+".@&>#%&,-#')@.",
+".@%&&#%%!~''@.",
+".@{%]#^/#({_@.",
+".@%:#&,({#<[@.",
+".@&#=&,}{|12@.",
+".@#334567890@.",
+".+@@@@@@@@@@+.",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".............."};
diff --git a/src/privacy.c b/src/privacy.c
new file mode 100644 (file)
index 0000000..918c296
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto & the Sylpheed-Claws team
+ *
+ * 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.
+ */
+
+#include <glib.h>
+
+#include "privacy.h"
+#include "procmime.h"
+
+void privacy_free_privacydata(PrivacyData *privacydata)
+{
+       g_return_if_fail(privacydata != NULL);
+
+       privacydata->system->free_privacydata(privacydata);
+}
+
+gboolean privacy_mimeinfo_is_signed(MimeInfo *mimeinfo)
+{
+       g_return_val_if_fail(mimeinfo != NULL, NULL);
+
+       return FALSE;
+       /* return mimeinfo->type == MIMETYPE_TEXT ? TRUE : FALSE; */
+}
+
+const gchar *privacy_get_signer(MimeInfo *mimeinfo)
+{
+       g_return_val_if_fail(mimeinfo != NULL, NULL);
+
+       return "Dummy";
+}
+
+gboolean privacy_mimeinfo_is_encrypted(MimeInfo *mimeinfo)
+{
+       g_return_val_if_fail(mimeinfo != NULL, NULL);
+
+       return FALSE;
+}
diff --git a/src/privacy.h b/src/privacy.h
new file mode 100644 (file)
index 0000000..cb18220
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto & the Sylpheed-Claws team
+ *
+ * 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 PRIVACY_H
+#define PRIVACY_H
+
+typedef struct _PrivacySystem PrivacySystem;
+typedef struct _PrivacyData PrivacyData;
+
+typedef enum {
+       SIGNATURE_UNCHECKED,
+       SIGNATURE_OK,
+       SIGNATURE_INVALID,
+} SignatureStatus;
+
+#include <glib.h>
+
+#include "procmime.h"
+
+void privacy_free_privacydata          (PrivacyData *);
+
+gboolean privacy_mimeinfo_is_signed    (MimeInfo *);
+const gchar *privacy_get_signer                (MimeInfo *);
+SignatureStatus privacy_check_signature        (MimeInfo *);
+
+#if 0 /* NOT YET */
+gboolean privacy_mimeinfo_is_encrypted (MimeInfo *);
+gint privacy_decrypt                   (MimeInfo *);
+#endif
+
+struct _PrivacySystem {
+       void             (*free_privacydata)    (PrivacyData *);
+
+       gboolean         (*is_signed)           (MimeInfo *);
+       const gchar     *(*get_signer)          (MimeInfo *);
+       SignatureStatus  (*check_signature)     (MimeInfo *);
+
+#if 0 /* NOT YET */
+       gboolean         (*is_encrypted)        (MimeInfo *);
+       MimeInfo        *(*decrypt)             (MimeInfo *);
+#endif
+};
+
+struct _PrivacyData {
+       PrivacySystem   *system;
+};
+
+#endif /* PRIVACY_H */
index aed3ff7..e1ff280 100644 (file)
@@ -84,7 +84,8 @@ void procmime_mimeinfo_free_all(MimeInfo *mimeinfo)
                unlink(mimeinfo->filename);
        g_free(mimeinfo->filename);
 
-       procmime_mimeinfo_free_all(mimeinfo->children);
+       if (mimeinfo->children != NULL)
+               procmime_mimeinfo_free_all(mimeinfo->children);
        g_free(mimeinfo->subtype);
        g_free(mimeinfo->description);
        g_free(mimeinfo->id);
@@ -92,6 +93,9 @@ void procmime_mimeinfo_free_all(MimeInfo *mimeinfo)
        g_hash_table_foreach_remove(mimeinfo->parameters, procmime_mimeinfo_parameters_destroy, NULL);
        g_hash_table_destroy(mimeinfo->parameters);
 
+       if (mimeinfo->privacy)
+               privacy_free_privacydata(mimeinfo->privacy);
+
        next = mimeinfo->next;
        g_free(mimeinfo);
        mimeinfo = next;
index 5c0d4e2..e121b82 100644 (file)
@@ -58,6 +58,7 @@ typedef enum
 #include <stdio.h>
 
 #include "procmsg.h"
+#include "privacy.h"
 
 struct _MimeType
 {
@@ -126,6 +127,9 @@ struct _MimeInfo
 
        guint            offset;
        guint            length;
+
+       /* Privacy */
+       PrivacyData     *privacy;
 };
 
 #define IS_BOUNDARY(s, bnd, len) \
index f76012c..0fb2559 100644 (file)
 #include "pixmaps/mime_gpg_failed.xpm"
 #include "pixmaps/mime_gpg_unknown.xpm"
 #include "pixmaps/mime_gpg_expired.xpm"                  
+#include "pixmaps/mime_message.xpm"                  
 #include "pixmaps/address_search.xpm"
 
 typedef struct _StockPixmapData        StockPixmapData;
@@ -124,74 +125,74 @@ static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname);
 
 static StockPixmapData pixmaps[] =
 {
-       {address_xpm                    , NULL, NULL, "address", "  "},
-       {address_book_xpm               , NULL, NULL, "address_book", "  "},
-       {address_search_xpm             , NULL, NULL, "address_search", "  "},
+       {address_xpm                            , NULL, NULL, "address", "  "},
+       {address_book_xpm                       , NULL, NULL, "address_book", "  "},
+       {address_search_xpm                     , NULL, NULL, "address_search", "  "},
        {book_xpm                               , NULL, NULL, "book", "  "},
-       {category_xpm                   , NULL, NULL, "category", "  "},
-       {checkbox_off_xpm               , NULL, NULL, "checkbox_off", "  "},
-       {checkbox_on_xpm                , NULL, NULL, "checkbox_on", "  "},
+       {category_xpm                           , NULL, NULL, "category", "  "},
+       {checkbox_off_xpm                       , NULL, NULL, "checkbox_off", "  "},
+       {checkbox_on_xpm                        , NULL, NULL, "checkbox_on", "  "},
        {clip_xpm                               , NULL, NULL, "clip", "  "},
-       {clipkey_xpm                    , NULL, NULL, "clipkey", "  "},
+       {clipkey_xpm                            , NULL, NULL, "clipkey", "  "},
        {close_xpm                              , NULL, NULL, "close", "  "},
-       {complete_xpm                   , NULL, NULL, "complete", "  "},
-       {continue_xpm                   , NULL, NULL, "continue", "  "},
-       {deleted_xpm                    , NULL, NULL, "deleted", "  "},
-       {dir_close_xpm                  , NULL, NULL, "dir_close", "  "},
-       {dir_close_xpm                  , NULL, NULL, "dir_close_hrm", " "},
-       {dir_open_xpm                   , NULL, NULL, "dir_open", "  "},
-       {dir_open_hrm_xpm               , NULL, NULL, "dir_open_hrm", "  "},
-       {down_arrow_xpm                 , NULL, NULL, "down_arrow", "  "},
-       {up_arrow_xpm                   , NULL, NULL, "up_arrow", "  "},
-       {mail_compose_xpm               , NULL, NULL, "edit_extern", "  "},
+       {complete_xpm                           , NULL, NULL, "complete", "  "},
+       {continue_xpm                           , NULL, NULL, "continue", "  "},
+       {deleted_xpm                            , NULL, NULL, "deleted", "  "},
+       {dir_close_xpm                          , NULL, NULL, "dir_close", "  "},
+       {dir_close_xpm                          , NULL, NULL, "dir_close_hrm", " "},
+       {dir_open_xpm                           , NULL, NULL, "dir_open", "  "},
+       {dir_open_hrm_xpm                       , NULL, NULL, "dir_open_hrm", "  "},
+       {down_arrow_xpm                         , NULL, NULL, "down_arrow", "  "},
+       {up_arrow_xpm                           , NULL, NULL, "up_arrow", "  "},
+       {mail_compose_xpm                       , NULL, NULL, "edit_extern", "  "},
        {error_xpm                              , NULL, NULL, "error", "  "},
        {exec_xpm                               , NULL, NULL, "exec", "  "},
-       {forwarded_xpm                  , NULL, NULL, "forwarded", "  "},
+       {forwarded_xpm                          , NULL, NULL, "forwarded", "  "},
        {group_xpm                              , NULL, NULL, "group", "  "},
-       {ignorethread_xpm               , NULL, NULL, "ignorethread", "  "},
+       {ignorethread_xpm                       , NULL, NULL, "ignorethread", "  "},
        {inbox_xpm                              , NULL, NULL, "inbox_close", "  "},
-       {inbox_hrm_xpm                  , NULL, NULL, "inbox_close_hrm", "  "},
+       {inbox_hrm_xpm                          , NULL, NULL, "inbox_close_hrm", "  "},
        {inbox_xpm                              , NULL, NULL, "inbox_open", "  "},
-       {inbox_hrm_xpm                  , NULL, NULL, "inbox_open_hrm", "  "},
+       {inbox_hrm_xpm                          , NULL, NULL, "inbox_open_hrm", "  "},
        {paste_xpm                              , NULL, NULL, "insert_file", "  "},
-       {interface_xpm                  , NULL, NULL, "interface", "  "},
+       {interface_xpm                          , NULL, NULL, "interface", "  "},
        {jpilot_xpm                             , NULL, NULL, "jpilot", "  "},
        {key_xpm                                , NULL, NULL, "key", "  "},
        {ldap_xpm                               , NULL, NULL, "ldap", "  "},
-       {linewrap_xpm                   , NULL, NULL, "linewrap", "  "},
+       {linewrap_xpm                           , NULL, NULL, "linewrap", "  "},
        {locked_xpm                             , NULL, NULL, "locked", "  "},
        {mail_xpm                               , NULL, NULL, "mail", "  "},
-       {mail_attach_xpm                , NULL, NULL, "mail_attach", "  "},
-       {mail_compose_xpm               , NULL, NULL, "mail_compose", "  "},
-       {mail_forward_xpm               , NULL, NULL, "mail_forward", "  "},
-       {mail_receive_xpm               , NULL, NULL, "mail_receive", "  "},
-       {mail_receive_all_xpm   , NULL, NULL, "mail_receive_all", "  "},
-       {mail_reply_xpm                 , NULL, NULL, "mail_reply", "  "},
-       {mail_reply_to_all_xpm  , NULL, NULL, "mail_reply_to_all", "  "},
+       {mail_attach_xpm                        , NULL, NULL, "mail_attach", "  "},
+       {mail_compose_xpm                       , NULL, NULL, "mail_compose", "  "},
+       {mail_forward_xpm                       , NULL, NULL, "mail_forward", "  "},
+       {mail_receive_xpm                       , NULL, NULL, "mail_receive", "  "},
+       {mail_receive_all_xpm                   , NULL, NULL, "mail_receive_all", "  "},
+       {mail_reply_xpm                         , NULL, NULL, "mail_reply", "  "},
+       {mail_reply_to_all_xpm                  , NULL, NULL, "mail_reply_to_all", "  "},
        {mail_reply_to_author_xpm
-                                                       , NULL, NULL, "mail_reply_to_author", "  "},
-       {mail_send_xpm                  , NULL, NULL, "mail_send", "  "},
-       {mail_send_queue_xpm    , NULL, NULL, "mail_send_queue", "  "},
+                                               , NULL, NULL, "mail_reply_to_author", "  "},
+       {mail_send_xpm                          , NULL, NULL, "mail_send", "  "},
+       {mail_send_queue_xpm                    , NULL, NULL, "mail_send_queue", "  "},
        {mail_xpm                               , NULL, NULL, "mail_sign", "  "},
        {mark_xpm                               , NULL, NULL, "mark", "  "},
        {new_xpm                                , NULL, NULL, "new", "  "},
-       {news_compose_xpm               , NULL, NULL, "news_compose", "  "},
+       {news_compose_xpm                       , NULL, NULL, "news_compose", "  "},
        {outbox_xpm                             , NULL, NULL, "outbox_close", "  "},
-       {outbox_hrm_xpm                 , NULL, NULL, "outbox_close_hrm", "  "},
+       {outbox_hrm_xpm                         , NULL, NULL, "outbox_close_hrm", "  "},
        {outbox_xpm                             , NULL, NULL, "outbox_open", "  "},
-       {outbox_hrm_xpm                 , NULL, NULL, "outbox_open_hrm", "  "},
-       {replied_xpm                    , NULL, NULL, "replied", "  "},
+       {outbox_hrm_xpm                         , NULL, NULL, "outbox_open_hrm", "  "},
+       {replied_xpm                            , NULL, NULL, "replied", "  "},
        {paste_xpm                              , NULL, NULL, "paste", "  "},
-       {preferences_xpm                , NULL, NULL, "preferences", "  "},
-       {properties_xpm                 , NULL, NULL, "properties", "  "},
+       {preferences_xpm                        , NULL, NULL, "preferences", "  "},
+       {properties_xpm                         , NULL, NULL, "properties", "  "},
        {outbox_xpm                             , NULL, NULL, "queue_close", "  "},
-       {outbox_hrm_xpm                 , NULL, NULL, "queue_close_hrm", "  "},
+       {outbox_hrm_xpm                         , NULL, NULL, "queue_close_hrm", "  "},
        {outbox_xpm                             , NULL, NULL, "queue_open", "  "},
-       {outbox_hrm_xpm                 , NULL, NULL, "queue_open_hrm", "  "},
+       {outbox_hrm_xpm                         , NULL, NULL, "queue_open_hrm", "  "},
        {trash_xpm                              , NULL, NULL, "trash_open", "  "},
-       {trash_hrm_xpm                  , NULL, NULL, "trash_open_hrm", "  "},
+       {trash_hrm_xpm                          , NULL, NULL, "trash_open_hrm", "  "},
        {trash_xpm                              , NULL, NULL, "trash_close", "  "},
-       {trash_hrm_xpm                  , NULL, NULL, "trash_close_hrm", "  "},
+       {trash_hrm_xpm                          , NULL, NULL, "trash_close_hrm", "  "},
        {unread_xpm                             , NULL, NULL, "unread", "  "},
        {vcard_xpm                              , NULL, NULL, "vcard", "  "},
        {work_online_xpm                        , NULL, NULL, "work_online", "  "},
@@ -217,6 +218,7 @@ static StockPixmapData pixmaps[] =
        {mime_gpg_failed_xpm                    , NULL, NULL, "mime_gpg_failed", "  "}, 
        {mime_gpg_unknown_xpm                   , NULL, NULL, "mime_gpg_unknown", "  "},
        {mime_gpg_expired_xpm                   , NULL, NULL, "mime_gpg_expired", "  "},
+       {mime_message_xpm                       , NULL, NULL, "mime_message", "  "},
        {sylpheed_logo_xpm                      , NULL, NULL, "sylpheed_logo", "  "},
 };
 
index ab6b994..3590cc0 100644 (file)
@@ -117,6 +117,7 @@ typedef enum
        STOCK_PIXMAP_MIME_GPG_FAILED,
        STOCK_PIXMAP_MIME_GPG_UNKNOWN,
        STOCK_PIXMAP_MIME_GPG_EXPIRED,
+       STOCK_PIXMAP_MIME_MESSAGE,
        
        STOCK_PIXMAP_SYLPHEED_LOGO,             /* last entry */