aboutsummaryrefslogtreecommitdiffstats
path: root/ui/evolution-message-composer.xml
blob: 3cf84f5f3d91286a0cb2a5bf21d7c51624134974 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<Root>
    <commands>

            <cmd name="FileOpen" _label="Open" hidden="1"
        _tip="Open a file" pixtype="stock" pixname="Open" accel="*Control*o"/>
    
            <cmd name="FileSave" _label="Save"
        _tip="Save the current file" pixtype="stock" pixname="Save"
        accel="*Ctrl*s"/>
    
            <cmd name="FileSaveAs" _label="Save As"
              _tip="Save the current file with a different name"
          pixtype="stock" pixname="Save As"/>

            <cmd name="FileClose" _label="Close"
        _tip="Close the current file" pixtype="stock" pixname="Close"
        accel="*Ctrl*w"/>

        <cmd name="FileSaveInFolder" _label="Save in folder..."
        _tip="Save the message in a specified folder"/>
    
        <cmd name="FileInsertFile" _label="Insert text file..."
        _tip="Insert a file as text into the message"/>

        <cmd name="FileSend" _label="Send" _tip="Send the message now"
        accel="*Ctrl*Return"
                pixtype="stock" pixname="Send Mail"/>

        <cmd name="FileSendLater" _label="Send _later" _tip="Send the message later"
        pixtype="stock" pixname="Send Mail"/> 

        <cmd name="FileAttach" _label="Attach" _tip="Attach a file"
        pixtype="stock" pixname="Attach" accel="*Ctrl**Alt*A"/>

        <cmd name="FormatHtml" _label="HTML" _tip="Send the mail in HTML format"
        type="toggle" state="0"/> 

        <cmd name="ViewAttach" _label="Show attachments" _tip="Show / hide attachments"
        type="toggle" state="0"/> 
    
                <cmd name="SecuritySign" _label="PGP Sign" _tip="Sign this message with your PGP key"
        type="toggle" state="0"/>

                <cmd name="SecurityEncrypt" _label="PGP Encrypt" _tip="Encrypt this message with PGP"
        type="toggle" state="0"/>

    </commands>


        <keybindings>

        </keybindings>

    <menu>

        <submenu name="File" _label="_File">

            <menuitem name="FileOpen" verb="" _label="_Open..."/>

            <placeholder name="FileOps"/>

            <menuitem name="FileSave" verb="" _label="_Save"/>

            <menuitem name="FileSaveAs" verb="" _label="Save _As..."/>

                        <menuitem name="FileSaveDraft" verb="" _label="Save _Draft"/>

            <menuitem name="FileSaveInFolder" verb="" _label="Save in _folder... (FIXME)"/>

            <placeholder name="Print" delimit="top"/>
            <separator/>

            <menuitem name="FileInsertFile" verb="" _label="_Insert text file... (FIXME)"/>

            <separator/>

            <menuitem name="FileSend" verb="" _label="Send"/>

            <menuitem name="FileSendLater" verb="" _label="Send _Later"/>

            <separator/>

            <menuitem name="FileClose" verb="" _label="_Close"/>

        </submenu>


        <submenu name="Edit" _label="_Edit"/>
              

        <submenu name="Format" _label="F_ormat">

            <menuitem name="FormatHtml" verb=""/>

        </submenu>

        <submenu name="View" _label="_View">

            <menuitem name="ViewAttach" verb="" _label="Show _attachments"/>

        </submenu>

        <placeholder name="Component"/>

                <submenu name="Security" _label="_Security">

                        <menuitem name="SecuritySign" verb="" _label="PGP Sign"/>

                        <menuitem name="SecurityEncrypt" verb="" _label="PGP Encrypt"/>

                </submenu>

        <submenu name="Help" _label="_Help">
    
            <placeholder name="BuiltMenuItems"/>

                <menuitem name="HelpAbout" verb="" _label="_About..."/>

        </submenu>

        <submenu name="Debug" _label="_Debug" hidden="1">

            <menuitem name="DebugDumpXml" verb=""/>

        </submenu>

    </menu>

    <dockitem name="Toolbar" behavior="exclusive">

        <toolitem name="FileSend" verb=""  _tip="Send this message now"/>

        <toolitem name="FileAttach" verb=""/>

        <separator/>

    </dockitem>

</Root>













































8'>758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; fill-column: 160 -*- */
/* camelMimePart.c : Abstract class for a mime_part */

/* 
 * Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
 *      Michael Zucchi <notzed@ximian.com>
 *
 * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
 *
 * This program is free software; you can redistribute it and/or 
 * modify it under the terms of version 2 of the GNU General Public 
 * License as published by the Free Software Foundation.
 *
 * 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
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>

#include <gal/util/e-iconv.h>

#include "camel-mime-parser.h"
#include "camel-stream-mem.h"
#include "camel-stream-filter.h"
#include "camel-mime-filter-basic.h"
#include "camel-mime-filter-crlf.h"
#include "camel-mime-filter-charset.h"
#include "camel-mime-part.h"
#include "camel-mime-part-utils.h"
#include "camel-mime-utils.h"
#include "camel-exception.h"
#include "camel-charset-map.h"
#include "string-utils.h"

#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/

typedef enum {
    HEADER_UNKNOWN,
    HEADER_DESCRIPTION,
    HEADER_DISPOSITION,
    HEADER_CONTENT_ID,
    HEADER_ENCODING,
    HEADER_CONTENT_MD5,
    HEADER_CONTENT_LOCATION,
    HEADER_CONTENT_LANGUAGES,
    HEADER_CONTENT_TYPE
} CamelHeaderType;


static GHashTable *header_name_table;
static GHashTable *header_formatted_table;

static CamelMediumClass *parent_class=NULL;

/* Returns the class for a CamelMimePart */
#define CMP_CLASS(so) CAMEL_MIME_PART_CLASS (CAMEL_OBJECT_GET_CLASS(so))
#define CDW_CLASS(so) CAMEL_DATA_WRAPPER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
#define CMD_CLASS(so) CAMEL_MEDIUM_CLASS (CAMEL_OBJECT_GET_CLASS(so))

