-
Notifications
You must be signed in to change notification settings - Fork 9
/
mutt-1.5.23-gmail-labels.sgeb.v1.patch
77 lines (72 loc) · 2.35 KB
/
mutt-1.5.23-gmail-labels.sgeb.v1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
diff -Naur mutt-1.5.23.orig/imap/message.c mutt-1.5.23/imap/message.c
--- mutt-1.5.23.orig/imap/message.c 2014-03-12 13:03:45.000000000 -0300
+++ mutt-1.5.23/imap/message.c 2014-04-05 15:26:27.000000000 -0300
@@ -240,7 +240,7 @@
char *cmd;
fetchlast = msgend + 1;
- safe_asprintf (&cmd, "FETCH %d:%d (UID FLAGS INTERNALDATE RFC822.SIZE %s)",
+ safe_asprintf (&cmd, "FETCH %d:%d (UID FLAGS INTERNALDATE RFC822.SIZE X-GM-LABELS %s)",
msgno + 1, fetchlast, hdrreq);
imap_cmd_start (idata, cmd);
FREE (&cmd);
@@ -321,6 +321,7 @@
0, 0);
/* content built as a side-effect of mutt_read_rfc822_header */
ctx->hdrs[idx]->content->length = h.content_length;
+ ctx->hdrs[idx]->env->x_label = h.data->labels;
ctx->size += h.content_length;
#if USE_HCACHE
@@ -1139,6 +1140,44 @@
{
SKIPWS (s);
+ if (ascii_strncasecmp ("X-GM-LABELS", s, 11) == 0)
+ {
+ s += 11;
+ SKIPWS (s);
+ ptmp = tmp;
+ s++; /* skip ( */
+ while (*s && *s != ')')
+ {
+ if (ptmp-tmp == sizeof(tmp)/sizeof(char))
+ s++;
+ else if (ascii_strncasecmp ("\"\\\\Important\"", s, 13) == 0)
+ {
+ s += 13;
+ SKIPWS (s);
+ }
+ else if (ascii_strncasecmp ("\"\\\\Starred\"", s, 11) == 0)
+ {
+ s += 11;
+ SKIPWS (s);
+ }
+ else if (ascii_strncasecmp ("\"\\\\", s, 3) == 0)
+ s += 3;
+ else if (ascii_strncasecmp ("\"", s, 1) == 0)
+ s++;
+ else
+ *ptmp++ = *s++;
+
+ if (*s == ')' && *(ptmp-1) == ' ')
+ ptmp--;
+ }
+ if (*s != ')')
+ return -1;
+ s++; /* skip ) */
+ *ptmp = 0;
+ h->data->labels = safe_strdup(tmp);
+ SKIPWS (s);
+ }
+
if (ascii_strncasecmp ("FLAGS", s, 5) == 0)
{
if ((s = msg_parse_flags (h, s)) == NULL)
diff -Naur mutt-1.5.23.orig/imap/message.h mutt-1.5.23/imap/message.h
--- mutt-1.5.23.orig/imap/message.h 2014-03-12 13:03:45.000000000 -0300
+++ mutt-1.5.23/imap/message.h 2014-04-05 15:25:50.000000000 -0300
@@ -37,6 +37,8 @@
unsigned int parsed : 1;
unsigned int uid; /* 32-bit Message UID */
+ char *labels;
+
LIST *keywords;
} IMAP_HEADER_DATA;