Control: tags 868664 + patch
Control: tags 868664 + pending

Dear maintainer,

I've prepared an NMU for notmuch-addrlookup (versioned as 8-0.1) and
uploaded it to DELAYED/5. Please feel free to tell me if I
should delay it longer.

Although it's a bit unusual to NMU a new upstream version, the actual
diff is relatively small.

d
diff -Nru notmuch-addrlookup-5/CHANGELOG.md notmuch-addrlookup-8/CHANGELOG.md
--- notmuch-addrlookup-5/CHANGELOG.md	1969-12-31 20:00:00.000000000 -0400
+++ notmuch-addrlookup-8/CHANGELOG.md	2017-02-07 06:24:11.000000000 -0400
@@ -0,0 +1,61 @@
+# Change Log
+All notable changes to this project will be documented in this file.
+
+## [Unreleased]
+
+## [8] - 2017-02-07
+### Fixed
+- Avoid a segmentation fault when `notmuch_message_get_header()` returns
+  `NULL`. (Patch by Víctor M. Jáquez
+  <[vjaq...@igalia.com](mailto:vjaq...@igalia.com)>).
+
+## [7] - 2016-01-09
+### Fixed
+- Do not use functions deprecated starting with `libnotmuch` 4.3; building
+  against older versions is still possible.
+
+## [6] - 2015-11-06
+### Added
+- This change log file.
+
+### Fixed
+- Fix sorting of results. (Patch by Jeremy Simon
+  <[jtsy...@gmail.com](mailto:jtsy...@gmail.com)>.)
+
+## [5] - 2015-06-05
+### Fixed
+- Normal output was missing angle brackets around e-mail addresses. This issue
+  is fixed in this release.
+
+## [4] - 2015-05-21
+### Fixed
+- Allow building with versions of Glib older than 2.44. (Patch by `cellscape`
+  <[m...@nooff.info](mailto:m...@nooff.info)>.)
+
+## [3] - 2015-05-19
+### Added
+- Support output in a Mutt-compatible format. This allows using
+  `notmuch-addrlookup --mutt` directly in for Mutt's `query_command`
+  setting.
+
+### Changed
+- Parsing of command line arguments is now done using Glib.
+
+## [2] - 2015-05-12
+### Fixed
+- Reverse sorting of results, so most frequently contacted addresses are
+  sorted first. (Patch by Leonhard Markert.)
+
+## [1] - 2015-01-05
+### Added
+- First working version of `notmuch-addrlookup`.
+
+[Unreleased]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/v8...HEAD
+[8]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/v7...v8
+[7]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/v6...v7
+[6]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/v5...v6
+[5]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/v4...v5
+[4]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/v3...v4
+[3]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/v2...v3
+[2]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/v1...v2
+[1]: https://github.com/aperezdc/notmuch-addrlookup-c/compare/a9364d4...v1
diff -Nru notmuch-addrlookup-5/debian/changelog notmuch-addrlookup-8/debian/changelog
--- notmuch-addrlookup-5/debian/changelog	2015-06-19 06:12:31.000000000 -0300
+++ notmuch-addrlookup-8/debian/changelog	2017-07-19 07:32:40.000000000 -0300
@@ -1,3 +1,11 @@
+notmuch-addrlookup (8-0.1) unstable; urgency=medium
+
+  * Non maintainer upload
+  * New upstream release
+  * Stop using deprecated/removed API (Closes: #868664).
+
+ -- David Bremner <brem...@debian.org>  Wed, 19 Jul 2017 07:32:40 -0300
+
 notmuch-addrlookup (5-1) unstable; urgency=low
 
   * Initial release (Closes: #790873)
diff -Nru notmuch-addrlookup-5/notmuch-addrlookup.c notmuch-addrlookup-8/notmuch-addrlookup.c
--- notmuch-addrlookup-5/notmuch-addrlookup.c	2015-06-05 08:02:50.000000000 -0300
+++ notmuch-addrlookup-8/notmuch-addrlookup.c	2017-02-07 06:24:11.000000000 -0400
@@ -1,6 +1,6 @@
 /*
  * notmuch-addrlookup.c
- * Copyright (C) 2014-2015 Adrian Perez <ape...@igalia.com>
+ * Copyright (C) 2014-2016 Adrian Perez <ape...@igalia.com>
  *
  * Distributed under terms of the MIT license.
  */
@@ -164,9 +164,20 @@
   queries[1] = notmuch_query_create (db, sbuf);
   g_free (sbuf);
 
+#if LIBNOTMUCH_MAJOR_VERSION >= 4 && LIBNOTMUCH_MINOR_VERSION >= 3
+  unsigned int count = 0;
+  unsigned int tmp;
+  if (notmuch_query_count_messages_st (queries[0], &tmp) == NOTMUCH_STATUS_SUCCESS)
+      count += tmp;
+  if (notmuch_query_count_messages_st (queries[1], &tmp) == NOTMUCH_STATUS_SUCCESS)
+      count += tmp;
+#else
+  unsigned int count = notmuch_query_count_messages (queries[0])
+                     + notmuch_query_count_messages (queries[1]);
+#endif
+
   /* Pass 3: With only a few hits, add all the "from:" addresses */
-  if (notmuch_query_count_messages (queries[0]) +
-      notmuch_query_count_messages (queries[1]) < 10)
+  if (count < 10)
     {
       qs = g_string_new ("");
       if (name)
@@ -217,16 +228,24 @@
         continue;
 
       const gchar **headers = (i == 1) ? headers_pass1 : headers_pass0;
+      notmuch_messages_t *messages = NULL;
+
+#if LIBNOTMUCH_MAJOR_VERSION >= 4 && LIBNOTMUCH_MINOR_VERSION >= 3
+      if (notmuch_query_search_messages_st (queries[i], &messages) != NOTMUCH_STATUS_SUCCESS)
+          continue;
+#else
+      if (!(messages = notmuch_query_search_messages (queries[i])))
+          continue;
+#endif
 
-      for (notmuch_messages_t *messages = notmuch_query_search_messages (queries[i]);
-           notmuch_messages_valid (messages);
-           notmuch_messages_move_to_next (messages))
-        {
+      for (; notmuch_messages_valid (messages); notmuch_messages_move_to_next (messages)) {
           notmuch_message_t *msg = notmuch_messages_get (messages);
 
-          for (guint i = 0; headers[i] != NULL; i++)
+          for (guint j = 0; headers[j] != NULL; j++)
             {
-              const gchar* froms = notmuch_message_get_header (msg, headers[i]);
+              const gchar* froms = notmuch_message_get_header (msg, headers[j]);
+              if (!froms || *froms == '\0')
+                continue;
 
               GMatchInfo *matches;
               g_regex_match (match_re, froms, 0, &matches);
diff -Nru notmuch-addrlookup-5/README.md notmuch-addrlookup-8/README.md
--- notmuch-addrlookup-5/README.md	2015-06-05 08:02:50.000000000 -0300
+++ notmuch-addrlookup-8/README.md	2017-02-07 06:24:11.000000000 -0400
@@ -58,7 +58,7 @@
 ### Emacs UI
 
 The Emacs Notmuch UI
-[can be configured](http://notmuchmail.org/emacstips/#index15h2)
+[can be configured](http://notmuchmail.org/emacstips/#index13h2)
 to use the tool for completing addresses when composing.
 
 ### Mutt
@@ -70,6 +70,25 @@
 set query_command="notmuch-addrlookup --mutt '%s'"
 ```
 
+### alot
+
+The [alot](https://github.com/pazz/alot) MUA can be configured to use
+`notmuch-addrlookup`, using an `[accounts]` section in the configuration
+file similar to this:
+
+```
+[accounts]
+  [[youraccountname]]
+    realname = Your Name
+    address = y...@address.com
+    ...
+    [[[abook]]]
+      type = shellcommand
+      regexp = '^(?P<email>[^@]+@[^\t]+)\t+(?P<name>[^\t]+)'
+      command = notmuch-addrlookup --mutt
+      ignorecase = True
+```
+
 
 ## License
 

Reply via email to