97ad717713a08db7c9a6124eff0817847fd91ba5
[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
35 typedef enum
36 {
37         COMPOSE_TO,
38         COMPOSE_CC,
39         COMPOSE_BCC,
40         COMPOSE_REPLYTO,
41         COMPOSE_NEWSGROUPS,
42         COMPOSE_FOLLOWUPTO
43 } ComposeEntryType;
44
45 typedef enum
46 {
47         COMPOSE_REPLY,
48         COMPOSE_REPLY_WITH_QUOTE,
49         COMPOSE_REPLY_WITHOUT_QUOTE,
50         COMPOSE_REPLY_TO_SENDER,
51         COMPOSE_FOLLOWUP_AND_REPLY_TO,
52         COMPOSE_REPLY_TO_SENDER_WITH_QUOTE,
53         COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE,
54         COMPOSE_REPLY_TO_ALL,
55         COMPOSE_REPLY_TO_ALL_WITH_QUOTE,
56         COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE,
57         COMPOSE_FORWARD,
58         COMPOSE_FORWARD_AS_ATTACH,
59         COMPOSE_NEW,
60         COMPOSE_REEDIT
61 } ComposeMode;
62
63 typedef struct {
64         guint headernum;
65         Compose *compose;
66         GtkWidget *combo;
67         GtkWidget *entry;
68 } compose_headerentry;
69
70 struct _Compose
71 {
72         GtkWidget *window;
73         GtkWidget *vbox;
74         GtkWidget *menubar;
75
76         GtkWidget *handlebox;
77         GtkWidget *toolbar;
78         GtkWidget *send_btn;
79         GtkWidget *sendl_btn;
80         GtkWidget *draft_btn;
81         GtkWidget *insert_btn;
82         GtkWidget *attach_btn;
83         GtkWidget *sig_btn;
84         GtkWidget *exteditor_btn;
85         GtkWidget *linewrap_btn;
86         GtkWidget *addrbook_btn;
87
88         GtkWidget *vbox2;
89
90         GtkWidget *table_vbox;
91         GtkWidget *table;
92 /*
93         GtkWidget *to_hbox;
94         GtkWidget *to_entry;
95         GtkWidget *newsgroups_hbox;
96         GtkWidget *newsgroups_entry;
97 */
98         GtkWidget *subject_entry;
99 /*
100         GtkWidget *cc_hbox;
101         GtkWidget *cc_entry;
102         GtkWidget *bcc_hbox;
103         GtkWidget *bcc_entry;
104         GtkWidget *reply_hbox;
105         GtkWidget *reply_entry;
106         GtkWidget *followup_hbox;
107         GtkWidget *followup_entry;
108 */
109         GtkWidget *paned;
110
111         GtkWidget *attach_scrwin;
112         GtkWidget *attach_clist;
113
114         GtkWidget *edit_vbox;
115         GtkWidget *ruler_hbox;
116         GtkWidget *ruler;
117         GtkWidget *scrolledwin;
118         GtkWidget *text;
119
120         GtkWidget *focused_editable;
121
122         GtkWidget *popupmenu;
123
124         GtkItemFactory *popupfactory;
125
126         ComposeMode mode;
127
128         MsgInfo *targetinfo;
129         MsgInfo *replyinfo;
130
131         GtkWidget *header_table;
132         GSList *header_list;
133         guint header_nextrow;
134         compose_headerentry *header_last;
135
136         gchar   *replyto;
137         gchar   *cc;
138         gchar   *bcc;
139         gchar   *newsgroups;
140         gchar   *followup_to;
141
142         gchar   *inreplyto;
143         gchar   *references;
144         gchar   *msgid;
145         gchar   *boundary;
146
147         gboolean use_to;
148         gboolean use_cc;
149         gboolean use_bcc;
150         gboolean use_replyto;
151         gboolean use_followupto;
152         gboolean use_attach;
153
154         /* privacy settings */
155         gboolean use_signing;
156         gboolean use_encryption;
157
158         gboolean modified;
159
160         gboolean return_receipt;
161
162         GSList *to_list;
163         GSList *newsgroup_list;
164
165         PrefsAccount *account;
166         PrefsAccount *orig_account;
167
168         /* external editor */
169         gchar *exteditor_file;
170         pid_t  exteditor_pid;
171         gint   exteditor_readdes;
172         gint   exteditor_tag;
173 };
174
175 struct _AttachInfo
176 {
177         gchar *file;
178         gchar *content_type;
179         EncodingType encoding;
180         gchar *name;
181         off_t size;
182 };
183
184 Compose * compose_new           (PrefsAccount   *account);
185
186 Compose * compose_new_with_recipient    (PrefsAccount   *account,
187                                          const gchar    *to);
188
189 Compose * compose_new_with_folderitem   (PrefsAccount   *account,
190                                          FolderItem     *item);
191
192 void compose_followup_and_reply_to (MsgInfo     *msginfo,
193                                     gboolean     quote,
194                                     gboolean     to_all,
195                                     gboolean     ignore_replyto);
196 void compose_reply              (MsgInfo        *msginfo,
197                                  gboolean        quote,
198                                  gboolean        to_all,
199                                  gboolean        ignore_replyto);
200 Compose * compose_forward       (PrefsAccount *account,
201                                  MsgInfo        *msginfo,
202                                  gboolean        as_attach);
203 Compose * compose_forward_multiple(PrefsAccount * account, 
204                           GSList *msginfo_list);
205                           
206 void compose_reedit             (MsgInfo        *msginfo);
207
208 GList *compose_get_compose_list (void);
209
210 void compose_entry_append       (Compose          *compose,
211                                  const gchar      *address,
212                                  ComposeEntryType  type);
213 gint compose_send(Compose *compose);
214
215 #endif /* __COMPOSE_H__ */