more revision of filtering system
[claws.git] / src / compose.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2001 Hiroyuki Yamamoto
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __COMPOSE_H__
21 #define __COMPOSE_H__
22
23 #include <glib.h>
24 #include <gtk/gtkwidget.h>
25 #include <gtk/gtkitemfactory.h>
26
27 typedef struct _Compose         Compose;
28 typedef struct _AttachInfo      AttachInfo;
29
30 #include "procmsg.h"
31 #include "procmime.h"
32 #include "addressbook.h"
33 #include "prefs_account.h"
34 #include "undo.h"
35
36 #ifdef USE_PSPELL
37 #include "gtkspell.h"
38 #endif
39
40 typedef enum
41 {
42         COMPOSE_TO,
43         COMPOSE_CC,
44         COMPOSE_BCC,
45         COMPOSE_REPLYTO,
46         COMPOSE_NEWSGROUPS,
47         COMPOSE_FOLLOWUPTO
48 } ComposeEntryType;
49
50 typedef enum
51 {
52         COMPOSE_REPLY,
53         COMPOSE_REPLY_WITH_QUOTE,
54         COMPOSE_REPLY_WITHOUT_QUOTE,
55         COMPOSE_REPLY_TO_SENDER,
56         COMPOSE_FOLLOWUP_AND_REPLY_TO,
57         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
58         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
59         COMPOSE_REPLY_TO_ALL,
60         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
61         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
62         COMPOSE_FORWARD,
63         COMPOSE_FORWARD_AS_ATTACH,
64         COMPOSE_BOUNCE,
65         COMPOSE_NEW,
66         COMPOSE_REEDIT
67 } ComposeMode;
68
69 typedef struct {
70         guint headernum;
71         Compose *compose;
72         GtkWidget *combo;
73         GtkWidget *entry;
74 } ComposeHeaderEntry;
75
76 struct _Compose
77 {
78         GtkWidget *window;
79         GtkWidget *vbox;
80         GtkWidget *menubar;
81
82         GtkWidget *handlebox;
83         GtkWidget *toolbar;
84         GtkWidget *send_btn;
85         GtkWidget *sendl_btn;
86         GtkWidget *draft_btn;
87         GtkWidget *insert_btn;
88         GtkWidget *attach_btn;
89         GtkWidget *sig_btn;
90         GtkWidget *exteditor_btn;
91         GtkWidget *linewrap_btn;
92         GtkWidget *addrbook_btn;
93
94         GtkWidget *vbox2;
95
96         /* Header */
97         GtkWidget *table_vbox;
98         GtkWidget *table;
99 /*
100         GtkWidget *to_hbox;
101         GtkWidget *to_entry;
102         GtkWidget *newsgroups_hbox;
103         GtkWidget *newsgroups_entry;
104 */
105         GtkWidget *subject_entry;
106 /*
107         GtkWidget *cc_hbox;
108         GtkWidget *cc_entry;
109         GtkWidget *bcc_hbox;
110         GtkWidget *bcc_entry;
111         GtkWidget *reply_hbox;
112         GtkWidget *reply_entry;
113         GtkWidget *followup_hbox;
114         GtkWidget *followup_entry;
115 */
116         GtkWidget *paned;
117
118         /* Attachments */
119         GtkWidget *attach_scrwin;
120         GtkWidget *attach_clist;
121
122         /* Others */
123         GtkWidget *savemsg_checkbtn;
124         GtkWidget *savemsg_entry;
125
126         /* Textedit */
127         GtkWidget *edit_vbox;
128         GtkWidget *ruler_hbox;
129         GtkWidget *ruler;
130         GtkWidget *scrolledwin;
131         GtkWidget *text;
132
133         GtkWidget *focused_editable;
134
135         GtkWidget *popupmenu;
136
137         GtkItemFactory *popupfactory;
138
139         GtkWidget *tmpl_menu;
140
141         ComposeMode mode;
142
143         MsgInfo *targetinfo;
144         MsgInfo *replyinfo;
145
146         GtkWidget *header_table;
147         GSList    *header_list;
148         guint      header_nextrow;
149         ComposeHeaderEntry *header_last;
150
151         gchar   *replyto;
152         gchar   *cc;
153         gchar   *bcc;
154         gchar   *newsgroups;
155         gchar   *followup_to;
156         gchar   *mailinglist;
157
158         gchar   *inreplyto;
159         gchar   *references;
160         gchar   *msgid;
161         gchar   *boundary;
162
163         gboolean use_to;
164         gboolean use_cc;
165         gboolean use_bcc;
166         gboolean use_replyto;
167         gboolean use_followupto;
168         gboolean use_mailinglist;
169         gboolean use_attach;
170
171         /* privacy settings */
172         gboolean use_signing;
173         gboolean use_encryption;
174
175         gboolean modified;
176
177         gboolean return_receipt;
178
179         GSList *to_list;
180         GSList *newsgroup_list;
181
182         PrefsAccount *account;
183         PrefsAccount *orig_account;
184
185         /* external editor */
186         gchar *exteditor_file;
187         pid_t  exteditor_pid;
188         gint   exteditor_readdes;
189         gint   exteditor_tag;
190
191         UndoMain *undostruct;
192
193 #if USE_PSPELL
194         /* Pspell spell checker */
195         GtkPspell *gtkpspell;
196 #endif
197
198         gchar *bounce_filename;
199 };
200
201 struct _AttachInfo
202 {
203         gchar *file;
204         gchar *content_type;
205         EncodingType encoding;
206         gchar *name;
207         off_t size;
208 };
209
210 Compose *compose_new                    (PrefsAccount   *account);
211
212 Compose *compose_new_with_recipient     (PrefsAccount   *account,
213                                          const gchar    *to);
214
215 Compose *compose_new_with_folderitem    (PrefsAccount   *account,
216                                          FolderItem     *item);
217
218 void compose_followup_and_reply_to      (MsgInfo        *msginfo,
219                                          gboolean        quote,
220                                          gboolean        to_all,
221                                          gboolean        ignore_replyto);
222 void compose_reply                      (MsgInfo        *msginfo,
223                                          gboolean        quote,
224                                          gboolean        to_all,
225                                          gboolean        ignore_replyto);
226 Compose *compose_forward                (PrefsAccount *account,
227                                          MsgInfo        *msginfo,
228                                          gboolean        as_attach);
229 Compose *compose_forward_multiple       (PrefsAccount   *account, 
230                                          GSList         *msginfo_list);
231 Compose *compose_bounce                 (PrefsAccount   *account,
232                                          MsgInfo        *msginfo);
233 void compose_reedit                     (MsgInfo        *msginfo);
234
235 GList *compose_get_compose_list         (void);
236
237 void compose_entry_append               (Compose          *compose,
238                                          const gchar      *address,
239                                          ComposeEntryType  type);
240
241 gint compose_send                       (Compose          *compose);
242
243 void compose_reflect_prefs_all          (void);
244
245 #endif /* __COMPOSE_H__ */