* use the utf8 functions to cut subjects at the border of glyphs
authorWilfried Göesgens <willi@citadel.org>
Wed, 26 Mar 2008 00:04:22 +0000 (00:04 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 26 Mar 2008 00:04:22 +0000 (00:04 +0000)
webcit/messages.c

index bd9e52f842a8c4d76e733f39515852add5afab92..2f4a5950900cdd0b87e3362327fbb209178981cf 100644 (file)
@@ -1381,7 +1381,7 @@ void pullquote_message(long msgnum, int forward_attachments, int include_headers
        char *ptr = NULL;
        int num_attachments = 0;
        struct wc_attachment *att, *aptr;
-       char m_subject[256];
+       char m_subject[1024];
        char from[256];
        char node[256];
        char rfca[256];
@@ -2015,6 +2015,7 @@ int load_msg_ptrs(char *servcmd, int with_headers)
        char inetaddr[128];
        char subject[256];
        int nummsgs;
+       int sbjlen;
        int maxload = 0;
 
        int num_summ_alloc = 0;
@@ -2069,8 +2070,12 @@ int load_msg_ptrs(char *servcmd, int with_headers)
                                        safestrncpy(WC->summ[nummsgs-1].subj, subject,
                                                    sizeof WC->summ[nummsgs-1].subj);
                                }
-                               if (strlen(WC->summ[nummsgs-1].subj) > 75) {
-                                       strcpy(&WC->summ[nummsgs-1].subj[72], "...");
+                               sbjlen = Ctdl_Utf8StrLen(WC->summ[nummsgs-1].subj);
+                               if (sbjlen > 75) {
+                                       char *ptr;
+                                       ptr = Ctdl_Utf8StrCut(WC->summ[nummsgs-1].subj, 72);
+
+                                       strcpy(ptr, "...");
                                }
 
                                if (!IsEmptyStr(nodename)) {