]> code.citadel.org Git - citadel.git/blobdiff - webcit/subst.c
add new outputtoken 'F', which does FMOUT with the escaper.
[citadel.git] / webcit / subst.c
index dce5de89671ca107231b52381851085c20dd71a6..cf6c9e130399ad5a3e051141377dfde810c26397 100644 (file)
@@ -109,6 +109,8 @@ const char *CtxNames[]  = {
        "Context DavNamespace",
        "Context TAB",
        "Context VCARD",
+       "Context SIEVE List",
+       "Context SIEVE Script",
        "Context UNKNOWN"
 };
 
@@ -256,7 +258,7 @@ void LogError (StrBuf *Target, const char *Type, const char *Format, ...)
        StrBufVAppendPrintf(Error, Format, arg_ptr);
        va_end(arg_ptr);
 
-       syslog(1, ChrPtr(Error));
+       syslog(1, "%s", ChrPtr(Error));
 
        WCC = WC;
        if (WCC->WFBuf == NULL) WCC->WFBuf = NewStrBuf();
@@ -618,12 +620,14 @@ void StrBufAppendTemplate(StrBuf *Target,
                          const StrBuf *Source, int FormatTypeIndex)
 {
         wcsession *WCC;
+       const char *pFmt = NULL;
        char EscapeAs = ' ';
 
        if ((FormatTypeIndex < TP->Tokens->nParameters) &&
            (TP->Tokens->Params[FormatTypeIndex]->Type == TYPE_STR) &&
-           (TP->Tokens->Params[FormatTypeIndex]->len == 1)) {
-               EscapeAs = *TP->Tokens->Params[FormatTypeIndex]->Start;
+           (TP->Tokens->Params[FormatTypeIndex]->len >= 1)) {
+               pFmt = TP->Tokens->Params[FormatTypeIndex]->Start;
+               EscapeAs = pFmt;
        }
 
        switch(EscapeAs)
@@ -644,6 +648,12 @@ void StrBufAppendTemplate(StrBuf *Target,
        case 'U':
                StrBufUrlescAppend(Target, Source, NULL);
                break;
+       case 'F':
+               if (pFmt != NULL)       pFmt++;
+               else                    pFmt = "JUSTIFY";
+               if (*pFmt == '\0')      pFmt = "JUSTIFY";
+               FmOut(Target, pFmt, Source);
+               break;
        default:
                StrBufAppendBuf(Target, Source, 0);
        }
@@ -1003,7 +1013,7 @@ WCTemplateToken *NewTemplateSubstitute(StrBuf *Buf,
                                                     &NewToken->Params[NewToken->nParameters - 1]))
                                {
                                        NewToken->HaveParameters = 1;
-                                       if (NewToken->nParameters > MAXPARAM) {
+                                       if (NewToken->nParameters >= MAXPARAM) {
                                                LogTemplateError(
                                                        NULL, "Parseerror", ERR_NAME, &TP,
                                                        "only [%d] Params allowed in Tokens",
@@ -2164,9 +2174,9 @@ void tmpl_do_boxed(StrBuf *Target, WCTemplputParams *TP)
        memcpy (&SubTP, TP, sizeof(WCTemplputParams));
        SubTP.Context = Headline;
        SubTP.Filter.ContextType = CTX_STRBUF;
-       DoTemplate(HKEY("beginbox"), Target, &SubTP);
+       DoTemplate(HKEY("box_begin"), Target, &SubTP);
        DoTemplate(TKEY(0), Target, TP);
-       DoTemplate(HKEY("endbox"), Target, TP);
+       DoTemplate(HKEY("box_end"), Target, TP);
        FreeStrBuf(&Headline);
 }
 
@@ -2433,9 +2443,9 @@ enum {
 };
 
 ConstStr SortIcons[] = {
-       {HKEY("static/sort_none.gif")},
-       {HKEY("static/up_pointer.gif")},
-       {HKEY("static/down_pointer.gif")},
+       {HKEY("static/webcit_icons/sort_none.gif")},
+       {HKEY("static/webcit_icons/up_pointer.gif")},
+       {HKEY("static/webcit_icons/down_pointer.gif")},
 };
 
 ConstStr SortNextOrder[] = {
@@ -2629,7 +2639,7 @@ void dbg_print_longvector(long *LongVector)
                        StrBufAppendPrintf(Buf, "%d: %ld]\n", i, LongVector[i]);
 
        }
-       syslog(1, ChrPtr(Buf));
+       syslog(1, "%s", ChrPtr(Buf));
        FreeStrBuf(&Buf);
 }