{
char buf[SIZ];
- if (!IsEmptyStr(bstr("language"))) {
+ if (havebstr("language")) {
set_selected_language(bstr("language"));
go_selected_language();
}
- if (!IsEmptyStr(bstr("exit_action"))) {
+ if (havebstr("exit_action")) {
do_logout();
return;
}
- if (!IsEmptyStr(bstr("login_action"))) {
+ if (havebstr("login_action")) {
serv_printf("USER %s", bstr("name"));
serv_getln(buf, sizeof buf);
if (buf[0] == '3') {
return;
}
}
- if (!IsEmptyStr(bstr("newuser_action"))) {
- if (IsEmptyStr(bstr("pass"))) {
+ if (havebstr("newuser_action")) {
+ if (!havebstr("pass")) {
display_login(_("Blank passwords are not allowed."));
return;
}
/** If the user just submitted a validation, process it... */
safestrncpy(buf, bstr("user"), sizeof buf);
if (!IsEmptyStr(buf)) {
- if (!IsEmptyStr(bstr("axlevel"))) {
+ if (havebstr("axlevel")) {
serv_printf("VALI %s|%s", buf, bstr("axlevel"));
serv_getln(buf, sizeof buf);
if (buf[0] != '2') {
char buf[SIZ];
char newpass1[32], newpass2[32];
- if (IsEmptyStr(bstr("change_action"))) {
+ if (!havebstr("change_action")) {
safestrncpy(WC->ImportantMessage,
_("Cancelled. Password was not changed."),
sizeof WC->ImportantMessage);
created_new_vtodo = 1;
}
- if (!IsEmptyStr(bstr("save_button"))) {
+ if (havebstr("save_button")) {
/** Replace values in the component with ones from the form */
icalcomponent_remove_property(vtodo, prop);
icalproperty_free(prop);
}
- if (!IsEmptyStr(bstr("summary"))) {
+ if (havebstr("summary")) {
icalcomponent_add_property(vtodo,
icalproperty_new_summary(bstr("summary")));
/**
* If the user clicked 'Delete' then explicitly delete the message.
*/
- if (!IsEmptyStr(bstr("delete_button"))) {
+ if (havebstr("delete_button")) {
delete_existing = 1;
}
if ( (delete_existing) && (msgnum > 0L) ) {
- serv_printf("DELE %ld", atol(bstr("msgnum")));
+ serv_printf("DELE %ld", lbstr("msgnum"));
serv_getln(buf, sizeof buf);
}
long msgnum = 0L;
/** Force change the room if we have to */
- if (!IsEmptyStr(bstr("taskrm"))) {
+ if (havebstr("taskrm")) {
gotoroom(bstr("taskrm"));
}
- msgnum = atol(bstr("msgnum"));
+ msgnum = lbstr("msgnum");
if (msgnum > 0L) {
/** existing task */
display_using_handler(msgnum, 0,
void save_task(void) {
long msgnum = 0L;
- msgnum = atol(bstr("msgnum"));
+ msgnum = lbstr("msgnum");
if (msgnum > 0L) {
display_using_handler(msgnum, 0,
ICAL_VTODO_COMPONENT,
void display_edit_event(void) {
long msgnum = 0L;
- msgnum = atol(bstr("msgnum"));
+ msgnum = lbstr("msgnum");
if (msgnum > 0L) {
/* existing event */
display_using_handler(msgnum, 0,
void save_event(void) {
long msgnum = 0L;
- msgnum = atol(bstr("msgnum"));
+ msgnum = lbstr("msgnum");
if (msgnum > 0L) {
display_using_handler(msgnum, 0,
urlformat[i+1] = 0;
}
- embeddable_mini_calendar( atoi(bstr("year")), atoi(bstr("month")), urlformat );
+ embeddable_mini_calendar( ibstr("year"), ibstr("month"), urlformat );
}
day = tm.tm_mday;
/** Now see if a date was specified */
- if (!IsEmptyStr(bstr("year"))) year = atoi(bstr("year"));
- if (!IsEmptyStr(bstr("month"))) month = atoi(bstr("month"));
- if (!IsEmptyStr(bstr("day"))) day = atoi(bstr("day"));
+ if (havebstr("year")) year = ibstr("year");
+ if (havebstr("month")) month = ibstr("month");
+ if (havebstr("day")) day = ibstr("day");
/** How would you like that cooked? */
- if (!IsEmptyStr(bstr("calview"))) {
+ if (havebstr("calview")) {
strcpy(calview, bstr("calview"));
}
else {
int n = 0;
- if (atol(bstr("frame")) == 1) {
+ if (lbstr("frame") == 1) {
output_headers(1, 1, 2, 0, 0, 0);
wprintf("<div id=\"banner\">\n");
{
char FileBuf[SIZ];
const char *FileName;
+ size_t tlen;
- FileName = GetIconFilename(bstr("type"), strlen(bstr("type")));
+ FileName = GetIconFilename(xbstr("type", &tlen), tlen);
if (FileName == NULL)
snprintf (FileBuf, SIZ, "%s%s", static_dirs[0], "/diskette_24x.gif");
}
else {
localtime_r(&now, &tm_now);
- if (!IsEmptyStr(bstr("year"))) {
- tm_now.tm_year = atoi(bstr("year")) - 1900;
- tm_now.tm_mon = atoi(bstr("month")) - 1;
- tm_now.tm_mday = atoi(bstr("day"));
+ if (havebstr("year")) {
+ tm_now.tm_year = ibstr("year") - 1900;
+ tm_now.tm_mon = ibstr("month") - 1;
+ tm_now.tm_mday = ibstr("day");
}
- if (!IsEmptyStr(bstr("hour"))) {
- tm_now.tm_hour = atoi(bstr("hour"));
- tm_now.tm_min = atoi(bstr("minute"));
+ if (havebstr("hour")) {
+ tm_now.tm_hour = ibstr("hour");
+ tm_now.tm_min = ibstr("minute");
tm_now.tm_sec = 0;
}
else {
t_start = icaltime_from_timet_with_zone(
mktime(&tm_now),
- ((!strcasecmp(bstr("alldayevent"), "yes")) ? 1 : 0),
+ ((yesbstr("alldayevent")) ? 1 : 0),
icaltimezone_get_utc_timezone()
);
t_start.is_utc = 1;
created_new_vevent = 1;
}
- if ( (!IsEmptyStr(bstr("save_button")))
- || (!IsEmptyStr(bstr("check_button"))) ) {
+ if ( (havebstr("save_button"))
+ || (havebstr("check_button")) ) {
/** Replace values in the component with ones from the form */
icalproperty_free(prop);
}
- if (!IsEmptyStr(bstr("summary"))) {
+ if (havebstr("summary")) {
icalcomponent_add_property(vevent,
icalproperty_new_summary(bstr("summary")));
icalcomponent_remove_property(vevent, prop);
icalproperty_free(prop);
}
- if (!IsEmptyStr(bstr("location"))) {
+ if (havebstr("location")) {
icalcomponent_add_property(vevent,
icalproperty_new_location(bstr("location")));
}
icalcomponent_remove_property(vevent, prop);
icalproperty_free(prop);
}
- if (!IsEmptyStr(bstr("description"))) {
+ if (havebstr("description")) {
icalcomponent_add_property(vevent,
icalproperty_new_description(bstr("description")));
}
icalproperty_free(prop);
}
- if (!strcmp(bstr("alldayevent"), "yes")) {
+ if (yesbstr("alldayevent")) {
all_day_event = 1;
}
else {
}
/** See if transparency is indicated */
- if (!IsEmptyStr(bstr("transp"))) {
+ if (havebstr("transp")) {
if (!strcasecmp(bstr("transp"), "opaque")) {
formtransp = ICAL_TRANSP_OPAQUE;
}
icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH);
/** If the user clicked 'Save' then save it to the server. */
- if ( (encaps != NULL) && (!IsEmptyStr(bstr("save_button"))) ) {
+ if ( (encaps != NULL) && (havebstr("save_button")) ) {
serv_puts("ENT0 1|||4|||1|");
serv_getln(buf, sizeof buf);
if (buf[0] == '8') {
}
/** Or, check attendee availability if the user asked for that. */
- if ( (encaps != NULL) && (!IsEmptyStr(bstr("check_button"))) ) {
+ if ( (encaps != NULL) && (havebstr("check_button")) ) {
/** Call this function, which does the real work */
check_attendee_availability(encaps);
/**
* If the user clicked 'Delete' then delete it.
*/
- if ( (!IsEmptyStr(bstr("delete_button"))) && (msgnum > 0L) ) {
- serv_printf("DELE %ld", atol(bstr("msgnum")));
+ if ( (havebstr("delete_button")) && (msgnum > 0L) ) {
+ serv_printf("DELE %ld", lbstr("msgnum"));
serv_getln(buf, sizeof buf);
}
}
/** If this was a save or delete, go back to the calendar view. */
- if (IsEmptyStr(bstr("check_button"))) {
+ if (!havebstr("check_button")) {
readloop("readfwd");
}
}
char buf[SIZ];
char message[SIZ];
- floornum = atoi(bstr("floornum"));
+ floornum = ibstr("floornum");
serv_printf("KFLR %d|1", floornum);
serv_getln(buf, sizeof buf);
char message[SIZ];
char floorname[SIZ];
- floornum = atoi(bstr("floornum"));
+ floornum = ibstr("floornum");
strcpy(floorname, bstr("floorname"));
serv_printf("EFLR %d|%s", floornum, floorname);
int thisblock;
bytes_remaining = WC->upload_length;
- if (!IsEmptyStr(bstr("cancel_button"))) {
+ if (havebstr("cancel_button")) {
strcpy(WC->ImportantMessage,
_("Graphics upload has been cancelled."));
display_main_menu();
"ib_citadel"
};
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
display_main_menu();
return;
}
- sprintf(iconbar, "ib_displayas=%d", atoi(bstr("ib_displayas")));
+ sprintf(iconbar, "ib_displayas=%d", ibstr("ib_displayas"));
for (i=0; i<(sizeof(boxen)/sizeof(char *)); ++i) {
char *Val;
char *junk;
size_t len;
- if (IsEmptyStr(bstr("sc_button"))) {
+ if (!havebstr("sc_button")) {
display_main_menu();
return;
}
return;
}
- startmsg = atol(bstr("startmsg"));
- maxmsgs = atoi(bstr("maxmsgs"));
- is_summary = atoi(bstr("is_summary"));
+ startmsg = lbstr("startmsg");
+ maxmsgs = ibstr("maxmsgs");
+ is_summary = ibstr("is_summary");
if (maxmsgs == 0) maxmsgs = DEFAULT_MAXMSGS;
snprintf(sortpref_name, sizeof sortpref_name, "sort %s", WCC->wc_roomname);
}
}
- is_singlecard = atoi(bstr("is_singlecard"));
+ is_singlecard = ibstr("is_singlecard");
if (WCC->wc_default_view == VIEW_CALENDAR) { /**< calendar */
is_calendar = 1;
struct wcsession *WCC = WC;
char *ptr = NULL;
- if (!IsEmptyStr(bstr("force_room"))) {
+ if (havebstr("force_room")) {
gotoroom(bstr("force_room"));
}
return;
}
- if (!IsEmptyStr(bstr("cancel_button"))) {
+ if (havebstr("cancel_button")) {
sprintf(WCC->ImportantMessage,
_("Cancelled. Message was not posted."));
- } else if (!IsEmptyStr(bstr("attach_button"))) {
+ } else if (havebstr("attach_button")) {
display_enter();
return;
- } else if (atol(bstr("postseq")) == dont_post) {
+ } else if (lbstr("postseq") == dont_post) {
sprintf(WCC->ImportantMessage,
_("Automatically cancelled because you have already "
"saved this message."));
if (encoded_subject) free(encoded_subject);
if (buf[0] == '4') {
post_mime_to_server();
- if ( (!IsEmptyStr(bstr("recp")))
- || (!IsEmptyStr(bstr("cc" )))
- || (!IsEmptyStr(bstr("bcc" )))
+ if ( (havebstr("recp"))
+ || (havebstr("cc" ))
+ || (havebstr("bcc" ))
) {
sprintf(WCC->ImportantMessage, _("Message has been sent.\n"));
}
else {
sprintf(WC->ImportantMessage, _("Message has been posted.\n"));
}
- dont_post = atol(bstr("postseq"));
+ dont_post = lbstr("postseq");
} else {
lprintf(9, "%s:%d: server post error: %s\n", __FILE__, __LINE__, buf);
sprintf(WC->ImportantMessage, "%s", &buf[4]);
* We may have been supplied with instructions regarding the location
* to which we must return after posting. If found, go there.
*/
- if (!IsEmptyStr(bstr("return_to"))) {
+ if (havebstr("return_to")) {
http_redirect(bstr("return_to"));
}
/**
* If we were editing a page in a wiki room, go to that page now.
*/
- else if (!IsEmptyStr(bstr("wikipage"))) {
+ else if (havebstr("wikipage")) {
snprintf(buf, sizeof buf, "wiki?page=%s", bstr("wikipage"));
http_redirect(buf);
}
int i;
int is_anonymous = 0;
long existing_page = (-1L);
+ size_t dplen;
now = time(NULL);
- if (!IsEmptyStr(bstr("force_room"))) {
+ if (havebstr("force_room")) {
gotoroom(bstr("force_room"));
}
- display_name = bstr("display_name");
+ display_name = xbstr("display_name", &dplen);
if (!strcmp(display_name, "__ANONYMOUS__")) {
display_name = "";
+ dplen = 0;
is_anonymous = 1;
}
/* Now check our actual recipients if there are any */
if (recipient_required) {
- sprintf(buf, "ENT0 0|%s|%d|0||%s||%s|%s|%s",
- bstr("recp"),
+ const char *Recp = "";
+ const char *Cc = "";
+ const char *Bcc = "";
+ const char *Wikipage = "";
+ char *CmdBuf = NULL;;
+ size_t len = 0;
+ size_t nLen;
+ const char CMD[] = "ENT0 0|%s|%d|0||%s||%s|%s|%s";
+
+ len = sizeof(CMD) + dplen;
+ Recp = xbstr("recp", &nLen);
+ len += nLen;
+ Cc = xbstr("cc", &nLen);
+ len += nLen;
+ Bcc = xbstr("bcc", &nLen);
+ len += nLen;
+ Wikipage = xbstr("wikipage", &nLen);
+ len += nLen;
+
+
+ CmdBuf = (char*) malloc (len + 1);
+
+ snprintf(CmdBuf, len, CMD,
+ Recp,
is_anonymous,
display_name,
- bstr("cc"), bstr("bcc"), bstr("wikipage"));
+ Cc, Bcc, Wikipage);
serv_puts(buf);
serv_getln(buf, sizeof buf);
if (!strncmp(buf, "570", 3)) { /** 570 means we have an invalid recipient listed */
- if (!IsEmptyStr(bstr("recp")) &&
- !IsEmptyStr(bstr("cc" )) &&
- !IsEmptyStr(bstr("bcc" ))) {
+ if (havebstr("recp") &&
+ havebstr("cc" ) &&
+ havebstr("bcc" )) {
recipient_bad = 1;
}
}
wprintf(_("To:"));
wprintf("</label></th>"
"<td><input autocomplete=\"off\" type=\"text\" name=\"recp\" id=\"recp_id\" value=\"");
- ccraw = bstr("recp");
- len = strlen(ccraw);
+ ccraw = xbstr("recp", &len);
copy = (char*) malloc(len * 2 + 1);
memcpy(copy, ccraw, len + 1);
utf8ify_rfc822_string(copy);
wprintf(_("CC:"));
wprintf("</label></th>"
"<td><input autocomplete=\"off\" type=\"text\" name=\"cc\" id=\"cc_id\" value=\"");
- ccraw = bstr("cc");
- len = strlen(ccraw);
+ ccraw = xbstr("cc", &len);
copy = (char*) malloc(len * 2 + 1);
memcpy(copy, ccraw, len + 1);
utf8ify_rfc822_string(copy);
wprintf(_("BCC:"));
wprintf("</label></th>"
"<td><input autocomplete=\"off\" type=\"text\" name=\"bcc\" id=\"bcc_id\" value=\"");
- ccraw = bstr("bcc");
- len = strlen(ccraw);
+ ccraw = xbstr("bcc", &len);
copy = (char*) malloc(len * 2 + 1);
memcpy(copy, ccraw, len + 1);
utf8ify_rfc822_string(copy);
msgescputs(bstr("msgtext"));
/* If we're forwarding a message, insert it here... */
- if (atol(bstr("fwdquote")) > 0L) {
+ if (lbstr("fwdquote") > 0L) {
wprintf("<br><div align=center><i>");
wprintf(_("--- forwarded message ---"));
wprintf("</i></div><br>");
- pullquote_message(atol(bstr("fwdquote")), 1, 1);
+ pullquote_message(lbstr("fwdquote"), 1, 1);
}
/** If we're replying quoted, insert the quote here... */
- else if (atol(bstr("replyquote")) > 0L) {
+ else if (lbstr("replyquote") > 0L) {
wprintf("<br>"
"<blockquote>");
- pullquote_message(atol(bstr("replyquote")), 0, 1);
+ pullquote_message(lbstr("replyquote"), 0, 1);
wprintf("</blockquote><br>");
}
}
/** Insert our signature if appropriate... */
- if ( (WC->is_mailbox) && (strcmp(bstr("sig_inserted"), "yes")) ) {
+ if ( (WC->is_mailbox) && yesbstr("sig_inserted") ) {
get_preference("use_sig", buf, sizeof buf);
if (!strcasecmp(buf, "yes")) {
int len;
long msgid;
char buf[SIZ];
- msgid = atol(bstr("msgid"));
+ msgid = lbstr("msgid");
if (WC->wc_is_trash) { /** Delete from Trash is a real delete */
serv_printf("DELE %ld", msgid);
long msgid;
char buf[SIZ];
- msgid = atol(bstr("msgid"));
+ msgid = lbstr("msgid");
- if (!IsEmptyStr(bstr("move_button"))) {
+ if (havebstr("move_button")) {
sprintf(buf, "MOVE %ld|%s", msgid, bstr("target_room"));
serv_puts(buf);
serv_getln(buf, sizeof buf);
char buf[SIZ];
char targ[SIZ];
- msgid = atol(bstr("msgid"));
+ msgid = lbstr("msgid");
output_headers(1, 1, 2, 0, 0, 0);
char cnode[SIZ];
FILE *fp;
- if (!IsEmptyStr(bstr("ok_button"))) {
+ if (havebstr("ok_button")) {
strcpy(node, bstr("node") );
fp = tmpfile();
if (fp != NULL) {
safestrncpy(recp, bstr("recp"), sizeof recp);
- if (IsEmptyStr(bstr("send_button"))) {
+ if (!havebstr("send_button")) {
safestrncpy(WC->ImportantMessage,
_("Message was not sent."),
sizeof WC->ImportantMessage
"<BODY onLoad=\"document.chatsendform.send_this.focus();\" >"
);
- if (bstr("send_this") != NULL) {
+ if (havebstr("send_this")) {
strcpy(send_this, bstr("send_this"));
}
else {
strcpy(send_this, "");
}
- if (!IsEmptyStr(bstr("help_button"))) {
+ if (havebstr("help_button")) {
strcpy(send_this, "/help");
}
- if (!IsEmptyStr(bstr("list_button"))) {
+ if (havebstr("list_button")) {
strcpy(send_this, "/who");
}
- if (!IsEmptyStr(bstr("exit_button"))) {
+ if (havebstr("exit_button")) {
strcpy(send_this, "/quit");
}
time_format_cache = &(WC->time_format_cache);
- if (IsEmptyStr(bstr("change_button"))) {
+ if (!havebstr("change_button")) {
safestrncpy(WC->ImportantMessage,
_("Cancelled. No settings were changed."),
sizeof WC->ImportantMessage);
case VIEW_CALENDAR:
case VIEW_CALBRIEF:
wprintf("<li class=\"addevent\"><a href=\"display_enter");
- if (!IsEmptyStr(bstr("year" ))) wprintf("?year=%s", bstr("year"));
- if (!IsEmptyStr(bstr("month"))) wprintf("?month=%s", bstr("month"));
- if (!IsEmptyStr(bstr("day" ))) wprintf("?day=%s", bstr("day"));
+ if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
+ if (havebstr("month")) wprintf("?month=%s", bstr("month"));
+ if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
wprintf("\">"
"<img align=\"middle\" src=\"static/addevent_24x.gif\" "
"border=\"0\"><span class=\"navbar_link\">"
get_roomflags (&RoomFlags);
- if (!strcasecmp(bstr("QR2_SelfList"), "yes"))
+ if (yesbstr("QR2_SelfList"))
RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
else
RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
- if (!strcasecmp(bstr("QR2_SMTP_PUBLIC"), "yes"))
+ if (yesbstr("QR2_SMTP_PUBLIC"))
RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
else
RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
- if (!strcasecmp(bstr("QR2_Moderated"), "yes"))
+ if (yesbstr("QR2_Moderated"))
RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
else
RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
- if (!strcasecmp(bstr("QR2_SubsOnly"), "yes"))
+ if (yesbstr("QR2_SubsOnly"))
RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
else
RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
int bump;
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
strcpy(WC->ImportantMessage,
_("Cancelled. Changes were not saved."));
display_editroom();
er_flags &= ~QR_MAILBOX;
}
- if (!strcmp(bstr("prefonly"), "yes")) {
+ if (yesbstr("prefonly")) {
er_flags |= QR_PREFONLY;
} else {
er_flags &= ~QR_PREFONLY;
}
- if (!strcmp(bstr("readonly"), "yes")) {
+ if (yesbstr("readonly")) {
er_flags |= QR_READONLY;
} else {
er_flags &= ~QR_READONLY;
}
- if (!strcmp(bstr("collabdel"), "yes")) {
+ if (yesbstr("collabdel")) {
er_flags2 |= QR2_COLLABDEL;
} else {
er_flags2 &= ~QR2_COLLABDEL;
}
- if (!strcmp(bstr("permanent"), "yes")) {
+ if (yesbstr("permanent")) {
er_flags |= QR_PERMANENT;
} else {
er_flags &= ~QR_PERMANENT;
}
- if (!strcmp(bstr("subjectreq"), "yes")) {
+ if (yesbstr("subjectreq")) {
er_flags2 |= QR2_SUBJECTREQ;
} else {
er_flags2 &= ~QR2_SUBJECTREQ;
}
- if (!strcmp(bstr("network"), "yes")) {
+ if (yesbstr("network")) {
er_flags |= QR_NETWORK;
} else {
er_flags &= ~QR_NETWORK;
}
- if (!strcmp(bstr("directory"), "yes")) {
+ if (yesbstr("directory")) {
er_flags |= QR_DIRECTORY;
} else {
er_flags &= ~QR_DIRECTORY;
}
- if (!strcmp(bstr("ulallowed"), "yes")) {
+ if (yesbstr("ulallowed")) {
er_flags |= QR_UPLOAD;
} else {
er_flags &= ~QR_UPLOAD;
}
- if (!strcmp(bstr("dlallowed"), "yes")) {
+ if (yesbstr("dlallowed")) {
er_flags |= QR_DOWNLOAD;
} else {
er_flags &= ~QR_DOWNLOAD;
}
- if (!strcmp(bstr("visdir"), "yes")) {
+ if (yesbstr("visdir")) {
er_flags |= QR_VISDIR;
} else {
er_flags &= ~QR_VISDIR;
if (!strcmp(bstr("bump"), "yes"))
bump = 1;
- er_floor = atoi(bstr("er_floor"));
+ er_floor = ibstr("er_floor");
sprintf(buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
er_name, er_password, er_dirname, er_flags, bump, er_floor,
strcpy(username, bstr("username"));
- if (!IsEmptyStr(bstr("kick_button"))) {
+ if (havebstr("kick_button")) {
sprintf(buf, "KICK %s", username);
serv_puts(buf);
serv_getln(buf, sizeof buf);
}
}
- if (!IsEmptyStr(bstr("invite_button"))) {
+ if (havebstr("invite_button")) {
sprintf(buf, "INVT %s", username);
serv_puts(buf);
serv_getln(buf, sizeof buf);
int er_num_type;
int er_view;
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
strcpy(WC->ImportantMessage,
_("Cancelled. No new room was created."));
display_main_menu();
strcpy(er_name, bstr("er_name"));
strcpy(er_type, bstr("type"));
strcpy(er_password, bstr("er_password"));
- er_floor = atoi(bstr("er_floor"));
- er_view = atoi(bstr("er_view"));
+ er_floor = ibstr("er_floor");
+ er_view = ibstr("er_view");
er_num_type = 0;
if (!strcmp(er_type, "hidden"))
char hold_rm[SIZ];
char buf[SIZ];
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
display_main_menu();
return;
}
*/
strcpy(final_destination, WC->wc_roomname);
- if (!IsEmptyStr(bstr("ok_button"))) {
+ if (havebstr("ok_button")) {
serv_printf("GOTO %s", WC->wc_roomname);
serv_getln(buf, sizeof buf);
if (buf[0] == '2') {
char cmpb0[SIZ];
char cmpb1[SIZ];
int i, num_addrs;
-
- if (!IsEmptyStr(bstr("line_pop3host"))) {
+ // TODO: do line dynamic!
+ if (havebstr("line_pop3host")) {
strcpy(line, bstr("prefix"));
strcat(line, bstr("line_pop3host"));
strcat(line, "|");
strcat(line, "|");
strcat(line, bstr("line_pop3pass"));
strcat(line, "|");
- strcat(line, atoi(bstr("line_pop3keep")) ? "1" : "0" );
+ strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
strcat(line, "|");
- sprintf(&line[strlen(line)],"%ld", atol(bstr("line_pop3int")));
+ sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
strcat(line, bstr("suffix"));
}
- else if (!IsEmptyStr(bstr("line"))) {
+ else if (havebstr("line")) {
strcpy(line, bstr("prefix"));
strcat(line, bstr("line"));
strcat(line, bstr("suffix"));
serv_puts(buf);
}
- if (!IsEmptyStr(bstr("add_button"))) {
+ if (havebstr("add_button")) {
num_addrs = num_tokens(bstr("line"), ',');
if (num_addrs < 2) {
/* just adding one node or address */
void change_view(void) {
int view;
- view = atol(bstr("view"));
+ view = lbstr("view");
do_change_view(view);
}
/** Determine whether the user is trying to change views */
if (bstr("view") != NULL) {
- if (!IsEmptyStr(bstr("view"))) {
+ if (havebstr("view")) {
set_preference("roomlistview", bstr("view"), 1);
}
}
void set_room_policy(void) {
char buf[SIZ];
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
strcpy(WC->ImportantMessage,
_("Cancelled. Changes were not saved."));
display_editroom();
return;
}
- serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
+ serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
serv_getln(buf, sizeof buf);
strcpy(WC->ImportantMessage, &buf[4]);
if (WC->axlevel >= 6) {
strcat(WC->ImportantMessage, "<br />\n");
- serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
+ serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), bstr("floorvalue"));
serv_getln(buf, sizeof buf);
strcat(WC->ImportantMessage, &buf[4]);
}
safestrncpy(sizecomp, BSTR(fname), sizeof sizecomp);
sprintf(fname, "sizeval%d", i);
- sizeval = atoi(BSTR(fname));
+ sizeval = IBSTR(fname);
sprintf(fname, "action%d", i);
safestrncpy(action, BSTR(fname), sizeof action);
char this_name[64];
char buf[256];
- if (IsEmptyStr(bstr("save_button"))) {
+ if (!havebstr("save_button")) {
strcpy(WC->ImportantMessage,
_("Cancelled. Changes were not saved."));
display_main_menu();
}
}
- bigaction = atoi(bstr("bigaction"));
+ bigaction = ibstr("bigaction");
if (bigaction == 0) {
serv_puts("MSIV setactive||");
serv_printf("%s", bstr("c_fqdn"));
serv_printf("%s", bstr("c_humannode"));
serv_printf("%s", bstr("c_phonenum"));
- serv_printf("%s", ((!strcasecmp(bstr("c_creataide"), "yes") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_creataide") ? "1" : "0")));
serv_printf("%s", bstr("c_sleeping"));
serv_printf("%s", bstr("c_initax"));
- serv_printf("%s", ((!strcasecmp(bstr("c_regiscall"), "yes") ? "1" : "0")));
- serv_printf("%s", ((!strcasecmp(bstr("c_twitdetect"), "yes") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_regiscall") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_twitdetect") ? "1" : "0")));
serv_printf("%s", bstr("c_twitroom"));
serv_printf("%s", bstr("c_moreprompt"));
- serv_printf("%s", ((!strcasecmp(bstr("c_restrict"), "yes") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_restrict") ? "1" : "0")));
serv_printf("%s", bstr("c_bbs_city"));
serv_printf("%s", bstr("c_sysadm"));
serv_printf("%s", bstr("c_maxsessions"));
serv_printf("%s", bstr("c_max_workers"));
serv_printf("%s", bstr("c_pop3_port"));
serv_printf("%s", bstr("c_smtp_port"));
- serv_printf("%s", ((!strcasecmp(bstr("c_rfc822_strict_from"), "yes") ? "0" : "1"))); /* note: reverse bool */
- serv_printf("%s", ((!strcasecmp(bstr("c_aide_zap"), "yes") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_rfc822_strict_from") ? "0" : "1"))); /* note: reverse bool */
+ serv_printf("%s", ((yesbstr("c_aide_zap") ? "1" : "0")));
serv_printf("%s", bstr("c_imap_port"));
serv_printf("%s", bstr("c_net_freq"));
- serv_printf("%s", ((!strcasecmp(bstr("c_disable_newu"), "yes") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_disable_newu") ? "1" : "0")));
serv_printf("1"); /* placeholder - this field is not in use */
serv_printf("%s", bstr("c_purge_hour"));
serv_printf("%s", bstr("c_ldap_host"));
serv_printf("%s", bstr("c_imaps_port"));
serv_printf("%s", bstr("c_pop3s_port"));
serv_printf("%s", bstr("c_smtps_port"));
- serv_printf("%s", ((!strcasecmp(bstr("c_enable_fulltext"), "yes") ? "1" : "0")));
- serv_printf("%s", ((!strcasecmp(bstr("c_auto_cull"), "yes") ? "1" : "0")));
- serv_printf("%s", ((!strcasecmp(bstr("c_instant_expunge"), "yes") ? "1" : "0")));
- serv_printf("%s", ((!strcasecmp(bstr("c_allow_spoofing"), "yes") ? "1" : "0")));
- serv_printf("%s", ((!strcasecmp(bstr("c_journal_email"), "yes") ? "1" : "0")));
- serv_printf("%s", ((!strcasecmp(bstr("c_journal_pubmsgs"), "yes") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_enable_fulltext") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_auto_cull") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_instant_expunge") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_allow_spoofing") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_journal_email") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_journal_pubmsgs") ? "1" : "0")));
serv_printf("%s", bstr("c_journal_dest"));
serv_printf("%s", bstr("c_default_cal_zone"));
serv_printf("%s", bstr("c_pftcpdict_port"));
serv_printf("%s", bstr("c_funambol_port"));
serv_printf("%s", bstr("c_funambol_source"));
serv_printf("%s", bstr("c_funambol_auth"));
- serv_printf("%s", ((!strcasecmp(bstr("c_rbl_at_greeting"), "yes") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_rbl_at_greeting") ? "1" : "0")));
serv_printf("%s", bstr("c_master_user"));
serv_printf("%s", bstr("c_master_pass"));
serv_printf("%s", bstr("c_pager_program"));
- serv_printf("%s", ((!strcasecmp(bstr("c_imap_keep_from"), "yes") ? "1" : "0")));
+ serv_printf("%s", ((yesbstr("c_imap_keep_from") ? "1" : "0")));
serv_printf("%s", bstr("c_xmpp_c2s_port"));
serv_printf("%s", bstr("c_xmpp_s2s_port"));
serv_printf("%s", bstr("c_pop3_fetch"));
serv_printf("%s", bstr("c_pop3_fastest"));
serv_printf("000");
- serv_printf("SPEX site|%d|%d", atoi(bstr("sitepolicy")), atoi(bstr("sitevalue")));
+ serv_printf("SPEX site|%d|%d", ibstr("sitepolicy"), ibstr("sitevalue"));
serv_getln(buf, sizeof buf);
- serv_printf("SPEX mailboxes|%d|%d", atoi(bstr("mboxpolicy")), atoi(bstr("mboxvalue")));
+ serv_printf("SPEX mailboxes|%d|%d", ibstr("mboxpolicy"), ibstr("mboxvalue"));
serv_getln(buf, sizeof buf);
strcpy(serv_info.serv_default_cal_zone, bstr("c_default_cal_zone"));
{
char buf[SIZ];
- if (IsEmptyStr(bstr("save_button"))) {
+ if (!havebstr("save_button")) {
sprintf(WC->ImportantMessage,
_("Cancelled. %s was not saved."),
description);
lastcall = extract_long(&buf[4], 7);
purgedays = extract_long(&buf[4], 8);
- if (!IsEmptyStr(bstr("edit_abe_button"))) {
+ if (havebstr("edit_abe_button")) {
display_edit_address_book_entry(username, usernum);
return;
}
- if (!IsEmptyStr(bstr("delete_button"))) {
+ if (havebstr("delete_button")) {
delete_user(username);
return;
}
unsigned int flags = 0;
char *username;
- is_new = atoi(bstr("is_new"));
+ is_new = ibstr("is_new");
safestrncpy(message, "", sizeof message);
username = bstr("username");
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
safestrncpy(message, _("Changes were not saved."), sizeof message);
}
else {
- flags = atoi(bstr("flags"));
- if (!strcasecmp(bstr("inetmail"), "yes")) {
+ flags = ibstr("flags");
+ if (yesbstr("inetmail")) {
flags |= US_INTERNET;
}
else {
flags &= ~US_INTERNET ;
}
- if (bstr("newname") != NULL) if (strcasecmp(bstr("username"), bstr("newname"))) {
+ if ((havebstr("newname")) && (strcasecmp(bstr("username"), bstr("newname")))) {
serv_printf("RENU %s|%s", bstr("username"), bstr("newname"));
serv_getln(buf, sizeof buf);
if (buf[0] != '2') {
* the vCard edit screen.
*/
if (is_new) {
- display_edit_address_book_entry(username, atol(bstr("usernum")) );
+ display_edit_address_book_entry(username, lbstr("usernum") );
}
else {
select_user_to_edit(message, username);
long msgnum;
char *partnum;
- msgnum = atol(bstr("msgnum"));
+ msgnum = lbstr("msgnum");
partnum = bstr("partnum");
do_edit_vcard(msgnum, partnum, "", NULL);
}
char buf[SIZ];
int i;
- if (IsEmptyStr(bstr("ok_button"))) {
+ if (!havebstr("ok_button")) {
readloop("readnew");
return;
}
- if (!IsEmptyStr(bstr("force_room"))) {
+ if (havebstr("force_room")) {
gotoroom(bstr("force_room"));
}
{
char *aptr, *bptr, *eptr;
char *up;
- char buf[SIZ];
+ char buf[SIZ] = "";
int len, n, keylen;
urlcontent *u;
struct wcsession *WCC = WC;
* \brief Return the value of a variable supplied to the current web page (from the url or a form)
* \param key The name of the variable we want
*/
-const char *BSTR(char *key)
+
+const char *XBstr(char *key, size_t keylen, size_t *len)
{
void *U;
- if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, strlen (key), &U))
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, keylen, &U)) {
+ *len = ((urlcontent *)U)->url_data_size;
return ((urlcontent *)U)->url_data;
- else
+ }
+ else {
+ *len = 0;
return ("");
+ }
}
const char *XBSTR(char *key, size_t *len)
}
}
+
+const char *BSTR(char *key)
+{
+ void *U;
+
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, strlen (key), &U))
+ return ((urlcontent *)U)->url_data;
+ else
+ return ("");
+}
+
const char *Bstr(char *key, size_t keylen)
{
void *U;
return ("");
}
-const char *XBstr(char *key, size_t keylen, size_t *len)
+long LBstr(char *key, size_t keylen)
{
void *U;
if ((WC->urlstrings != NULL) &&
- GetHash(WC->urlstrings, key, keylen, &U)) {
- *len = ((urlcontent *)U)->url_data_size;
- return ((urlcontent *)U)->url_data;
- }
- else {
- *len = 0;
- return ("");
- }
+ GetHash(WC->urlstrings, key, keylen, &U))
+ return atol(((urlcontent *)U)->url_data);
+ else
+ return (0);
+}
+
+long LBSTR(char *key)
+{
+ void *U;
+
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, strlen(key), &U))
+ return atol(((urlcontent *)U)->url_data);
+ else
+ return (0);
+}
+
+int IBstr(char *key, size_t keylen)
+{
+ void *U;
+
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, keylen, &U))
+ return atoi(((urlcontent *)U)->url_data);
+ else
+ return (0);
+}
+
+int IBSTR(char *key)
+{
+ void *U;
+
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, strlen(key), &U))
+ return atoi(((urlcontent *)U)->url_data);
+ else
+ return (0);
+}
+
+int HaveBstr(char *key, size_t keylen)
+{
+ void *U;
+
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, keylen, &U))
+ return ((urlcontent *)U)->url_data_size != 0;
+ else
+ return (0);
+}
+
+int HAVEBSTR(char *key)
+{
+ void *U;
+
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, strlen(key), &U))
+ return ((urlcontent *)U)->url_data_size != 0;
+ else
+ return (0);
+}
+
+
+int YesBstr(char *key, size_t keylen)
+{
+ void *U;
+
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, keylen, &U))
+ return strcmp( ((urlcontent *)U)->url_data, "yes") == 0;
+ else
+ return (0);
+}
+
+int YESBSTR(char *key)
+{
+ void *U;
+
+ if ((WC->urlstrings != NULL) &&
+ GetHash(WC->urlstrings, key, strlen(key), &U))
+ return strcmp( ((urlcontent *)U)->url_data, "yes") == 0;
+ else
+ return (0);
}
/**
http_transmit_thing(bigbuffer, (size_t)bytes, content_type, 1);
free(bigbuffer);
}
- if (!strcasecmp(bstr("force_close_session"), "yes")) {
+ if (yesbstr("force_close_session")) {
end_webcit_session();
}
}
if (strlen(bstr("nonce")) > 0) {
lprintf(9, "Comparing supplied nonce %s to session nonce %ld\n",
bstr("nonce"), WC->nonce);
- if (atoi(bstr("nonce")) != WC->nonce) {
+ if (ibstr("nonce") != WC->nonce) {
lprintf(9, "Ignoring request with mismatched nonce.\n");
wprintf("HTTP/1.1 404 Security check failed\r\n");
wprintf("Content-Type: text/plain\r\n");
void pullquote_fmout(void);
void wDumpContent(int);
void serv_printf(const char *format,...);
-const char *Bstr(char *key, size_t keylen);
-const char *XBstr(char *key, size_t keylen, size_t *len);
+
/* TODO: get rid of the non-const-typecast */
#define bstr(a) (char*) Bstr(a, sizeof(a) - 1)
-#define xbstr(a, b) (char*) XBstr(a, sizeof(a) - 1, b)
const char *BSTR(char *key);
+const char *Bstr(char *key, size_t keylen);
+
+#define xbstr(a, b) (char*) XBstr(a, sizeof(a) - 1, b)
+const char *XBstr(char *key, size_t keylen, size_t *len);
const char *XBSTR(char *key, size_t *len);
+
+#define lbstr(a) LBstr(a, sizeof(a) - 1)
+long LBstr(char *key, size_t keylen);
+long LBSTR(char *key);
+
+#define ibstr(a) IBstr(a, sizeof(a) - 1)
+int IBstr(char *key, size_t keylen);
+int IBSTR(char *key);
+
+#define havebstr(a) HaveBstr(a, sizeof(a) - 1)
+int HaveBstr(char *key, size_t keylen);
+int HAVEBSTR(char *key);
+
+#define yesbstr(a) YesBstr(a, sizeof(a) - 1)
+int YesBstr(char *key, size_t keylen);
+int YESBSTR(char *key);
+
+
void urlescputs(char *);
void jsesc(char *, size_t, char *);
void jsescputs(char *);
{
char buf[SIZ];
- if (!IsEmptyStr(bstr("change_room_name_button"))) {
+ if (havebstr("change_room_name_button")) {
serv_printf("RCHG %s", bstr("fake_roomname"));
serv_getln(buf, sizeof buf);
http_redirect("who");
- } else if (!IsEmptyStr(bstr("change_host_name_button"))) {
+ } else if (havebstr("change_host_name_button")) {
serv_printf("HCHG %s", bstr("fake_hostname"));
serv_getln(buf, sizeof buf);
http_redirect("who");
- } else if (!IsEmptyStr(bstr("change_user_name_button"))) {
+ } else if (havebstr("change_user_name_button")) {
serv_printf("UCHG %s", bstr("fake_username"));
serv_getln(buf, sizeof buf);
http_redirect("who");
- } else if (!IsEmptyStr(bstr("cancel_button"))) {
+ } else if (havebstr("cancel_button")) {
http_redirect("who");
} else {
output_headers(1, 1, 0, 0, 0, 0);