if (mesg != NULL) if (!IsEmptyStr(mesg)) {
stresc(buf, SIZ, mesg, 0, 0);
- svprintf("mesg", WCS_STRING, "%s", buf);
+ svprintf(HKEY("mesg"), WCS_STRING, "%s", buf);
}
- svprintf("LOGIN_INSTRUCTIONS", WCS_STRING,
+ svprintf(HKEY("LOGIN_INSTRUCTIONS"), WCS_STRING,
_("<ul>"
"<li><b>If you already have an account on %s</b>, "
"enter your user name and password and click "Login." "
serv_info.serv_humannode
);
- svprintf("USERNAME_BOX", WCS_STRING, "%s", _("User name:"));
- svprintf("PASSWORD_BOX", WCS_STRING, "%s", _("Password:"));
- svprintf("LANGUAGE_BOX", WCS_STRING, "%s", _("Language:"));
- svprintf("LOGIN_BUTTON", WCS_STRING, "%s", _("Login"));
- svprintf("NEWUSER_BUTTON", WCS_STRING, "%s", _("New User"));
- svprintf("EXIT_BUTTON", WCS_STRING, "%s", _("Exit"));
- svprintf("hello", WCS_SERVCMD, "MESG hello");
- svprintf("BOXTITLE", WCS_STRING, _("%s - powered by <a href=\"http://www.citadel.org\">Citadel</a>"),
+ svput("USERNAME_BOX", WCS_STRING, _("User name:"));
+ svput("PASSWORD_BOX", WCS_STRING, _("Password:"));
+ svput("LANGUAGE_BOX", WCS_STRING, _("Language:"));
+ svput("LOGIN_BUTTON", WCS_STRING, _("Login"));
+ svput("NEWUSER_BUTTON", WCS_STRING, _("New User"));
+ svput("EXIT_BUTTON", WCS_STRING, _("Exit"));
+ svput("hello", WCS_SERVCMD, "MESG hello");
+ svprintf(HKEY("BOXTITLE"), WCS_STRING, _("%s - powered by <a href=\"http://www.citadel.org\">Citadel</a>"),
serv_info.serv_humannode);
svcallback("DO_LANGUAGE_BOX", offer_languages);
if (serv_info.serv_newuser_disabled) {
- svprintf("NEWUSER_BUTTON_PRE", WCS_STRING, "<div style=\"display:none;\">");
- svprintf("NEWUSER_BUTTON_POST", WCS_STRING, "</div>");
+ svput("NEWUSER_BUTTON_PRE", WCS_STRING, "<div style=\"display:none;\">");
+ svput("NEWUSER_BUTTON_POST", WCS_STRING, "</div>");
}
else {
- svprintf("NEWUSER_BUTTON_PRE", WCS_STRING, "");
- svprintf("NEWUSER_BUTTON_POST", WCS_STRING, "");
+ svput("NEWUSER_BUTTON_PRE", WCS_STRING, "");
+ svput("NEWUSER_BUTTON_POST", WCS_STRING, "");
}
do_template("login");
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Change your password"));
+ svput("BOXTITLE", WCS_STRING, _("Change your password"));
do_template("beginbox");
if (!IsEmptyStr(WC->ImportantMessage)) {
}
free_attachments(sessions_to_kill);
free_march_list(sessions_to_kill);
- clear_substs(sessions_to_kill);
DeleteHash(&(sessions_to_kill->hash_prefs));
pthread_mutex_unlock(&sessions_to_kill->SessionMutex);
TheSession->hash_prefs = NewHash(1,NULL); /* Get a hash table for the user preferences */
pthread_mutex_init(&TheSession->SessionMutex, NULL);
pthread_mutex_lock(&SessionListMutex);
+ TheSession->urlstrings = NULL;
+ TheSession->vars = NULL;
TheSession->nonce = rand();
TheSession->next = SessionList;
SessionList = TheSession;
*/
pthread_mutex_lock(&TheSession->SessionMutex); /* bind */
pthread_setspecific(MyConKey, (void *)TheSession);
+
+ TheSession->urlstrings = NewHash(1,NULL);
+ TheSession->vars = NewHash(1,NULL);
TheSession->http_sock = sock;
TheSession->lastreq = time(NULL); /* log */
TheSession->gzip_ok = gzip_ok;
#ifdef ENABLE_NLS
stop_selected_language(); /* unset locale */
#endif
+ DeleteHash(&TheSession->urlstrings);
+ DeleteHash(&TheSession->vars);
+
pthread_mutex_unlock(&TheSession->SessionMutex); /* unbind */
/* Free the request buffer */
* Free up any session-local substitution variables which
* were set during this transaction
*/
- clear_local_substs();
+
+
}
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Image upload"));
+ svput("BOXTITLE", WCS_STRING, _("Image upload"));
do_template("beginbox");
wprintf("<form enctype=\"multipart/form-data\" action=\"%s\" "
if (which == (ic_max / 2)) {
wprintf("</td><td valign=top>");
}
- svprintf("BOXTITLE", WCS_STRING, ic_boxtitle[which]);
+ svput("BOXTITLE", WCS_STRING, ic_boxtitle[which]);
do_template("beginbox");
wprintf("<span class=\"menudesc\">");
escputs(ic_desc[which]);
wprintf("<div align=center>");
wprintf("<table border=0 width=75%%><tr><td>");
- svprintf("BOXTITLE", WCS_STRING, _("List subscribe/unsubscribe"));
+ svput("BOXTITLE", WCS_STRING, _("List subscribe/unsubscribe"));
do_template("beginbox");
wprintf("<div align=center><br>");
"<table width=\"100%%\" cellspacing=\"10px\" cellpadding=\"0\">"
"<tr><td colspan=\"2\" class=\"advanced\">\n");
- svprintf("BOXTITLE", WCS_STRING, _("Basic commands"));
+ svput("BOXTITLE", WCS_STRING, _("Basic commands"));
do_template("beginbox");
/**< start of first column */
serv_printf("%s", bstr("g_cmd"));
serv_getln(buf, sizeof buf);
- svprintf("BOXTITLE", WCS_STRING, _("Server command results"));
+ svput("BOXTITLE", WCS_STRING, _("Server command results"));
do_template("beginbox");
wprintf("<table border=0><tr><td>Command:</td><td><tt>");
if ((message == NULL) || (IsEmptyStr(message)))
{
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Message to your Users:"));
+ svput("BOXTITLE", WCS_STRING, _("Message to your Users:"));
do_template("beginbox");
wprintf("<form action=\"server_shutdown\">\n"
"<input type=\"hidden\" name=\"when\" value=\"page\">\n"
gotoroom(bstr("force_room"));
}
- if (GetHash(WCC->urlstrings, HKEY("display_name"), &U)) {
+ if (GetHash(WC->urlstrings, HKEY("display_name"), &U)) {
u = (urlcontent*) U;
display_name = u->url_data;
dpLen = u->url_data_size;
int is_pager = 0;
int is_funambol = 0;
char mobnum[20];
- svprintf("BOXTITLE", WCS_STRING, _("Push email and SMS settings"));
+
+ svput("BOXTITLE", WCS_STRING, _("Push email and SMS settings"));
/* Find any existing settings*/
if (goto_config_room() == 0) {
}
}
if (is_none) {
- svprintf("PUSH_NONE", WCS_STRING, "checked=\"checked\"");
+ svput("PUSH_NONE", WCS_STRING, "checked=\"checked\"");
} else if (is_pager) {
- svprintf("PUSH_TEXT", WCS_STRING, "checked=\"checked\"");
- svprintf("SMSNUM", WCS_STRING, "value=\"%s\"", mobnum);
+ svput("PUSH_TEXT", WCS_STRING, "checked=\"checked\"");
+ svprintf(HKEY("SMSNUM"), WCS_STRING, "value=\"%s\"", mobnum);
} else if (is_funambol) {
- svprintf("PUSH_FNBL", WCS_STRING, "checked=\"checked\"");
+ svput("PUSH_FNBL", WCS_STRING, "checked=\"checked\"");
}
serv_printf("GOTO %s", WC->wc_roomname);
serv_getln(buf, sizeof buf);
{
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Zapped (forgotten) rooms"));
+ svput("BOXTITLE", WCS_STRING, _("Zapped (forgotten) rooms"));
do_template("beginbox");
listrms("LZRM -1");
strcpy (with_files, "");
stresc(sanitized_roomname, 256, WC->wc_roomname, 1, 1);
- svprintf("ROOMNAME", WCS_STRING, "%s", sanitized_roomname);
- svprintf("NUMMSGS", WCS_STRING,
+ svprintf(HKEY("ROOMNAME"), WCS_STRING, "%s", sanitized_roomname);
+ svprintf(HKEY("NUMMSGS"), WCS_STRING,
_("%d new of %d messages%s"),
extract_int(&got[4], 1),
extract_int(&got[4], 2),
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Create a new room"));
+ svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
do_template("beginbox");
wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
{
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Go to a hidden room"));
+ svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Go to a hidden room"));
do_template("beginbox");
wprintf("<p>");
if (levels == 1) {
/** Begin inner box */
stresc(boxtitle, 256, floor_name, 1, 0);
- svprintf("BOXTITLE", WCS_STRING, boxtitle);
+ svprintf(HKEY("BOXTITLE"), WCS_STRING, boxtitle);
do_template("beginbox");
}
#include "webserver.h"
struct serv_info serv_info; /**< our connection data to the server */
-
+HashList *ServHash = NULL;//// TODO;
/*
* get info about the server we've connected to
*
wprintf("<table border=0 cellspacing=10><tr valign=top><td>\n");
- svprintf("BOXTITLE", WCS_STRING, _("Add a new script"));
+ svput("BOXTITLE", WCS_STRING, _("Add a new script"));
do_template("beginbox");
wprintf(_("To create a new script, enter the desired "
do_template("endbox");
- svprintf("BOXTITLE", WCS_STRING, _("Edit scripts"));
+ svput("BOXTITLE", WCS_STRING, _("Edit scripts"));
do_template("beginbox");
wprintf("<br /><div align=center><a href=\"display_sieve\">%s</a><br /><br />\n",
_("Return to the script editing screen")
wprintf("</td><td>");
- svprintf("BOXTITLE", WCS_STRING, _("Delete scripts"));
+ svput("BOXTITLE", WCS_STRING, _("Delete scripts"));
do_template("beginbox");
wprintf(_("To delete an existing script, select the script "
#include <unistd.h>
#include "webcit.h"
+#include "webserver.h"
/**
- * \brief Clear out the list of substitution variables local to this session
+ * \brief debugging function to print array to log
*/
-void clear_substs(struct wcsession *wc) {
- struct wcsubst *ptr;
+void VarPrintTransition(void *vVar1, void *vVar2, int odd){}
+/**
+ * \brief debugging function to print array to log
+ */
+void VarPrintEntry(const char *Key, void *vSubst, int odd)
+{
+ wcsubst *ptr;
+ lprintf(1,"Subst[%s] : ", Key);
+ ptr = (wcsubst*) vSubst;
+
+ switch(ptr->wcs_type) {
+ case WCS_STRING:
+ lprintf(1, " -> %s\n", ptr->wcs_value);
+ break;
+ case WCS_SERVCMD:
+ lprintf(1, " -> Server [%s]\n", ptr->wcs_value);
+ break;
+ case WCS_FUNCTION:
+ lprintf(1, " -> function at [%0xd]\n", ptr->wcs_function);
+ break;
+ default:
+ lprintf(1," WARNING: invalid type: [%ld]!\n", ptr->wcs_type);
+ }
+}
- while (wc->vars != NULL) {
- ptr = wc->vars->next;
- if ((wc->vars->wcs_type == WCS_STRING)
- || (wc->vars->wcs_type == WCS_SERVCMD)) {
- free(wc->vars->wcs_value);
- }
- free(wc->vars);
- wc->vars = ptr;
- }
+/**
+ * \brief Clear out the list of substitution variables local to this session
+ */
+void clear_substs(struct wcsession *wc) {
- wc->vars = NULL;
+ if (wc->vars != NULL) {
+
+ DeleteHash(&wc->vars);
+ }
}
/**
clear_substs (WC);
}
+/**
+ * \brief destructor; kill one entry.
+ */
+void deletevar(void *data)
+{
+ wcsubst *ptr = (wcsubst*)data;
+// if ((wc->vars->wcs_type == WCS_STRING)
+// || (wc->vars->wcs_type == WCS_SERVCMD)) {
+ if (ptr->wcs_type != WCS_FUNCTION)
+ free(ptr->wcs_value);
+ free(ptr);
+}
-/*
- * \brief Add a substitution variable (local to this session)
+/**
+ * \brief Add a substitution variable (local to this session) (strlen version...)
* \param keyname the replacementstring to substitute
* \param keytype the kind of the key
* \param format the format string ala printf
* \param ... the arguments to substitute in the formatstring
*/
-void svprintf(char *keyname, int keytype, const char *format,...)
+void SVPRINTF(char *keyname, int keytype, const char *format,...)
{
va_list arg_ptr;
char wbuf[SIZ];
- struct wcsubst *ptr = NULL;
- struct wcsubst *scan;
-
+ void *vPtr;
+ wcsubst *ptr = NULL;
+ size_t keylen;
+ struct wcsession *WCC = WC;
+
+ keylen = strlen(keyname);
/**
- * First scan through to see if we're doing a replacement of
+ * First look if we're doing a replacement of
* an existing key
*/
- for (scan=WC->vars; scan!=NULL; scan=scan->next) {
- if (!strcasecmp(scan->wcs_key, keyname)) {
- ptr = scan;
- if (ptr->wcs_value != NULL)
- free(ptr->wcs_value);
- }
+ /*PrintHash(WCC->vars, VarPrintTransition, VarPrintEntry);*/
+ if (GetHash(WCC->vars, keyname, keylen, &vPtr)) {
+ ptr = (wcsubst*)vPtr;
+ if (ptr->wcs_value != NULL)
+ free(ptr->wcs_value);
}
-
- /** Otherwise allocate a new one */
- if (ptr == NULL) {
- ptr = (struct wcsubst *) malloc(sizeof(struct wcsubst));
+ else /** Otherwise allocate a new one */
+ {
+ ptr = (wcsubst *) malloc(sizeof(wcsubst));
safestrncpy(ptr->wcs_key, keyname, sizeof ptr->wcs_key);
- ptr->next = WC->vars;
- WC->vars = ptr;
+ Put(WCC->vars, keyname, keylen, ptr, deletevar);
}
/** Format the string and save it */
ptr->wcs_value = strdup(wbuf);
}
+/**
+ * \brief Add a substitution variable (local to this session)
+ * \param keyname the replacementstring to substitute
+ * \param keytype the kind of the key
+ * \param format the format string ala printf
+ * \param ... the arguments to substitute in the formatstring
+ */
+void svprintf(char *keyname, size_t keylen, int keytype, const char *format,...)
+{
+ va_list arg_ptr;
+ char wbuf[SIZ];
+ void *vPtr;
+ wcsubst *ptr = NULL;
+ struct wcsession *WCC = WC;
+ size_t len;
+
+ /**
+ * First look if we're doing a replacement of
+ * an existing key
+ */
+ /*PrintHash(WCC->vars, VarPrintTransition, VarPrintEntry);*/
+ if (GetHash(WCC->vars, keyname, keylen, &vPtr)) {
+ ptr = (wcsubst*)vPtr;
+ if (ptr->wcs_value != NULL)
+ free(ptr->wcs_value);
+ }
+ else /** Otherwise allocate a new one */
+ {
+ ptr = (wcsubst *) malloc(sizeof(wcsubst));
+ safestrncpy(ptr->wcs_key, keyname, sizeof ptr->wcs_key);
+ Put(WCC->vars, keyname, keylen, ptr, deletevar);
+ }
+
+ /** Format the string and save it */
+
+ va_start(arg_ptr, format);
+ len = vsnprintf(wbuf, sizeof wbuf, format, arg_ptr);
+ va_end(arg_ptr);
+
+ ptr->wcs_value = (char*) malloc(len + 1);
+ memcpy(ptr->wcs_value, wbuf, len + 1);
+ ptr->wcs_function = NULL;
+ ptr->wcs_type = keytype;
+}
+
+/**
+ * \brief Add a substitution variable (local to this session)
+ * \param keyname the replacementstring to substitute
+ * \param keytype the kind of the key
+ * \param format the format string ala printf
+ * \param ... the arguments to substitute in the formatstring
+ */
+void SVPut(char *keyname, size_t keylen, int keytype, char *Data)
+{
+ void *vPtr;
+ wcsubst *ptr = NULL;
+ struct wcsession *WCC = WC;
+
+
+ /**
+ * First look if we're doing a replacement of
+ * an existing key
+ */
+ /*PrintHash(WCC->vars, VarPrintTransition, VarPrintEntry);*/
+ if (GetHash(WCC->vars, keyname, keylen, &vPtr)) {
+ ptr = (wcsubst*)vPtr;
+ if (ptr->wcs_value != NULL)
+ free(ptr->wcs_value);
+ }
+ else /** Otherwise allocate a new one */
+ {
+ ptr = (wcsubst *) malloc(sizeof(wcsubst));
+ safestrncpy(ptr->wcs_key, keyname, sizeof ptr->wcs_key);
+ Put(WCC->vars, keyname, keylen, ptr, deletevar);
+ }
+
+ ptr->wcs_function = NULL;
+ ptr->wcs_type = keytype;
+ ptr->wcs_value = strdup(Data);
+}
+
/**
* \brief Add a substitution variable (local to this session) that does a callback
* \param keyname the keystring to substitute
* \param fcn_ptr the function callback to give the substitution string
*/
-void svcallback(char *keyname, void (*fcn_ptr)() )
+void SVCallback(char *keyname, size_t keylen, var_callback_fptr fcn_ptr)
{
- struct wcsubst *scan;
- struct wcsubst *ptr;
+ wcsubst *ptr;
+ void *vPtr;
+ struct wcsession *WCC = WC;
/**
- * First scan through to see if we're doing a replacement of
+ * First look if we're doing a replacement of
* an existing key
*/
- ptr = NULL;
- for (scan=WC->vars; scan!=NULL; scan=scan->next) {
- if (!strcasecmp(scan->wcs_key, keyname)) {
- ptr = scan;
- if (ptr->wcs_value != NULL)
- free(ptr->wcs_value);
- }
+ /*PrintHash(WCC->vars, VarPrintTransition, VarPrintEntry);*/
+ if (GetHash(WCC->vars, keyname, keylen, &vPtr)) {
+ ptr = (wcsubst*)vPtr;
+ if (ptr->wcs_value != NULL)
+ free(ptr->wcs_value);
}
-
- /** Otherwise allocate a new one */
- if (ptr == NULL) {
- ptr = (struct wcsubst *) malloc(sizeof(struct wcsubst));
+ else /** Otherwise allocate a new one */
+ {
+ ptr = (wcsubst *) malloc(sizeof(wcsubst));
safestrncpy(ptr->wcs_key, keyname, sizeof ptr->wcs_key);
- ptr->next = WC->vars;
- WC->vars = ptr;
+ Put(WCC->vars, keyname, keylen, ptr, deletevar);
}
+
ptr->wcs_value = NULL;
ptr->wcs_type = WCS_FUNCTION;
ptr->wcs_function = fcn_ptr;
}
+inline void SVCALLBACK(char *keyname, var_callback_fptr fcn_ptr)
+{
+ SVCallback(keyname, strlen(keyname), fcn_ptr);
+}
}
}
-
-
/**
* \brief Print the value of a variable
* \param keyname get a key to print
*/
-void print_value_of(char *keyname) {
- struct wcsubst *ptr;
+void print_value_of(char *keyname, size_t keylen) {
+ struct wcsession *WCC = WC;
+ wcsubst *ptr;
void *fcn();
+ void *vVar;
+ /*if (WCC->vars != NULL) PrintHash(WCC->vars, VarPrintTransition, VarPrintEntry);*/
if (keyname[0] == '=') {
do_template(&keyname[1]);
}
-
- if (!strcasecmp(keyname, "SERV_PID")) {
- wprintf("%d", WC->ctdl_pid);
+ /** Page-local variables */
+ if ((WCC->vars!= NULL) && GetHash(WCC->vars, keyname, keylen, &vVar)) {
+ ptr = (wcsubst*) vVar;
+ switch(ptr->wcs_type) {
+ case WCS_STRING:
+ wprintf("%s", ptr->wcs_value);
+ break;
+ case WCS_SERVCMD:
+ pvo_do_cmd(ptr->wcs_value);
+ break;
+ case WCS_FUNCTION:
+ (*ptr->wcs_function) ();
+ break;
+ default:
+ lprintf(1,"WARNING: invalid value in SV-Hash at %s!", keyname);
+ }
+ }
+ else if (!strcasecmp(keyname, "SERV_PID")) {
+ wprintf("%d", WCC->ctdl_pid);
}
else if (!strcasecmp(keyname, "SERV_NODENAME")) {
}
else if (!strcasecmp(keyname, "CURRENT_USER")) {
- escputs(WC->wc_fullname);
+ escputs(WCC->wc_fullname);
}
else if (!strcasecmp(keyname, "CURRENT_ROOM")) {
- escputs(WC->wc_roomname);
+ escputs(WCC->wc_roomname);
}
- /** Page-local variables */
- else for (ptr = WC->vars; ptr != NULL; ptr = ptr->next) {
- if (!strcasecmp(ptr->wcs_key, keyname)) {
- if (ptr->wcs_type == WCS_STRING) {
- wprintf("%s", ptr->wcs_value);
- }
- else if (ptr->wcs_type == WCS_SERVCMD) {
- pvo_do_cmd(ptr->wcs_value);
- }
- else if (ptr->wcs_type == WCS_FUNCTION) {
- (*ptr->wcs_function) ();
- }
- }
- }
}
extern char *static_dirs[PATH_MAX]; /**< Disk representation */
}
strncpy(key, &inbuf[2], pos-2);
key[pos-2] = 0;
- print_value_of(key);
+ print_value_of(key, pos-2);
pos++;
memmove(inbuf, &inbuf[pos], len - pos + 1);
len -= pos;
* \brief Dummy section
*/
void dummy_section(void) {
- svprintf("BOXTITLE", WCS_STRING, "(dummy section)");
+ svput("BOXTITLE", WCS_STRING, "(dummy section)");
do_template("beginbox");
wprintf(_("(nothing)"));
do_template("endbox");
pthread_mutex_t Critters[MAX_SEMAPHORES]; /* Things needing locking */
pthread_key_t MyConKey; /* TSD key for MyContext() */
+pthread_key_t MyReq; /* TSD key for MyReq() */
void InitialiseSemaphores(void)
{
output_headers(1, 1, 0, 0, 0, 0);
}
- svprintf("BOXTITLE", WCS_STRING, _("Edit %s"), description);
+ svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Edit %s"), description);
do_template("beginbox");
wprintf(_("Enter %s below. Text is formatted to the reader's browser."
wprintf("<table border=0 cellspacing=10><tr valign=top><td>\n");
- svprintf("BOXTITLE", WCS_STRING, _("Add users"));
+ svput("BOXTITLE", WCS_STRING, _("Add users"));
do_template("beginbox");
wprintf(_("To create a new user account, enter the desired "
wprintf("</td><td>");
- svprintf("BOXTITLE", WCS_STRING, _("Edit or Delete users"));
+ svput("BOXTITLE", WCS_STRING, _("Edit or Delete users"));
do_template("beginbox");
wprintf(_("To edit an existing user account, select the user "
/** Display the form */
output_headers(1, 1, 1, 0, 0, 0);
- svprintf("BOXTITLE", WCS_STRING, _("Edit contact information"));
+ svput("BOXTITLE", WCS_STRING, _("Edit contact information"));
do_template("beginbox");
wprintf("<form method=\"POST\" action=\"submit_vcard\">\n");
if (do_htmlhead) {
begin_burst();
if (!access("static.local/webcit.css", R_OK)) {
- svprintf("CSSLOCAL", WCS_STRING,
+ svprintf(HKEY("CSSLOCAL"), WCS_STRING,
"<link href=\"static.local/webcit.css\" rel=\"stylesheet\" type=\"text/css\">"
);
}
va_list arg_list;
long i;
- svprintf("BOXTITLE", WCS_STRING, Title);
+ svput("BOXTITLE", WCS_STRING, Title);
do_template("beginbox");
wprintf("<ul class=\"%s\">", Class);
WC->upload_length = 0;
WC->upload = NULL;
- WC->vars = NULL;
WC->is_wap = 0;
hptr = req;
/**
* \brief Dynamic content for variable substitution in templates
*/
-struct wcsubst {
- struct wcsubst *next; /**< next item in the list */
+typedef struct _wcsubst {
int wcs_type; /**< which type of ??? */
char wcs_key[32]; /**< ??? what?*/
void *wcs_value; /**< ???? what?*/
void (*wcs_function)(void); /**< funcion hook ???*/
-};
+} wcsubst;
/**
* \brief Values for wcs_type
struct message_summary *summ; /**< array of messages for mailbox summary view */
int is_wap; /**< Client is a WAP gateway */
HashList *urlstrings; /**< variables passed to webcit in a URL */
- struct wcsubst *vars; /**< HTTP variable substitutions for this page */
+ HashList *vars; /**< HTTP variable substitutions for this page */
char this_page[512]; /**< URL of current page */
char http_host[512]; /**< HTTP Host: header */
HashList *hash_prefs; /**< WebCit preferences for this user */
void http_redirect(char *);
void clear_substs(struct wcsession *wc);
void clear_local_substs(void);
-void svprintf(char *keyname, int keytype, const char *format,...);
-void svcallback(char *keyname, void (*fcn_ptr)() );
+
+
+typedef void (*var_callback_fptr)();
+
+
+void SVPut(char *keyname, size_t keylen, int keytype, char *Data);
+#define svput(a, b, c) SVPut(a, sizeof(a) - 1, b, c)
+void svprintf(char *keyname, size_t keylen, int keytype, const char *format,...);
+void SVPRINTF(char *keyname, int keytype, const char *format,...);
+void SVCALLBACK(char *keyname, var_callback_fptr fcn_ptr);
+void SVCallback(char *keyname, size_t keylen, var_callback_fptr fcn_ptr);
+#define svcallback(a, b) SVCallback(a, sizeof(a) - 1, b)
+
void do_template(void *templatename);
+
+
int lingering_close(int fd);
char *memreadline(char *start, char *buf, int maxlen);
char *memreadlinelen(char *start, char *buf, int maxlen, int *retlen);