/* from CamelDataWrapper */
static int             write_to_stream                 (CamelDataWrapper *data_wrapper, CamelStream *stream);
static int         construct_from_stream           (CamelDataWrapper *dw, CamelStream *s);

/* from CamelMedia */ 
static void            add_header                      (CamelMedium *medium, const char *header_name, const void *header_value);
static void            set_header                      (CamelMedium *medium, const char *header_name, const void *header_value);
static void            remove_header                   (CamelMedium *medium, const char *header_name);
static const void     *get_header                      (CamelMedium *medium, const char *header_name);
static GArray         *get_headers                     (CamelMedium *medium);
static void            free_headers                    (CamelMedium *medium, GArray *headers);

static void            set_content_object              (CamelMedium *medium, CamelDataWrapper *content);

/* from camel mime parser */
static int             construct_from_parser           (CamelMimePart *, CamelMimeParser *);

/* forward references */
static void set_disposition (CamelMimePart *mime_part, const gchar *disposition);

/* format output of headers */
static int write_references(CamelStream *stream, struct _header_raw *h);
/*static int write_fold(CamelStream *stream, struct _header_raw *h);*/
static int write_raw(CamelStream *stream, struct _header_raw *h);


/* loads in a hash table the set of header names we */
/* recognize and associate them with a unique enum  */
/* identifier (see CamelHeaderType above)           */
static void
init_header_name_table()
{
    header_name_table = g_hash_table_new (g_strcase_hash, g_strcase_equal);
    g_hash_table_insert (header_name_table, "Content-Description", (gpointer)HEADER_DESCRIPTION);
    g_hash_table_insert (header_name_table, "Content-Disposition", (gpointer)HEADER_DISPOSITION);
    g_hash_table_insert (header_name_table, "Content-id", (gpointer)HEADER_CONTENT_ID);
    g_hash_table_insert (header_name_table, "Content-Transfer-Encoding", (gpointer)HEADER_ENCODING);
    g_hash_table_insert (header_name_table, "Content-MD5", (gpointer)HEADER_CONTENT_MD5);
    g_hash_table_insert (header_name_table, "Content-Location", (gpointer)HEADER_CONTENT_LOCATION);
    g_hash_table_insert (header_name_table, "Content-Type", (gpointer)HEADER_CONTENT_TYPE);

    header_formatted_table = g_hash_table_new(g_strcase_hash, g_strcase_equal);
    g_hash_table_insert(header_formatted_table, "Content-Type", write_raw);
    g_hash_table_insert(header_formatted_table, "Content-Disposition", write_raw);
    g_hash_table_insert(header_formatted_table, "To", write_raw);
    g_hash_table_insert(header_formatted_table, "From", write_raw);
    g_hash_table_insert(header_formatted_table, "Reply-To", write_raw);
    g_hash_table_insert(header_formatted_table, "Cc", write_raw);
    g_hash_table_insert(header_formatted_table, "Bcc", write_raw);
    g_hash_table_insert(header_formatted_table, "Message-ID", write_raw);
    g_hash_table_insert(header_formatted_table, "In-Reply-To", write_raw);
    g_hash_table_insert(header_formatted_table, "References", write_references);
}

static void
camel_mime_part_class_init (CamelMimePartClass *camel_mime_part_class)
{
    CamelMediumClass *camel_medium_class = CAMEL_MEDIUM_CLASS (camel_mime_part_class);
    CamelDataWrapperClass *camel_data_wrapper_class = CAMEL_DATA_WRAPPER_CLASS (camel_mime_part_class);

    parent_class = CAMEL_MEDIUM_CLASS (camel_type_get_global_classfuncs (camel_medium_get_type ()));
    init_header_name_table();

    camel_mime_part_class->construct_from_parser = construct_from_parser;
    
    /* virtual method overload */   
    camel_medium_class->add_header                = add_header;
    camel_medium_class->set_header                = set_header;
    camel_medium_class->get_header                = get_header;
    camel_medium_class->remove_header             = remove_header;
    camel_medium_class->get_headers               = get_headers;
    camel_medium_class->free_headers              = free_headers;
    camel_medium_class->set_content_object        = set_content_object;

    camel_data_wrapper_class->write_to_stream     = write_to_stream;
    camel_data_wrapper_class->construct_from_stream= construct_from_stream;
}

static void
camel_mime_part_init (gpointer   object,  gpointer   klass)
{
    CamelMimePart *camel_mime_part = CAMEL_MIME_PART (object);
    
    camel_mime_part->content_type         = header_content_type_new ("text", "plain");
    camel_mime_part->description          = NULL;
    camel_mime_part->disposition          = NULL;
    camel_mime_part->content_id           = NULL;
    camel_mime_part->content_MD5          = NULL;
    camel_mime_part->content_location     = NULL;
    camel_mime_part->content_languages    = NULL;
    camel_mime_part->encoding             = CAMEL_MIME_PART_ENCODING_DEFAULT;
}


static void