#include "webcit.h"
#include "webserver.h"
+#include "groupdav.h"
/*
* message index functions
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;
Buf, &TP);
vnote_free(v);
-
- FreeStrBuf(&Mime->Data);
Mime->Data = Buf;
}
else
- FlushStrBuf(Mime->Data);
+ Mime->Data = NewStrBuf();
}
}
FreeStrBuf(&Buf);
}
+void tmplput_EDIT_WIKI_BODY(StrBuf *Target, WCTemplputParams *TP) // FIXME
+{
+ const StrBuf *Mime;
+ long msgnum;
+ StrBuf *Buf;
+
+ msgnum = locate_message_by_uid(BSTR("wikipage"));
+ if (msgnum >= 0L) {
+ Buf = NewStrBuf();
+ read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime);
+ StrBufAppendTemplate(Target, TP, Buf, 1);
+ FreeStrBuf(&Buf);
+ }
+}
+
void tmplput_MAIL_BODY(StrBuf *Target, WCTemplputParams *TP)
{
message_summary *Msg = (message_summary*) CTX;
void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
{
- StrBuf *cs = NULL;
const char *ptr, *pte;
const char *BufPtr = NULL;
StrBuf *Line;
StrBuf *Line2;
StrBuf *Target;
- int ConvertIt = 1;
int bn = 0;
int bq = 0;
- int i, n, done = 0;
+ int i;
long len;
#ifdef HAVE_ICONV
+ StrBuf *cs = NULL;
+ int ConvertIt = 1;
iconv_t ic = (iconv_t)(-1) ;
#endif
Line2 = NewStrBufPlain(NULL, SIZ);
Target = NewStrBufPlain(NULL, StrLength(Mime->Data));
- while ((n = StrBufSipLine(Line, Mime->Data, &BufPtr), n >= 0) && !done)
- {
- done = n == 0;
- bq = 0;
- i = 0;
- ptr = ChrPtr(Line);
- len = StrLength(Line);
- pte = ptr + len;
-
- while ((ptr < pte) &&
- ((*ptr == '>') ||
- isspace(*ptr)))
+ if (StrLength(Mime->Data) > 0)
+ do
{
- if (*ptr == '>')
- bq++;
- ptr ++;
- i++;
- }
- if (i > 0) StrBufCutLeft(Line, i);
+ StrBufSipLine(Line, Mime->Data, &BufPtr);
+ bq = 0;
+ i = 0;
+ ptr = ChrPtr(Line);
+ len = StrLength(Line);
+ pte = ptr + len;
- if (StrLength(Line) == 0) {
- StrBufAppendBufPlain(Target, HKEY("<tt></tt><br />\n"), 0);
- continue;
- }
+ while ((ptr < pte) &&
+ ((*ptr == '>') ||
+ isspace(*ptr)))
+ {
+ if (*ptr == '>')
+ bq++;
+ ptr ++;
+ i++;
+ }
+ if (i > 0) StrBufCutLeft(Line, i);
+
+ if (StrLength(Line) == 0) {
+ StrBufAppendBufPlain(Target, HKEY("<tt></tt><br />\n"), 0);
+ continue;
+ }
- for (i = bn; i < bq; i++)
- StrBufAppendBufPlain(Target, HKEY("<blockquote>"), 0);
- for (i = bq; i < bn; i++)
- StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
+ for (i = bn; i < bq; i++)
+ StrBufAppendBufPlain(Target, HKEY("<blockquote>"), 0);
+ for (i = bq; i < bn; i++)
+ StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
+#ifdef HAVE_ICONV
+ if (ConvertIt) {
+ StrBufConvert(Line, Line1, &ic);
+ }
+#endif
+ StrBufAppendBufPlain(Target, HKEY("<tt>"), 0);
+ UrlizeText(Line1, Line, Line2);
- if (ConvertIt) {
- StrBufConvert(Line, Line1, &ic);
+ StrEscAppend(Target, Line1, NULL, 0, 0);
+ StrBufAppendBufPlain(Target, HKEY("</tt><br />\n"), 0);
+ bn = bq;
}
-
- StrBufAppendBufPlain(Target, HKEY("<tt>"), 0);
- UrlizeText(Line1, Line, Line2);
-
- StrEscAppend(Target, Line1, NULL, 0, 0);
- StrBufAppendBufPlain(Target, HKEY("</tt><br />\n"), 0);
- bn = bq;
- }
+ while ((BufPtr != StrBufNOTNULL) &&
+ (BufPtr != NULL));
for (i = 0; i < bn; i++)
StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
RegisterNamespace("MAIL:BODY", 0, 2, tmplput_MAIL_BODY, CTX_MAILSUM);
RegisterNamespace("MAIL:QUOTETEXT", 1, 2, tmplput_QUOTED_MAIL_BODY, CTX_NONE);
RegisterNamespace("MAIL:EDITTEXT", 1, 2, tmplput_EDIT_MAIL_BODY, CTX_NONE);
+ RegisterNamespace("MAIL:EDITWIKI", 1, 2, tmplput_EDIT_WIKI_BODY, CTX_NONE);
RegisterConditional(HKEY("COND:MAIL:SUMM:RFCA"), 0, Conditional_MAIL_SUMM_RFCA, CTX_MAILSUM);
RegisterConditional(HKEY("COND:MAIL:SUMM:CCCC"), 0, Conditional_MAIL_SUMM_CCCC, CTX_MAILSUM);
RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM);