2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
4 * Copyright (C) 2004 g10 Code GmbH
6 * This file is part of mutt-ng, see http://www.muttng.org/.
7 * It's licensed under the GNU General Public License,
8 * please see the file GPL in the top level source directory.
22 #ifndef _POSIX_PATH_MAX
23 #include <posix1_lim.h>
26 #include <lib-lib/buffer.h>
27 #include <lib-lib/hash.h>
28 #include <lib-lib/list.h>
29 #include <lib-lib/rx.h>
31 #include <lib-mime/mime.h>
33 #define MUTT_VERSION (VERSION)
35 /* nifty trick I stole from ELM 2.5alpha. */
38 #define INITVAL(x) = x
45 int ch; /* raw key pressed */
46 int op; /* function op */
49 /* flags for mutt_FormatString() */
51 M_FORMAT_FORCESUBJ = (1 << 0), /* print the subject even if unchanged */
52 M_FORMAT_TREE = (1 << 1), /* draw the thread tree */
53 M_FORMAT_MAKEPRINT = (1 << 2), /* make sure that all chars are printable */
54 M_FORMAT_OPTIONAL = (1 << 3),
55 M_FORMAT_STAT_FILE = (1 << 4), /* used by mutt_attach_fmt */
56 M_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */
57 M_FORMAT_INDEX = (1 << 6) /* this is a main index entry */
60 /* types for mutt_add_hook() */
61 #define M_FOLDERHOOK 1
62 #define M_MBOXHOOK (1<<1)
63 #define M_SENDHOOK (1<<2)
64 #define M_FCCHOOK (1<<3)
65 #define M_SAVEHOOK (1<<4)
66 #define M_CHARSETHOOK (1<<5)
67 #define M_ICONVHOOK (1<<6)
68 #define M_MESSAGEHOOK (1<<7)
69 #define M_CRYPTHOOK (1<<8)
70 #define M_ACCOUNTHOOK (1<<9)
71 #define M_REPLYHOOK (1<<10)
72 #define M_SEND2HOOK (1<<11)
74 #define M_OPENHOOK (1<<12)
75 #define M_APPENDHOOK (1<<13)
76 #define M_CLOSEHOOK (1<<14)
78 /* tree characters for linearize_tree and print_enriched_string */
79 #define M_TREE_LLCORNER 1
80 #define M_TREE_ULCORNER 2
82 #define M_TREE_HLINE 4
83 #define M_TREE_VLINE 5
84 #define M_TREE_SPACE 6
85 #define M_TREE_RARROW 7
87 #define M_TREE_HIDDEN 9
88 #define M_TREE_EQUALS 10
89 #define M_TREE_TTEE 11
90 #define M_TREE_BTEE 12
91 #define M_TREE_MISSING 13
94 #define M_THREAD_COLLAPSE (1<<0)
95 #define M_THREAD_UNCOLLAPSE (1<<1)
96 #define M_THREAD_GET_HIDDEN (1<<2)
97 #define M_THREAD_UNREAD (1<<3)
98 #define M_THREAD_NEXT_UNREAD (1<<4)
101 /* modes for mutt_view_attachment() */
106 /* action codes used by mutt_set_flag() and mutt_pattern_function() */
126 /* actions for mutt_pattern_comp/mutt_pattern_exec */
166 /* Options for Mailcap lookup */
172 /* options for socket code */
178 /* Options for mutt_save_attachment */
183 /* possible arguments to set_quadoption() */
191 /* quad-option vars */
205 OPT_PGPMIMEAUTO, /* ask to revert to PGP/MIME when inline fails */
213 #if defined(USE_SSL) || defined(USE_GNUTLS)
217 OPT_VERIFYSIG, /* verify PGP signatures */
223 OPT_FOLLOWUPTOPOSTER,
224 #endif /* USE_NNTP */
226 /* THIS MUST BE THE LAST VALUE. */
230 /* flags to ci_send_message() */
231 #define SENDREPLY (1<<0)
232 #define SENDGROUPREPLY (1<<1)
233 #define SENDLISTREPLY (1<<2)
234 #define SENDFORWARD (1<<3)
235 #define SENDPOSTPONED (1<<4)
236 #define SENDBATCH (1<<5)
237 #define SENDKEY (1<<6)
238 #define SENDRESEND (1<<7)
239 #define SENDNEWS (1<<8)
241 /* flags to _mutt_select_file() */
242 #define M_SEL_BUFFY (1<<0)
243 #define M_SEL_MULTI (1<<1)
244 #define M_SEL_FOLDER (1<<2)
246 /* flags for parse_spam_list */
291 #endif /* HAVE_QDBM */
299 OPTHIDETHREADSUBJECT,
302 OPTIGNORELISTREPLYTO,
303 OPTIMAPCHECKSUBSCRIBED,
308 #if defined(USE_SSL) || defined(USE_GNUTLS)
312 # endif /* !USE_GNUTLS */
316 #endif /* USE_SSL || USE_GNUTLS */
325 OPTMENUSCROLL, /* scroll menu instead of implicit next-page */
327 OPTMETAKEY, /* interpret ALT-x as ESC-x */
332 OPTMIMESUBJECT, /* encode subject line with RFC2047 */
379 #ifdef HAVE_GETADDRINFO
386 OPTWRITEBCC, /* write out a bcc header? */
388 OPTXMAILTO, /* 1 if $edit_header is forcebly set */
399 OPTCRYPTREPLYENCRYPT,
401 OPTCRYPTREPLYSIGNENCRYPTED,
405 OPTSDEFAULTDECRYPTKEY,
428 #endif /* USE_NNTP */
432 OPTAUXSORT, /* (pseudo) using auxillary sort function */
433 OPTFORCEREFRESH, /* (pseudo) refresh even during macros */
434 OPTLOCALES, /* (pseudo) set if user has valid locale definition */
435 OPTNOCURSES, /* (pseudo) when sending in batch mode */
436 OPTNEEDREDRAW, /* (pseudo) to notify caller of a submenu */
437 OPTSEARCHREVERSE, /* (pseudo) used by ci_search_command */
438 OPTMSGERR, /* (pseudo) used by mutt_error/mutt_message */
439 OPTSEARCHINVALID, /* (pseudo) used to invalidate the search pat */
440 OPTSIGNALSBLOCKED, /* (pseudo) using by mutt_block_signals () */
441 OPTSYSSIGNALSBLOCKED, /* (pseudo) using by mutt_block_signals_system () */
442 OPTNEEDRESORT, /* (pseudo) used to force a re-sort */
443 OPTRESORTINIT, /* (pseudo) used to force the next resort to be from scratch */
444 OPTVIEWATTACH, /* (pseudo) signals that we are viewing attachments */
445 OPTFORCEREDRAWINDEX, /* (pseudo) used to force a redraw in the main index */
446 OPTFORCEREDRAWPAGER, /* (pseudo) used to force a redraw in the pager */
447 OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
448 OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
449 OPTATTACHMSG, /* (pseudo) used by attach-message */
450 OPTHIDEREAD, /* (pseudo) whether or not hide read messages */
451 OPTKEEPQUIET, /* (pseudo) shut up the message and refresh
452 * functions while we are executing an
455 OPTMENUCALLER, /* (pseudo) tell menu to give caller a take */
456 OPTREDRAWTREE, /* (pseudo) redraw the thread tree */
457 OPTPGPCHECKTRUST, /* (pseudo) used by pgp_select_key () */
458 OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
459 OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
462 OPTNEWS, /* (pseudo) used to change reader mode */
463 OPTNEWSSEND, /* (pseudo) used to change behavior when posting */
464 OPTNEWSCACHE, /* (pseudo) used to indicate if news cache exist */
466 OPTSHORTENHIERARCHY, /* set when to shorten "hierarchies" in the sidebar */
467 OPTSIDEBARNEWMAILONLY,
471 #define mutt_bit_alloc(n) p_new(char, (n + 7) / 8)
472 #define mutt_bit_set(v,n) v[n/8] |= (1 << (n % 8))
473 #define mutt_bit_unset(v,n) v[n/8] &= ~(1 << (n % 8))
474 #define mutt_bit_toggle(v,n) v[n/8] ^= (1 << (n % 8))
475 #define mutt_bit_isset(v,n) (v[n/8] & (1 << (n % 8)))
477 #define set_option(x) mutt_bit_set(Options,x)
478 #define unset_option(x) mutt_bit_unset(Options,x)
479 #define toggle_option(x) mutt_bit_toggle(Options,x)
480 #define option(x) mutt_bit_isset(Options,x)
482 typedef struct spam_list_t {
486 struct spam_list_t *next;
490 #define mutt_new_spam_list() p_new(SPAM_LIST, 1)
491 void mutt_free_spam_list (SPAM_LIST **);
493 int mutt_matches_ignore (const char *, string_list_t *);
495 void mutt_init (int, string_list_t *);
497 typedef struct thread {
498 unsigned int fake_thread:1;
499 unsigned int duplicate_thread:1;
500 unsigned int sort_children:1;
501 unsigned int check_subject:1;
502 unsigned int visible:1;
504 unsigned int subtree_visible:2;
505 unsigned int next_subtree_visible:1;
506 struct thread *parent;
507 struct thread *child;
515 /* flag to mutt_pattern_comp() */
516 #define M_FULL_MSG (1<<0) /* enable body and header matching */
519 M_MATCH_FULL_ADDRESS = 1
522 typedef struct pattern_t {
524 unsigned int not : 1;
525 unsigned int alladdr : 1;
526 unsigned int stringmatch : 1;
529 struct pattern_t *next;
530 struct pattern_t *child; /* arguments to logical op */
539 time_t mtime_cur; /* used with maildir folders */
542 char *pattern; /* limit pattern string */
543 pattern_t *limit_pattern; /* compiled limit pattern */
545 HEADER *last_tag; /* last tagged msg. used to link threads */
546 THREAD *tree; /* top of thread tree */
547 HASH *id_hash; /* hash table by msg id */
548 HASH *subj_hash; /* hash table by subject */
549 HASH *thread_hash; /* hash table for threading */
550 int *v2r; /* mapping from virtual to real msgno */
551 int hdrmax; /* number of pointers in hdrs */
552 int msgcount; /* number of messages in the mailbox */
553 int vcount; /* the number of virtual messages */
554 int tagged; /* how many messages are tagged? */
555 int new; /* how many new messages? */
556 int unread; /* how many unread messages? */
557 int deleted; /* how many deleted messages */
558 int appended; /* how many saved messages? */
559 int flagged; /* how many flagged messages */
560 int msgnotreadyet; /* which msg "new" in pager, -1 if none */
561 void *data; /* driver specific data */
563 short magic; /* mailbox type */
565 void *compressinfo; /* compressed mbox module private data */
566 char *realpath; /* path to compressed mailbox */
568 unsigned int locked:1; /* is the mailbox locked? */
569 unsigned int changed:1; /* mailbox has been modified */
570 unsigned int readonly:1; /* don't allow changes to the mailbox */
571 unsigned int dontwrite:1; /* dont write the mailbox on close */
572 unsigned int append:1; /* mailbox is opened in append mode */
573 unsigned int quiet:1; /* inhibit status messages? */
574 unsigned int collapsed:1; /* are all threads collapsed? */
575 unsigned int closing:1; /* mailbox is being closed */
576 unsigned int counting:1; /* do we just want to cound? */
579 /* for attachment counter */
587 /* Flags for mutt_count_body_parts() */
588 #define M_PARTS_TOPLEVEL (1<<0) /* is the top-level part */
589 #define M_PARTS_RECOUNT (1<<1) /* force recount */
594 #endif /* !_MUTT_H */