#include <errno.h>
#include <stdarg.h>
#include "citadel.h"
+#include "citadel_ipc.h"
#include "commands.h"
#include "messages.h"
#include "citadel_decls.h"
#include "tools.h"
#include "rooms.h"
#include "client_chat.h"
-#include "citadel_ipc.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
#endif
int lines_printed = 0; /* line count for paginator */
extern int screenwidth, screenheight;
extern int termn8;
+extern CtdlIPC *ipc_for_signal_handlers; /* KLUDGE cover your eyes */
struct citcmd *cmdlist = NULL;
}
while (express_msgs != 0) {
- r = CtdlIPCGetInstantMessage(&listing, buf);
+ r = CtdlIPCGetInstantMessage(ipc_for_signal_handlers, &listing, buf);
if (r / 100 != 1)
return;
* wait for a response.
*/
if (keepalives_enabled == KA_YES) {
- r = CtdlIPCNoop();
+ r = CtdlIPCNoop(ipc_for_signal_handlers);
if (express_msgs > 0) {
if (ok_to_interrupt == 1) {
scr_printf("\r%64s\r", "");
*/
if ( (keepalives_enabled == KA_HALF)
&& (serv_info.serv_supports_qnop > 0) ) {
- serv_puts("QNOP");
+ CtdlIPC_putline(ipc_for_signal_handlers, "QNOP");
}
}
}
if (ccfile == NULL) {
perror("commands: cannot open citadel.rc");
- logoff(errno);
+ logoff(NULL, 3);
}
while (fgets(buf, sizeof buf, ccfile) != NULL) {
while ((strlen(buf) > 0) ? (isspace(buf[strlen(buf) - 1])) : 0)
rc_encrypt = RC_YES;
#else
fprintf(stderr, "citadel.rc requires encryption support but citadel is not compiled with OpenSSL");
- logoff(1);
+ logoff(NULL, 3);
#endif
}
#ifdef HAVE_OPENSSL
* This function returns an integer command number. If the command prompts
* for a string then it is placed in the supplied buffer.
*/
-int getcmd(char *argbuf)
+int getcmd(CtdlIPC *ipc, char *argbuf)
{
char cmdbuf[5];
int cmdspaces[5];
enable_color = 0;
}
/* if we're running in idiot mode, display a cute little menu */
- IFNEXPERT formout("mainmenu");
+ IFNEXPERT formout(ipc, "mainmenu");
- print_express(); /* print express messages if there are any */
+ print_express();
strcpy(argbuf, "");
cmdpos = 0;
for (a = 0; a < 5; ++a)
/*
* display_help() - help file viewer
*/
-void display_help(char *name)
+void display_help(CtdlIPC *ipc, char *name)
{
- formout(name);
+ formout(ipc, name);
}
/* keypress caught; drain the server */
OOPS: /* do {
- serv_gets(aaa);
+ CtdlIPC_getline(ipc, aaa);
} while (strcmp(aaa, "000")); */
FMTEND:
#endif
/* When switching to dim white, actually output an 'original
* pair' sequence -- this looks better on black-on-white
- * terminals.
+ * terminals. - Changed to ORIGINAL_PAIR as this actually
+ * wound up looking horrible on black-on-white terminals, not
+ * to mention transparent terminals.
*/
- if (colornum == DIM_WHITE)
+ if (colornum == ORIGINAL_PAIR)
printf("\033[39;49m");
else
printf("\033[3%d;40m", (colornum & 7));