switch (op)
{
+ case 'a':
+ mutt_format_s(buf, buflen, prec, alias->name);
+ break;
case 'f':
snprintf(fmt, sizeof(fmt), "%%%ss", prec);
snprintf(buf, buflen, fmt, alias->del ? "D" : " ");
break;
- case 'a':
- mutt_format_s(buf, buflen, prec, alias->name);
+ case 'n':
+ snprintf(fmt, sizeof(fmt), "%%%sd", prec);
+ snprintf(buf, buflen, fmt, alias->num + 1);
break;
case 'r':
adr[0] = '\0';
snprintf(fmt, sizeof(fmt), "%%%ss", prec);
snprintf(buf, buflen, fmt, adr);
break;
- case 'n':
- snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, alias->num + 1);
- break;
case 't':
buf[0] = alias->tagged ? '*' : ' ';
buf[1] = '\0';
snprintf(buf, buflen, fmt, folder->num + 1);
break;
+ case 'd':
+ if (folder->ff->nd->desc)
+ {
+ char *desc = mutt_str_strdup(folder->ff->nd->desc);
+ if (NewsgroupsCharset && *NewsgroupsCharset)
+ mutt_convert_string(&desc, NewsgroupsCharset, Charset, MUTT_ICONV_HOOK_FROM);
+ mutt_filter_unprintable(&desc);
+
+ snprintf(fmt, sizeof(fmt), "%%%ss", prec);
+ snprintf(buf, buflen, fmt, desc);
+ FREE(&desc);
+ }
+ else
+ {
+ snprintf(fmt, sizeof(fmt), "%%%ss", prec);
+ snprintf(buf, buflen, fmt, "");
+ }
+ break;
+
case 'f':
strncpy(fn, folder->ff->name, sizeof(fn) - 1);
snprintf(fmt, sizeof(fmt), "%%%ss", prec);
snprintf(buf, buflen, fmt, fn);
break;
- case 'N':
- snprintf(fmt, sizeof(fmt), "%%%sc", prec);
- if (folder->ff->nd->subscribed)
- snprintf(buf, buflen, fmt, ' ');
- else
- snprintf(buf, buflen, fmt, folder->ff->new ? 'N' : 'u');
- break;
-
case 'M':
snprintf(fmt, sizeof(fmt), "%%%sc", prec);
if (folder->ff->nd->deleted)
snprintf(buf, buflen, fmt, folder->ff->nd->allowed ? ' ' : '-');
break;
+ case 'N':
+ snprintf(fmt, sizeof(fmt), "%%%sc", prec);
+ if (folder->ff->nd->subscribed)
+ snprintf(buf, buflen, fmt, ' ');
+ else
+ snprintf(buf, buflen, fmt, folder->ff->new ? 'N' : 'u');
+ break;
+
case 's':
if (flags & MUTT_FORMAT_OPTIONAL)
{
snprintf(buf, buflen, fmt, folder->ff->nd->unread);
}
break;
-
- case 'd':
- if (folder->ff->nd->desc)
- {
- char *desc = mutt_str_strdup(folder->ff->nd->desc);
- if (NewsgroupsCharset && *NewsgroupsCharset)
- mutt_convert_string(&desc, NewsgroupsCharset, Charset, MUTT_ICONV_HOOK_FROM);
- mutt_filter_unprintable(&desc);
-
- snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- snprintf(desc, buflen, fmt, desc);
- FREE(&desc);
- }
- else
- {
- snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- snprintf(buf, buflen, fmt, "");
- }
- break;
}
return src;
}
switch (tolower(op))
{
- case '[':
- {
- const char *cp = NULL;
- char buf2[SHORT_STRING], *p = NULL;
- int do_locales;
- struct tm *tm = NULL;
- size_t len;
-
- p = buf;
-
- cp = src;
- if (*cp == '!')
- {
- do_locales = 0;
- cp++;
- }
- else
- do_locales = 1;
-
- len = buflen - 1;
- while (len > 0 && *cp != ']')
+ case 'a':
+ if (!optional)
{
- if (*cp == '%')
- {
- cp++;
- if (len >= 2)
- {
- *p++ = '%';
- *p++ = *cp;
- len -= 2;
- }
- else
- break; /* not enough space */
- cp++;
- }
+ snprintf(fmt, sizeof(fmt), "%%%s.3s", prec);
+ if (key->kobj->subkeys)
+ s = gpgme_pubkey_algo_name(key->kobj->subkeys->pubkey_algo);
else
- {
- *p++ = *cp++;
- len--;
- }
+ s = "?";
+ snprintf(buf, buflen, fmt, s);
}
- *p = 0;
+ break;
+ case 'c':
+ if (!optional)
{
- time_t tt = 0;
-
- if (key->kobj->subkeys && (key->kobj->subkeys->timestamp > 0))
- tt = key->kobj->subkeys->timestamp;
-
- tm = localtime(&tt);
+ snprintf(fmt, sizeof(fmt), "%%%ss", prec);
+ snprintf(buf, buflen, fmt, crypt_key_abilities(kflags));
}
+ else if (!(kflags & (KEYFLAG_ABILITIES)))
+ optional = 0;
+ break;
- if (!do_locales)
- setlocale(LC_TIME, "C");
- strftime(buf2, sizeof(buf2), buf, tm);
- if (!do_locales)
- setlocale(LC_TIME, "");
-
- snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- snprintf(buf, buflen, fmt, buf2);
- if (len > 0)
- src = cp + 1;
- }
- break;
- case 'n':
+ case 'f':
if (!optional)
{
- snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, entry->num);
+ snprintf(fmt, sizeof(fmt), "%%%sc", prec);
+ snprintf(buf, buflen, fmt, crypt_flags(kflags));
}
+ else if (!(kflags & (KEYFLAG_RESTRICTIONS)))
+ optional = 0;
break;
+
case 'k':
if (!optional)
{
snprintf(buf, buflen, fmt, crypt_keyid(key));
}
break;
- case 'u':
- if (!optional)
- {
- snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- snprintf(buf, buflen, fmt, key->uid);
- }
- break;
- case 'a':
- if (!optional)
- {
- snprintf(fmt, sizeof(fmt), "%%%s.3s", prec);
- if (key->kobj->subkeys)
- s = gpgme_pubkey_algo_name(key->kobj->subkeys->pubkey_algo);
- else
- s = "?";
- snprintf(buf, buflen, fmt, s);
- }
- break;
+
case 'l':
if (!optional)
{
snprintf(buf, buflen, fmt, val);
}
break;
- case 'f':
+
+ case 'n':
if (!optional)
{
- snprintf(fmt, sizeof(fmt), "%%%sc", prec);
- snprintf(buf, buflen, fmt, crypt_flags(kflags));
+ snprintf(fmt, sizeof(fmt), "%%%sd", prec);
+ snprintf(buf, buflen, fmt, entry->num);
}
- else if (!(kflags & (KEYFLAG_RESTRICTIONS)))
- optional = 0;
break;
- case 'c':
- if (!optional)
- {
- snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- snprintf(buf, buflen, fmt, crypt_key_abilities(kflags));
- }
- else if (!(kflags & (KEYFLAG_ABILITIES)))
- optional = 0;
+
+ case 'p':
+ snprintf(fmt, sizeof(fmt), "%%%ss", prec);
+ snprintf(buf, buflen, fmt, gpgme_get_protocol_name(key->kobj->protocol));
break;
+
case 't':
if ((kflags & KEYFLAG_ISX509))
s = "x";
snprintf(fmt, sizeof(fmt), "%%%sc", prec);
snprintf(buf, buflen, fmt, *s);
break;
- case 'p':
- snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- snprintf(buf, buflen, fmt, gpgme_get_protocol_name(key->kobj->protocol));
+
+ case 'u':
+ if (!optional)
+ {
+ snprintf(fmt, sizeof(fmt), "%%%ss", prec);
+ snprintf(buf, buflen, fmt, key->uid);
+ }
break;
+ case '[':
+ {
+ const char *cp = NULL;
+ char buf2[SHORT_STRING], *p = NULL;
+ int do_locales;
+ struct tm *tm = NULL;
+ size_t len;
+
+ p = buf;
+
+ cp = src;
+ if (*cp == '!')
+ {
+ do_locales = 0;
+ cp++;
+ }
+ else
+ do_locales = 1;
+
+ len = buflen - 1;
+ while (len > 0 && *cp != ']')
+ {
+ if (*cp == '%')
+ {
+ cp++;
+ if (len >= 2)
+ {
+ *p++ = '%';
+ *p++ = *cp;
+ len -= 2;
+ }
+ else
+ break; /* not enough space */
+ cp++;
+ }
+ else
+ {
+ *p++ = *cp++;
+ len--;
+ }
+ }
+ *p = 0;
+
+ {
+ time_t tt = 0;
+
+ if (key->kobj->subkeys && (key->kobj->subkeys->timestamp > 0))
+ tt = key->kobj->subkeys->timestamp;
+
+ tm = localtime(&tt);
+ }
+
+ if (!do_locales)
+ setlocale(LC_TIME, "C");
+ strftime(buf2, sizeof(buf2), buf, tm);
+ if (!do_locales)
+ setlocale(LC_TIME, "");
+
+ snprintf(fmt, sizeof(fmt), "%%%ss", prec);
+ snprintf(buf, buflen, fmt, buf2);
+ if (len > 0)
+ src = cp + 1;
+ }
+ break;
+
default:
*buf = '\0';
}
switch (op)
{
- case 'n':
+ case 'a':
if (!optional)
{
- snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, remailer->num);
+ snprintf(fmt, sizeof(fmt), "%%%ss", prec);
+ snprintf(buf, buflen, fmt, NONULL(remailer->addr));
}
+ else if (!remailer->addr)
+ optional = 0;
break;
+
case 'c':
if (!optional)
{
snprintf(buf, buflen, fmt, mix_format_caps(remailer));
}
break;
- case 's':
+
+ case 'n':
if (!optional)
{
- snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- snprintf(buf, buflen, fmt, NONULL(remailer->shortname));
+ snprintf(fmt, sizeof(fmt), "%%%sd", prec);
+ snprintf(buf, buflen, fmt, remailer->num);
}
- else if (!remailer->shortname)
- optional = 0;
break;
- case 'a':
+
+ case 's':
if (!optional)
{
snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- snprintf(buf, buflen, fmt, NONULL(remailer->addr));
+ snprintf(buf, buflen, fmt, NONULL(remailer->shortname));
}
- else if (!remailer->addr)
+ else if (!remailer->shortname)
optional = 0;
break;