* Return the value of a variable supplied to the current web page (from the url or a form)
*/
-const char *XBstr(char *key, size_t keylen, size_t *len)
+const char *XBstr(const char *key, size_t keylen, size_t *len)
{
void *U;
}
}
-const char *XBSTR(char *key, size_t *len)
+const char *XBSTR(const char *key, size_t *len)
{
void *U;
}
-const char *BSTR(char *key)
+const char *BSTR(const char *key)
{
void *U;
return ("");
}
-const char *Bstr(char *key, size_t keylen)
+const char *Bstr(const char *key, size_t keylen)
{
void *U;
return NULL;
}
-long LBstr(char *key, size_t keylen)
+long LBstr(const char *key, size_t keylen)
{
void *U;
return (0);
}
-long LBSTR(char *key)
+long LBSTR(const char *key)
{
void *U;
return (0);
}
-int IBstr(char *key, size_t keylen)
+int IBstr(const char *key, size_t keylen)
{
void *U;
return (0);
}
-int IBSTR(char *key)
+int IBSTR(const char *key)
{
void *U;
return (0);
}
-int HaveBstr(char *key, size_t keylen)
+int HaveBstr(const char *key, size_t keylen)
{
void *U;
return (0);
}
-int HAVEBSTR(char *key)
+int HAVEBSTR(const char *key)
{
void *U;
}
-int YesBstr(char *key, size_t keylen)
+int YesBstr(const char *key, size_t keylen)
{
void *U;
return (0);
}
-int YESBSTR(char *key)
+int YESBSTR(const char *key)
{
void *U;
return;
StrMsgEscAppend(OutBuf, NULL, strbuf);
StrEscAppend(WC->WBuf, OutBuf, NULL, 0, 0);
+ FreeStrBuf(&OutBuf);
}
/*
char buf[256];
off_t bytes;
char content_type[256];
- char *content = NULL;
serv_printf("OPNA %s|%s", msgnum, partnum);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
bytes = extract_long(&buf[4], 0);
- content = malloc(bytes + 2);
if (force_download) {
strcpy(content_type, "application/octet-stream");
}
wprintf(_("An error occurred while retrieving this part: %s\n"), &buf[4]);
end_burst();
}
-
}
else {
return(NULL);
}
-
}
* Convenience functions to wrap around asynchronous ajax responses
*/
void begin_ajax_response(void) {
+ struct wcsession *WCC = WC;
+
+ FlushStrBuf(WCC->HBuf);
output_headers(0, 0, 0, 0, 0, 0);
hprintf("Content-type: text/html; charset=UTF-8\r\n"
"Server: %s\r\n"
"Connection: close\r\n"
- "Pragma: no-cache\r\n"
- "Cache-Control: no-cache\r\n"
- "Expires: -1\r\n"
,
PACKAGE_STRING);
begin_burst();
{
char buf[256];
- begin_ajax_response();
if ( (time(NULL) - WC->last_pager_check) < 30) {
wprintf("NO\n");
}
wprintf("NO");
}
}
- end_ajax_response();
}
/**
body_start = strlen(content);
/** Read the entire input data at once. */
- client_read(WCC->http_sock, &content[body_start], ContentLength);
+ client_read(&WCC->http_sock, &content[body_start], ContentLength);
if (!strncasecmp(ContentType, "application/x-www-form-urlencoded", 33)) {
StrBuf *Content;
//cmd[len - a] = '\0';
Params = _NewConstStrBuf(&cmd[a + 1], len - a);
addurls(Params);
+ FreeStrBuf(&Params);
cmd[a] = 0;
len = a - 1;
}
output_headers(1, 1, 1, 0, 0, 0);
wprintf("Session: %d<hr />\n", WC->wc_session);
wprintf("Command: <br /><PRE>\n");
- escputs(WC->UrlFragment1);
+ StrEscPuts(WC->UrlFragment1);
wprintf("<br />\n");
- escputs(WC->UrlFragment2);
+ StrEscPuts(WC->UrlFragment2);
wprintf("</PRE><hr />\n");
wprintf("Variables: <br /><PRE>\n");
dump_vars();
1);
}
+
+int ConditionalImportantMesage(WCTemplateToken *Tokens, void *Context)
+{
+ struct wcsession *WCC = WC;
+ if (WCC != NULL)
+ return (!IsEmptyStr(WCC->ImportantMessage));
+ else
+ return 0;
+}
+
+void tmplput_importantmessage(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+{
+ struct wcsession *WCC = WC;
+
+ if (WCC != NULL) {
+ StrEscAppend(Target, NULL, WCC->ImportantMessage, 0, 0);
+ WCC->ImportantMessage[0] = '\0';
+ }
+}
+
+void tmplput_offer_start_page(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+{
+ offer_start_page();
+}
+
void
InitModule_WEBCIT
(void)
WebcitAddUrlHandler(HKEY("mimepart"), view_mimepart, NEED_URL);
WebcitAddUrlHandler(HKEY("mimepart_download"), download_mimepart, NEED_URL);
WebcitAddUrlHandler(HKEY("diagnostics"), diagnostics, NEED_URL);
+ RegisterConditional(HKEY("COND:IMPMSG"), 0, ConditionalImportantMesage);
+ RegisterNamespace("IMPORTANTMESSAGE", 0, 0, tmplput_importantmessage);
+ RegisterNamespace("OFFERSTARTPAGE", 0, 0, tmplput_offer_start_page);
}