extract_token(WC->cs_inet_email, &buf[4], 3, '|', sizeof WC->cs_inet_email);
}
- get_preference("current_iconbar", buf, sizeof buf);
- WC->current_iconbar = atoi(buf);
+ get_pref_long("current_iconbar", &WC->current_iconbar, current_iconbar_menu);
- get_preference("floordiv_expanded", WC->floordiv_expanded, sizeof WC->floordiv_expanded);
+ get_preference("floordiv_expanded", &WC->floordiv_expanded);
}
*/
void do_welcome(void)
{
- char buf[SIZ];
+ StrBuf *Buf;
#ifdef XXX_NOT_FINISHED_YET_XXX
FILE *fp;
int i;
/*
* Go to the user's preferred start page
*/
- get_preference("startpage", buf, sizeof buf);
- if (IsEmptyStr(buf)) {
- safestrncpy(buf, "dotskip&room=_BASEROOM_", sizeof buf);
- set_preference("startpage", buf, 1);
+ if (!get_preference("startpage", &Buf)) {
+ Buf = NewStrBuf ();
+ StrBufPrintf(Buf, "dotskip&room=_BASEROOM_");
+ set_preference("startpage", Buf, 1);
}
- if (buf[0] == '/') {
- strcpy(buf, &buf[1]);
+ if (ChrPtr(Buf)[0] == '/') {
+ StrBufCutLeft(Buf, 1);
}
- http_redirect(buf);
+ http_redirect(ChrPtr(Buf));
}
* Disconnect from the Citadel server, and end this WebCit session
*/
void end_webcit_session(void) {
- char buf[256];
-
+
if (WC->logged_in) {
- sprintf(buf, "%d", WC->current_iconbar);
- set_preference("current_iconbar", buf, 0);
+ set_pref_long("current_iconbar", WC->current_iconbar, 0);
set_preference("floordiv_expanded", WC->floordiv_expanded, 1);
}
wprintf(_("Select access level for this user:"));
wprintf("<br />\n");
for (a = 0; a <= 6; ++a) {
- wprintf("<a href=\"validate?nonce=%ld?user=", WC->nonce);
+ wprintf("<a href=\"validate?nonce=%d?user=", WC->nonce);
urlescputs(user);
wprintf("&axlevel=%d\">%s</A> \n",
a, axdefs[a]);
}
wprintf("<form name=\"changepwform\" action=\"changepw\" method=\"post\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<table class=\"altern\" ");
wprintf("<tr class=\"even\"><td>");
wprintf(_("Enter new password:"));
wprintf("<div class=\"boxcontent\">\n");
wprintf("<FORM METHOD=\"POST\" action=\"save_task\">\n");
wprintf("<div style=\"display: none;\">\n ");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgnum\" VALUE=\"%ld\">\n",
msgnum);
wprintf("</div>");
time_t colheader_time;
struct tm colheader_tm;
char colheader_label[32];
- int weekstart = 0;
- char weekstart_buf[16];
+ long weekstart = 0;
char url[256];
char div_id[256];
char escaped_urlformat[256];
/* Determine what day to start.
*/
- get_preference("weekstart", weekstart_buf, sizeof weekstart_buf);
- weekstart = atoi(weekstart_buf);
+ get_pref_long("weekstart", &weekstart, 17);
/*
* Now back up to the 1st of the month...
struct tm colheader_tm;
char colheader_label[32];
int chg_month = 0;
- int weekstart = 0;
- char weekstart_buf[16];
+ long weekstart = 0;
/*
* Determine what day to start
*/
- get_preference("weekstart", weekstart_buf, sizeof weekstart_buf);
- weekstart = atoi(weekstart_buf);
+ get_pref_long("weekstart", &weekstart, 17);
/*
* Now back up to the 1st of the month...
wprintf("<table width=100%% border=0 cellpadding=1 cellspacing=1 "
"bgcolor=#EEEECC><TR>");
wprintf("</tr>\n");
- wprintf("<tr><td colspan=\"100%\">\n");
+ wprintf("<tr><td colspan=\"100%%\">\n");
/* Now do 35 days */
for (i = 0; i < 35; ++i) {
/* Before displaying Sunday, start a new CELL */
if ((i % 7) == 0) {
wc_strftime(&weeknumber[0], sizeof(weeknumber), "%U", &tm);
- wprintf("<table border='0' bgcolor=\"#EEEECC\" width='100%'> <tr><th colspan='4'>%s %s</th></tr>"
+ wprintf("<table border='0' bgcolor=\"#EEEECC\" width='100%%'> <tr><th colspan='4'>%s %s</th></tr>"
" <tr><td>%s</td><td width=70%%>%s</td><td>%s</td><td>%s</td></tr>\n",
_("Week"),
weeknumber,
void calendar_day_view(int year, int month, int day) {
int hour;
struct icaltimetype today, yesterday, tomorrow;
- int daystart = 8;
- int dayend = 17;
- char daystart_str[16], dayend_str[16];
+ long daystart;
+ long dayend;
struct tm d_tm;
char d_str[128];
int time_format;
int gap = 0;
time_format = get_time_format_cached ();
- get_preference("daystart", daystart_str, sizeof daystart_str);
- if (!IsEmptyStr(daystart_str)) daystart = atoi(daystart_str);
- get_preference("dayend", dayend_str, sizeof dayend_str);
- if (!IsEmptyStr(dayend_str)) dayend = atoi(dayend_str);
+ get_pref_long("daystart", &daystart, 8);
+ get_pref_long("dayend", &dayend, 17);
/* Today's date */
memset(&d_tm, 0, sizeof d_tm);
wprintf("<dt class=\"hour\" "
"style=\" "
"position: absolute; "
- "top: %dpx; left: 0px; "
+ "top: %ldpx; left: 0px; "
"height: %dpx; "
"\" > "
"<a href=\"display_edit_event?msgnum=0&calview=day"
wprintf("<dt class=\"extrahour\" "
"style=\" "
"position: absolute; "
- "top: %dpx; left: 0px; "
+ "top: %ldpx; left: 0px; "
"height: %dpx; "
"\" > "
"<a href=\"display_edit_event?msgnum=0&calview=day"
free_attachments(sessions_to_kill);
free_march_list(sessions_to_kill);
DeleteHash(&(sessions_to_kill->hash_prefs));
-
+ DeleteHash(&(sessions_to_kill->IconBarSetttings));
+
pthread_mutex_unlock(&sessions_to_kill->SessionMutex);
sptr = sessions_to_kill->next;
free(sessions_to_kill);
MBSTRING_ASC, "Mount Kisco", -1, -1, 0);
*/
- X509_NAME_add_entry_by_txt(name, "O",
- MBSTRING_ASC, "Organization name", -1, -1, 0);
-
- X509_NAME_add_entry_by_txt(name, "OU",
- MBSTRING_ASC, "Citadel server", -1, -1, 0);
-
- X509_NAME_add_entry_by_txt(name, "CN",
- MBSTRING_ASC, "*", -1, -1, 0);
+ X509_NAME_add_entry_by_txt(
+ name, "O",
+ MBSTRING_ASC,
+ (unsigned char*)"Organization name",
+ -1, -1, 0);
+
+ X509_NAME_add_entry_by_txt(
+ name, "OU",
+ MBSTRING_ASC,
+ (unsigned char*)"Citadel server",
+ -1, -1, 0);
+
+ X509_NAME_add_entry_by_txt(
+ name, "CN",
+ MBSTRING_ASC,
+ (unsigned char*)"*", -1, -1, 0);
X509_REQ_set_subject_name(req, name);
"name=\"upload_file_form\""
">\n"
);
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf(_("Upload a file:"));
wprintf(" <input NAME=\"filename\" SIZE=16 TYPE=\"file\"> \n");
*************************************************************/
wprintf("<FORM NAME=\"EventForm\" METHOD=\"POST\" action=\"save_event\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgnum\" VALUE=\"%ld\">\n",
msgnum);
"<INPUT TYPE=\"text\" NAME=\"floorname\" "
"VALUE=\"%s\" MAXLENGTH=\"250\">\n",
floornum, floorname);
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
"VALUE=\"%s\">"
"</FORM></TD>", _("Change name"));
"<INPUT TYPE=\"text\" NAME=\"floorcss\" "
"VALUE=\"%s\" MAXLENGTH=\"250\">\n",
floornum, floorname);
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
"VALUE=\"%s\">"
"</FORM></TD>", _("Change CSS"));
wprintf("<TR><TD> </TD>"
"<TD><FORM METHOD=\"POST\" action=\"create_floor\">");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<INPUT TYPE=\"text\" NAME=\"floorname\" "
"MAXLENGTH=\"250\">\n"
"<INPUT TYPE=\"SUBMIT\" NAME=\"sc\" "
*/
int get_time_format_cached (void)
{
- char calhourformat[16];
+ long calhourformat;
int *time_format_cache;
time_format_cache = &(WC->time_format_cache);
if (*time_format_cache == WC_TIMEFORMAT_NONE)
{
- get_preference("calhourformat", calhourformat, sizeof calhourformat);
- if (!strcasecmp(calhourformat, "24"))
+ get_pref_long("calhourformat", &calhourformat, 24);
+ if (calhourformat == 24)
*time_format_cache = WC_TIMEFORMAT_24;
else
*time_format_cache = WC_TIMEFORMAT_AMPM;
wprintf("<form enctype=\"multipart/form-data\" action=\"%s\" "
"method=\"post\" name=\"graphicsupload\">\n", uplurl);
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<input type=\"hidden\" name=\"which_room\" value=\"");
urlescputs(bstr("which_room"));
wprintf("\">\n");
converted_alloc = content_length + 8192;
converted_msg = malloc(converted_alloc);
if (converted_msg == NULL) {
- wprintf("Error %d: %s<br />%s:%s", errno, strerror(errno), __FILE__, __LINE__);
+ wprintf("Error %d: %s<br />%s:%d", errno, strerror(errno), __FILE__, __LINE__);
goto BAIL;
}
}
}
-/**
- * \brief draw the icon bar???
- */
-void do_iconbar(void) {
- char iconbar[SIZ];
- char buf[SIZ];
- char key[SIZ], value[SIZ];
- int i;
+void DontDeleteThis(void *Data){};
+
+#define IconbarIsEnabled(a, b) IconbarIsENABLED(a, sizeof(a), b)
+
+long IconbarIsENABLED(const char *key, size_t keylen, long defval)
+{
+ void *Data;
+ if (GetHash(WC->IconBarSetttings, key, keylen,
+ &Data))
+ return (long) Data;
+ else
+ return defval;
+}
- WC->current_iconbar = current_iconbar_menu;
+static char nbuf[32];
+inline const char *PrintInt(void *Prefstr)
+{
+ snprintf(nbuf, sizeof(nbuf), "%ld", Prefstr);
+ return nbuf;
+}
+void LoadIconSettings(void)
+{
+ struct wcsession *WCC = WC;
+ StrBuf *iconbar;
+ StrBuf *buf = NewStrBuf();;
+ StrBuf *key = NewStrBuf();
+ long val;
+ int i, nTokens;
+
+ WCC->current_iconbar = current_iconbar_menu;
+ if (WCC->IconBarSetttings == NULL)
+ WCC->IconBarSetttings = NewHash(1, NULL);
/**
* The initialized values of these variables also happen to
* specify the default values for users who haven't customized
* their iconbars. These should probably be set in a master
* configuration somewhere.
*/
- int ib_displayas = 0; /**< pictures and text, pictures, text */
- int ib_logo = 0; /**< Site logo */
- int ib_summary = 1; /**< Summary page icon */
- int ib_inbox = 1; /**< Inbox icon */
- int ib_calendar = 1; /**< Calendar icon */
- int ib_contacts = 1; /**< Contacts icon */
- int ib_notes = 1; /**< Notes icon */
- int ib_tasks = 1; /**< Tasks icon */
- int ib_rooms = 1; /**< Rooms icon */
- int ib_users = 1; /**< Users icon */
- int ib_chat = 1; /**< Chat icon */
- int ib_advanced = 1; /**< Advanced Options icon */
- int ib_citadel = 1; /**< 'Powered by Citadel' logo */
- /*
- */
- get_preference("iconbar", iconbar, sizeof iconbar);
- for (i=0; i<num_tokens(iconbar, ','); ++i) {
- extract_token(buf, iconbar, i, ',', sizeof buf);
- extract_token(key, buf, 0, '=', sizeof key);
- extract_token(value, buf, 1, '=', sizeof value);
-
- if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
- if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
- if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
- if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
- if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
- if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
- if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
- if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
- if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
- if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
- if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
- if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
- if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
+ if (get_preference("iconbar", &iconbar)) {
+ nTokens = StrBufNum_tokens(iconbar, ',');
+ for (i=0; i<nTokens; ++i) {
+ StrBufExtract_token(buf, iconbar, i, ',');
+ StrBufExtract_token(key, buf, 0, '=');
+ val = StrBufExtract_long(buf, 1, '=');
+ Put(WCC->IconBarSetttings,
+ ChrPtr(key), StrLength(key),
+ (void*)val, DontDeleteThis);
+ }
}
+ printf("-----------icon-------------------\n");
+ dbg_PrintHash(WCC->IconBarSetttings, PrintInt, NULL);
+
+ FreeStrBuf(&key);
+ FreeStrBuf(&buf);
+}
+
+
+/**
+ * \brief draw the icon bar???
+ */
+void do_iconbar(void) {
+ int ib_displayas = 0; /**< pictures and text, pictures, text */
- if (ib_logo) {
+ LoadIconSettings();
+ ib_displayas = IconbarIsEnabled("ib_displayas", 0);
+
+/** Site logo */
+ if (IconbarIsEnabled("ib_logo", 0)) {
if (ib_displayas != IB_TEXTONLY) {
wprintf("<div class=\"logo\"> <img "
"src=\"image&name=hello\" alt=\" \"> "
wprintf("\n");
}
- if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
+/** 'Powered by Citadel' logo */
+ if (IconbarIsEnabled("ib_citadel", 1) && (ib_displayas != IB_TEXTONLY)) wprintf(
"<div class=\"logo_citadel\"> "
"<a href=\"http://www.citadel.org\" "
"title=\"%s\"> "
wprintf(_("switch to room list"));
wprintf("</a></li>");
- if (ib_summary) {
+/** Summary page icon */
+ if (IconbarIsEnabled("ib_summary", 1)) {
wprintf("<li><a href=\"summary\" "
"title=\"%s\" "
">", _("Your summary page")
wprintf("</a></li>\n");
}
- if (ib_inbox) {
+/** Inbox icon */
+ if (IconbarIsEnabled("ib_inbox", 1)) {
wprintf("<li>"
"<a href=\"dotgoto?room=_MAIL_\" "
"title=\"%s\" "
wprintf("</a></li>\n");
}
- if (ib_calendar) {
+/** Calendar icon */
+ if (IconbarIsEnabled("ib_calendar", 1)) {
wprintf("<li>"
"<a href=\"dotgoto?room=_CALENDAR_\" "
"title=\"%s\" "
wprintf("</a></li>\n");
}
- if (ib_contacts) {
+/** Contacts icon */
+ if (IconbarIsEnabled("ib_contacts", 1)) {
wprintf("<li>"
"<a href=\"dotgoto?room=_CONTACTS_\" "
"title=\"%s\" "
wprintf("</a></li>\n");
}
- if (ib_notes) {
+/** Notes icon */
+ if (IconbarIsEnabled("ib_notes", 1)) {
wprintf("<li>"
"<a href=\"dotgoto?room=_NOTES_\" "
"title=\"%s\" "
wprintf("</a></li>\n");
}
- if (ib_tasks) {
+/** Tasks icon */
+ if (IconbarIsEnabled("ib_tasks", 1)) {
wprintf("<li>"
"<a href=\"dotgoto?room=_TASKS_\" "
"title=\"%s\" "
wprintf("</a></li>\n");
}
- if (ib_rooms) {
+/** Rooms icon */
+ if (IconbarIsEnabled("ib_rooms", 1)) {
wprintf("<li>"
"<a href=\"knrooms\" title=\"%s\" >",
_("List all of your accessible rooms")
wprintf("</a></li>\n");
}
- if (ib_users) {
+/** Users icon */
+ if (IconbarIsEnabled("ib_users", 1)) {
wprintf("<li>"
"<a href=\"who\" title=\"%s\" "
">",
wprintf("</a>\n");
- if (ib_users > 1) {
+ if (IconbarIsEnabled("ib_users", 0)) {
wprintf("<ul id=\"wholist\">");
wprintf("</ul></li>\n");
}
}
- if (ib_chat) {
+/** Chat icon */
+ if (IconbarIsEnabled("ib_chat", 1)) {
wprintf("<li>"
"<a href=\"#\" onClick=\"window.open('chat', "
"'ctdl_chat_window', "
wprintf("</a></li>\n");
}
- if (ib_advanced) {
+/** Advanced Options icon */
+ if (IconbarIsEnabled("ib_advanced", 1)) {
wprintf("<li>"
"<a href=\"display_main_menu\" "
"title=\"%s\" "
wprintf("</ul>\n");
- if (ib_users > 1) {
+ if (IconbarIsEnabled("ib_users", 0)) {
wprintf(
"<script type=\"text/javascript\"> "
" new Ajax.PeriodicalUpdater('wholist', 'wholist_section', { method: 'get', frequency: 30 } );"
- "</script> \n"
- );
+ "</script> \n"
+ );
}
-
}
* we generate its innerHTML...
*/
void do_iconbar_roomlist(void) {
- char iconbar[SIZ];
- char buf[SIZ];
- char key[SIZ], value[SIZ];
- int i;
-
+
WC->current_iconbar = current_iconbar_roomlist;
/**
* their iconbars. These should probably be set in a master
* configuration somewhere.
*/
- int ib_displayas = 0; /* pictures and text, pictures, text */
- int ib_logo = 0; /* Site logo */
- int ib_citadel = 1; /* 'Powered by Citadel' logo */
- /*
- */
+ int ib_displayas;
- get_preference("iconbar", iconbar, sizeof iconbar);
- for (i=0; i<num_tokens(iconbar, ','); ++i) {
- extract_token(buf, iconbar, i, ',', sizeof buf);
- extract_token(key, buf, 0, '=', sizeof key);
- extract_token(value, buf, 1, '=', sizeof value);
+ LoadIconSettings();
- if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
- if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
- if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
- }
+ ib_displayas = IconbarIsEnabled("ib_displayas", 0); /* pictures and text, pictures, text */
- if (ib_logo) {
+/** Site logo */
+ if (IconbarIsEnabled("ib_logo", 0)) {
if (ib_displayas != IB_TEXTONLY) {
wprintf("<div class=\"logo\"> <img "
"src=\"image&name=hello\" alt=\" \"> "
}
}
- if (ib_citadel) if (ib_displayas != IB_TEXTONLY) wprintf(
+/** 'Powered by Citadel' logo */
+ if (IconbarIsEnabled("ib_citadel", 1) && (ib_displayas != IB_TEXTONLY)) wprintf(
"<div class=\"logo_citadel\"> "
"<a href=\"http://www.citadel.org\" "
"title=\"%s\"> "
* \brief display a customized version of the iconbar
*/
void display_customize_iconbar(void) {
- char iconbar[SIZ];
- char buf[SIZ];
- char key[SIZ], value[SIZ];
int i;
int bar = 0;
+ long val;
- /**
- * The initialized values of these variables also happen to
- * specify the default values for users who haven't customized
- * their iconbars. These should probably be set in a master
- * configuration somewhere.
- */
- int ib_displayas = IB_PICTEXT; /**< pictures and text, pictures, text */
- int ib_logo = 0; /**< Site logo */
- int ib_summary = 1; /**< Summary page icon */
- int ib_inbox = 1; /**< Inbox icon */
- int ib_calendar = 1; /**< Calendar icon */
- int ib_contacts = 1; /**< Contacts icon */
- int ib_notes = 1; /**< Notes icon */
- int ib_tasks = 1; /**< Tasks icon */
- int ib_rooms = 1; /**< Rooms icon */
- int ib_users = 1; /**< Users icon */
- int ib_chat = 1; /**< Chat icon */
- int ib_advanced = 1; /**< Advanced Options icon */
- int ib_citadel = 1; /**< 'Powered by Citadel' logo */
- /*
- */
+ int ib_displayas;
- get_preference("iconbar", iconbar, sizeof iconbar);
- for (i=0; i<num_tokens(iconbar, ','); ++i) {
- extract_token(buf, iconbar, i, ',', sizeof buf);
- extract_token(key, buf, 0, '=', sizeof key);
- extract_token(value, buf, 1, '=', sizeof value);
-
- if (!strcasecmp(key, "ib_displayas")) ib_displayas = atoi(value);
- if (!strcasecmp(key, "ib_logo")) ib_logo = atoi(value);
- if (!strcasecmp(key, "ib_summary")) ib_summary = atoi(value);
- if (!strcasecmp(key, "ib_inbox")) ib_inbox = atoi(value);
- if (!strcasecmp(key, "ib_calendar")) ib_calendar = atoi(value);
- if (!strcasecmp(key, "ib_contacts")) ib_contacts = atoi(value);
- if (!strcasecmp(key, "ib_notes")) ib_notes = atoi(value);
- if (!strcasecmp(key, "ib_tasks")) ib_tasks = atoi(value);
- if (!strcasecmp(key, "ib_rooms")) ib_rooms = atoi(value);
- if (!strcasecmp(key, "ib_users")) ib_users = atoi(value);
- if (!strcasecmp(key, "ib_chat")) ib_chat = atoi(value);
- if (!strcasecmp(key, "ib_advanced")) ib_advanced = atoi(value);
- if (!strcasecmp(key, "ib_citadel")) ib_citadel = atoi(value);
- }
+ LoadIconSettings();
output_headers(1, 1, 2, 0, 0, 0);
wprintf("<div id=\"banner\">");
wprintf("<div class=\"fix_scrollbar_bug\">");
wprintf("<form method=\"post\" action=\"commit_iconbar\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<table class=\"altern\" >\n");
wprintf("<tr><td></td><td colspan=\"2\"><b>");
wprintf(_("Display icons as:"));
wprintf("</b>");
+ ib_displayas = IconbarIsEnabled("ib_displayas",IB_PICTEXT);
for (i=0; i<=2; ++i) {
wprintf("<input type=\"radio\" name=\"ib_displayas\" value=\"%d\"", i);
if (ib_displayas == i) wprintf(" CHECKED");
wprintf("</td></tr>\n");
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_logo", 0);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_logo\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_logo\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_logo ? "CHECKED" : ""),_("Yes"),
- (!ib_logo ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Site logo"),
_("An icon describing this site")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_summary", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_summary\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_summary\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_summary ? "CHECKED" : ""),_("Yes"),
- (!ib_summary ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Summary"),
_("Your summary page")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_inbox", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_inbox\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_inbox\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_inbox ? "CHECKED" : ""),_("Yes"),
- (!ib_inbox ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Mail (inbox)"),
_("A shortcut to your email Inbox")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_contacts", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_contacts\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_contacts\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_contacts ? "CHECKED" : ""),_("Yes"),
- (!ib_contacts ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Contacts"),
_("Your personal address book")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_notes", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_notes\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_notes\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_notes ? "CHECKED" : ""),_("Yes"),
- (!ib_notes ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Notes"),
_("Your personal notes")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_calendar", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_calendar\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_calendar\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_calendar ? "CHECKED" : ""),_("Yes"),
- (!ib_calendar ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Calendar"),
_("A shortcut to your personal calendar")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_tasks", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_tasks\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_tasks\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_tasks ? "CHECKED" : ""),_("Yes"),
- (!ib_tasks ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Tasks"),
_("A shortcut to your personal task list")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_rooms", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_rooms\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_rooms\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_rooms ? "CHECKED" : ""),_("Yes"),
- (!ib_rooms ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Rooms"),
_("Clicking this icon displays a list of all accessible "
"rooms (or folders) available.")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_users", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_users\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_users\" value=\"no\" %s> %s <br />"
"<br />%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_users ? "CHECKED" : ""),_("Yes"),
- (!ib_users ? "CHECKED" : ""),_("No"),
- ((ib_users > 1) ? "CHECKED" : ""),_("Yes with users list"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
+ ((val > 1) ? "CHECKED" : ""),_("Yes with users list"),
_("Who is online?"),
_("Clicking this icon displays a list of all users "
"currently logged in.")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_chat", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_chat\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_chat\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_chat ? "CHECKED" : ""),_("Yes"),
- (!ib_chat ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Chat"),
_("Clicking this icon enters real-time chat mode "
"with other users in the same room.")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_advanced", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_advanced\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_advanced\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_advanced ? "CHECKED" : ""),_("Yes"),
- (!ib_advanced ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Advanced options"),
_("Access to the complete menu of Citadel functions.")
);
bar = 1 - bar;
+ val = IconbarIsEnabled("ib_citadel", 1);
wprintf("<tr class=\"%s\"><td>"
"<input type=\"radio\" name=\"ib_citadel\" value=\"yes\" %s> %s "
"<input type=\"radio\" name=\"ib_citadel\" value=\"no\" %s> %s <br />"
"%s"
"</td></tr>\n",
(bar ? "even" : "odd"),
- (ib_citadel ? "CHECKED" : ""),_("Yes"),
- (!ib_citadel ? "CHECKED" : ""),_("No"),
+ (val ? "CHECKED" : ""),_("Yes"),
+ (!val ? "CHECKED" : ""),_("No"),
_("Citadel logo"),
_("Displays the 'Powered by Citadel' icon")
);
* \brief commit the changes of an edited iconbar ????
*/
void commit_iconbar(void) {
- char iconbar[SIZ];
+ StrBuf *iconbar;
+ StrBuf *buf;
int i;
char *boxen[] = {
return;
}
- sprintf(iconbar, "ib_displayas=%d", ibstr("ib_displayas"));
-
+ iconbar = NewStrBuf();
+ buf = NewStrBuf();
+ StrBufPrintf(iconbar, "ib_displayas=%d", ibstr("ib_displayas"));
for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
char *Val;
if (!strcasecmp(BSTR(boxen[i]), "yes")) {
else {
Val = "0";
}
- sprintf(&iconbar[strlen(iconbar)], ",%s=%s", boxen[i], Val);
- }
+ StrBufPrintf(buf, ",%s=%s", boxen[i], Val);
+ StrBufAppendBuf(iconbar, buf, 0);
+ }
+ FreeStrBuf(&buf);
set_preference("iconbar", iconbar, 1);
output_headers(1, 1, 2, 0, 0, 0);
"choices to continue."));
wprintf("</td></tr></table>\n");
wDumpContent(2);
+ printf("-----------icon-------------------\n");
+ dbg_PrintHash(WC->IconBarSetttings, PrintInt, NULL);
}
}
wprintf("<form method=\"post\" action=\"save_inetconf\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<tr><td>"
"<input type=\"text\" name=\"ename\" maxlength=\"64\">"
"<input type=\"hidden\" name=\"etype\" VALUE=\"%s\">", ic_keyword[which]);
wprintf("<br />\n");
wprintf("<form method=\"post\" action=\"do_generic\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf(_("Enter command:"));
wprintf("<br /><input type=\"text\" name=\"g_cmd\" size=80 maxlength=\"250\"><br />\n");
}
}
if (illegal_non_rfc2047_encoding) {
- char default_header_charset[128];
- get_preference("default_header_charset", default_header_charset, sizeof default_header_charset);
- if ( (strcasecmp(default_header_charset, "UTF-8")) && (strcasecmp(default_header_charset, "us-ascii")) ) {
- ic = ctdl_iconv_open("UTF-8", default_header_charset);
+ StrBuf *default_header_charset;
+ get_preference("default_header_charset", &default_header_charset);
+ if ( (strcasecmp(ChrPtr(default_header_charset), "UTF-8")) &&
+ (strcasecmp(ChrPtr(default_header_charset), "us-ascii")) ) {
+ ic = ctdl_iconv_open("UTF-8", ChrPtr(default_header_charset));
if (ic != (iconv_t)(-1) ) {
ibuf = malloc(1024);
isav = ibuf;
wprintf("<tr><td>");
wprintf(_("Photo:"));
wprintf("</td><td>");
- wprintf("<img src=\"/vcardphoto/%d/\" alt=\"Contact photo\"/>",msgnum);
+ wprintf("<img src=\"/vcardphoto/%ld/\" alt=\"Contact photo\"/>",msgnum);
wprintf("</td></tr>\n");
}
else if (!strcasecmp(firsttoken, "version")) {
urlescputs(reply_to);
if (!IsEmptyStr(m_subject)) {
wprintf("?subject=");
- if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
+ if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%%20");
urlescputs(m_subject);
}
wprintf("?references=");
urlescputs(reply_to);
if (!IsEmptyStr(m_subject)) {
wprintf("?subject=");
- if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
+ if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%%20");
urlescputs(m_subject);
}
wprintf("?references=");
urlescputs(reply_all);
if (!IsEmptyStr(m_subject)) {
wprintf("?subject=");
- if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%20");
+ if (strncasecmp(m_subject, "Re:", 3)) wprintf("Re:%%20");
urlescputs(m_subject);
}
wprintf("?references=");
/* Forward */
if (WC->wc_view == VIEW_MAILBOX) {
wprintf("<a href=\"display_enter?fwdquote=%ld?subject=", msgnum);
- if (strncasecmp(m_subject, "Fwd:", 4)) wprintf("Fwd:%20");
+ if (strncasecmp(m_subject, "Fwd:", 4)) wprintf("Fwd:%%20");
urlescputs(m_subject);
wprintf("\"><span>[</span>%s<span>]</span></a> ", _("Forward"));
}
/* Unknown weirdness */
else {
wprintf(_("I don't know how to display %s"), mime_content_type);
- wprintf("<br />\n", mime_content_type);
+ wprintf("<br />\n");
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) { }
}
int highest_displayed = 0;
struct addrbookent *addrbook = NULL;
int num_ab = 0;
- char *sortby = NULL;
- char sortpref_name[128];
- char sortpref_value[128];
+ StrBuf *sortby = NULL;
+ StrBuf *sortpref_name;
+ StrBuf *sortpref_value;
char *subjsort_button;
char *sendsort_button;
char *datesort_button;
is_summary = (ibstr("is_summary") && !WCC->is_mobile);
if (maxmsgs == 0) maxmsgs = DEFAULT_MAXMSGS;
- snprintf(sortpref_name, sizeof sortpref_name, "sort %s", WCC->wc_roomname);
- get_preference(sortpref_name, sortpref_value, sizeof sortpref_value);
+ sortpref_name = NewStrBuf ();
+ StrBufPrintf(sortpref_name, "sort %s", WCC->wc_roomname);
+ get_pref(sortpref_name, &sortpref_value);
- sortby = bstr("sortby");
- if ( (!IsEmptyStr(sortby)) && (strcasecmp(sortby, sortpref_value)) ) {
- set_preference(sortpref_name, sortby, 1);
+ sortby = NewStrBufPlain(bstr("sortby"), -1);
+ if ( (!IsEmptyStr(ChrPtr(sortby))) &&
+ (strcasecmp(ChrPtr(sortby), ChrPtr(sortpref_value))) ) {
+ set_pref(sortpref_name, sortby, 1);
}
- if (IsEmptyStr(sortby)) sortby = sortpref_value;
+ FreeStrBuf(&sortpref_name);
+ if (IsEmptyStr(ChrPtr(sortby))) StrBufAppendBuf(sortby, sortpref_value, 0);
/** mailbox sort */
- if (IsEmptyStr(sortby)) sortby = "rdate";
+ if (IsEmptyStr(ChrPtr(sortby))) StrBufPrintf(sortby, "rdate");
/** message board sort */
- if (!strcasecmp(sortby, "reverse")) {
+ if (!strcasecmp(ChrPtr(sortby), "reverse")) {
bbs_reverse = 1;
}
else {
}
if (is_summary || WCC->is_mobile) {
- if (!strcasecmp(sortby, "subject")) {
+ if (!strcasecmp(ChrPtr(sortby), "subject")) {
qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_subj);
}
- else if (!strcasecmp(sortby, "rsubject")) {
+ else if (!strcasecmp(ChrPtr(sortby), "rsubject")) {
qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_rsubj);
}
- else if (!strcasecmp(sortby, "sender")) {
+ else if (!strcasecmp(ChrPtr(sortby), "sender")) {
qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_sender);
}
- else if (!strcasecmp(sortby, "rsender")) {
+ else if (!strcasecmp(ChrPtr(sortby), "rsender")) {
qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_rsender);
}
- else if (!strcasecmp(sortby, "date")) {
+ else if (!strcasecmp(ChrPtr(sortby), "date")) {
qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_date);
}
- else if (!strcasecmp(sortby, "rdate")) {
+ else if (!strcasecmp(ChrPtr(sortby), "rdate")) {
qsort(WCC->summ, WCC->num_summ,
sizeof(struct message_summary), summcmp_rdate);
}
}
- if (!strcasecmp(sortby, "subject")) {
+ if (!strcasecmp(ChrPtr(sortby), "subject")) {
subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=rsubject\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
}
- else if (!strcasecmp(sortby, "rsubject")) {
+ else if (!strcasecmp(ChrPtr(sortby), "rsubject")) {
subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=subject\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
}
else {
subjsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=subject\"><img border=\"0\" src=\"static/sort_none.gif\" /></a>" ;
}
- if (!strcasecmp(sortby, "sender")) {
+ if (!strcasecmp(ChrPtr(sortby), "sender")) {
sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=rsender\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
}
- else if (!strcasecmp(sortby, "rsender")) {
+ else if (!strcasecmp(ChrPtr(sortby), "rsender")) {
sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=sender\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
}
else {
sendsort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=sender\"><img border=\"0\" src=\"static/sort_none.gif\" /></a>" ;
}
- if (!strcasecmp(sortby, "date")) {
+ if (!strcasecmp(ChrPtr(sortby), "date")) {
datesort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=rdate\"><img border=\"0\" src=\"static/down_pointer.gif\" /></a>" ;
}
- else if (!strcasecmp(sortby, "rdate")) {
+ else if (!strcasecmp(ChrPtr(sortby), "rdate")) {
datesort_button = "<a href=\"readfwd?startmsg=1?maxmsgs=9999999?is_summary=1?sortby=date\"><img border=\"0\" src=\"static/up_pointer.gif\" /></a>" ;
}
else {
if (is_bbview) {
/** begin bbview scroller */
wprintf("<form name=\"msgomatictop\" class=\"selector_top\" > \n <p>");
- wprintf(_("Reading #"), lowest_displayed, highest_displayed);
+ wprintf(_("Reading #"));//// TODO this isn't used, should it? : , lowest_displayed, highest_displayed);
wprintf("<select name=\"whichones\" size=\"1\" "
"OnChange=\"location.href=msgomatictop.whichones.options"
if (is_bbview) {
/** begin bbview scroller */
wprintf("<form name=\"msgomatic\" class=\"selector_bottom\" > \n <p>");
- wprintf(_("Reading #"), lowest_displayed, highest_displayed);
+ wprintf(_("Reading #")); /// TODO: this isn't used: , lowest_displayed, highest_displayed);
wprintf("<select name=\"whichones\" size=\"1\" "
"OnChange=\"location.href=msgomatic.whichones.options"
void display_enter(void)
{
char buf[SIZ];
- char ebuf[SIZ];
+ StrBuf *ebuf;
long now;
char *display_name;
struct wc_attachment *att;
wprintf("<input type=\"hidden\" name=\"wikipage\" value=\"%s\">\n", bstr("wikipage"));
}
wprintf("<input type=\"hidden\" name=\"return_to\" value=\"%s\">\n", bstr("return_to"));
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<input type=\"hidden\" name=\"force_room\" value=\"");
escputs(WC->wc_roomname);
wprintf("\">\n");
/** Insert our signature if appropriate... */
if ( (WC->is_mailbox) && yesbstr("sig_inserted") ) {
- get_preference("use_sig", buf, sizeof buf);
- if (!strcasecmp(buf, "yes")) {
+ int UseSig;
+ get_pref_yesno("use_sig", &UseSig, 0);
+ if (UseSig) {
int len;
- get_preference("signature", ebuf, sizeof ebuf);
- euid_unescapize(buf, ebuf);
+ get_preference("signature", &ebuf);
+ euid_unescapize(buf, ChrPtr(ebuf));/////TODO
wprintf("<br>--<br>");
len = strlen(buf);
for (i=0; i<len; ++i) {
wprintf("<br />\n");
wprintf("<form METHOD=\"POST\" action=\"move_msg\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%s\">\n", bstr("msgid"));
wprintf("<SELECT NAME=\"target_room\" SIZE=5>\n");
wprintf("<div id=\"content\" class=\"service\">\n");
wprintf("<FORM METHOD=\"POST\" action=\"edit_node\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<CENTER><TABLE border=0>\n");
wprintf("<TR><TD>%s</TD>", _("Node name"));
wprintf("<TD><INPUT TYPE=\"text\" NAME=\"node\" MAXLENGTH=\"16\"></TD></TR>\n");
if (!strcasecmp(node, cnode)) {
wprintf("<FORM METHOD=\"POST\" action=\"edit_node\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<CENTER><TABLE border=0>\n");
wprintf("<TR><TD>");
wprintf(_("Node name"));
v = vnote_new_from_msg(msgnum);
if (!v) {
begin_ajax_response();
- wprintf("Cannot locate a vNote within message %ld\n", msgnum);
+ wprintf("Cannot locate a vNote within message %d\n", msgnum);
end_ajax_response();
return;
}
wprintf("</table><br />\n");
wprintf("<form method=\"POST\" action=\"openid_attach\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf(_("Add an OpenID: "));
wprintf("<input type=\"text\" name=\"openid_url\" class=\"openid_urlarea\" size=\"40\">\n");
wprintf("<input type=\"submit\" name=\"attach_button\" value=\"%s\">"
wprintf("<br>\n");
wprintf("<FORM METHOD=\"POST\" action=\"page_user\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<TABLE border=0 width=100%%><TR><TD>\n");
WC->chat_sock = i;
wprintf("<FORM METHOD=\"POST\" action=\"chat_send\" NAME=\"chatsendform\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<INPUT TYPE=\"text\" SIZE=\"80\" MAXLENGTH=\"%d\" "
"NAME=\"send_this\">\n", SIZ-10);
wprintf("<br />");
inline const char *PrintPref(void *Prefstr)
{
- return Prefstr;
+ return ChrPtr(Prefstr);
}
/*
void load_preferences(void) {
char buf[SIZ];
long msgnum = 0L;
- char key[SIZ], value[SIZ];
+ StrBuf *ReadBuf;
serv_printf("GOTO %s", USERCONFIGROOM);
serv_getln(buf, sizeof buf);
serv_printf("MSG0 %ld", msgnum);
serv_getln(buf, sizeof buf);
if (buf[0] == '1') {
- while (serv_getln(buf, sizeof buf),
- (strcmp(buf, "text") && strcmp(buf, "000"))) {
+ ReadBuf = NewStrBuf();
+ while (StrBuf_ServGetln(ReadBuf),
+ (strcmp(ChrPtr(ReadBuf), "text") &&
+ strcmp(ChrPtr(ReadBuf), "000"))) {
}
- if (!strcmp(buf, "text")) {
- while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
- extract_token(key, buf, 0, '|', sizeof key);
- extract_token(value, buf, 1, '|', sizeof value);
- if (!IsEmptyStr(key))
- Put(WC->hash_prefs, key, strlen(key), strdup(value), free);
+ if (!strcmp(ChrPtr(ReadBuf), "text")) {
+ StrBuf *Key;
+ StrBuf *Data = NULL;
+ StrBuf *LastData = NULL;
+
+ Key = NewStrBuf();
+ while (StrBuf_ServGetln(ReadBuf),
+ strcmp(ChrPtr(ReadBuf), "000"))
+ {
+ if ((ChrPtr(ReadBuf)[0] == ' ') &&
+ (Data != NULL)) {
+ StrBufAppendBuf(Data, ReadBuf, 1);
+ }
+ else {
+ LastData = Data = NewStrBuf();
+ StrBufExtract_token(Key, ReadBuf, 0, '|');
+ StrBufExtract_token(Data, ReadBuf, 1, '|');
+ if (!IsEmptyStr(ChrPtr(Key)))
+ {
+ Put(WC->hash_prefs,
+ ChrPtr(Key), StrLength(Key),
+ Data,
+ HFreeStrBuf);
+ }
+ else
+ {
+ FreeStrBuf(&Data);
+ LastData = NULL;
+ }
+ }
}
+ FreeStrBuf(&Key);
}
}
}
HashList *Hash;
void *Value;
char *Key;
+ StrBuf *Buf;
+ StrBuf *SubBuf = NULL;
Hash = WC->hash_prefs;
dbg_PrintHash(Hash, PrintPref, NULL);
HashPos = GetNewHashPos();
while (GetNextHashPos(Hash, HashPos, &len, &Key, &Value)!=0)
{
- serv_printf("%s|%s", Key, (char*)Value);
+ size_t nchars;
+ Buf = (StrBuf*) Value;
+ nchars = StrLength(Buf);
+ if (nchars > 80){
+ int n = 0;
+ size_t offset, nchars;
+ if (SubBuf == NULL)
+ SubBuf = NewStrBuf();
+ nchars = 1;
+ offset = 0;
+ while (nchars > 0) {
+ if (n == 0)
+ nchars = 70;
+ else
+ nchars = 80;
+
+ nchars = StrBufSub(SubBuf, Buf, offset, nchars);
+
+ if (n == 0)
+ serv_printf("%s|%s", Key, ChrPtr(SubBuf));
+ else
+ serv_printf(" %s", Key, ChrPtr(SubBuf));
+
+ offset += nchars;
+ n++;
+ }
+
+ }
+ else
+ serv_printf("%s|%s", Key, ChrPtr(Buf));
+
}
+ if (SubBuf != NULL)
+ FreeStrBuf(&SubBuf);
serv_puts("");
serv_puts("000");
DeleteHashPos(&HashPos);
/**
* \brief query the actual setting of key in the citadel database
* \param key config key to query
- * \param value value to the key to get
- * \param value_len length of the value string
+ * \param keylen length of the key string
+ * \param value StrBuf-value to the key to get
+ * \returns found?
*/
-void get_preference(char *key, char *value, size_t value_len) {
+int get_PREFERENCE(const char *key, size_t keylen, StrBuf **value)
+{
void *hash_value = NULL;
- strcpy(value, "");
dbg_PrintHash(WC->hash_prefs, PrintPref, NULL);
- if (GetHash(WC->hash_prefs, key, strlen(key), &hash_value) == 0)
- return;
-
- if(hash_value)
- safestrncpy(value, hash_value, value_len);
+ if (GetHash(WC->hash_prefs, key, keylen, &hash_value) == 0) {
+ *value = NULL;
+ return 0;
+ }
+ else {
+ *value = NULL;
+ *value = (StrBuf*) hash_value;
+ return 1;
+ }
}
/**
* \brief Write a key into the webcit preferences database for this user
*
* \params key key whichs value is to be modified
+ * \param keylen length of the key string
* \param value value to set
* \param save_to_server 1 = flush all data to the server, 0 = cache it for now
*/
-void set_preference(char *key, char *value, int save_to_server) {
+void set_PREFERENCE(const char *key, size_t keylen, StrBuf *value, int save_to_server) {
- Put(WC->hash_prefs, key, strlen(key), strdup(value), free);
+ Put(WC->hash_prefs, key, keylen, value, HFreeStrBuf);
if (save_to_server) save_preferences();
}
+int get_PREF_LONG(const char *key, size_t keylen, long *value, long Default)
+{
+ int ret;
+ StrBuf *val;
+ ret = get_PREFERENCE(key, keylen, &val);
+ if (ret) {
+ *value = atol(ChrPtr(val));
+ }
+ else {
+ *value = Default;
+ }
+
+ return ret;
+}
+
+
+void set_PREF_LONG(const char *key, size_t keylen, long value, int save_to_server)
+{
+ StrBuf *val;
+ if (get_PREFERENCE(key, keylen, &val)) {
+ StrBufPrintf(val, "%ld", value);
+ }
+ else {
+ val = NewStrBuf();
+ StrBufPrintf(val, "%ld", value);
+ set_PREFERENCE(key, keylen, val, save_to_server);
+ }
+}
+int get_PREF_YESNO(const char *key, size_t keylen, int *value, int Default)
+{
+ int ret;
+ StrBuf *val;
+ ret = get_PREFERENCE(key, keylen, &val);
+ if (ret) {
+ *value = strcmp(ChrPtr(val), "yes") == 0;
+ }
+ else {
+ *value = Default;
+ }
+
+ return ret;
+}
+
+void set_PREF_YESNO(const char *key, size_t keylen, int value, int save_to_server)
+{
+ StrBuf *val;
+ if (get_PREFERENCE(key, keylen, &val)) {
+ StrBufPrintf(val, "%s", (value)?"yes":"no");
+ }
+ else {
+ val = NewStrBuf();
+ StrBufPrintf(val, "%s", (value)?"yes":"no");
+ set_PREFERENCE(key, keylen, val, save_to_server);
+ }
+}
+
/**
* \brief display form for changing your preferences and settings
*/
void display_preferences(void)
{
output_headers(1, 1, 1, 0, 0, 0);
- char ebuf[300];
- char buf[256];
+ StrBuf *ebuf = NULL;
int i;
+ long DayEnd, DayStart, WeekStart;
+ int UseSig, ShowEmptyFloors;
int time_format;
time_t tt;
struct tm tm;
char daylabel[32];
-
+ StrBuf *Buf;
+ StrBuf *Signature;
+
time_format = get_time_format_cached ();
wprintf("<div class=\"box\">\n");
/** begin form */
wprintf("<form name=\"prefform\" action=\"set_preferences\" "
"method=\"post\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
/** begin table */
wprintf("<table class=\"altern\">\n");
/**
* Room list view
*/
- get_preference("roomlistview", buf, sizeof buf);
+ get_preference("roomlistview", &Buf);
wprintf("<tr class=\"even\"><td>");
wprintf(_("Room list view"));
wprintf("</td><td>");
wprintf("<input type=\"radio\" name=\"roomlistview\" VALUE=\"folders\"");
- if (!strcasecmp(buf, "folders")) wprintf(" checked");
+ if (!strcasecmp(ChrPtr(Buf), "folders")) wprintf(" checked");
wprintf(">");
wprintf(_("Tree (folders) view"));
wprintf("</input> ");
wprintf("<input type=\"radio\" name=\"roomlistview\" VALUE=\"rooms\"");
- if (!strcasecmp(buf, "rooms")) wprintf(" checked");
+ if (IsEmptyStr(ChrPtr(Buf)) || !strcasecmp(ChrPtr(Buf), "rooms")) wprintf(" checked");
wprintf(">");
wprintf(_("Table (rooms) view"));
wprintf("</input>\n");
/**
* Calendar day view -- day start time
*/
- get_preference("daystart", buf, sizeof buf);
- if (buf[0] == 0) strcpy(buf, "8");
+ get_pref_long("daystart", &DayStart, 8);
+
wprintf("<tr class=\"even\"><td>");
wprintf(_("Calendar day view begins at:"));
wprintf("</td><td>");
if (time_format == WC_TIMEFORMAT_24) {
wprintf("<option %s value=\"%d\">%d:00</option>\n",
- ((atoi(buf) == i) ? "selected" : ""),
+ ((DayStart == i) ? "selected" : ""),
i, i
);
}
else {
wprintf("<option %s value=\"%d\">%s</option>\n",
- ((atoi(buf) == i) ? "selected" : ""),
+ ((DayStart == i) ? "selected" : ""),
i, hourname[i]
);
}
/**
* Calendar day view -- day end time
*/
- get_preference("dayend", buf, sizeof buf);
- if (buf[0] == 0) strcpy(buf, "17");
+ get_pref_long("dayend", &DayEnd, 17);
+
wprintf("<tr class=\"odd\"><td>");
wprintf(_("Calendar day view ends at:"));
wprintf("</td><td>");
if (time_format == WC_TIMEFORMAT_24) {
wprintf("<option %s value=\"%d\">%d:00</option>\n",
- ((atoi(buf) == i) ? "selected" : ""),
+ ((DayEnd == i) ? "selected" : ""),
i, i
);
}
else {
wprintf("<option %s value=\"%d\">%s</option>\n",
- ((atoi(buf) == i) ? "selected" : ""),
+ ((DayEnd == i) ? "selected" : ""),
i, hourname[i]
);
}
/**
* Day of week to begin calendar month view
*/
- get_preference("weekstart", buf, sizeof buf);
- if (buf[0] == 0) strcpy(buf, "17");
+ get_pref_long("weekstart", &WeekStart, 17);
wprintf("<tr class=\"even\"><td>");
wprintf(_("Week starts on:"));
wprintf("</td><td>");
wc_strftime(daylabel, sizeof daylabel, "%A", &tm);
wprintf("<option %s value=\"%d\">%s</option>\n",
- ((atoi(buf) == i) ? "selected" : ""),
+ ((WeekStart == i) ? "selected" : ""),
i, daylabel
);
}
/**
* Signature
*/
- get_preference("use_sig", buf, sizeof buf);
- if (buf[0] == 0) strcpy(buf, "no");
+ get_pref_yesno("use_sig", &UseSig, 0);
wprintf("<tr class=\"odd\"><td>");
wprintf(_("Attach signature to email messages?"));
wprintf("</td><td>");
);
wprintf("<input type=\"radio\" id=\"no_sig\" name=\"use_sig\" VALUE=\"no\"");
- if (!strcasecmp(buf, "no")) wprintf(" checked");
+ if (!UseSig) wprintf(" checked");
wprintf(" onChange=\"show_or_hide_sigbox();\" >");
wprintf(_("No signature"));
wprintf("</input> , \n");
wprintf("<input type=\"radio\" id=\"yes_sig\" name=\"use_sig\" VALUE=\"yes\"");
- if (!strcasecmp(buf, "yes")) wprintf(" checked");
+ if (UseSig) wprintf(" checked");
wprintf(" onChange=\"show_or_hide_sigbox();\" >");
wprintf(_("Use this signature:"));
wprintf("<div id=\"signature_box\">"
"<br><textarea name=\"signature\" cols=\"40\" rows=\"5\">"
);
- get_preference("signature", ebuf, sizeof ebuf);
- euid_unescapize(buf, ebuf);
- escputs(buf);
+
+ get_preference("signature", &Signature);
+ ebuf = NewStrBuf();
+ StrBufEUid_unescapize(ebuf, Signature);
+ escputs(ChrPtr(ebuf));
+ FreeStrBuf(&ebuf);
wprintf("</textarea>"
"</div>"
);
);
/** Character set to assume is in use for improperly encoded headers */
- get_preference("default_header_charset", buf, sizeof buf);
- if (buf[0] == 0) strcpy(buf, "UTF-8");
+ if (!get_preference("default_header_charset", &Buf)) {
+ Buf = NewStrBuf();////TODO: freeme!
+ StrBufPrintf(Buf, "%s", "UTF-8");
+ }
wprintf("<tr class=\"even\"><td>");
wprintf(_("Default character set for email headers:"));
wprintf("</td><td>");
wprintf("<input type=\"text\" NAME=\"default_header_charset\" MAXLENGTH=\"32\" VALUE=\"");
- escputs(buf);
+ escputs(ChrPtr(Buf));
wprintf("\">");
wprintf("</td></tr>");
* Show empty floors?
*/
- get_preference("emptyfloors", buf, sizeof buf);
- if (buf[0] == 0) strcpy(buf, "no");
+ get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
wprintf("<tr class=\"odd\"><td>");
wprintf(_("Show empty floors"));
wprintf("</td><td>");
wprintf("<input type=\"radio\" name=\"emptyfloors\" VALUE=\"yes\"");
- if (!strcasecmp(buf, "yes")) wprintf(" checked");
+ if (ShowEmptyFloors) wprintf(" checked");
wprintf(">");
wprintf(_("Yes"));
wprintf("</input> ");
wprintf("<input type=\"radio\" name=\"emptyfloors\" VALUE=\"no\"");
- if (!strcasecmp(buf, "no")) wprintf(" checked");
+ if (!ShowEmptyFloors) wprintf(" checked");
wprintf(">");
wprintf(_("No"));
wprintf("</input>\n");
*/
void set_preferences(void)
{
- char *fmt;
- char ebuf[300];
+ long fmt;
+ StrBuf *ebuf;
int *time_format_cache;
time_format_cache = &(WC->time_format_cache);
* Set the last argument to 1 only for the final setting, so
* we don't send the prefs file to the server repeatedly
*/
- set_preference("roomlistview", bstr("roomlistview"), 0);
- fmt = bstr("calhourformat");
- set_preference("calhourformat", fmt, 0);
- if (!strcasecmp(fmt, "24"))
+ set_preference("roomlistview", NewStrBufPlain(bstr("roomlistview"), -1), 0);
+ fmt = lbstr("calhourformat");
+ set_pref_long("calhourformat", fmt, 0);
+ if (fmt == 24)
*time_format_cache = WC_TIMEFORMAT_24;
else
*time_format_cache = WC_TIMEFORMAT_AMPM;
- set_preference("weekstart", bstr("weekstart"), 0);
- set_preference("use_sig", bstr("use_sig"), 0);
- set_preference("daystart", bstr("daystart"), 0);
- set_preference("dayend", bstr("dayend"), 0);
- set_preference("default_header_charset", bstr("default_header_charset"), 0);
- set_preference("emptyfloors", bstr("emptyfloors"), 0);
+ set_pref_long("weekstart", lbstr("weekstart"), 0);
+ set_pref_yesno("use_sig", yesbstr("use_sig"), 0);
+ set_pref_long("daystart", lbstr("daystart"), 0);
+ set_pref_long("dayend", lbstr("dayend"), 0);
+ set_preference("default_header_charset", NewStrBufPlain(bstr("default_header_charset"), -1), 0);
+ set_preference("emptyfloors", NewStrBufPlain(bstr("emptyfloors"), -1), 0);
- euid_escapize(ebuf, bstr("signature"));
+ ebuf = NewStrBufPlain(bstr("signature"), -1);
+ /////TODOeuid_escapize(ebuf);
set_preference("signature", ebuf, 1);
display_main_menu();
int i;
wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
- wprintf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<label for=\"view_name\">");
wprintf(_("View as:"));
wprintf("</label> "
*/
void embed_search_o_matic(void) {
wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
- wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<label for=\"search_name\">");
wprintf(_("Search: "));
wprintf("</label><input ");
er_flags2 = extract_int(&buf[4], 7);
wprintf("<form method=\"POST\" action=\"editroom\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<ul><li>");
wprintf(_("Name of room: "));
extract_token(remote_room, buf, 1, '|', sizeof remote_room);
if (!IsEmptyStr(node)) {
wprintf("<form method=\"POST\" action=\"netedit\">");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<tr><td>%s</td>\n", node);
wprintf("<td>");
extract_token(node, not_shared_with, i, '\n', sizeof node);
if (!IsEmptyStr(node)) {
wprintf("<form method=\"POST\" action=\"netedit\">");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<tr><td>");
escputs(node);
wprintf("</td><td>"
wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
"<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
"<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
wprintf("</form>\n");
wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
"<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
"<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
wprintf("</form>\n");
}
wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<table border=0 cellspacing=5>\n");
wprintf("<tr><td>");
wprintf(_("Message expire policy for this room"));
"<tr>"
"<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
"<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<td>");
wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
wprintf("</td>");
"<tr>"
"<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
"<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<td>");
wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
"maxlength=\"256\" name=\"line_pop3host\">\n");
wprintf("<br /><br />");
wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
serv_puts("WHOK");
wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf(_("Invite:"));
wprintf(" ");
wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
do_template("beginbox");
wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<table class=\"altern\"> ");
wprintf("</p>");
wprintf("<form method=\"post\" action=\"goto_private\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<table class=\"altern\"> "
"<tr class=\"even\"><td>");
"to do?<br />\n"), WC->wc_roomname);
wprintf("<form method=\"POST\" action=\"zap\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
wprintf(" ");
wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
*/
void set_floordiv_expanded(char *which_floordiv) {
begin_ajax_response();
- safestrncpy(WC->floordiv_expanded, which_floordiv, sizeof WC->floordiv_expanded);
+ StrBufPrintf(WC->floordiv_expanded, "%s", which_floordiv);
end_ajax_response();
}
"%s</span><br>\n", floordiv_id, floordivtitle);
wprintf("<div id=\"%s\" style=\"display:%s\">",
floordiv_id,
- (!strcasecmp(floordiv_id, WC->floordiv_expanded) ? "block" : "none")
+ (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
);
}
}
wprintf("num_drop_targets = %d;\n", num_drop_targets);
- if ((WC->floordiv_expanded[0] != '\0')&&
- (WC->floordiv_expanded[1] != '\0')){
- wprintf("which_div_expanded = '%s';\n", WC->floordiv_expanded);
+ if ((ChrPtr(WC->floordiv_expanded)[0] != '\0')&&
+ (ChrPtr(WC->floordiv_expanded)[1] != '\0')){
+ wprintf("which_div_expanded = '%s';\n", ChrPtr(WC->floordiv_expanded));
}
wprintf("\">\n");
* \param viewpref the view preferences???
*/
-void list_all_rooms_by_floor(char *viewpref) {
+void list_all_rooms_by_floor(const char *viewpref) {
char buf[SIZ];
int swap = 0;
struct folder *fold = NULL;
int *floor_mapping;
int IDMax;
int i, j;
+ int ShowEmptyFloors;
int ra_flags = 0;
int flags = 0;
int num_floors = 1; /** add an extra one for private folders */
- char buf2[SIZ];
char buf3[SIZ];
/** If our cached folder list is very old, burn it. */
/*
* Remove any floors that don't have rooms
*/
- get_preference("emptyfloors", buf2, sizeof buf2);
- if (buf2[0]==0 || (strcasecmp(buf2, "no") == 0))
+ get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
+ if (ShowEmptyFloors)
{
for (i=0; i<num_floors; i++)
{
*/
void knrooms(void)
{
- char listviewpref[SIZ];
+ StrBuf *ListView;
output_headers(1, 1, 2, 0, 0, 0);
/** Determine whether the user is trying to change views */
if (bstr("view") != NULL) {
if (havebstr("view")) {
- set_preference("roomlistview", bstr("view"), 1);
+ set_preference("roomlistview", NewStrBufPlain(bstr("view"), -1), 1);
}
}
- get_preference("roomlistview", listviewpref, sizeof listviewpref);
-
- if ( (strcasecmp(listviewpref, "folders"))
- && (strcasecmp(listviewpref, "table")) ) {
- strcpy(listviewpref, "rooms");
+ if(!get_preference("roomlistview", &ListView) ||
+ ((strcasecmp(ChrPtr(ListView), "folders"))
+ && (strcasecmp(ChrPtr(ListView), "table")))) {
+ if (ListView == NULL)
+ ListView = NewStrBuf();
+ StrBufPrintf(ListView, "%s", "rooms");
+ set_preference("roomlistview", ListView, 0);
}
/** title bar */
wprintf("<div id=\"banner\">\n");
wprintf("<div class=\"room_banner\">");
wprintf("<h1>");
- if (!strcasecmp(listviewpref, "rooms")) {
+ if (!strcasecmp(ChrPtr(ListView), "rooms")) {
wprintf(_("Room list"));
}
- if (!strcasecmp(listviewpref, "folders")) {
+ else if (!strcasecmp(ChrPtr(ListView), "folders")) {
wprintf(_("Folder list"));
}
- if (!strcasecmp(listviewpref, "table")) {
+ else if (!strcasecmp(ChrPtr(ListView), "table")) {
wprintf(_("Room list"));
}
wprintf("</h1></div>\n");
wprintf("<option %s value=\"knrooms&view=rooms\">"
"View as room list"
"</option>\n",
- ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
+ ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
);
wprintf("<option %s value=\"knrooms&view=folders\">"
"View as folder list"
"</option>\n",
- ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
+ ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
);
wprintf("</select>");
wprintf("<div id=\"content\" class=\"service\">\n");
/** Display the room list in the user's preferred format */
- list_all_rooms_by_floor(listviewpref);
+ list_all_rooms_by_floor(ChrPtr(ListView));
wDumpContent(1);
}
wprintf("<a href=\"display_enter?recp=");
urlescputs(reply_to);
wprintf("&subject=");
- if (strncasecmp(subject, "Re: ", 3)) wprintf("Re:%20");
+ if (strncasecmp(subject, "Re: ", 3)) wprintf("Re:%%20");
urlescputs(subject);
wprintf("\">[%s]</a> \n", _("Reply"));
wprintf("<a href=\"display_enter?recp=");
urlescputs(reply_to);
wprintf("&force_room=_MAIL_&subject=");
- if (strncasecmp(subject, "Re: ", 3)) wprintf("Re:%20");
+ if (strncasecmp(subject, "Re: ", 3)) wprintf("Re:%%20");
urlescputs(subject);
wprintf("\">[%s]</a>\n", _("Email"));
wprintf("</p></div>\n");
wprintf("<div class=\"fix_scrollbar_bug\">"
"<form method=\"post\" action=\"setup_wizard\">\n"
);
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<div align=center>"
"This is where the setup wizard will be placed.<br>\n"
wprintf("<form id=\"sieveform\" method=\"post\" action=\"save_sieve\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf(_("When new mail arrives: "));
wprintf("<select name=\"bigaction\" size=1 onChange=\"ToggleSievePanels();\">\n");
wprintf("<br /><br />");
wprintf("<center><form method=\"POST\" action=\"create_script\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf(_("Script name: "));
wprintf("<input type=\"text\" name=\"script_name\"><br />\n"
"<input type=\"submit\" name=\"create_button\" value=\"%s\">"
wprintf("<center>"
"<form method=\"POST\" action=\"delete_script\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<select name=\"script_name\" size=10 style=\"width:100%%\">\n");
serv_puts("MSIV listscripts");
);
wprintf("<form method=\"post\" action=\"siteconfig\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
sprintf(&general[strlen(general)], "<tr><td><a href=\"display_edithello\"> %s </a></td>", _("Change Login Logo"));
sprintf(&general[strlen(general)], "<td><a href=\"display_editgoodbuye\"> %s </a></td></tr>\n", _("Change Logout Logo"));
ptr = (wcsubst*) vVar;
switch(ptr->wcs_type) {
case WCS_STRING:
- wprintf("%s", ptr->wcs_value);
+ wprintf("%s", (const char*)ptr->wcs_value);
break;
case WCS_SERVCMD:
pvo_do_cmd(ptr->wcs_value);
if (fp == NULL) {
wprintf(_("ERROR: could not open template "));
wprintf("'%s' - %s<br />\n",
- templatename, strerror(errno));
+ (const char*)templatename, strerror(errno));
return;
}
" A newline is forced by preceding the next line by a blank."), description);
wprintf("<form method=\"post\" action=\"%s\">\n", save_cmd);
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<textarea name=\"msgtext\" wrap=soft "
"rows=10 cols=80 width=80>\n");
serv_puts(read_cmd);
">",
i,
( (i==0) ? "tab_cell_label" : "tab_cell_edit" ),
- i,
i
- );
+ );
wprintf("%s", tabnames[i]);
wprintf("</td>");
#define SERV_TRACE 1
*/
+
#include "webcit.h"
#include "webserver.h"
return len;
}
-
+int StrBuf_ServGetln(StrBuf *buf)
+{
+ const char *ErrStr;
+ int rc;
+
+ rc = StrBufTCP_read_line(buf, WC->serv_sock, 0, &ErrStr);
+ if (rc < 0)
+ {
+ lprintf(1, "Server connection broken: %s\n",
+ ErrStr);
+ wc_backtrace();
+ WC->serv_sock = (-1);
+ WC->connected = 0;
+ WC->logged_in = 0;
+ }
+ return rc;
+}
/**
* \brief send binary to server
wprintf("<br /><br />");
wprintf("<center><form method=\"POST\" action=\"create_user\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf(_("New user: "));
wprintf("<input type=\"text\" name=\"username\"><br />\n"
"<input type=\"submit\" name=\"create_button\" value=\"%s\">"
wprintf("<center>"
"<form method=\"POST\" action=\"display_edituser\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<select name=\"username\" size=10 style=\"width:100%%\">\n");
serv_puts("LIST");
serv_getln(buf, sizeof buf);
wprintf("<input type=\"hidden\" name=\"is_new\" value=\"%d\">\n"
"<input type=\"hidden\" name=\"usernum\" value=\"%ld\">\n",
is_new, usernum);
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<input type=\"hidden\" name=\"flags\" value=\"%d\">\n", flags);
do_template("beginbox");
wprintf("<form method=\"POST\" action=\"submit_vcard\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
if (force_room != NULL) {
wprintf("<input type=\"hidden\" name=\"force_room\" value=\"");
/*
* Generic function to do an HTTP redirect. Easy and fun.
*/
-void http_redirect(char *whichpage) {
+void http_redirect(const char *whichpage) {
wprintf("HTTP/1.1 302 Moved Temporarily\n");
wprintf("Location: %s\r\n", whichpage);
wprintf("URI: %s\r\n", whichpage);
return;
}
- set_preference("startpage", bstr("startpage"), 1);
+ set_preference("startpage", NewStrBufPlain(bstr("startpage"), -1), 1);
output_headers(1, 1, 0, 0, 0, 0);
do_template("newstartpage");
void authorization_required(const char *message)
{
wprintf("HTTP/1.1 401 Authorization Required\r\n");
- wprintf("WWW-Authenticate: Basic realm=\"\"\r\n", serv_info.serv_humannode);
+ wprintf("WWW-Authenticate: Basic realm=\"%s\"\r\n", serv_info.serv_humannode);
wprintf("Content-Type: text/html\r\n\r\n");
wprintf("<h1>");
wprintf(_("Authorization Required"));
#define CLIENT_ID 4
#define CLIENT_VERSION 737 /* This version of WebCit */
#define MINIMUM_CIT_VERSION 737 /* min required Citadel ver */
-#define LIBCITADEL_MIN 737 /* min required libcitadel ver */
+#define LIBCITADEL_MIN 738 /* min required libcitadel ver */
#define DEFAULT_HOST "localhost" /* Default Citadel server */
#define DEFAULT_PORT "504"
#define LB (1) /* Internal escape chars */
int cache_max_folders; /**< ??? todo */
int cache_num_floors; /**< ??? todo */
time_t cache_timestamp; /**< ??? todo */
- int current_iconbar; /**< What is currently in the iconbar? */
- char floordiv_expanded[32]; /**< which floordiv currently expanded */
+ HashList *IconBarSetttings; /**< which icons should be shown / not shown? */
+ long current_iconbar; /**< What is currently in the iconbar? */
+ StrBuf *floordiv_expanded; /**< which floordiv currently expanded */
int selected_language; /**< Language selected by user */
time_t last_pager_check; /**< last time we polled for instant msgs */
int nonce; /**< session nonce (to prevent session riding) */
int uds_connectsock(char *);
int tcp_connectsock(char *, char *);
int serv_getln(char *strbuf, int bufsize);
+int StrBuf_ServGetln(StrBuf *buf);
void serv_puts(char *string);
void who(void);
void who_inner_div(void);
int unset_cookies,
int suppress_check,
int cache);
-void wprintf(const char *format,...);
+void wprintf(const char *format,...)__attribute__((__format__(__printf__,1,2)));
void output_static(char *what);
void display_mime_icon(void);
void print_menu_box(char* Title, char *Class, int nLines, ...);
void page_popup(void);
void chat_recv(void);
void chat_send(void);
-void http_redirect(char *);
+void http_redirect(const char *);
void clear_substs(struct wcsession *wc);
void clear_local_substs(void);
void do_change_view(int);
void change_view(void);
void folders(void);
+
+
void load_preferences(void);
void save_preferences(void);
-void get_preference(char *key, char *value, size_t value_len);
-void set_preference(char *key, char *value, int save_to_server);
+#define get_preference(a, b) get_PREFERENCE(a, sizeof(a) - 1, b)
+#define get_pref(a, b) get_PREFERENCE(ChrPtr(a), StrLength(a), b)
+int get_PREFERENCE(const char *key, size_t keylen, StrBuf **value);
+#define set_preference(a, b, c) set_PREFERENCE(a, sizeof(a) - 1, b, c)
+#define set_pref(a, b, c) set_PREFERENCE(ChrPtr(a), StrLength(a), b, c)
+void set_PREFERENCE(const char *key, size_t keylen, StrBuf *value, int save_to_server);
+
+#define get_pref_long(a, b, c) get_PREF_LONG(a, sizeof(a) - 1, b, c)
+int get_PREF_LONG(const char *key, size_t keylen, long *value, long Default);
+#define set_pref_long(a, b, c) set_PREF_LONG(a, sizeof(a) - 1, b, c)
+void set_PREF_LONG(const char *key, size_t keylen, long value, int save_to_server);
+
+#define get_pref_yesno(a, b, c) get_PREF_YESNO(a, sizeof(a) - 1, b, c)
+int get_PREF_YESNO(const char *key, size_t keylen, int *value, int Default);
+#define set_pref_yesno(a, b, c) set_PREF_LONG(a, sizeof(a) - 1, b, c)
+void set_PREF_YESNO(const char *key, size_t keylen, int value, int save_to_server);
+
+
+
void knrooms(void);
int is_msg_in_mset(char *mset, long msgnum);
void display_addressbook(long msgnum, char alpha);
void initialize_viewdefs(void);
void initialize_axdefs(void);
void burn_folder_cache(time_t age);
-void list_all_rooms_by_floor(char *viewpref);
+void list_all_rooms_by_floor(const char *viewpref);
void display_room_directory(void);
void display_picture(void);
void display_pictureview(void);
wprintf("</td>");
/* (link to page this user) */
- wprintf("<td width=\"5%\"><a href=\"display_page?recp=");
+ wprintf("<td width=\"5%%\"><a href=\"display_page?recp=");
urlescputs(User->UserName);
wprintf("\">"
"<img align=\"middle\" "
wprintf("</td>");
/* (idle flag) */
- wprintf("<td width=\"5%\">");
+ wprintf("<td width=\"5%%\">");
if (User->Idle) {
wprintf(" "
"<img align=\"middle\" "
"src=\"static/inactiveuser_24x.gif\" "
- "alt=\"(%s %d %s)\" border=\"0\" />",
+ "alt=\"(%s %ld %s)\" border=\"0\" />",
_("idle since"),
(now - User->LastActive) / 60,
_("Minutes")
wprintf("<br />\n");
wprintf("<form method=\"POST\" action=\"edit_me\">\n");
- wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
+ wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
wprintf("<table border=0 width=100%%>\n");