]> code.citadel.org Git - citadel.git/blobdiff - webcit/msg_renderers.c
* use SmashStrBuf where apropriate
[citadel.git] / webcit / msg_renderers.c
index 2ff94b66a30b7c2aa397830b00812391a9f0292c..5e88b91721be8f03cc0fde5e20969be01a903411 100644 (file)
@@ -509,9 +509,12 @@ void render_MIME_VNote(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundC
        if (StrLength(Mime->Data) > 0) {
                struct vnote *v;
                StrBuf *Buf;
+               char *vcard;
 
                Buf = NewStrBuf();
-               v = vnote_new_from_str(ChrPtr(Mime->Data));
+               vcard = SmashStrBuf(&Mime->Data);
+               v = vnote_new_from_str(vcard);
+               free (vcard);
                if (v) {
                        WCTemplputParams TP;
                        
@@ -522,12 +525,10 @@ void render_MIME_VNote(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundC
                                   Buf, &TP);
                        
                        vnote_free(v);
-                       
-                       FreeStrBuf(&Mime->Data);
                        Mime->Data = Buf;
                }
                else
-                       FlushStrBuf(Mime->Data);
+                       Mime->Data = NewStrBuf();
        }
 
 }
@@ -1330,12 +1331,14 @@ int bbsview_PrintViewHeader(SharedMessageStatus *Stat, void **ViewSpecific)
                        Stat->maxmsgs = abs(Stat->maxmsgs);
 
        }
-       memset(&SubTP, 0, sizeof(WCTemplputParams));
-       SubTP.Filter.ContextType = CTX_STRBUF;
-       SubTP.Context = VS->MessageDropdown;
-       DoTemplate(HKEY("msg_listselector_top"), VS->BBViewToolBar, &SubTP);
-       StrBufAppendBuf(WC->WBuf, VS->BBViewToolBar, 0);
-       FlushStrBuf(VS->BBViewToolBar);
+       if (Stat->nummsgs > 0) {
+               memset(&SubTP, 0, sizeof(WCTemplputParams));
+               SubTP.Filter.ContextType = CTX_STRBUF;
+               SubTP.Context = VS->MessageDropdown;
+               DoTemplate(HKEY("msg_listselector_top"), VS->BBViewToolBar, &SubTP);
+               StrBufAppendBuf(WC->WBuf, VS->BBViewToolBar, 0);
+               FlushStrBuf(VS->BBViewToolBar);
+       }
        return 200;
 }