imap-send: Remove limitation on message body
There is a documented limitation on the body of any email not being able to contain lines starting with "From ". This patch removes that limitation by improving the parser to search for "From", "Date", and "Subject" fields in the email before considering it to be an email. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
Mar 22, 2010 at 23:37 UTC
4916c8f9535866210df6ec837ab910f3b8348784
2 files changed
+10
-8
Documentation/git-imap-send.txt
+3
-7
@@ -16,7 +16,9 @@ DESCRIPTION
16
This command uploads a mailbox generated with 'git format-patch'
17
into an IMAP drafts folder. This allows patches to be sent as
18
other email is when using mail clients that cannot read mailbox
19
-files directly.
19
+files directly. The command also works with any general mailbox
20
+in which emails have the fields "From", "Date", and "Subject" in
21
+that order.
22
23
Typical usage is something like:
24
@@ -118,12 +120,6 @@ Thunderbird in particular is known to be problematic. Thunderbird
120
users may wish to visit this web page for more information:
121
http://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
122
121
-
122
-BUGS
123
-----
124
-Doesn't handle lines starting with "From " in the message body.
125
-
126
-
123
Author
124
------
125
Derived from isync 1.0.1 by Mike McCormack.
imap-send.c
+7
-1
@@ -1306,8 +1306,14 @@ static int count_messages(struct msg_data *msg)
1306
1307
while (1) {
1308
if (!prefixcmp(p, "From ")) {
1309
+ p = strstr(p+5, "\nFrom: ");
1310
+ if (!p) break;
1311
+ p = strstr(p+7, "\nDate: ");
1312
+ if (!p) break;
1313
+ p = strstr(p+7, "\nSubject: ");
1314
+ if (!p) break;
1315
+ p += 10;
1316
count++;
1310
- p += 5;
1317
}
1318
p = strstr(p+5, "\nFrom ");
1319
if (!p)