📄 hdrline.c
字号:
else break; /* not enough space */ } cp++; } else { *p++ = *cp++; len--; } } *p = 0; if (do_locales && Locale) setlocale (LC_TIME, Locale); if (op == '[' || op == 'D') tm = localtime (&hdr->date_sent); else if (op == '(') tm = localtime (&hdr->received); else if (op == '<') { T = time (NULL); tm = localtime (&T); } else { /* restore sender's time zone */ T = hdr->date_sent; if (hdr->zoccident) T -= (hdr->zhours * 3600 + hdr->zminutes * 60); else T += (hdr->zhours * 3600 + hdr->zminutes * 60); tm = gmtime (&T); } strftime (buf2, sizeof (buf2), dest, tm); if (do_locales) setlocale (LC_TIME, "C"); mutt_format_s (dest, destlen, prefix, buf2); if (len > 0 && op != 'd' && op != 'D') /* Skip ending op */ src = cp + 1; } break; case 'e': snprintf (fmt, sizeof (fmt), "%%%sd", prefix); snprintf (dest, destlen, fmt, mutt_messages_in_thread(ctx, hdr, 1)); break; case 'E': if (!optional) { snprintf (fmt, sizeof (fmt), "%%%sd", prefix); snprintf (dest, destlen, fmt, mutt_messages_in_thread(ctx, hdr, 0)); } else if (mutt_messages_in_thread(ctx, hdr, 0) <= 1) optional = 0; break; case 'f': buf2[0] = 0; rfc822_write_address (buf2, sizeof (buf2), hdr->env->from, 1); mutt_format_s (dest, destlen, prefix, buf2); break; case 'F': if (!optional) { make_from (hdr->env, buf2, sizeof (buf2), 0); mutt_format_s (dest, destlen, prefix, buf2); } else if (mutt_addr_is_user (hdr->env->from)) optional = 0; break; case 'H': /* (Hormel) spam score */ if (optional) optional = hdr->env->spam ? 1 : 0; if (hdr->env->spam) mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->spam->data)); else mutt_format_s (dest, destlen, prefix, ""); break; case 'i': mutt_format_s (dest, destlen, prefix, hdr->env->message_id ? hdr->env->message_id : "<no.id>"); break; case 'l': if (!optional) { snprintf (fmt, sizeof (fmt), "%%%sd", prefix); snprintf (dest, destlen, fmt, (int) hdr->lines); } else if (hdr->lines <= 0) optional = 0; break; case 'L': if (!optional) { make_from (hdr->env, buf2, sizeof (buf2), 1); mutt_format_s (dest, destlen, prefix, buf2); } else if (!check_for_mailing_list (hdr->env->to, NULL, NULL, 0) && !check_for_mailing_list (hdr->env->cc, NULL, NULL, 0)) { optional = 0; } break; case 'm': if(ctx) { snprintf (fmt, sizeof (fmt), "%%%sd", prefix); snprintf (dest, destlen, fmt, ctx->msgcount); } else strfcpy(dest, "(null)", destlen); break; case 'n': mutt_format_s (dest, destlen, prefix, mutt_get_name (hdr->env->from)); break; case 'N': if (!optional) { snprintf (fmt, sizeof (fmt), "%%%sd", prefix); snprintf (dest, destlen, fmt, hdr->score); } else { if (hdr->score == 0) optional = 0; } break; case 'O': if (!optional) { make_from_addr (hdr->env, buf2, sizeof (buf2), 1); if (!option (OPTSAVEADDRESS) && (p = strpbrk (buf2, "%@"))) *p = 0; mutt_format_s (dest, destlen, prefix, buf2); } else if (!check_for_mailing_list_addr (hdr->env->to, NULL, 0) && !check_for_mailing_list_addr (hdr->env->cc, NULL, 0)) { optional = 0; } break; case 'M': snprintf (fmt, sizeof (fmt), "%%%sd", prefix); if (!optional) { if (threads && is_index && hdr->collapsed && hdr->num_hidden > 1) snprintf (dest, destlen, fmt, hdr->num_hidden); else if (is_index && threads) mutt_format_s (dest, destlen, prefix, " "); else *dest = '\0'; } else { if (!(threads && is_index && hdr->collapsed && hdr->num_hidden > 1)) optional = 0; } break; case 's': if (flags & M_FORMAT_TREE && !hdr->collapsed) { if (flags & M_FORMAT_FORCESUBJ) { mutt_format_s (dest, destlen, "", NONULL (hdr->env->subject)); snprintf (buf2, sizeof (buf2), "%s%s", hdr->tree, dest); mutt_format_s_tree (dest, destlen, prefix, buf2); } else mutt_format_s_tree (dest, destlen, prefix, hdr->tree); } else mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->subject)); break; case 'S': if (hdr->deleted) ch = 'D'; else if (hdr->attach_del) ch = 'd'; else if (hdr->tagged) ch = '*'; else if (hdr->flagged) ch = '!'; else if (hdr->replied) ch = 'r'; else if (hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno)) ch = '-'; else if (hdr->old) ch = 'O'; else ch = 'N'; /* FOO - this is probably unsafe, but we are not likely to have such a short string passed into this routine */ *dest = ch; *(dest + 1) = 0; break; case 't': buf2[0] = 0; if (!check_for_mailing_list (hdr->env->to, "To ", buf2, sizeof (buf2)) && !check_for_mailing_list (hdr->env->cc, "Cc ", buf2, sizeof (buf2))) { if (hdr->env->to) snprintf (buf2, sizeof (buf2), "To %s", mutt_get_name (hdr->env->to)); else if (hdr->env->cc) snprintf (buf2, sizeof (buf2), "Cc %s", mutt_get_name (hdr->env->cc)); } mutt_format_s (dest, destlen, prefix, buf2); break; case 'T': snprintf (fmt, sizeof (fmt), "%%%sc", prefix); snprintf (dest, destlen, fmt, (Tochars && ((i = mutt_user_is_recipient (hdr))) < mutt_strlen (Tochars)) ? Tochars[i] : ' '); break; case 'u': if (hdr->env->from && hdr->env->from->mailbox) { strfcpy (buf2, mutt_addr_for_display (hdr->env->from), sizeof (buf2)); if ((p = strpbrk (buf2, "%@"))) *p = 0; } else buf2[0] = 0; mutt_format_s (dest, destlen, prefix, buf2); break; case 'v': if (mutt_addr_is_user (hdr->env->from)) { if (hdr->env->to) mutt_format_s (buf2, sizeof (buf2), prefix, mutt_get_name (hdr->env->to)); else if (hdr->env->cc) mutt_format_s (buf2, sizeof (buf2), prefix, mutt_get_name (hdr->env->cc)); else *buf2 = 0; } else mutt_format_s (buf2, sizeof (buf2), prefix, mutt_get_name (hdr->env->from)); if ((p = strpbrk (buf2, " %@"))) *p = 0; mutt_format_s (dest, destlen, prefix, buf2); break; case 'Z': ch = ' '; if (WithCrypto && hdr->security & GOODSIGN) ch = 'S'; else if (WithCrypto && hdr->security & ENCRYPT) ch = 'P'; else if (WithCrypto && hdr->security & SIGN) ch = 's'; else if ((WithCrypto & APPLICATION_PGP) && hdr->security & PGPKEY) ch = 'K'; snprintf (buf2, sizeof (buf2), "%c%c%c", (THREAD_NEW ? 'n' : (THREAD_OLD ? 'o' : ((hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno)) ? (hdr->replied ? 'r' : ' ') : (hdr->old ? 'O' : 'N')))), hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch), hdr->tagged ? '*' : (hdr->flagged ? '!' : (Tochars && ((i = mutt_user_is_recipient (hdr)) < mutt_strlen (Tochars)) ? Tochars[i] : ' '))); mutt_format_s (dest, destlen, prefix, buf2); break; case 'X': { int count = mutt_count_body_parts (ctx, hdr); /* The recursion allows messages without depth to return 0. */ if (optional) optional = count != 0; snprintf (fmt, sizeof (fmt), "%%%sd", prefix); snprintf (dest, destlen, fmt, count); } break; case 'y': if (optional) optional = hdr->env->x_label ? 1 : 0; mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->x_label)); break; case 'Y': if (hdr->env->x_label) { i = 1; /* reduce reuse recycle */ htmp = NULL; if (flags & M_FORMAT_TREE && (hdr->thread->prev && hdr->thread->prev->message && hdr->thread->prev->message->env->x_label)) htmp = hdr->thread->prev->message; else if (flags & M_FORMAT_TREE && (hdr->thread->parent && hdr->thread->parent->message && hdr->thread->parent->message->env->x_label)) htmp = hdr->thread->parent->message; if (htmp && mutt_strcasecmp (hdr->env->x_label, htmp->env->x_label) == 0) i = 0; } else i = 0; if (optional) optional = i; if (i) mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->x_label)); else mutt_format_s (dest, destlen, prefix, ""); break; default: snprintf (dest, destlen, "%%%s%c", prefix, op); break; } if (optional) mutt_FormatString (dest, destlen, ifstring, hdr_format_str, (unsigned long) hfi, flags); else if (flags & M_FORMAT_OPTIONAL) mutt_FormatString (dest, destlen, elsestring, hdr_format_str, (unsigned long) hfi, flags); return (src);#undef THREAD_NEW#undef THREAD_OLD}void_mutt_make_string (char *dest, size_t destlen, const char *s, CONTEXT *ctx, HEADER *hdr, format_flag flags){ struct hdr_format_info hfi; hfi.hdr = hdr; hfi.ctx = ctx; mutt_FormatString (dest, destlen, s, hdr_format_str, (unsigned long) &hfi, flags);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -