[notmuch] Debian packaging

2009-11-29 Thread da...@tethera.net
Jameson Graef Rollins wrote:


>I'm happy to combine efforts.  Seems to me the most appropriate thing
>to do, since we're already working in git, is to track each others
>"debian" branches.  Is this the canonical URL of your repo?:

>http://pivot.cs.unb.ca/git/notmuch.git

That should work, but git://pivot.cs.unb.ca/git/notmuch.git, should be
faster (at least since I fixed the firewall!).

d


[notmuch] [PATCH 2/3] add checking for zlib development libraries to configure script

2009-11-29 Thread Mikhail Gusarov

Twas brillig at 18:57:36 28.11.2009 UTC-05 when jrollins at finestructure.net 
did gyre and gimble:

 JGR> + sudo apt-get install libxapian-dev libgmime-2.4-dev
 JGR> libtalloc-dev libz-dev

Proper fix is to fix libgmime-2.4.pc upstream to stop exposing -lz

-- 
  http://fossarchy.blogspot.com/
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20091129/7dd788c7/attachment.pgp>


[notmuch] OpenPGP support

2009-11-29 Thread Jameson Graef Rollins
On Thu, Nov 26, 2009 at 10:41:36AM -0800, Carl Worth wrote:
> On Mon, 23 Nov 2009 08:00:09 -0500, Jameson Graef Rollins  finestructure.net> wrote:
> > Hi, folks.  I know it's a hairy problem, but has anyone started
> > looking into OpenPGP support for notmuch?
> 
> I definitely want this.

Thanks so much for this response, Carl.  I'm glad to hear there's
other interest in the this.

> I've got message-mode setup to sign my messages automatically when I
> start a new compose from within notmuch with 'm'. I did this with the
> following in my .emacs:
> 
> ; sign messages by default
> (add-hook 'message-setup-hook
> (lambda ()
>   (mml-secure-message-sign)))
>
> I'm not sure how to make sure that I also get that when doing a reply
> within notmuch. Keith, I think you worked this out, right? What did you
> do?

Ah, this is a great suggestion.  Thank you.  I saw Keith's reply as
well, which also works great with replies.

> Meanwhile, the other pieces still needed are automatic signature
> verification for multipart/signed messages, and then support for
> decrypting GPG-encrypted messages.

So I think this is maybe the most important thing missing from notmuch
right now.  I would really really like to see this working.
Unfortunately my emacs/lisp skills are poor to say the least.  I'll
try to look into how gnus or other emacs mail interfaces handle this
stuff, but if anyone else has any pointers for the list that would be
great.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20091129/a5f8ae07/attachment.pgp>


[notmuch] Debian packaging

2009-11-29 Thread Jameson Graef Rollins
On Sun, Nov 29, 2009 at 11:06:34AM -0700, Bdale Garbee wrote:
> Actually, since Carl is a DD now, I've already nudged him about
> maintaining a Debian package, and offered to help.  Perhaps your work
> will provide additional motivation.  ;-)

Yeah, I realized that Carl and Keith are I think both DDs, but as
someone else pointed out to me, they've probably already got their
hands full as it is.  In any rate, building the packaging was mostly
for my own elucidation (I have never used git-buildpackage before),
and to prompt getting it into debian sooner.

> FWIW, it's entirely possible to configure git-buildpackage to package
> directly from the master branch.  I do that with AltOS, details can be
> found in the fw/altos repo on git.gag.com if you're curious.  There are
> various ways you could do this, but I've put a hook in .gbp.conf that
> invokes a new debian/rules 'prebuild' target...  This allows me to just
> run 'git-buildpackage' any time we want fresh packages, and get a Debian
> changelog crafted from the git commit logs since the last time I built a
> Debian package.

What I put together does build almost directly from the master
branch.  I just renamed my master "upstream".  I did create a separate
changelog, mostly because I like having more direct control over what
goes in them, but I'm curious about how changelogs would be crafted
from the git logs.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20091129/ff4d4ea6/attachment-0001.pgp>


