1 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */ 2 /* Balsa E-Mail Client 3 * Copyright (C) 1997-2013 Stuart Parmenter and others, 4 * See the file AUTHORS for a list. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 19 * 02111-1307, USA. 20 */ 21 22 #ifndef __BALSA_APP_H__ 23 #define __BALSA_APP_H__ 24 25 #ifndef BALSA_VERSION 26 # error "Include config.h before this file." 27 #endif 28 29 #include "libbalsa.h" 30 #include "identity.h" 31 #include "balsa-index.h" 32 #include "balsa-mblist.h" 33 #include "information-dialog.h" 34 #include "main-window.h" 35 36 /* misc.h for LibBalsaCodeset */ 37 #include "misc.h" 38 39 #if ENABLE_ESMTP 40 #include <libesmtp.h> /* part of libESMTP */ 41 #include <auth-client.h> /* part of libESMTP */ 42 #endif 43 44 /* Work around nonprivileged installs so we can find icons */ 45 #ifdef BALSA_LOCAL_INSTALL 46 #define gnome_pixmap_file( s ) g_strconcat( BALSA_RESOURCE_PREFIX, "/pixmaps/", s, NULL ) 47 #define gnome_unconditional_pixmap_file( s ) g_strconcat( BALSA_RESOURCE_PREFIX, "/pixmaps", s, NULL ) 48 #endif 49 50 /* global definitions */ 51 #define BALSA_BUTTON_HEIGHT 30 52 #define BALSA_BUTTON_WIDTH 70 53 54 #define MW_DEFAULT_WIDTH 640 55 #define MW_DEFAULT_HEIGHT 480 56 57 /* column width settings */ 58 #define NUM_DEFAULT_WIDTH 30 59 #define STATUS_DEFAULT_WIDTH 16 60 #define ATTACHMENT_DEFAULT_WIDTH 16 61 #define FROM_DEFAULT_WIDTH 128 62 #define SUBJECT_DEFAULT_WIDTH 180 63 #define DATE_DEFAULT_WIDTH 128 64 #define SIZE_DEFAULT_WIDTH 40 65 66 /* default width settings for the mailbox list columns, not fully utilized yet */ 67 #define MBNAME_DEFAULT_WIDTH 80 68 69 #define NEWMSGCOUNT_DEFAULT_WIDTH 20 70 #define TOTALMSGCOUNT_DEFAULT_WIDTH 25 71 #define INFO_FIELD_LENGTH 10 72 73 /* 74 * Default colour for quoted text 75 * oh no, I used the US spelling. 76 */ 77 #define MAX_QUOTED_COLOR 2 78 #define DEFAULT_QUOTED_COLOR "#055" 79 #define DEFAULT_QUOTE_REGEX "^[ \\t]*[|>:}#]" 80 81 #define DEFAULT_URL_COLOR "dark blue" 82 #define DEFAULT_BAD_ADDRESS_COLOR "red" 83 84 #define MAILBOX_MANAGER_WIDTH 350 85 #define MAILBOX_MANAGER_HEIGHT 400 86 87 #define MESSAGEBOX_WIDTH 450 88 #define MESSAGEBOX_HEIGHT 150 89 90 #define DEFAULT_MESSAGE_FONT "Monospace" 91 #define DEFAULT_SUBJECT_FONT "Monospace Bold" 92 #define DEFAULT_DATE_FORMAT "%x %X" 93 #define DEFAULT_PAPER_SIZE "A4" 94 #define DEFAULT_PRINT_HEADER_FONT "Monospace Regular 10" 95 #define DEFAULT_PRINT_BODY_FONT "Monospace Regular 10" 96 #define DEFAULT_PRINT_FOOTER_FONT "Sans Regular 8" 97 #define DEFAULT_SELECTED_HDRS "from to date cc subject" 98 #define DEFAULT_MESSAGE_TITLE_FORMAT "Message from %F: %s" 99 #define DEFAULT_ENCODING ENC8BIT 100 #define DEFAULT_LINESIZE 78 101 102 #define DEFAULT_CHECK_SIG FALSE 103 #define DEFAULT_CHECK_QUOTED FALSE 104 105 #define DEFAULT_BROKEN_CODESET "0" /* == west european */ 106 107 108 enum { 109 WHILERETR, 110 UNTILCLOSED, 111 NEVER 112 }; 113 114 115 typedef enum _ShownHeaders ShownHeaders; 116 enum _ShownHeaders { 117 HEADERS_NONE = 0, 118 HEADERS_SELECTED, 119 HEADERS_ALL 120 }; 121 122 123 typedef enum _BalsaMDNReply BalsaMDNReply; 124 enum _BalsaMDNReply { 125 BALSA_MDN_REPLY_NEVER = 0, 126 BALSA_MDN_REPLY_ASKME, 127 BALSA_MDN_REPLY_ALWAYS, 128 }; 129 130 typedef enum _MwActionAfterMove MwActionAfterMove; 131 enum _MwActionAfterMove { 132 NEXT_UNREAD, 133 NEXT, 134 CLOSE 135 }; 136 137 /* global balsa application structure */ 138 extern struct BalsaApplication { 139 /* personal information */ 140 GList* identities; 141 LibBalsaIdentity* current_ident; 142 143 GSList* filters; 144 145 gchar *local_mail_directory; 146 147 #if ENABLE_ESMTP 148 GSList *smtp_servers; 149 #endif 150 151 /* folder scanning */ 152 guint local_scan_depth; 153 guint imap_scan_depth; 154 155 BalsaWindow *main_window; 156 BalsaMBList *mblist; 157 GtkTreeStore *mblist_tree_store; 158 159 LibBalsaMailbox *inbox; 160 GList *inbox_input; /* mailboxes such as POP3, etc that will be appending into inbox */ 161 LibBalsaMailbox *sentbox; 162 LibBalsaMailbox *draftbox; 163 LibBalsaMailbox *outbox; 164 LibBalsaMailbox *trash; 165 166 BalsaMailboxNode *root_node; 167 168 /* timer for mm_exists callback */ 169 gint new_messages_timer; 170 gint new_messages; 171 172 /* timer for checking mail every xx minutes */ 173 gboolean check_mail_auto; 174 gint check_mail_timer; 175 gint check_mail_timer_id; 176 177 /* This can be configured from the gnome control panel */ 178 /* It's here just in case some other app also uses the same */ 179 /* system wide sound event and you want Balsa to behave differently */ 180 /* There is no prefs setting for this item */ 181 gint notify_new_mail_sound; 182 183 gint notify_new_mail_dialog; 184 gint notify_new_mail_icon; 185 186 /* automatically close mailboxes after XX minutes */ 187 gboolean close_mailbox_auto; 188 gint close_mailbox_timeout; /* seconds */ 189 190 /* automatically expunge mailboxes after XX hours */ 191 gboolean expunge_auto; 192 gint expunge_timeout; /* seconds */ 193 194 gint check_imap; 195 gint check_imap_inbox; 196 gint quiet_background_check; 197 gint msg_size_limit; /* for POP mailboxes; in kB */ 198 199 /* GUI settings */ 200 gint mw_width; 201 gint mw_height; 202 gboolean mw_maximized; 203 gint mblist_width; 204 gint sw_width; /* sendmsg window */ 205 gint sw_height; 206 gboolean sw_maximized; 207 gint message_window_width; 208 gint message_window_height; 209 gboolean message_window_maximized; 210 211 /* toolbars */ 212 int toolbar_wrap_button_text; 213 GSList *main_window_toolbar_current; 214 GSList *compose_window_toolbar_current; 215 GSList *message_window_toolbar_current; 216 217 /* file paths */ 218 gchar *attach_dir; 219 gchar *save_dir; 220 221 /* Column width settings */ 222 gint index_num_width; 223 gint index_status_width; 224 gint index_attachment_width; 225 gint index_from_width; 226 gint index_subject_width; 227 gint index_date_width; 228 gint index_size_width; 229 230 /*gint mblist_height; PKGW: unused */ 231 gint notebook_height; /* PKGW: used :-) */ 232 233 /* Column width settings for mailbox list window, not fully implemented yet */ 234 gint mblist_name_width; 235 gboolean mblist_show_mb_content_info; 236 gint mblist_newmsg_width; 237 gint mblist_totalmsg_width; 238 239 /* Colour of quoted text. */ 240 gboolean mark_quoted; 241 gchar *quote_regex; 242 GdkRGBA quoted_color[MAX_QUOTED_COLOR]; 243 244 /* text color of URL's */ 245 GdkRGBA url_color; 246 247 guint pwindow_option; 248 gboolean wordwrap; 249 gint wraplength; 250 gboolean browse_wrap; 251 gint browse_wrap_length; 252 ShownHeaders shown_headers; 253 gboolean show_all_headers; 254 gchar *selected_headers; 255 gboolean expand_tree; 256 gboolean show_mblist; 257 gboolean show_notebook_tabs; 258 enum { LAYOUT_DEFAULT, LAYOUT_WIDE_MSG, LAYOUT_WIDE_SCREEN } layout_type; 259 gboolean view_message_on_open; 260 gboolean ask_before_select; 261 gboolean pgdownmod; 262 gint pgdown_percent; 263 #if defined(ENABLE_TOUCH_UI) 264 gboolean do_file_format_check; /* do file format check on attaching */ 265 gboolean enable_view_filter; /* enable quick view filter */ 266 #endif 267 268 /* Show toolbars, status bar, and subject-or-sender search bar */ 269 gboolean show_main_toolbar; 270 gboolean show_message_toolbar; 271 gboolean show_compose_toolbar; 272 gboolean show_statusbar; 273 gboolean show_sos_bar; 274 275 gboolean empty_trash_on_exit; 276 gboolean previewpane; 277 gboolean debug; 278 279 /* Source viewer */ 280 gboolean source_escape_specials; 281 gint source_width; 282 gint source_height; 283 284 /* MRU mailbox tree */ 285 gint mru_tree_width; 286 gint mru_tree_height; 287 288 /* what to do with message window after moving the message */ 289 MwActionAfterMove mw_action_after_move; 290 291 /* external editor */ 292 gboolean edit_headers; 293 294 /* arp --- string to prefix "replied to" messages. */ 295 gchar *quote_str; 296 297 /* reply/forward: automatically quote original when replying */ 298 gboolean autoquote; 299 300 /* reply/forward: don't include text/html parts */ 301 gboolean reply_strip_html; 302 303 /* forward attached by default */ 304 gboolean forward_attached; 305 306 /* command line options */ 307 gint open_inbox_upon_startup; 308 gint check_mail_upon_startup; 309 gint remember_open_mboxes; 310 gint open_unread_mailbox; 311 312 /* list of currently open mailboxes */ 313 GList *open_mailbox_list; /* data is a pointer to the mailbox */ 314 gchar *current_mailbox_url;/* remember for next session */ 315 316 /* font used to display messages */ 317 gchar *message_font; 318 gchar *subject_font; 319 320 /* encoding stuff */ 321 gchar *date_string; 322 323 /* printing */ 324 GtkPageSetup *page_setup; 325 GtkPrintSettings *print_settings; 326 gdouble margin_left; 327 gdouble margin_top; 328 gdouble margin_right; 329 gdouble margin_bottom; 330 gchar* print_header_font; /* font for printing headers */ 331 gchar* print_body_font; /* font for printing text parts */ 332 gchar* print_footer_font; /* font for printing footers */ 333 gboolean print_highlight_cited; 334 gboolean print_highlight_phrases; 335 336 /* compose */ 337 gchar *compose_headers; 338 gboolean always_queue_sent_mail; 339 gboolean copy_to_sentbox; 340 341 /* mailbox indices */ 342 GtkWidget *notebook; 343 344 /* address book */ 345 GList *address_book_list; 346 LibBalsaAddressBook *default_address_book; 347 348 /* spell checking */ 349 #if HAVE_GTKSPELL 350 gchar *spell_check_lang; 351 gboolean spell_check_active; 352 #else /* HAVE_GTKSPELL */ 353 gboolean check_sig; 354 gboolean check_quoted; 355 #endif /* HAVE_GTKSPELL */ 356 357 /* Information messages */ 358 BalsaInformationShow information_message; 359 BalsaInformationShow warning_message; 360 BalsaInformationShow error_message; 361 BalsaInformationShow debug_message; 362 BalsaInformationShow fatal_message; 363 364 /* how to act if a MDN request is received */ 365 BalsaMDNReply mdn_reply_clean; 366 BalsaMDNReply mdn_reply_notclean; 367 368 /* how to handle multipart/alternative */ 369 gboolean display_alt_plain; 370 371 /* how to handle broken mails with 8-bit chars */ 372 gboolean convert_unknown_8bit; 373 LibBalsaCodeset convert_unknown_8bit_codeset; 374 375 #ifdef HAVE_GPGME 376 /* gpgme stuff */ 377 gboolean has_openpgp; 378 gboolean has_smime; 379 #endif 380 381 /* Most recently used lists */ 382 GList *folder_mru; 383 GList *fcc_mru; 384 GList *pipe_cmds; 385 386 gboolean expunge_on_close; 387 388 /* use as default email client for GNOME */ 389 int default_client; 390 } balsa_app; 391 392 #define BALSA_IS_MAILBOX_SPECIAL(a) ((a)==balsa_app.inbox || (a)==balsa_app.trash || (a)==balsa_app.outbox||(a)==balsa_app.draftbox || (a)==balsa_app.sentbox) 393 394 void balsa_app_init(void); 395 void balsa_app_destroy(void); 396 void update_timer(gboolean update, guint minutes); 397 398 gchar *ask_password(LibBalsaServer * server, LibBalsaMailbox * mbox); 399 GtkWidget *balsa_stock_button_with_label(const char *icon, 400 const char *label); 401 void balsa_open_mailbox_list(gchar ** urls); 402 403 /* Search functions */ 404 BalsaMailboxNode *balsa_find_mailbox(LibBalsaMailbox * mailbox); 405 BalsaMailboxNode *balsa_find_dir(LibBalsaServer *server, const gchar * path); 406 BalsaMailboxNode *balsa_find_url(const gchar * url); 407 LibBalsaMailbox *balsa_find_mailbox_by_url(const gchar * url); 408 LibBalsaMailbox *balsa_find_sentbox_by_url(const gchar * url); 409 void balsa_add_open_mailbox_urls(GPtrArray * url_array); 410 411 /** Returns a short mailbox name that identifies the host. This is 412 longer than LibBalsaMailbox::name which contains only filename 413 without information about mailbox's location in the hierarchy. */ 414 gchar *balsa_get_short_mailbox_name(const gchar * url); 415 gboolean balsa_find_iter_by_data(GtkTreeIter * iter, gpointer data); 416 BalsaIndex* balsa_find_index_by_mailbox(LibBalsaMailbox* mailbox); 417 418 void balsa_remove_children_mailbox_nodes(BalsaMailboxNode * mbnode); 419 420 #if USE_GREGEX 421 GRegex *balsa_quote_regex_new(void); 422 #endif /* USE_GREGEX */ 423 424 #endif /* __BALSA_APP_H__ */ 425