comment list functions
authorRichard Russon <rich@flatcap.org>
Sat, 7 Apr 2018 22:57:26 +0000 (23:57 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 7 Apr 2018 22:57:26 +0000 (23:57 +0100)
18 files changed:
alias.c
compose.c
hcache/hcache.c
hook.c
init.c
main.c
mutt/md5.c
mutt/string.c
ncrypt/crypt_gpgme.c
ncrypt/gnupgparse.c
ncrypt/pgp.c
ncrypt/pgpinvoke.c
parse.c
pattern.c
remailer.c
send.c
sendlib.c
thread.c

diff --git a/alias.c b/alias.c
index bcf7b1ba7fecf0d9162b0418305d0fcfb1b01109..c442fbec96935c52773d05a53243b91691f4d603 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -48,6 +48,14 @@ struct Address *mutt_alias_lookup(const char *s)
   return NULL; /* no such alias */
 }
 
+/**
+ * expand_aliases_r - Expand aliases, recursively
+ * @param[in]  a    Address List
+ * @param[out] expn Alias List
+ * @retval ptr Address List with aliases expanded
+ *
+ * ListHead expn is used as temporary storage for already-expanded aliases.
+ */
 static struct Address *expand_aliases_r(struct Address *a, struct ListHead *expn)
 {
   struct Address *head = NULL, *last = NULL, *t = NULL, *w = NULL;
index a213392d09979c78f81b06304cc2795c9dd0ad59..a59f96eccde1dfabc55597a50915f71937367767 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -319,6 +319,10 @@ static void redraw_crypt_lines(struct Header *msg)
 
 #ifdef MIXMASTER
 
+/**
+ * redraw_mix_line - Redraw the Mixmaster chain
+ * @param chain List of chain links
+ */
 static void redraw_mix_line(struct ListHead *chain)
 {
   char *t = NULL;
index 8302f4cd39443a51ab41804a2a972cff7b8102ca..c73e1f8d0d8dba3f31c044fdbed7a609d2fd2849 100644 (file)
@@ -268,6 +268,14 @@ static void restore_address(struct Address **a, const unsigned char *d, int *off
   *a = NULL;
 }
 
+/**
+ * dump_stailq - Pack a STAILQ into a binary blob
+ * @param l       List to read from
+ * @param d       Binary blob to add to
+ * @param off     Offset into the blob
+ * @param convert If true, the strings will be converted to utf-8
+ * @retval ptr End of the newly packed binary
+ */
 static unsigned char *dump_stailq(struct ListHead *l, unsigned char *d, int *off, bool convert)
 {
   unsigned int counter = 0;
@@ -287,6 +295,13 @@ static unsigned char *dump_stailq(struct ListHead *l, unsigned char *d, int *off
   return d;
 }
 
+/**
+ * restore_stailq - Unpack a STAILQ from a binary blob
+ * @param l       List to add to
+ * @param d       Binary blob to read from
+ * @param off     Offset into blob
+ * @param convert If true, the strings will be converted from utf-8
+ */
 static void restore_stailq(struct ListHead *l, const unsigned char *d, int *off, bool convert)
 {
   unsigned int counter;
diff --git a/hook.c b/hook.c
index aa7593688c6b945112be7c6e7a404159c8fcfc60..bea902e42ab8f6e0ea7320bf9f8d510ec194405a 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -516,6 +516,12 @@ void mutt_select_fcc(char *path, size_t pathlen, struct Header *hdr)
   mutt_pretty_mailbox(path, pathlen);
 }
 
+/**
+ * list_hook - Find hook strings matching
+ * @param[out] matches List of hook strings
+ * @param[in]  match   String to match
+ * @param[in]  hook    Hook type, e.g. #MUTT_CRYPTHOOK
+ */
 static void list_hook(struct ListHead *matches, const char *match, int hook)
 {
   struct Hook *tmp = NULL;
@@ -530,6 +536,13 @@ static void list_hook(struct ListHead *matches, const char *match, int hook)
   }
 }
 
+/**
+ * mutt_crypt_hook - Find crypto hooks for an Address
+ * @param[out] list List of keys
+ * @param[in]  addr Address to match
+ *
+ * The crypt-hook associates keys with addresses.
+ */
 void mutt_crypt_hook(struct ListHead *list, struct Address *addr)
 {
   list_hook(list, addr->mailbox, MUTT_CRYPTHOOK);
diff --git a/init.c b/init.c
index 1b3b545e107bc9a9696cac63e526bec7ac488ded..1f1b7629168fc16a7e93a45a2d2f4aa8977d667c 100644 (file)
--- a/init.c
+++ b/init.c
@@ -721,6 +721,13 @@ void mutt_free_opts(void)
   mutt_regexlist_free(&NoSpamList);
 }
 
+/**
+ * add_to_stailq - Add a string to a list
+ * @param head String list
+ * @param str  String to add
+ *
+ * @note Duplicate or empty strings will not be added
+ */
 static void add_to_stailq(struct ListHead *head, const char *str)
 {
   /* don't add a NULL or empty string to the list */
@@ -741,7 +748,7 @@ static void add_to_stailq(struct ListHead *head, const char *str)
 
 /**
  * finish_source - 'finish' command: stop processing current config file
- * @param tmp  Temporary space shared by all command handlers
+ * @param buf  Temporary space shared by all command handlers
  * @param s    Current line of the config file
  * @param data data field from init.h:struct Command
  * @param err  Buffer for any error message
@@ -764,7 +771,7 @@ static int finish_source(struct Buffer *buf, struct Buffer *s,
 
 /**
  * parse_ifdef - 'ifdef' command: conditional config
- * @param tmp  Temporary space shared by all command handlers
+ * @param buf  Temporary space shared by all command handlers
  * @param s    Current line of the config file
  * @param data data field from init.h:struct Command
  * @param err  Buffer for any error message
@@ -861,6 +868,13 @@ static int parse_ifdef(struct Buffer *buf, struct Buffer *s, unsigned long data,
   return 0;
 }
 
+/**
+ * remove_from_stailq - Remove an item, matching a string, from a List
+ * @param head Head of the List
+ * @param str  String to match
+ *
+ * @note The string comparison is case-insensitive
+ */
 static void remove_from_stailq(struct ListHead *head, const char *str)
 {
   if (mutt_str_strcmp("*", str) == 0)
@@ -1339,6 +1353,15 @@ static void attachments_clean(void)
     Context->hdrs[i]->attach_valid = false;
 }
 
+/**
+ * parse_attach_list - Parse the "attachments" command
+ * @param buf  Buffer for temporary storage
+ * @param s    Buffer containing the attachments command
+ * @param head List of AttachMatch to add to
+ * @param err  Buffer for error messages
+ * @retval  0 Success
+ * @retval -1 Error
+ */
 static int parse_attach_list(struct Buffer *buf, struct Buffer *s,
                              struct ListHead *head, struct Buffer *err)
 {
@@ -1406,6 +1429,14 @@ static int parse_attach_list(struct Buffer *buf, struct Buffer *s,
   return 0;
 }
 
+/**
+ * parse_unattach_list - Parse the "unattachments" command
+ * @param buf  Buffer for temporary storage
+ * @param s    Buffer containing the unattachments command
+ * @param head List of AttachMatch to remove from
+ * @param err  Buffer for error messages
+ * @retval 0 Always
+ */
 static int parse_unattach_list(struct Buffer *buf, struct Buffer *s,
                                struct ListHead *head, struct Buffer *err)
 {
@@ -1461,6 +1492,13 @@ static int parse_unattach_list(struct Buffer *buf, struct Buffer *s,
   return 0;
 }
 
+/**
+ * print_attach_list - Print a list of attachments
+ * @param h    List of attachments
+ * @param op   Operation, e.g. '+', '-'
+ * @param name Attached/Inline, 'A', 'I'
+ * @retval 0 Always
+ */
 static int print_attach_list(struct ListHead *h, char op, char *name)
 {
   struct ListNode *np;
@@ -3506,6 +3544,9 @@ int var_to_string(int idx, char *val, size_t len)
 
 /**
  * mutt_query_variables - Implement the -Q command line flag
+ * @param queries List of query strings
+ * @retval 0 Success, all queries exist
+ * @retval 1 Error
  */
 int mutt_query_variables(struct ListHead *queries)
 {
@@ -3583,6 +3624,12 @@ int mutt_dump_variables(int hide_sensitive)
   return 0;
 }
 
+/**
+ * execute_commands - Execute a set of NeoMutt commands
+ * @param p List of command strings
+ * @retval  0 Success, all the commands succeeded
+ * @retval -1 Error
+ */
 static int execute_commands(struct ListHead *p)
 {
   struct Buffer err, token;
@@ -3720,6 +3767,13 @@ static bool get_hostname(void)
   return true;
 }
 
+/**
+ * mutt_init - Initialise NeoMutt
+ * @param skip_sys_rc If true, don't read the system config file
+ * @param commands    List of config commands to execute
+ * @retval 0 Success
+ * @retval 1 Error
+ */
 int mutt_init(int skip_sys_rc, struct ListHead *commands)
 {
   char buffer[LONG_STRING];
diff --git a/main.c b/main.c
index 93b22341b1fea1dcdbe6e31844a381cf277cbb62..b7ba4fc24926c25681fc261d6a76881be579c58e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -174,6 +174,12 @@ static int start_curses(void)
 #define MUTT_NEWS (1 << 5) /* -g and -G */
 #endif
 
+/**
+ * get_user_info - Find the user's name, home and shell
+ * @param cs Config Set
+ * @retval 0 Success
+ * @retval 1 Error
+ */
 static int get_user_info(void)
 {
   const char *p = mutt_str_getenv("HOME");
@@ -229,7 +235,7 @@ static int get_user_info(void)
  * main - Start NeoMutt
  * @param argc Number of command line arguments
  * @param argv List of command line arguments
- * @param env  Copy of the environment
+ * @param envp Copy of the environment
  * @retval 0 on success
  * @retval 1 on error
  */
index 791e234581ef5744296f3fd80f42ec2d328f62e8..91e0e309b688bd2fc6465497905705feb15ab617 100644 (file)
@@ -302,7 +302,7 @@ void *mutt_md5_finish_ctx(struct Md5Ctx *ctx, void *resbuf)
 
 /**
  * mutt_md5 - Calculate the MD5 hash of a NULL-terminated string
- * @param s      String to hash
+ * @param string String to hash
  * @param resbuf Buffer for result
  */
 void *mutt_md5(const char *string, void *resbuf)
@@ -337,8 +337,8 @@ void *mutt_md5_bytes(const void *buffer, size_t len, void *resbuf)
 
 /**
  * mutt_md5_process - Process a NULL-terminated string
- * @param s    String to process
- * @param ctx  MD5 context
+ * @param string String to process
+ * @param ctx    MD5 context
  */
 void mutt_md5_process(const char *string, struct Md5Ctx *ctx)
 {
index 122a84f9b051296f4f54bbec8db43e5bc0a3da1b..3edc2da4d1c2e723112b117cf3e96aefdcb8698e 100644 (file)
@@ -278,7 +278,7 @@ int mutt_str_atoul(const char *str, unsigned long *dst)
  * mutt_str_strdup - Copy a string, safely
  * @param str String to copy
  * @retval ptr  Copy of the string
- * @retval NULL if s was NULL
+ * @retval NULL if str was NULL
  */
 char *mutt_str_strdup(const char *str)
 {
index 175251095fb6e160e953252f86abdac391d5d20d..6bbdd794e601c21c20be615fd7730780e862c57a 100644 (file)
@@ -3895,8 +3895,12 @@ leave:
 
 /**
  * list_to_pattern - Convert STailQ to GPGME-compatible pattern
+ * @param list List of strings to convert
+ * @retval ptr GPGME-compatible pattern
  *
  * We need to convert spaces in an item into a '+' and '%' into "%25".
+ *
+ * @note The caller must free the returned pattern
  */
 static char *list_to_pattern(struct ListHead *list)
 {
@@ -3952,6 +3956,11 @@ static char *list_to_pattern(struct ListHead *list)
 
 /**
  * get_candidates - Get a list of keys which are candidates for the selection
+ * @param hints  List of strings to match
+ * @param app    Application type, e.g. #APPLICATION_PGP
+ * @param secret If true, only match secret keys
+ * @retval ptr  Key List
+ * @retval NULL Error
  *
  * Select by looking at the HINTS list.
  */
@@ -4574,7 +4583,11 @@ static struct CryptKeyInfo *crypt_ask_for_key(char *tag, char *whatfor, short ab
 
 /**
  * find_keys - Find keys of the recipients of the message
- * @retval NULL if any of the keys can not be found
+ * @param addrlist    Address List
+ * @param app         Application type, e.g. #APPLICATION_PGP
+ * @param oppenc_mode If true, use opportunistic encryption
+ * @retval ptr  Space-separated string of keys
+ * @retval NULL At least one of the keys can't be found
  *
  * If oppenc_mode is true, only keys that can be determined without prompting
  * will be used.
index 00c43f9f39ef7491e31c3b67fc8e7a4a4efee9c8..5e180e8fe3e991bf990b5b9bd569929b4cb268e4 100644 (file)
@@ -375,6 +375,13 @@ bail:
   return NULL;
 }
 
+/**
+ * pgp_get_candidates - Find PGP keys matching a list of hints
+ * @param keyring PGP Keyring
+ * @param hints   List of strings to match
+ * @retval ptr  Key list
+ * @retval NULL Error
+ */
 struct PgpKeyInfo *pgp_get_candidates(enum PgpRing keyring, struct ListHead *hints)
 {
   FILE *fp = NULL;
index 1d0f9e2f002e2b415b0c92da94edfcadd71f38b5..3333e92ce4fed162bb3577bcfd89816e039c050e 100644 (file)
@@ -1217,9 +1217,13 @@ struct Body *pgp_sign_message(struct Body *a)
 
 /**
  * pgp_find_keys - Find the keyids of the recipients of a message
+ * @param addrlist    Address List
+ * @param oppenc_mode If true, use opportunistic encryption
+ * @retval ptr  Space-separated string of keys
+ * @retval NULL At least one of the keys can't be found
  *
- * It returns NULL if any of the keys can not be found.  If oppenc_mode is
- * true, only keys that can be determined without prompting will be used.
+ * If oppenc_mode is true, only keys that can be determined without prompting
+ * will be used.
  */
 char *pgp_find_keys(struct Address *addrlist, int oppenc_mode)
 {
index 9e69245554df84ec0fd5383ed66fdcedce4852bd..fac13bb2ed9a1ef3aec3e4bee7c52832b3c07272 100644 (file)
@@ -312,6 +312,19 @@ pid_t pgp_invoke_verify_key(FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpi
                     NULL, uids, PgpVerifyKeyCommand);
 }
 
+/**
+ * pgp_invoke_list_keys - Find matching PGP Keys
+ * @param pgpin    File stream pointing to stdin for the command process, can be NULL
+ * @param pgpout   File stream pointing to stdout for the command process, can be NULL
+ * @param pgperr   File stream pointing to stderr for the command process, can be NULL
+ * @param pgpinfd  If `pgpin` is NULL and pgpin is not -1 then pgpin will be used as stdin for the command process
+ * @param pgpoutfd If `pgpout` is NULL and pgpout is not -1 then pgpout will be used as stdout for the command process
+ * @param pgperrfd If `pgperr` is NULL and pgperr is not -1 then pgperr will be used as stderr for the command process
+ * @param keyring  Keyring type, e.g. #PGP_SECRING
+ * @param hints    Match keys to these strings
+ * @retval n  pid of the created process
+ * @retval -1 on any error creating pipes or forking
+ */
 pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr,
                            int pgpinfd, int pgpoutfd, int pgperrfd,
                            enum PgpRing keyring, struct ListHead *hints)
diff --git a/parse.c b/parse.c
index 212e9ebdb224bcaef5b49d77517141f16877b88b..0a4e0254d9647c7735c1659ec8f7717810c6e337 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -107,6 +107,11 @@ char *mutt_rfc822_read_line(FILE *f, char *line, size_t *linelen)
   /* not reached */
 }
 
+/**
+ * parse_references - Parse references from an email header
+ * @param head List to receive the references
+ * @param s    String to parse
+ */
 static void parse_references(struct ListHead *head, char *s)
 {
   char *m = NULL;
@@ -1295,6 +1300,10 @@ struct Envelope *mutt_rfc822_read_header(FILE *f, struct Header *hdr,
 
 /**
  * count_body_parts_check - Compares mime types to the ok and except lists
+ * @param checklist List of AttachMatch
+ * @param b         Email Body
+ * @param dflt      Log whether the matches are OK, or Excluded
+ * @retval true Attachment should be counted
  */
 static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, bool dflt)
 {
index 14a3890b8c9b1ac54dec88420889416a162cc9f7..845e0a63c88fd4c0e7ea3ae82b85bf774b984bbf 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -1368,6 +1368,12 @@ static int match_addrlist(struct Pattern *pat, int match_personal, int n, ...)
   return pat->alladdr; /* No matches, or all matches if alladdr */
 }
 
+/**
+ * match_reference - Match references against a Pattern
+ * @param pat  Pattern to match
+ * @param refs List of References
+ * @retval true One of the references matches
+ */
 static bool match_reference(struct Pattern *pat, struct ListHead *refs)
 {
   struct ListNode *np;
index f64d583c94805b9c544a2aa6c3648bf85c0e6247..cc1859850da9b20dfb398a7d1f63d4a4646c90d7 100644 (file)
@@ -477,6 +477,12 @@ static const struct Mapping RemailerHelp[] = {
   { N_("OK"), OP_MIX_USE },        { NULL, 0 },
 };
 
+/**
+ * mix_make_chain - Create a Mixmaster chain
+ * @param chainhead List if chain links
+ *
+ * Ask the user to select Mixmaster hosts to create a chain.
+ */
 void mix_make_chain(struct ListHead *chainhead)
 {
   int c_cur = 0, c_old = 0;
@@ -733,6 +739,13 @@ int mix_check_message(struct Header *msg)
   return 0;
 }
 
+/**
+ * mix_send_message - Send an email via Mixmaster
+ * @param chain    String list of hosts
+ * @param tempfile Temporary file containing email
+ * @retval -1  Error
+ * @retval >=0 Success (Mixmaster's return code)
+ */
 int mix_send_message(struct ListHead *chain, const char *tempfile)
 {
   char cmd[HUGE_STRING];
diff --git a/send.c b/send.c
index 74949809a3682aa5e2137a3eddbc7f9a05ad29e6..7ff2af2128b09dd8de49306a7a0923bb9140963b 100644 (file)
--- a/send.c
+++ b/send.c
@@ -611,6 +611,11 @@ int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags)
   return 0;
 }
 
+/**
+ * add_references - Add the email's references to a list
+ * @param head List of references
+ * @param e    Envelope of message
+ */
 static void add_references(struct ListHead *head, struct Envelope *e)
 {
   struct ListHead *src;
@@ -623,6 +628,11 @@ static void add_references(struct ListHead *head, struct Envelope *e)
   }
 }
 
+/**
+ * add_message_id - Add the email's message ID to a list
+ * @param head List of message IDs
+ * @param e    Envelope of message
+ */
 static void add_message_id(struct ListHead *head, struct Envelope *e)
 {
   if (e->message_id)
index a1e3cb89932e1192f82538eee2e11eab559ad812..f20fcc27c2939d2ef5872eb776d1f5527be13c1e 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1635,9 +1635,12 @@ void mutt_write_address_list(struct Address *addr, FILE *fp, int linelen, bool d
 
 /**
  * mutt_write_references - Add the message references to a list
+ * @param r    String List of references
+ * @param f    File to write to
+ * @param trim Trim the list to at most this many items
  *
- * need to write the list in reverse because they are stored in reverse order
- * when parsed to speed up threading
+ * Write the list in reverse because they are stored in reverse order when
+ * parsed to speed up threading.
  */
 void mutt_write_references(const struct ListHead *r, FILE *f, size_t trim)
 {
@@ -2173,6 +2176,12 @@ int mutt_rfc822_write_header(FILE *fp, struct Envelope *env,
   return (ferror(fp) == 0 ? 0 : -1);
 }
 
+/**
+ * encode_headers - RFC2047-encode a list of headers
+ * @param h String List of headers
+ *
+ * The strings are encoded in-place.
+ */
 static void encode_headers(struct ListHead *h)
 {
   char *tmp = NULL;
index 96deda6b4b25ae3028d1bccbc3fe29f317f36a81..c0f5e5a07192c814307316d7569ecb01fa99afab 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -370,12 +370,14 @@ void mutt_draw_tree(struct Context *ctx)
 }
 
 /**
- * make_subject_list - Create a list of all subjects in a thread
+ * make_subject_list - Create a sorted list of all subjects in a thread
+ * @param[out] subjects String List of subjects
+ * @param[in]  cur      Email Thread
+ * @param[out] dateptr  Earliest date found in thread
  *
- * since we may be trying to attach as a pseudo-thread a MuttThread that
- * has no message, we have to make a list of all the subjects of its
- * most immediate existing descendants.  we also note the earliest
- * date on any of the parents and put it in *dateptr.
+ * Since we may be trying to attach as a pseudo-thread a MuttThread that has no
+ * message, we have to make a list of all the subjects of its most immediate
+ * existing descendants.
  */
 static void make_subject_list(struct ListHead *subjects, struct MuttThread *cur, time_t *dateptr)
 {
@@ -424,6 +426,9 @@ static void make_subject_list(struct ListHead *subjects, struct MuttThread *cur,
 
 /**
  * find_subject - Find the best possible match for a parent based on subject
+ * @param ctx Mailbox
+ * @param cur Email to match
+ * @retval ptr Best match for a parent
  *
  * If there are multiple matches, the one which was sent the latest, but before
  * the current message, is used.