score.c send.c sendlib.c sort.c state.c thread.c account.c remailer.c
madmutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ \
- -Llib-lib -llib -Llib-mime -lmime -Llib-crypt -lcrypt -Llib-mx -lmx \
+ -Llib-mime -lmime -Llib-crypt -lcrypt -Llib-mx -lmx \
-Limap -limap -Lpop -lpop $(LIBNNTP) \
- -Llib-hash -lhash -Llib-sys -lsys -Llib-ui -lui \
+ -Llib-hash -lhash -Llib-sys -lsys -Llib-ui -lui -Llib-lib -llib \
$(MUTTLIBS) $(INTLLIBS) $(LIBICONV)
madmutt_DEPENDENCIES = @MUTT_LIB_OBJECTS@ @LIBOBJS@ \
0x00, 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
};
-static inline int ustrlen(const char *s)
+int m_ustrlen(const char *s)
{
int len = 0;
return len;
}
-static inline int ustrgetc(const char *s, const char **outp)
+int m_ustrgetc(const char *s, const char **outp)
{
uint32_t ret = 0;
int trail = __utf8_trail[(unsigned char)*s];
return ret - __utf8_offs[trail];
}
-static inline int ustrputc(char *dst, ssize_t n, int c)
+int m_ustrputc(char *dst, ssize_t n, int c)
{
int bytes = 1 + (c >= 0x80) + (c >= 0x800) + (c >= 0x10000);
/** \addtogroup mutt_strings */
/*@{*/
+int m_ustrlen(const char *s);
+int m_ustrgetc(const char *s, const char **outp);
+int m_ustrputc(char *dst, ssize_t n, int c);
+
+static inline char *m_vustrskipc(char *s) {
+ if (*s++ & 0x80) {
+ while ((*s & 0xc0) == 0x80)
+ s++;
+ }
+ return s;
+}
+
+static inline const char *m_ustrskipc(const char *s) {
+ return m_vustrskipc((char *)s);
+}
+
/*@}*/
#endif /* MUTT_LIB_LIB_UTF8_H */
HEADER *hdr, *htmp;
CONTEXT *ctx;
char fmt[STRING], buf2[STRING], ch, *p;
- int do_locales, i;
+ int do_locales, i, c;
int optional = (flags & M_FORMAT_OPTIONAL);
int threads = ((Sort & SORT_MASK) == SORT_THREADS);
int is_index = (flags & M_FORMAT_INDEX);
break;
case 'T':
- snprintf (fmt, sizeof (fmt), "%%%sc", prefix);
- snprintf (dest, destlen, fmt,
- ((i = mutt_user_is_recipient(hdr)) < m_strlen(Tochars)) ? Tochars[i] : ' ');
+ i = mutt_user_is_recipient(hdr);
+ assert (i >= 0); /* help compiler to see c is initialized */
+
+ if (Charset_is_utf8) {
+ const char *s = Tochars;
+
+ snprintf (fmt, sizeof (fmt), "%%%slc", prefix);
+ while (i-- >= 0) {
+ c = m_ustrgetc(s, &s);
+ if (c <= 0) {
+ c = ' ';
+ break;
+ }
+ }
+
+ snprintf(dest, destlen, fmt, c);
+ } else {
+ snprintf(fmt, sizeof (fmt), "%%%sc", prefix);
+ snprintf(dest, destlen, fmt, i < m_strlen(Tochars) ? Tochars[i] : ' ');
+ }
break;
case 'u':
else if (hdr->security & PGPKEY)
ch = 'K';
- snprintf(buf2, sizeof (buf2), "%c%c%c",
+ if (hdr->tagged) {
+ c = '*';
+ } else
+ if (hdr->flagged) {
+ c = '!';
+ } else {
+ i = mutt_user_is_recipient(hdr);
+ assert (i >= 0); /* help compiler to see c is initialized */
+
+ if (Charset_is_utf8) {
+ const char *s = Tochars;
+
+ snprintf (fmt, sizeof (fmt), "%%%slc", prefix);
+ while (i-- >= 0) {
+ c = m_ustrgetc(s, &s);
+ if (c <= 0) {
+ c = ' ';
+ break;
+ }
+ }
+ } else {
+ c = i < m_strlen(Tochars) ? Tochars[i] : ' ';
+ }
+ }
+ snprintf(buf2, sizeof (buf2), Charset_is_utf8 ? "%c%c%lc" : "%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 ? '!'
- : ((i = mutt_user_is_recipient(hdr)) < m_strlen(Tochars) ? Tochars[i] : ' ')));
+ hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch), c);
mutt_format_s (dest, destlen, prefix, buf2);
break;