/* these variables are local to this module */
char keepalives_enabled = KA_YES; /* send NOOPs to server when idle */
-int ok_to_interrupt = 0; /* print express msgs asynchronously */
+int ok_to_interrupt = 0; /* print instant msgs asynchronously */
time_t AnsiDetect; /* when did we send the detect code? */
int enable_color = 0; /* nonzero for ANSI color */
if (!pagin) return(0);
if (lp>=(height-1)) {
set_keepalives(KA_HALF);
- hit_any_key();
+ hit_any_key(ipc_for_signal_handlers); /* Cheating -IO */
set_keepalives(KA_YES);
return(0);
}
/*
- * print_express() - print express messages if there are any
+ * print_instant() - print instant messages if there are any
*/
-void print_express(void)
+void print_instant(void)
{
char buf[1024];
FILE *outpipe;
time_t timestamp;
- struct tm *stamp;
+ struct tm stamp;
int flags = 0;
char sender[64];
char node[64];
char *listing = NULL;
int r; /* IPC result code */
- if (express_msgs == 0)
+ if (instant_msgs == 0)
return;
if (rc_exp_beep) {
scr_printf("\r---");
}
- while (express_msgs != 0) {
+ while (instant_msgs != 0) {
r = CtdlIPCGetInstantMessage(ipc_for_signal_handlers, &listing, buf);
if (r / 100 != 1)
return;
- express_msgs = extract_int(buf, 0);
+ instant_msgs = extract_int(buf, 0);
timestamp = extract_long(buf, 1);
flags = extract_int(buf, 2);
- extract(sender, buf, 3);
- extract(node, buf, 4);
+ extract_token(sender, buf, 3, '|', sizeof sender);
+ extract_token(node, buf, 4, '|', sizeof node);
strcpy(last_paged, sender);
- stamp = localtime(×tamp);
+ localtime_r(×tamp, &stamp);
/* If the page is a Logoff Request, honor it. */
if (flags & 2) {
else
fprintf(outpipe, "Message ");
/* Timestamp. Can this be improved? */
- if (stamp->tm_hour == 0 || stamp->tm_hour == 12)
+ if (stamp.tm_hour == 0 || stamp.tm_hour == 12)
fprintf(outpipe, "at 12:%02d%cm",
- stamp->tm_min,
- stamp->tm_hour ? 'p' : 'a');
- else if (stamp->tm_hour > 12) /* pm */
+ stamp.tm_min,
+ stamp.tm_hour ? 'p' : 'a');
+ else if (stamp.tm_hour > 12) /* pm */
fprintf(outpipe, "at %d:%02dpm",
- stamp->tm_hour - 12,
- stamp->tm_min);
+ stamp.tm_hour - 12,
+ stamp.tm_min);
else /* am */
fprintf(outpipe, "at %d:%02dam",
- stamp->tm_hour, stamp->tm_min);
+ stamp.tm_hour, stamp.tm_min);
fprintf(outpipe, " from %s", sender);
- if (strncmp(serv_info.serv_nodename, node, 32))
+ if (strncmp(ipc_for_signal_handlers->ServInfo.nodename, node, 32))
fprintf(outpipe, " @%s", node);
fprintf(outpipe, ":\n%s\n", listing);
pclose(outpipe);
- if (express_msgs == 0)
+ if (instant_msgs == 0)
return;
continue;
}
}
- /* fall back to built-in express message display */
+ /* fall back to built-in instant message display */
scr_printf("\n");
lines_printed++;
scr_printf("Message ");
/* Timestamp. Can this be improved? */
- if (stamp->tm_hour == 0 || stamp->tm_hour == 12)/* 12am/12pm */
- scr_printf("at 12:%02d%cm", stamp->tm_min,
- stamp->tm_hour ? 'p' : 'a');
- else if (stamp->tm_hour > 12) /* pm */
+ if (stamp.tm_hour == 0 || stamp.tm_hour == 12)/* 12am/12pm */
+ scr_printf("at 12:%02d%cm", stamp.tm_min,
+ stamp.tm_hour ? 'p' : 'a');
+ else if (stamp.tm_hour > 12) /* pm */
scr_printf("at %d:%02dpm",
- stamp->tm_hour - 12, stamp->tm_min);
+ stamp.tm_hour - 12, stamp.tm_min);
else /* am */
- scr_printf("at %d:%02dam", stamp->tm_hour, stamp->tm_min);
+ scr_printf("at %d:%02dam", stamp.tm_hour, stamp.tm_min);
/* Sender */
scr_printf(" from %s", sender);
/* Remote node, if any */
- if (strncmp(serv_info.serv_nodename, node, 32))
+ if (strncmp(ipc_for_signal_handlers->ServInfo.nodename, node, 32))
scr_printf(" @%s", node);
scr_printf(":\n");
*/
if (keepalives_enabled == KA_YES) {
r = CtdlIPCNoop(ipc_for_signal_handlers);
- if (express_msgs > 0) {
+ if (instant_msgs > 0) {
if (ok_to_interrupt == 1) {
scr_printf("\r%64s\r", "");
- print_express();
+ print_instant();
scr_printf("%s%c ", room_name,
room_prompt(room_flags));
scr_flush();
* server supports it) and then do nothing.
*/
if ( (keepalives_enabled == KA_HALF)
- && (serv_info.serv_supports_qnop > 0) ) {
- CtdlIPC_putline(ipc_for_signal_handlers, "QNOP");
+ && (ipc_for_signal_handlers->ServInfo.supports_qnop > 0) ) {
+ CtdlIPC_chat_send(ipc_for_signal_handlers, "QNOP");
}
}
* necessary and then waits again.
*/
do {
- scr_set_windowsize();
+ scr_set_windowsize(ipc_for_signal_handlers);
do_keepalive();
- scr_set_windowsize();
+ scr_set_windowsize(ipc_for_signal_handlers);
FD_ZERO(&rfds);
FD_SET(0, &rfds);
/* At this point, there's input, so fetch it.
* (There's a hole in the bucket...)
*/
- a = scr_getc(SCR_NOBLOCK);
+ a = scr_getc(SCR_BLOCK);
if (a == 127)
a = 8;
if (a > 126)
#ifndef DISABLE_CURSES
#if defined(HAVE_CURSES_H) || defined(HAVE_NCURSES_H)
- if (a == ERR)
- a = 0;
+ if (a == ERR) {
+ logoff(NULL, 3);
+ }
#endif
#endif
int i;
char buf[128];
- print_express();
+ print_instant();
color(DIM_WHITE);
scr_printf("%s ", prompt);
color(DIM_MAGENTA);
for (i = 0; i < MAX_EDITORS; i++)
strcpy(editor_paths[i], "");
strcpy(printcmd, "");
+ strcpy(imagecmd, "");
strcpy(rc_username, "");
strcpy(rc_password, "");
rc_floor_mode = 0;
rc_force_mail_prompts = 0;
rc_ansi_color = 0;
rc_color_use_bg = 0;
+ rc_reply_extedit = 0;
strcpy(rc_url_cmd, "");
strcpy(rc_gotmail_cmd, "");
#ifdef HAVE_OPENSSL
ccfile = fopen(buf, "r");
}
if (ccfile == NULL) {
- snprintf(buf, sizeof buf, "%s/citadel.rc", BBSDIR);
+ snprintf(buf, sizeof buf, "%s/citadel.rc", CTDLDIR);
ccfile = fopen(buf, "r");
}
if (ccfile == NULL) {
if (!strncasecmp(buf, "printcmd=", 9))
strcpy(printcmd, &buf[9]);
+ if (!strncasecmp(buf, "imagecmd=", 9))
+ strcpy(imagecmd, &buf[9]);
+
if (!strncasecmp(buf, "expcmd=", 7))
strcpy(rc_exp_cmd, &buf[7]);
rc_allow_attachments = atoi(&buf[18]);
}
if (!strncasecmp(buf, "idle_threshold=", 15)) {
- rc_idle_threshold = atoi(&buf[15]);
+ rc_idle_threshold = atol(&buf[15]);
}
if (!strncasecmp(buf, "remember_passwords=", 19)) {
rc_remember_passwords = atoi(&buf[19]);
rc_alt_semantics = 0;
}
}
+ if (!strncasecmp(buf, "reply_with_external_editor=", 27)) {
+ if (!strncasecmp(&buf[27], "yes", 3)) {
+ rc_reply_extedit = 1;
+ }
+ else {
+ rc_reply_extedit = 0;
+ }
+ }
if (!strncasecmp(buf, "cmd=", 4)) {
strcpy(buf, &buf[4]);
/* if we're running in idiot mode, display a cute little menu */
IFNEXPERT formout(ipc, "mainmenu");
- print_express();
+ print_instant();
strcpy(argbuf, "");
cmdpos = 0;
for (a = 0; a < 5; ++a)
/*
* set tty modes. commands are:
*
- * 01- set to bbs mode
+ * 01- set to Citadel mode
* 2 - save current settings for later restoral
* 3 - restore saved settings
*/
#ifdef HAVE_TERMIOS_H
-void sttybbs(int cmd)
-{ /* SysV version of sttybbs() */
+void stty_ctdl(int cmd)
+{ /* SysV version of stty_ctdl() */
struct termios live;
static struct termios saved_settings;
static int last_cmd = 0;
}
#else
-void sttybbs(int cmd)
-{ /* BSD version of sttybbs() */
+void stty_ctdl(int cmd)
+{ /* BSD version of stty_ctdl() */
struct sgttyb live;
static struct sgttyb saved_settings;
static int last_cmd = 0;
old = '\n';
continue;
}
+ /* Are we looking at a nonprintable? */
+ if ( (*e < 32) || (*e > 126) ) {
+ e++;
+ continue;
+ }
/* Or are we looking at a space? */
if (*e == ' ') {
e++;
}
else {
for (i=0; i<choices; ++i) {
- extract(buf, menustring, i);
+ extract_token(buf, menustring, i, '|', sizeof buf);
keyopt(buf);
scr_printf(" ");
}
}
- scr_printf(" -> ");
+ scr_printf("-> ");
display_prompt = 0;
}
ch = lkey();
scr_printf("\rOne of... ");
scr_printf(" \n");
for (i=0; i<choices; ++i) {
- extract(buf, menustring, i);
+ extract_token(buf, menustring, i, '|', sizeof buf);
scr_printf(" ");
keyopt(buf);
scr_printf("\n");
}
for (i=0; i<choices; ++i) {
- extract(buf, menustring, i);
+ extract_token(buf, menustring, i, '|', sizeof buf);
for (c=1; c<strlen(buf); ++c) {
if ( (ch == tolower(buf[c]))
&& (buf[c-1]=='<')
scr_putc(buf[a]);
}
}
- scr_printf("\n\n");
+ scr_printf("\n");
return ch;
}
}