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/lib-lib.h>
28 #include <lib-mime/mime.h>
30 #define MUTT_VERSION (VERSION)
32 /* nifty trick I stole from ELM 2.5alpha. */
35 #define INITVAL(x) = x
42 int ch; /* raw key pressed */
43 int op; /* function op */
46 /* flags for mutt_FormatString() */
48 M_FORMAT_FORCESUBJ = (1 << 0), /* print the subject even if unchanged */
49 M_FORMAT_TREE = (1 << 1), /* draw the thread tree */
50 M_FORMAT_MAKEPRINT = (1 << 2), /* make sure that all chars are printable */
51 M_FORMAT_OPTIONAL = (1 << 3),
52 M_FORMAT_STAT_FILE = (1 << 4), /* used by mutt_attach_fmt */
53 M_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */
54 M_FORMAT_INDEX = (1 << 6) /* this is a main index entry */
57 /* types for mutt_add_hook() */
58 #define M_FOLDERHOOK 1
59 #define M_MBOXHOOK (1<<1)
60 #define M_SENDHOOK (1<<2)
61 #define M_FCCHOOK (1<<3)
62 #define M_SAVEHOOK (1<<4)
63 #define M_CHARSETHOOK (1<<5)
64 #define M_ICONVHOOK (1<<6)
65 #define M_MESSAGEHOOK (1<<7)
66 #define M_CRYPTHOOK (1<<8)
67 #define M_ACCOUNTHOOK (1<<9)
68 #define M_REPLYHOOK (1<<10)
69 #define M_SEND2HOOK (1<<11)
71 #define M_OPENHOOK (1<<12)
72 #define M_APPENDHOOK (1<<13)
73 #define M_CLOSEHOOK (1<<14)
75 /* tree characters for linearize_tree and print_enriched_string */
76 #define M_TREE_LLCORNER 1
77 #define M_TREE_ULCORNER 2
79 #define M_TREE_HLINE 4
80 #define M_TREE_VLINE 5
81 #define M_TREE_SPACE 6
82 #define M_TREE_RARROW 7
84 #define M_TREE_HIDDEN 9
85 #define M_TREE_EQUALS 10
86 #define M_TREE_TTEE 11
87 #define M_TREE_BTEE 12
88 #define M_TREE_MISSING 13
91 #define M_THREAD_COLLAPSE (1<<0)
92 #define M_THREAD_UNCOLLAPSE (1<<1)
93 #define M_THREAD_GET_HIDDEN (1<<2)
94 #define M_THREAD_UNREAD (1<<3)
95 #define M_THREAD_NEXT_UNREAD (1<<4)
98 /* modes for mutt_view_attachment() */
103 /* action codes used by mutt_set_flag() and mutt_pattern_function() */
123 /* actions for mutt_pattern_comp/mutt_pattern_exec */
163 /* Options for Mailcap lookup */
169 /* options for socket code */
175 /* Options for mutt_save_attachment */
180 /* possible arguments to set_quadoption() */
188 /* quad-option vars */
202 OPT_PGPMIMEAUTO, /* ask to revert to PGP/MIME when inline fails */
210 #if defined(USE_SSL) || defined(USE_GNUTLS)
214 OPT_VERIFYSIG, /* verify PGP signatures */
220 OPT_FOLLOWUPTOPOSTER,
221 #endif /* USE_NNTP */
223 /* THIS MUST BE THE LAST VALUE. */
227 /* flags to ci_send_message() */
228 #define SENDREPLY (1<<0)
229 #define SENDGROUPREPLY (1<<1)
230 #define SENDLISTREPLY (1<<2)
231 #define SENDFORWARD (1<<3)
232 #define SENDPOSTPONED (1<<4)
233 #define SENDBATCH (1<<5)
234 #define SENDKEY (1<<6)
235 #define SENDRESEND (1<<7)
236 #define SENDNEWS (1<<8)
238 /* flags to _mutt_select_file() */
239 #define M_SEL_BUFFY (1<<0)
240 #define M_SEL_MULTI (1<<1)
241 #define M_SEL_FOLDER (1<<2)
243 /* flags for parse_spam_list */
288 #endif /* HAVE_QDBM */
296 OPTHIDETHREADSUBJECT,
299 OPTIGNORELISTREPLYTO,
300 OPTIMAPCHECKSUBSCRIBED,
305 #if defined(USE_SSL) || defined(USE_GNUTLS)
309 # endif /* !USE_GNUTLS */
313 #endif /* USE_SSL || USE_GNUTLS */
322 OPTMENUSCROLL, /* scroll menu instead of implicit next-page */
324 OPTMETAKEY, /* interpret ALT-x as ESC-x */
329 OPTMIMESUBJECT, /* encode subject line with RFC2047 */
376 #ifdef HAVE_GETADDRINFO
383 OPTWRITEBCC, /* write out a bcc header? */
385 OPTXMAILTO, /* 1 if $edit_header is forcebly set */
396 OPTCRYPTREPLYENCRYPT,
398 OPTCRYPTREPLYSIGNENCRYPTED,
402 OPTSDEFAULTDECRYPTKEY,
425 #endif /* USE_NNTP */
429 OPTAUXSORT, /* (pseudo) using auxillary sort function */
430 OPTFORCEREFRESH, /* (pseudo) refresh even during macros */
431 OPTNOCURSES, /* (pseudo) when sending in batch mode */
432 OPTNEEDREDRAW, /* (pseudo) to notify caller of a submenu */
433 OPTSEARCHREVERSE, /* (pseudo) used by ci_search_command */
434 OPTMSGERR, /* (pseudo) used by mutt_error/mutt_message */
435 OPTSEARCHINVALID, /* (pseudo) used to invalidate the search pat */
436 OPTSIGNALSBLOCKED, /* (pseudo) using by mutt_block_signals () */
437 OPTSYSSIGNALSBLOCKED, /* (pseudo) using by mutt_block_signals_system () */
438 OPTNEEDRESORT, /* (pseudo) used to force a re-sort */
439 OPTRESORTINIT, /* (pseudo) used to force the next resort to be from scratch */
440 OPTVIEWATTACH, /* (pseudo) signals that we are viewing attachments */
441 OPTFORCEREDRAWINDEX, /* (pseudo) used to force a redraw in the main index */
442 OPTFORCEREDRAWPAGER, /* (pseudo) used to force a redraw in the pager */
443 OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
444 OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
445 OPTATTACHMSG, /* (pseudo) used by attach-message */
446 OPTHIDEREAD, /* (pseudo) whether or not hide read messages */
447 OPTKEEPQUIET, /* (pseudo) shut up the message and refresh
448 * functions while we are executing an
451 OPTMENUCALLER, /* (pseudo) tell menu to give caller a take */
452 OPTREDRAWTREE, /* (pseudo) redraw the thread tree */
453 OPTPGPCHECKTRUST, /* (pseudo) used by pgp_select_key () */
454 OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
455 OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
458 OPTNEWS, /* (pseudo) used to change reader mode */
459 OPTNEWSSEND, /* (pseudo) used to change behavior when posting */
460 OPTNEWSCACHE, /* (pseudo) used to indicate if news cache exist */
462 OPTSHORTENHIERARCHY, /* set when to shorten "hierarchies" in the sidebar */
463 OPTSIDEBARNEWMAILONLY,
467 #define mutt_bit_alloc(n) p_new(char, (n + 7) / 8)
468 #define mutt_bit_set(v,n) v[n/8] |= (1 << (n % 8))
469 #define mutt_bit_unset(v,n) v[n/8] &= ~(1 << (n % 8))
470 #define mutt_bit_toggle(v,n) v[n/8] ^= (1 << (n % 8))
471 #define mutt_bit_isset(v,n) (v[n/8] & (1 << (n % 8)))
473 #define set_option(x) mutt_bit_set(Options,x)
474 #define unset_option(x) mutt_bit_unset(Options,x)
475 #define toggle_option(x) mutt_bit_toggle(Options,x)
476 #define option(x) mutt_bit_isset(Options,x)
478 typedef struct spam_list_t {
482 struct spam_list_t *next;
486 #define mutt_new_spam_list() p_new(SPAM_LIST, 1)
487 void mutt_free_spam_list (SPAM_LIST **);
489 int mutt_matches_ignore (const char *, string_list_t *);
491 void mutt_init (int, string_list_t *);
493 typedef struct thread {
494 unsigned int fake_thread:1;
495 unsigned int duplicate_thread:1;
496 unsigned int sort_children:1;
497 unsigned int check_subject:1;
498 unsigned int visible:1;
500 unsigned int subtree_visible:2;
501 unsigned int next_subtree_visible:1;
502 struct thread *parent;
503 struct thread *child;
511 /* flag to mutt_pattern_comp() */
512 #define M_FULL_MSG (1<<0) /* enable body and header matching */
515 M_MATCH_FULL_ADDRESS = 1
518 typedef struct pattern_t {
520 unsigned int not : 1;
521 unsigned int alladdr : 1;
522 unsigned int stringmatch : 1;
525 struct pattern_t *next;
526 struct pattern_t *child; /* arguments to logical op */
535 time_t mtime_cur; /* used with maildir folders */
538 char *pattern; /* limit pattern string */
539 pattern_t *limit_pattern; /* compiled limit pattern */
541 HEADER *last_tag; /* last tagged msg. used to link threads */
542 THREAD *tree; /* top of thread tree */
543 HASH *id_hash; /* hash table by msg id */
544 HASH *subj_hash; /* hash table by subject */
545 HASH *thread_hash; /* hash table for threading */
546 int *v2r; /* mapping from virtual to real msgno */
547 int hdrmax; /* number of pointers in hdrs */
548 int msgcount; /* number of messages in the mailbox */
549 int vcount; /* the number of virtual messages */
550 int tagged; /* how many messages are tagged? */
551 int new; /* how many new messages? */
552 int unread; /* how many unread messages? */
553 int deleted; /* how many deleted messages */
554 int appended; /* how many saved messages? */
555 int flagged; /* how many flagged messages */
556 int msgnotreadyet; /* which msg "new" in pager, -1 if none */
557 void *data; /* driver specific data */
559 short magic; /* mailbox type */
561 void *compressinfo; /* compressed mbox module private data */
562 char *realpath; /* path to compressed mailbox */
564 unsigned int locked:1; /* is the mailbox locked? */
565 unsigned int changed:1; /* mailbox has been modified */
566 unsigned int readonly:1; /* don't allow changes to the mailbox */
567 unsigned int dontwrite:1; /* dont write the mailbox on close */
568 unsigned int append:1; /* mailbox is opened in append mode */
569 unsigned int quiet:1; /* inhibit status messages? */
570 unsigned int collapsed:1; /* are all threads collapsed? */
571 unsigned int closing:1; /* mailbox is being closed */
572 unsigned int counting:1; /* do we just want to cound? */
575 /* for attachment counter */
583 /* Flags for mutt_count_body_parts() */
584 #define M_PARTS_TOPLEVEL (1<<0) /* is the top-level part */
585 #define M_PARTS_RECOUNT (1<<1) /* force recount */
590 #endif /* !_MUTT_H */