compose.h (7408B)
1 /* 2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client 3 * Copyright (C) 1999-2021 the Claws Mail team and 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 3 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, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef __COMPOSE_H__ 21 #define __COMPOSE_H__ 22 23 typedef struct _Compose Compose; 24 typedef struct _AttachInfo AttachInfo; 25 26 #include <glib.h> 27 #include <gtk/gtk.h> 28 29 #include "procmsg.h" 30 #include "procmime.h" 31 #include "prefs_account.h" 32 #include "undo.h" 33 #include "toolbar.h" 34 #include "codeconv.h" 35 #include "viewtypes.h" 36 #include "folder.h" 37 38 #define COMPOSE_CHECK_BEFORE_SEND_HOOKLIST "compose_check_before_send" 39 #define COMPOSE_CREATED_HOOKLIST "compose_created" 40 41 typedef enum 42 { 43 COMPOSE_TO, 44 COMPOSE_CC, 45 COMPOSE_BCC, 46 COMPOSE_REPLYTO, 47 COMPOSE_FOLLOWUPTO, 48 COMPOSE_INREPLYTO 49 } ComposeEntryType; 50 51 typedef enum 52 { 53 COMPOSE_REPLY, 54 COMPOSE_REPLY_WITH_QUOTE, 55 COMPOSE_REPLY_WITHOUT_QUOTE, 56 COMPOSE_REPLY_TO_SENDER, 57 COMPOSE_REPLY_TO_ADDRESS, 58 COMPOSE_FOLLOWUP_AND_REPLY_TO, 59 COMPOSE_REPLY_TO_SENDER_WITH_QUOTE, 60 COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE, 61 COMPOSE_REPLY_TO_ALL, 62 COMPOSE_REPLY_TO_ALL_WITH_QUOTE, 63 COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE, 64 COMPOSE_REPLY_TO_LIST, 65 COMPOSE_REPLY_TO_LIST_WITH_QUOTE, 66 COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE, 67 COMPOSE_FORWARD, 68 COMPOSE_FORWARD_AS_ATTACH, 69 COMPOSE_FORWARD_INLINE, 70 COMPOSE_NEW, 71 COMPOSE_REDIRECT, 72 COMPOSE_REEDIT 73 } ComposeMode; 74 75 typedef enum 76 { 77 COMPOSE_QUEUE_SUCCESS = 0, 78 COMPOSE_QUEUE_ERROR_NO_MSG = -1, 79 COMPOSE_QUEUE_ERROR_WITH_ERRNO = -2, 80 COMPOSE_QUEUE_ERROR_SIGNING_FAILED = -3, 81 COMPOSE_QUEUE_ERROR_ENCRYPT_FAILED = -4, 82 COMPOSE_QUEUE_ERROR_CHAR_CONVERSION = -5, 83 COMPOSE_QUEUE_ERROR_NO_ENCRYPTION_KEY = -6, 84 COMPOSE_QUEUE_SIGNING_CANCELLED = -7 85 } ComposeQueueResult; 86 87 typedef enum { 88 PREF_ACCOUNT, 89 PREF_FOLDER, 90 PREF_TEMPLATE, 91 PREF_ML, 92 PREF_MAILTO, 93 PREF_NONE 94 } ComposePrefType; 95 96 typedef struct { 97 guint headernum; 98 Compose *compose; 99 GtkWidget *combo; 100 GtkWidget *entry; 101 GtkWidget *button; 102 GtkWidget *hbox; 103 ComposePrefType type; 104 } ComposeHeaderEntry; 105 106 struct _Compose 107 { 108 /* start with window widget don`t change order */ 109 GtkWidget *window; 110 GtkWidget *vbox; 111 GtkWidget *menubar; 112 113 /* Toolbar handlebox */ 114 GtkWidget *handlebox; 115 Toolbar *toolbar; 116 117 GtkWidget *vbox2; 118 119 /* Header */ 120 GtkWidget *table_vbox; 121 GtkWidget *table; 122 GtkWidget *account_combo; 123 GtkWidget *subject_entry; 124 GtkWidget *paned; 125 126 /* Attachments */ 127 GtkWidget *attach_scrwin; 128 GtkWidget *attach_clist; 129 GtkWidget *attach_label; 130 131 /* Others */ 132 GtkWidget *savemsg_checkbtn; 133 GtkWidget *savemsg_combo; 134 135 /* Headers notebook */ 136 GtkWidget *notebook; 137 138 /* Textedit */ 139 GtkWidget *edit_vbox; 140 GtkWidget *scrolledwin; 141 GtkWidget *text; 142 GtkWidget *from_name; 143 144 GtkWidget *focused_editable; 145 146 GtkWidget *popupmenu; 147 148 GtkWidget *tmpl_menu; 149 150 ComposeMode mode; 151 152 MsgInfo *targetinfo; 153 MsgInfo *replyinfo; 154 MsgInfo *autosaved_draft; 155 MsgInfo *fwdinfo; 156 157 GtkWidget *header_table; 158 GSList *header_list; 159 guint header_nextrow; 160 ComposeHeaderEntry *header_last; 161 162 GHashTable *email_hashtable; 163 164 gchar *replyto; 165 gchar *cc; 166 gchar *bcc; 167 gchar *followup_to; 168 169 gchar *ml_post; 170 171 gchar *inreplyto; 172 gchar *references; 173 gchar *msgid; 174 gchar *boundary; 175 176 gboolean autowrap; 177 gboolean autoindent; 178 179 gboolean use_to; 180 gboolean use_cc; 181 gboolean use_bcc; 182 gboolean use_replyto; 183 gboolean use_followupto; 184 gboolean use_attach; 185 186 CharSet out_encoding; 187 188 /* privacy settings */ 189 gchar *encdata; 190 191 gboolean modified; 192 193 gboolean sending; 194 195 gboolean batch; 196 197 GSList *to_list; 198 199 PrefsAccount *account; 200 FolderItem *folder; 201 202 UndoMain *undostruct; 203 204 gchar *sig_str; 205 gboolean sig_inserted; 206 207 /* external editor */ 208 gchar *exteditor_file; 209 GPid exteditor_pid; 210 gint exteditor_tag; 211 GtkWidget *exteditor_socket; 212 213 gchar *redirect_filename; 214 215 gboolean remove_references; 216 217 gint64 draft_timeout_tag; 218 219 GtkTextTag *no_wrap_tag; 220 GtkTextTag *no_join_tag; 221 GtkTextTag *signature_tag; 222 GtkTextTag *quote0_tag; 223 GtkTextTag *quote1_tag; 224 GtkTextTag *quote2_tag; 225 GtkTextTag *uri_tag; 226 227 gboolean automatic_break; 228 GMutex mutex; 229 gint close_timeout_tag; 230 gchar *orig_charset; 231 gint set_cursor_pos; 232 233 gboolean updating; 234 gboolean deferred_destroy; 235 ComposeMode rmode; 236 GtkWidget *first_combo; 237 GtkWidget *first_entry; 238 239 GtkUIManager *ui_manager; 240 241 gint folder_update_callback_id; 242 }; 243 244 struct _AttachInfo 245 { 246 gchar *file; 247 gchar *content_type; 248 EncodingType encoding; 249 gchar *name; 250 goffset size; 251 gchar *charset; 252 gboolean insert; 253 }; 254 255 typedef enum 256 { 257 COMPOSE_QUIT_EDITING, 258 COMPOSE_KEEP_EDITING, 259 COMPOSE_AUTO_SAVE, 260 COMPOSE_DRAFT_FOR_EXIT 261 } ComposeDraftAction; 262 263 /*#warning FIXME_GTK2 */ 264 /* attach_files will be locale encode */ 265 Compose *compose_new (PrefsAccount *account, 266 const gchar *mailto, 267 GList *attach_files); 268 269 Compose *compose_new_with_folderitem (PrefsAccount *account, 270 FolderItem *item, 271 const gchar *mailto); 272 273 Compose *compose_new_with_list (PrefsAccount *account, 274 GList *listAddress); 275 276 Compose *compose_forward (PrefsAccount *account, 277 MsgInfo *msginfo, 278 gboolean as_attach, 279 const gchar *body, 280 gboolean no_extedit, 281 gboolean batch); 282 283 Compose *compose_redirect (PrefsAccount *account, 284 MsgInfo *msginfo, 285 gboolean batch); 286 Compose *compose_reedit (MsgInfo *msginfo, 287 gboolean batch); 288 289 const GList *compose_get_compose_list (void); 290 291 void compose_entry_append (Compose *compose, 292 const gchar *address, 293 ComposeEntryType type, 294 ComposePrefType pref_type); 295 296 297 gint compose_send (Compose *compose); 298 299 void compose_update_actions_menu (Compose *compose); 300 void compose_reflect_prefs_pixmap_theme (void); 301 302 void compose_destroy_all (void); 303 gboolean compose_draft (gpointer data, guint action); 304 void compose_toolbar_cb (gint action, 305 gpointer data); 306 void compose_reply_to_address (MessageView *msgview, 307 MsgInfo *msginfo, 308 const gchar *address); 309 void compose_reply_from_messageview (MessageView *msgview, 310 GSList *msginfo_list, 311 guint action); 312 void compose_action_cb (void *data); 313 314 void compose_set_position (Compose *compose, 315 gint pos); 316 gboolean compose_search_string (Compose *compose, 317 const gchar *str, 318 gboolean case_sens); 319 gboolean compose_search_string_backward (Compose *compose, 320 const gchar *str, 321 gboolean case_sens); 322 ComposeQueueResult compose_queue (Compose *compose, 323 gint *msgnum, 324 FolderItem **item, 325 gchar **msgpath, 326 gboolean remove_reedit_target); 327 gboolean compose_close (Compose *compose); 328 void compose_close_toolbar (Compose *compose); 329 void compose_clear_exit_drafts (void); 330 void compose_reopen_exit_drafts (void); 331 void compose_attach_from_list (Compose *compose, GList *file_list, gboolean free_data); 332 333 #endif /* __COMPOSE_H__ */