]> granicus.if.org Git - neomutt/commitdiff
Tidying the code
authorMehdi Abaakouk <sileht@sileht.net>
Fri, 21 Jul 2017 21:34:18 +0000 (23:34 +0200)
committerRichard Russon <rich@flatcap.org>
Tue, 3 Oct 2017 12:47:30 +0000 (13:47 +0100)
hdrline.c
header.h
imap/imap.c
imap/message.c
init.h
mutt_notmuch.c
mutt_tags.c
mutt_tags.h

index 6fcda728dc40477b768d46672becaa16baa727b4..4d1c9910f0aac8a26a901922df7cbead9a4915fd 100644 (file)
--- a/hdrline.c
+++ b/hdrline.c
@@ -472,9 +472,9 @@ static char *apply_subject_mods(struct Envelope *env)
  * | \%F     | like %n, unless from self
  * | \%g     | message tags (e.g. notmuch tags/imap flags)
  * | \%Gx    | individual message tag (e.g. notmuch tags/imap flags)
- * | \%J     | message tags (if present, tree unfolded, and != parent's keywords)
  * | \%i     | message-id
  * | \%I     | initials of author
+ * | \%J     | message tags (if present, tree unfolded, and != parent's keywords)
  * | \%K     | the list to which the letter was sent (if any; otherwise: empty)
  * | \%l     | number of lines in the message
  * | \%L     | like %F, except `lists' are displayed first
index 27add4da18e9d91c77c8e93509cf3591ead5980b..914462dd38d08c033c4f7d46ab251beee61f6f31 100644 (file)
--- a/header.h
+++ b/header.h
@@ -108,7 +108,7 @@ struct Header
   int refno; /**< message number on server */
 #endif
 
-  void *tags; /* for driver that support server tagging */
+  void *tags; /**< for drivers that support server tagging */
 #if defined(USE_POP) || defined(USE_IMAP) || defined(USE_NNTP) || defined(USE_NOTMUCH)
   void *data;                       /**< driver-specific data */
   void (*free_cb)(struct Header *); /**< driver-specific data free function */
index 0504afd95d4ef046727803c77470d4a7357e40c8..c667dd5e0e98c69e96a1dc1fa396ccf665e67e91 100644 (file)
@@ -1258,12 +1258,12 @@ static int sync_helper(struct ImapData *idata, int right, int flag, const char *
   return count;
 }
 
-
-/* imap_edit_message_tags: Prompt and validate new messages tags
+/**
+ * imap_edit_message_tags - Prompt and validate new messages tags
  *
  * @retval 0: no valid user input
  * @retval 1: buf set
- **/
+ */
 static int imap_edit_message_tags(struct Context *ctx, const char *tags, char *buf)
 {
   char *new = NULL;
@@ -1317,7 +1317,7 @@ static int imap_edit_message_tags(struct Context *ctx, const char *tags, char *b
         *checker == 91 ||                   // [
         *checker == 93)                     // ]
     {
-      mutt_error(_("Invalid IMAP keyworks"));
+      mutt_error(_("Invalid IMAP keywords"));
       mutt_sleep(2);
       return 0;
     }
index 23778adda2bfda0c3e4223b0fa36f0021824604c..072e64a175c02327441ce7fd036d29ef15f1c751 100644 (file)
@@ -477,7 +477,7 @@ static void imap_generate_seqset(struct Buffer *b, struct ImapData *idata,
   }
 }
 
-/*
+/**
  * imap_read_headers - Read headers from the server
  *
  * Changed to read many headers instead of just one. It will return the msn of
@@ -722,7 +722,6 @@ int imap_read_headers(struct ImapData *idata, unsigned int msn_begin, unsigned i
         /* make sure we don't get remnants from older larger message headers */
         fputs("\n\n", fp);
 
-
         if (h.data->msn < 1 || h.data->msn > fetch_msn_end)
         {
           mutt_debug(1, "imap_read_headers: skipping FETCH response for "
diff --git a/init.h b/init.h
index 5e2d71f65ff3b1e3d62dcc5edc543acc2cb58045..d0982bb17baebc08446793c573a679ef87e7afbe 100644 (file)
--- a/init.h
+++ b/init.h
@@ -2183,10 +2183,10 @@ struct Option MuttVars[] = {
   */
   { "hidden_tags", DT_STRING, R_NONE, UL &HiddenTags, UL "unread,draft,flagged,passed,replied,attachment,signed,encrypted" },
   /*
-   ** .pp
-   ** This variable specifies private notmuch tags which should not be printed
-   ** on screen.
-   */
+  ** .pp
+  ** This variable specifies private notmuch/imap tags which should not be printed
+  ** on screen.
+  */
   { "pager_context",    DT_NUMBER,  R_NONE, UL &PagerContext, 0 },
   /*
   ** .pp
index 9234eb30ac6fc4e08eac32179bd98b2ed78ba617..d172836100cab2aa113897533e0a700c0c5f1b9a 100644 (file)
@@ -837,7 +837,9 @@ err:
 
 static int update_header_tags(struct Header *h, notmuch_message_t *msg)
 {
+#ifdef DEBUG
   struct NmHdrData *data = h->data;
+#endif
   notmuch_tags_t *tags = NULL;
   char *new_tags = NULL;
 
@@ -1853,7 +1855,6 @@ static int nm_edit_message_tags(struct Context *ctx, const char *tags, char *buf
   return (mutt_get_field("Add/remove labels: ", buf, sizeof(buf), MUTT_NM_TAG) || !*buf);
 }
 
-
 static int nm_commit_message_tags(struct Context *ctx, struct Header *hdr, char *buf)
 {
   struct NmCtxData *data = get_ctxdata(ctx);
index 8493f85eccc0d12f2ab46c96ae0a3cf00d1105bc..ea90bf9e3bd5771080ed026bae6f0e3c89c90529 100644 (file)
@@ -1,20 +1,23 @@
-/*
- * Copyright (C) 2017 Mehdi Abaakouk <sileht@sileht.net>
+/**
+ * @file
+ * Email tags/keywords/labels
  *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
+ * @authors
+ * Copyright (C) 2017 Mehdi Abaakouk <sileht@sileht.net>
  *
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
  *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, write to the Free Software
- *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
  *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -30,7 +33,7 @@
 
 /**
  * hdr_tags_free_tag_list - free tag
- * @param[in] h: pointer to a header struct
+ * @param[in] h: pointer to a Header struct
  *
  * Free tag
  */
@@ -81,7 +84,7 @@ const char *hdr_tags_get_transformed(struct Header *h)
   return HEADER_TAGS(h)->tags_transformed;
 }
 
-/*
+/**
  * hdr_tags_get - Get tags from a header
  * @param[in] h: pointer to a header struct
  *
@@ -97,8 +100,8 @@ const char *hdr_tags_get(struct Header *h)
   return HEADER_TAGS(h)->tags;
 }
 
-/*
- * hdr_tags_get - Get tags with hiddens from a header
+/**
+ * hdr_tags_get_with_hidden - Get tags with hiddens from a header
  * @param[in] h: pointer to a header struct
  *
  * @return string tags
@@ -146,8 +149,9 @@ void hdr_tags_init(struct Header *h)
   HEADER_TAGS(h)->tags_with_hidden = NULL;
   HEADER_TAGS(h)->tag_list = NULL;
 }
+
 /**
- * hdr_tags_replace - Add a tag to header
+ * hdr_tags_add - Add a tag to header
  * @param[in] h: pointer to a header struct
  * @param[in] new_tag: string representing the new tag
  *
@@ -175,7 +179,7 @@ void hdr_tags_add(struct Header *h, char *new_tag)
   if (HiddenTags)
   {
     char *p = strstr(HiddenTags, new_tag);
-    size_t xsz = p ? strlen(new_tag) : 0;
+    size_t xsz = p ? mutt_strlen(new_tag) : 0;
 
     if (p && ((p == HiddenTags) || (*(p - 1) == ',') || (*(p - 1) == ' ')) &&
         ((*(p + xsz) == '\0') || (*(p + xsz) == ',') || (*(p + xsz) == ' ')))
@@ -197,7 +201,6 @@ void hdr_tags_add(struct Header *h, char *new_tag)
  * @retval  0 If no change are made
  * @retval  1 If tags are updated
  *
- *
  * Free current tags structures and replace it by
  * new tags
  */
@@ -221,7 +224,6 @@ int hdr_tags_replace(struct Header *h, char *tags)
   return 1;
 }
 
-
 int hdr_tags_editor(struct Context *ctx, const char *tags, char *buf)
 {
   if (ctx->mx_ops->edit_msg_tags)
@@ -231,7 +233,6 @@ int hdr_tags_editor(struct Context *ctx, const char *tags, char *buf)
   return -1;
 }
 
-
 int hdr_tags_commit(struct Context *ctx, struct Header *h, char *tags)
 {
   if (ctx->mx_ops->commit_msg_tags)
index 2403d8165f5b8f1f403b508ff56126689979053b..b3b1e16d0b42875a8f889f94b75f4ce818b5ab86 100644 (file)
@@ -1,20 +1,23 @@
-/*
- * Copyright (C) 2017 Mehdi Abaakouk <sileht@sileht.net>
+/**
+ * @file
+ * Email tags/keywords/labels
  *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
+ * @authors
+ * Copyright (C) 2017 Mehdi Abaakouk <sileht@sileht.net>
  *
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
+ * @copyright
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 2 of the License, or (at your option) any later
+ * version.
  *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, write to the Free Software
- *     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
  *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _MUTT_TAG_H
 #include "context.h"
 
 /**
- * hdr_tag -  Mail Header Tags
+ * struct HeaderTag - Mail Header Tags
  *
  * Keep a linked list of header tags and their transformed values.
  * Textual tags can be transformed to symbols to save space.
  *
- * @sa hdr_tags#tag_list
+ * @sa HeaderTags#tag_list
  */
 struct HeaderTag
 {
@@ -42,7 +45,6 @@ struct HeaderTag
  * struct HeaderTags - tags data attached to an email
  *
  * This stores all tags data associated with an email.
- *
  */
 struct HeaderTags
 {