On Sun, Jan 29, 2012 at 01:28:33AM -0700, Todd Hoffmann wrote:
It seems like it would be easiest to just put the labels in the x-label field. I started digging into the mutt code to implement this and encountered some issues. The patch I've included does make the labels appear in the message index if I include %y in the index_format setting, but some seem to be encoded. I tried to figure out if I need to use rfc2047_decode or something, but I haven't gotten anything to work so
I haven't looked at how the gmail labels work, but if they look of the form ?Q?UTF-8?something?= then you can use rfc2047_decode() to handle them at the time they are parsed.
far. Worse still, it segfaults when changing from the inbox to some (not all) other imap folders. static int msg_parse_fetch (IMAP_HEADER *h, char *s) { char tmp[SHORT_STRING]; + char buffer[LONG_STRING]; char *ptmp; if (!s) @@ -1137,6 +1139,22 @@ static int msg_parse_fetch (IMAP_HEADER { SKIPWS (s); + if (ascii_strncasecmp ("X-GM-LABELS", s, 11) == 0) + { + s += 11; + SKIPWS (s); + ptmp = buffer; + s++; /* skip ( */ + while (*s && *s != ')') + *ptmp++ = *s++; + if (*s != ')') + return -1; + s++; /* skip ) */ + *ptmp = 0; + h->data->labels = buffer;
you need to use safe_strdup() to make a copy of the string. you are trying to return a pointer to an automatic variable, which will be invalid once you exit the function.
note that you will also need to edit the function that frees up the data associated with that structure, by adding a
FREE(&h->data->labels) call.