git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Add git-imap-send.

From
Junio C Hamano <junkio@cox.net>
Date
Mar 9, 2006, 10:35 UTC
Message-ID
<7vacbz7vod.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<440C3499.9080000@codeweavers.com>
Mike McCormack <mike@codeweavers.com> writes:
> This probably needs a bit more work, but I'll solicit comments and
> flames anyway...
OK, then please work a bit more ;-)

I kind of like this approach and even wish my e-mail workflow involved an imap server with draft folders. Currently I do everything in Gnus and my drafts are on local disk.

Show 6 quoted lines
> The target IMAP folder:
>
> [imap]
>         Folder = "INBOX.Drafts"
>
> A command to open an ssh tunnel to the imap mail server.

The .git/config file is a good choice for storing this information, because you might even use different draft folders for different projects, i.e. the configuration is per-repository.

Show 8 quoted lines
> [imap]
>         Tunnel = "ssh -q user@imap.server.com /usr/bin/imapd ./Maildir
> 2> /dev/null"
> [imap]
> 	Host = imap.server.com
> 	User = bob
> 	Password = pwd
> 	Port = 143

These I am not so sure. It _might_ make sense to have something like this under $HOME/. Isn't there an established convention for storing something like this for existing MUAs?

Show 7 quoted lines
> + *  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.
> + *...
> + * As a special exception, mbsync may be linked with the OpenSSL library,
> + * despite that library's more restrictive license.
Hmmm.  
Show 5 quoted lines
> +#include <sys/types.h>
>...
> +#include <pwd.h>
> +
> +#include "cache.h"

If you are including "cache.h", you probably do not need to include many of the standard include files.

> +#define as(ar) (sizeof(ar)/sizeof(ar[0]))

We have something like this in apply.c, exec_cmd.c and git.c; probably we would want a macro in "cache.h".

	git.c:326:#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
Show 5 quoted lines
> +static int
> +git_imap_config(const char *key, const char *val)
> +{
>...
> +	if (!strcasecmp( "Folder", key )) {

git_config calls you after downcasing the keys, so you do not need to do strcasecmp. Just spell things out in lowercase.

> +		if (!memcmp( "imaps:", val, 6 )) {
> +			if (!memcmp( "imap:", val, 5 ))
Is val always longer than 5 or 6 bytes here?
Previous: Mike McCormackNext: Johannes Schindelin
Message 2 of 13 in “Add git-imap-send.”
  1. Add git-imap-send.Mike McCormack, Mar 6, 2006
  2. Junio C HamanoMar 9, 2006
  3. Johannes SchindelinMar 9, 2006
  4. Andreas EricssonMar 9, 2006
  5. Johannes SchindelinMar 9, 2006
  6. Mark WoodingMar 9, 2006
  7. Johannes SchindelinMar 9, 2006
  8. Mark WoodingMar 10, 2006
  9. Linus TorvaldsMar 9, 2006
  10. Junio C HamanoMar 9, 2006
  11. Linus TorvaldsMar 9, 2006
  12. Junio C HamanoMar 9, 2006
  13. Mike McCormackMar 10, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.