[notmuch] Debian packaging

2009-11-29 Thread David Bremner

Jameson Graef Rollins wrote:


>Please let me know if there are any questions, comments, patches, etc.

>jamie.

>[0] I noticed that David Bremner filled a RFP for notmuch a little
>while ago: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=557354

I should have mentioned on the RFP, but I have also made a debian package at 

  http://pivot.cs.unb.ca/git/?p=notmuch.git;a=shortlog;h=refs/heads/debian

We should combine efforts somehow I guess.  One option would be to
make a combined repo on alioth.debian.org in the collab-maint project.

d


[notmuch] Debian packaging

2009-11-29 Thread Bdale Garbee
On Sun, 2009-11-29 at 08:55 -0500, Jameson Graef Rollins wrote:

> As much as I would love to, at this point I'm not quite offering to
> actually be maintainer of a notmuch Debian package. 

Actually, since Carl is a DD now, I've already nudged him about
maintaining a Debian package, and offered to help.  Perhaps your work
will provide additional motivation.  ;-)

FWIW, it's entirely possible to configure git-buildpackage to package
directly from the master branch.  I do that with AltOS, details can be
found in the fw/altos repo on git.gag.com if you're curious.  There are
various ways you could do this, but I've put a hook in .gbp.conf that
invokes a new debian/rules 'prebuild' target...  This allows me to just
run 'git-buildpackage' any time we want fresh packages, and get a Debian
changelog crafted from the git commit logs since the last time I built a
Debian package.

Bdale




[notmuch] [PATCH v3] Add the beginnings of a test suite.

2009-11-29 Thread Jeffrey Ollie
On Sun, Nov 29, 2009 at 8:08 AM, Jameson Graef Rollins
 wrote:
> On Sat, Nov 28, 2009 at 03:33:14PM -0600, Jeffrey C. Ollie wrote:
>> Run "make check" from the toplevel directory to build and run the
>> checks.
>
> I think it's usually standard to call the tests with "make test", yes?
> Is there a reason to call them with "make check" instead?

There's no special reason to call it "make check".  If that's the
consensus I'm willing to change it.

-- 
Jeff Ollie


[notmuch] [PATCH v3] Add the beginnings of a test suite.

2009-11-29 Thread Jameson Graef Rollins
On Sat, Nov 28, 2009 at 03:33:14PM -0600, Jeffrey C. Ollie wrote:
> This is the beginning of a test suite.  It uses the Check[1] unit
> testing framework to handle the testing.  There are basic tests of the
> SHA1 and tag manipulation routines, obviously many more will need to
> be added.

Hey, Jeffrey.  I'm very glad to see someone starting to put together a
test suite.  They're usually a pain in the ass to put together, but
definitely a very very good thing to have.

> Run "make check" from the toplevel directory to build and run the
> checks.

I think it's usually standard to call the tests with "make test", yes?
Is there a reason to call them with "make check" instead?

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20091129/14de9c57/attachment.pgp>


[notmuch] [PATCH 2/3] add checking for zlib development libraries to configure script

2009-11-29 Thread da...@tethera.net

Mikhail Gusarov wrote:

>Twas brillig at 18:57:36 28.11.2009 UTC-05 when jrollins at finestructure.net 
>did gyre and gimble:

> JGR> + sudo apt-get install libxapian-dev libgmime-2.4-dev
> JGR> libtalloc-dev libz-dev

>Proper fix is to fix libgmime-2.4.pc upstream to stop exposing -lz

This is now upstream bug  

 https://bugzilla.gnome.org/show_bug.cgi?id=603273

People more knowledgable in the ways of pkg-config are welcome to
chime in if I said something wrong or misleading.

d



