* we were loosing the message Data blob in some weird edge cases. be a bit more paran...
authorWilfried Göesgens <willi@citadel.org>
Thu, 10 Dec 2009 22:18:46 +0000 (22:18 +0000)
committerWilfried Göesgens <willi@citadel.org>
Thu, 10 Dec 2009 22:18:46 +0000 (22:18 +0000)
webcit/msg_renderers.c

index 94c25dd32d5edf580a26cc4506873d83de63aea6..c7cb3670ede8325451db6bfc355f022c0c7e42a6 100644 (file)
@@ -468,7 +468,10 @@ void render_MAIL(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset
 {
        const StrBuf *TemplateMime;
 
-       Mime->Data = NewStrBufPlain(NULL, Mime->length);
+       if (Mime->Data == NULL) 
+               Mime->Data = NewStrBufPlain(NULL, Mime->length);
+       else 
+               FlushStrBuf(Mime->Data);
        read_message(Mime->Data, HKEY("view_submessage"), Mime->msgnum, Mime->PartNum, &TemplateMime);
 /*
        if ( (!IsEmptyStr(mime_submessages)) && (!section[0]) ) {
@@ -532,10 +535,13 @@ void render_MIME_VNote(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundC
                        vnote_free(v);
                        Mime->Data = Buf;
                }
-               else
-                       Mime->Data = NewStrBuf();
+               else {
+                       if (Mime->Data == NULL)
+                               Mime->Data = NewStrBuf();
+                       else
+                               FlushStrBuf(Mime->Data);
+               }
        }
-
 }
 
 void render_MIME_ICS(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
@@ -679,7 +685,10 @@ int Conditional_MAIL_SUMM_H_NODE(StrBuf *Target, WCTemplputParams *TP)
 
 void examine_text(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
 {
-       Msg->MsgBody->Data = NewStrBufPlain(NULL, SIZ);
+       if (Msg->MsgBody->Data == NULL)
+               Msg->MsgBody->Data = NewStrBufPlain(NULL, SIZ);
+       else
+               FlushStrBuf(Msg->MsgBody->Data);
 }
 
 void examine_msg4_partnum(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)