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.
14 #include <lib-lib/lib-lib.h>
15 #include <lib-mime/mime.h>
17 #define MUTT_VERSION (VERSION)
19 /* nifty trick I stole from ELM 2.5alpha. */
22 #define INITVAL(x) = x
29 int ch; /* raw key pressed */
30 int op; /* function op */
33 /* flags for m_strformat() */
35 M_FORMAT_FORCESUBJ = (1 << 0), /* print the subject even if unchanged */
36 M_FORMAT_TREE = (1 << 1), /* draw the thread tree */
37 M_FORMAT_MAKEPRINT = (1 << 2), /* make sure that all chars are printable */
38 M_FORMAT_OPTIONAL = (1 << 3),
39 M_FORMAT_STAT_FILE = (1 << 4), /* used by mutt_attach_fmt */
40 M_FORMAT_ARROWCURSOR = (1 << 5), /* reserve space for arrow_cursor */
41 M_FORMAT_INDEX = (1 << 6) /* this is a main index entry */
44 /* types for mutt_add_hook() */
45 #define M_FOLDERHOOK 1
46 #define M_MBOXHOOK (1<<1)
47 #define M_SENDHOOK (1<<2)
48 #define M_FCCHOOK (1<<3)
49 #define M_SAVEHOOK (1<<4)
50 #define M_CHARSETHOOK (1<<5)
51 #define M_ICONVHOOK (1<<6)
52 #define M_MESSAGEHOOK (1<<7)
53 #define M_CRYPTHOOK (1<<8)
54 #define M_ACCOUNTHOOK (1<<9)
55 #define M_REPLYHOOK (1<<10)
56 #define M_SEND2HOOK (1<<11)
58 #define M_OPENHOOK (1<<12)
59 #define M_APPENDHOOK (1<<13)
60 #define M_CLOSEHOOK (1<<14)
62 /* tree characters for linearize_tree and print_enriched_string */
63 #define M_TREE_LLCORNER 1
64 #define M_TREE_ULCORNER 2
66 #define M_TREE_HLINE 4
67 #define M_TREE_VLINE 5
68 #define M_TREE_SPACE 6
69 #define M_TREE_RARROW 7
71 #define M_TREE_HIDDEN 9
72 #define M_TREE_EQUALS 10
73 #define M_TREE_TTEE 11
74 #define M_TREE_BTEE 12
75 #define M_TREE_MISSING 13
78 #define M_THREAD_COLLAPSE (1<<0)
79 #define M_THREAD_UNCOLLAPSE (1<<1)
80 #define M_THREAD_GET_HIDDEN (1<<2)
81 #define M_THREAD_UNREAD (1<<3)
82 #define M_THREAD_NEXT_UNREAD (1<<4)
85 /* modes for mutt_view_attachment() */
90 /* action codes used by mutt_set_flag() and mutt_pattern_function() */
110 /* actions for mutt_pattern_comp/mutt_pattern_exec */
150 /* Options for Mailcap lookup */
156 /* options for socket code */
162 /* Options for mutt_save_attachment */
167 /* possible arguments to set_quadoption() */
175 /* quad-option vars */
189 OPT_PGPMIMEAUTO, /* ask to revert to PGP/MIME when inline fails */
197 #if defined(USE_SSL) || defined(USE_GNUTLS)
201 OPT_VERIFYSIG, /* verify PGP signatures */
207 OPT_FOLLOWUPTOPOSTER,
208 #endif /* USE_NNTP */
210 /* THIS MUST BE THE LAST VALUE. */
214 /* flags to ci_send_message() */
215 #define SENDREPLY (1<<0)
216 #define SENDGROUPREPLY (1<<1)
217 #define SENDLISTREPLY (1<<2)
218 #define SENDFORWARD (1<<3)
219 #define SENDPOSTPONED (1<<4)
220 #define SENDBATCH (1<<5)
221 #define SENDKEY (1<<6)
222 #define SENDRESEND (1<<7)
223 #define SENDNEWS (1<<8)
225 /* flags to _mutt_select_file() */
226 #define M_SEL_BUFFY (1<<0)
227 #define M_SEL_MULTI (1<<1)
228 #define M_SEL_FOLDER (1<<2)
230 /* flags for parse_spam_list */
274 #endif /* HAVE_QDBM */
282 OPTHIDETHREADSUBJECT,
285 OPTIGNORELISTREPLYTO,
286 OPTIMAPCHECKSUBSCRIBED,
291 #if defined(USE_SSL) || defined(USE_GNUTLS)
295 # endif /* !USE_GNUTLS */
299 #endif /* USE_SSL || USE_GNUTLS */
308 OPTMENUSCROLL, /* scroll menu instead of implicit next-page */
310 OPTMETAKEY, /* interpret ALT-x as ESC-x */
315 OPTMIMESUBJECT, /* encode subject line with RFC2047 */
362 #ifdef HAVE_GETADDRINFO
369 OPTWRITEBCC, /* write out a bcc header? */
371 OPTXMAILTO, /* 1 if $edit_header is forcebly set */
382 OPTCRYPTREPLYENCRYPT,
384 OPTCRYPTREPLYSIGNENCRYPTED,
388 OPTSDEFAULTDECRYPTKEY,
408 #endif /* USE_NNTP */
412 OPTAUXSORT, /* (pseudo) using auxillary sort function */
413 OPTFORCEREFRESH, /* (pseudo) refresh even during macros */
414 OPTNOCURSES, /* (pseudo) when sending in batch mode */
415 OPTNEEDREDRAW, /* (pseudo) to notify caller of a submenu */
416 OPTSEARCHREVERSE, /* (pseudo) used by ci_search_command */
417 OPTMSGERR, /* (pseudo) used by mutt_error/mutt_message */
418 OPTSEARCHINVALID, /* (pseudo) used to invalidate the search pat */
419 OPTSIGNALSBLOCKED, /* (pseudo) using by mutt_block_signals () */
420 OPTSYSSIGNALSBLOCKED, /* (pseudo) using by mutt_block_signals_system () */
421 OPTNEEDRESORT, /* (pseudo) used to force a re-sort */
422 OPTRESORTINIT, /* (pseudo) used to force the next resort to be from scratch */
423 OPTVIEWATTACH, /* (pseudo) signals that we are viewing attachments */
424 OPTFORCEREDRAWINDEX, /* (pseudo) used to force a redraw in the main index */
425 OPTFORCEREDRAWPAGER, /* (pseudo) used to force a redraw in the pager */
426 OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
427 OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
428 OPTATTACHMSG, /* (pseudo) used by attach-message */
429 OPTHIDEREAD, /* (pseudo) whether or not hide read messages */
430 OPTKEEPQUIET, /* (pseudo) shut up the message and refresh
431 * functions while we are executing an
434 OPTMENUCALLER, /* (pseudo) tell menu to give caller a take */
435 OPTREDRAWTREE, /* (pseudo) redraw the thread tree */
436 OPTPGPCHECKTRUST, /* (pseudo) used by pgp_select_key () */
437 OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
438 OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
441 OPTNEWS, /* (pseudo) used to change reader mode */
442 OPTNEWSSEND, /* (pseudo) used to change behavior when posting */
443 OPTNEWSCACHE, /* (pseudo) used to indicate if news cache exist */
445 OPTSHORTENHIERARCHY, /* set when to shorten "hierarchies" in the sidebar */
446 OPTSIDEBARNEWMAILONLY,
450 #define mutt_bit_alloc(n) p_new(char, (n + 7) / 8)
451 #define mutt_bit_set(v,n) v[n/8] |= (1 << (n % 8))
452 #define mutt_bit_unset(v,n) v[n/8] &= ~(1 << (n % 8))
453 #define mutt_bit_toggle(v,n) v[n/8] ^= (1 << (n % 8))
454 #define mutt_bit_isset(v,n) (v[n/8] & (1 << (n % 8)))
456 #define set_option(x) mutt_bit_set(Options,x)
457 #define unset_option(x) mutt_bit_unset(Options,x)
458 #define toggle_option(x) mutt_bit_toggle(Options,x)
459 #define option(x) mutt_bit_isset(Options,x)
461 int mutt_matches_ignore (const char *, string_list_t *);
463 void mutt_init (int, string_list_t *);
465 typedef struct thread {
466 unsigned int fake_thread:1;
467 unsigned int duplicate_thread:1;
468 unsigned int sort_children:1;
469 unsigned int check_subject:1;
470 unsigned int visible:1;
472 unsigned int subtree_visible:2;
473 unsigned int next_subtree_visible:1;
474 struct thread *parent;
475 struct thread *child;
482 typedef struct compress_info compress_info;
483 typedef struct pattern_t pattern_t;
489 time_t mtime_cur; /* used with maildir folders */
492 char *pattern; /* limit pattern string */
493 pattern_t *limit_pattern; /* compiled limit pattern */
495 HEADER *last_tag; /* last tagged msg. used to link threads */
496 THREAD *tree; /* top of thread tree */
497 HASH *id_hash; /* hash table by msg id */
498 HASH *subj_hash; /* hash table by subject */
499 HASH *thread_hash; /* hash table for threading */
500 int *v2r; /* mapping from virtual to real msgno */
501 int hdrmax; /* number of pointers in hdrs */
502 int msgcount; /* number of messages in the mailbox */
503 int vcount; /* the number of virtual messages */
504 int tagged; /* how many messages are tagged? */
505 int new; /* how many new messages? */
506 int unread; /* how many unread messages? */
507 int deleted; /* how many deleted messages */
508 int appended; /* how many saved messages? */
509 int flagged; /* how many flagged messages */
510 int msgnotreadyet; /* which msg "new" in pager, -1 if none */
511 void *data; /* driver specific data */
513 short magic; /* mailbox type */
515 compress_info *cinfo; /* compressed mbox module private data */
516 char *realpath; /* path to compressed mailbox */
518 unsigned int locked:1; /* is the mailbox locked? */
519 unsigned int changed:1; /* mailbox has been modified */
520 unsigned int readonly:1; /* don't allow changes to the mailbox */
521 unsigned int dontwrite:1; /* dont write the mailbox on close */
522 unsigned int append:1; /* mailbox is opened in append mode */
523 unsigned int quiet:1; /* inhibit status messages? */
524 unsigned int collapsed:1; /* are all threads collapsed? */
525 unsigned int closing:1; /* mailbox is being closed */
526 unsigned int counting:1; /* do we just want to cound? */
529 /* for attachment counter */
537 /* Flags for mutt_count_body_parts() */
538 #define M_PARTS_TOPLEVEL (1<<0) /* is the top-level part */
539 #define M_PARTS_RECOUNT (1<<1) /* force recount */
544 #endif /* !_MUTT_H */