[notmuch] [PATCH 2/2] notmuch-reply.c: Handle munged `Reply-To' headers.

2009-11-29 Thread Jed Brown
Some mailing lists engage in the evil practice of changing the Reply-To
header so that replies from all mailers go to the list by default, at
the expense of not responding to the person who actually sent the
message.  When this is detected, we reply to `From' and remove the
duplicate response to the mailing list.  Consider a reply to the
following message.

  From: Some User 
  To: Sample users list 
  Reply-To: Sample users list 

Prior to this patch, `notmuch reply' produces

  To: Sample users list ,
  Sample users list 

and after the patch,

  To: Some User ,
  Sample users list 

Signed-off-by: Jed Brown 
---
 notmuch-reply.c |   47 ++-
 1 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index b91a830..9b9e9ab 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -182,6 +182,39 @@ add_recipients_for_string (GMimeMessage *message,
 return add_recipients_for_address_list (message, config, type, list);
 }

+/* Some mailing lists munge the Reply-To header despite it being A Bad
+ * Thing, see http://www.unicom.com/pw/reply-to-harmful.html
+ *
+ * This function detects such munging so that reasonable headers can be
+ * generated anyway.  Returns 1 if munged, else 0.
+ *
+ * The current logic is fairly naive, Reply-To is diagnosed as munged if
+ * it contains exactly one address, and this address is also present in
+ * the To or Cc fields.
+ */
+static int
+mailing_list_munged_reply_to (notmuch_message_t *message)
+{
+const char *header, *addr;
+InternetAddressList *list;
+InternetAddress *address;
+InternetAddressMailbox *mailbox;
+
+header = notmuch_message_get_header (message, "reply-to");
+list = internet_address_list_parse_string (header);
+if (internet_address_list_length (list) != 1)
+   return 0;
+address = internet_address_list_get_address (list, 0);
+if (INTERNET_ADDRESS_IS_GROUP (address))
+   return 0;
+mailbox = INTERNET_ADDRESS_MAILBOX (address);
+addr = internet_address_mailbox_get_addr (mailbox);
+/* Note that strcasestr() is a GNU extension, strstr() might be sufficient 
*/
+if (strcasestr (notmuch_message_get_header (message, "to"), addr) == 0 ||
+   strcasestr (notmuch_message_get_header (message, "cc"), addr) == 0)
+   return 1;
+return 0; }
+
 /* Augments the recipients of reply from the headers of message.
  *
  * If any of the user's addresses were found in these headers, the first
@@ -192,7 +225,7 @@ add_recipients_from_message (GMimeMessage *reply,
 notmuch_config_t *config,
 notmuch_message_t *message)
 {
-static const struct {
+struct {
const char *header;
const char *fallback;
GMimeRecipientType recipient_type;
@@ -205,6 +238,18 @@ add_recipients_from_message (GMimeMessage *reply,
 const char *from_addr = NULL;
 unsigned int i;

+/* When we have detected Reply-To munging, we ignore the Reply-To
+ * field (because it appears in the To or Cc headers) and use the
+ * From header so that person will get pinged and will actually
+ * receive the response if not subscribed to the list.  Note that
+ * under no circumstances does this fail to reply to the address in
+ * the Reply-To header.
+ */
+if (mailing_list_munged_reply_to (message)) {
+   reply_to_map[0].header = "from";
+   reply_to_map[0].fallback = NULL;
+}
+
 for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
const char *addr, *recipients;

-- 
1.6.5.3



[notmuch] [PATCH 1/2] notmuch-reply.c: factor adding recipients into common function

2009-11-29 Thread Jed Brown
add_recipients_from_message, in order to isolate more sophisticated
mailing list logic.

Signed-off-by: Jed Brown 
---
 notmuch-reply.c |   88 ---
 1 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 9ca1236..b91a830 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -23,17 +23,6 @@
 #include "notmuch-client.h"
 #include "gmime-filter-reply.h"

-static const struct {
-const char *header;
-const char *fallback;
-GMimeRecipientType recipient_type;
-} reply_to_map[] = {
-{ "reply-to", "from", GMIME_RECIPIENT_TYPE_TO  },
-{ "to", NULL, GMIME_RECIPIENT_TYPE_TO  },
-{ "cc", NULL, GMIME_RECIPIENT_TYPE_CC  },
-{ "bcc",NULL, GMIME_RECIPIENT_TYPE_BCC }
-};
-
 static void
 reply_part_content (GMimeObject *part)
 {
@@ -193,16 +182,56 @@ add_recipients_for_string (GMimeMessage *message,
 return add_recipients_for_address_list (message, config, type, list);
 }

+/* Augments the recipients of reply from the headers of message.
+ *
+ * If any of the user's addresses were found in these headers, the first
+ * of these returned, otherwise NULL is returned.
+ */
+static const char *
+add_recipients_from_message (GMimeMessage *reply,
+notmuch_config_t *config,
+notmuch_message_t *message)
+{
+static const struct {
+   const char *header;
+   const char *fallback;
+   GMimeRecipientType recipient_type;
+} reply_to_map[] = {
+   { "reply-to", "from", GMIME_RECIPIENT_TYPE_TO  },
+   { "to", NULL, GMIME_RECIPIENT_TYPE_TO  },
+   { "cc", NULL, GMIME_RECIPIENT_TYPE_CC  },
+   { "bcc",NULL, GMIME_RECIPIENT_TYPE_BCC }
+};
+const char *from_addr = NULL;
+unsigned int i;
+
+for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
+   const char *addr, *recipients;
+
+   recipients = notmuch_message_get_header (message,
+reply_to_map[i].header);
+   if ((recipients == NULL || recipients[0] == '\0') && 
reply_to_map[i].fallback)
+   recipients = notmuch_message_get_header (message,
+reply_to_map[i].fallback);
+
+   addr = add_recipients_for_string (reply, config,
+ reply_to_map[i].recipient_type,
+ recipients);
+   if (from_addr == NULL)
+   from_addr = addr;
+}
+return from_addr;
+}
+
 static int
 notmuch_reply_format_default(void *ctx, notmuch_config_t *config, 
notmuch_query_t *query)
 {
 GMimeMessage *reply;
 notmuch_messages_t *messages;
 notmuch_message_t *message;
-const char *subject, *recipients, *from_addr = NULL;
+const char *subject, *from_addr = NULL;
 const char *in_reply_to, *orig_references, *references;
 char *reply_headers;
-unsigned int i;

 for (messages = notmuch_query_search_messages (query);
 notmuch_messages_has_more (messages);
@@ -223,21 +252,7 @@ notmuch_reply_format_default(void *ctx, notmuch_config_t 
*config, notmuch_query_
subject = talloc_asprintf (ctx, "Re: %s", subject);
g_mime_message_set_subject (reply, subject);

-   for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {
-   const char *addr;
-
-   recipients = notmuch_message_get_header (message,
-reply_to_map[i].header);
-   if ((recipients == NULL || recipients[0] == '\0') && 
reply_to_map[i].fallback)
-   recipients = notmuch_message_get_header (message,
-
reply_to_map[i].fallback);
-
-   addr = add_recipients_for_string (reply, config,
- reply_to_map[i].recipient_type,
- recipients);
-   if (from_addr == NULL)
-   from_addr = addr;
-   }
+   from_addr = add_recipients_from_message (reply, config, message);

if (from_addr == NULL)
from_addr = notmuch_config_get_user_primary_email (config);
@@ -290,9 +305,8 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
 GMimeMessage *reply;
 notmuch_messages_t *messages;
 notmuch_message_t *message;
-const char *recipients, *in_reply_to, *orig_references, *references;
+const char *in_reply_to, *orig_references, *references;
 char *reply_headers;
-unsigned int i;

 for (messages = notmuch_query_search_messages (query);
 notmuch_messages_has_more (messages);
@@ -326,19 +340,7 @@ notmuch_reply_format_headers_only(void *ctx, 
notmuch_config_t *config, notmuch_q
g_mime_object_set_header (GMIME_OBJECT (reply),
  "References", references);

-   for (i =