$Log$
+ Revision 614.51 2004/02/26 20:17:29 error
+ * Client stability and enhancements:
+ * CtdlServInfo structure moved inside CtdlIPC; eliminates unnecessary
+ global and makes IPC more self-contained
+ * Removed redundant serv_ from variable names in CtdlServInfo struct
+ * Send SIGHUP to process group when connection_died(). Kills self and
+ children (e.g. external editor).
+
Revision 614.50 2004/02/25 01:35:34 error
Missing parameter to a printf() function. No idea where it went, but I
put it back.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
char printcmd[SIZ]; /* print command */
int editor_pid = (-1);
char fullname[USERNAME_SIZE];
-struct CtdlServInfo serv_info; /* Info on the server connected */
int screenwidth;
int screenheight;
unsigned room_flags;
system(rc_gotmail_cmd);
}
}
- status_line(serv_info.serv_humannode, serv_info.serv_bbs_city,
+ status_line(ipc->ServInfo.humannode, ipc->ServInfo.bbs_city,
room_name, secure, newmailcount);
}
/*
* set floor mode depending on client, server, and user settings
*/
-void set_floor_mode(void)
+void set_floor_mode(CtdlIPC* ipc)
{
- if (serv_info.serv_ok_floors == 0) {
+ if (ipc->ServInfo.ok_floors == 0) {
floor_mode = 0; /* Don't use floors if the server */
}
/* doesn't support them! */
{
char buf[SIZ];
- CtdlIPCServerInfo(ipc, &serv_info, buf);
+ CtdlIPCServerInfo(ipc, buf);
/* be nice and identify ourself to the server */
CtdlIPCIdentifySoftware(ipc, SERVER_TYPE, 0, REV_LEVEL,
(ipc->isLocal ? "local" : CITADEL),
(supplied_hostname) ? supplied_hostname :
/* Look up the , in the bible if you're confused */
- (locate_host(buf), buf), buf);
+ (locate_host(ipc, buf), buf), buf);
/* Tell the server what our preferred content formats are */
if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "text/html|text/plain") / 100 )== 2) {
load_command_set(); /* parse the citadel.rc file */
sttybbs(SB_NO_INTR); /* Install the new ones */
signal(SIGHUP, dropcarr); /* Cleanup gracefully if carrier is dropped */
+ signal(SIGPIPE, dropcarr); /* Cleanup gracefully if local conn. dropped */
signal(SIGTERM, dropcarr); /* Cleanup gracefully if terminated */
signal(SIGCONT, catch_sigcont); /* Catch SIGCONT so we can reset terminal */
#ifdef SIGWINCH
#endif
get_serv_info(ipc, telnet_client_host);
- scr_printf("%-24s\n%s\n%s\n", serv_info.serv_software, serv_info.serv_humannode,
- serv_info.serv_bbs_city);
+ scr_printf("%-24s\n%s\n%s\n", ipc->ServInfo.software, ipc->ServInfo.humannode,
+ ipc->ServInfo.bbs_city);
scr_flush();
- status_line(serv_info.serv_humannode, serv_info.serv_bbs_city, NULL,
+ status_line(ipc->ServInfo.humannode, ipc->ServInfo.bbs_city, NULL,
secure, -1);
screenwidth = 80; /* default screen dimensions */
check_screen_dims();
#endif
- set_floor_mode();
+ set_floor_mode(ipc);
/* Enter the lobby */
dotgoto(ipc, "_BASEROOM_", 1, 0);
case 37:
enter_config(ipc, 0);
- set_floor_mode();
+ set_floor_mode(ipc);
break;
case 59:
enter_config(ipc, 3);
- set_floor_mode();
+ set_floor_mode(ipc);
break;
case 60:
/* INFO */
-int CtdlIPCServerInfo(CtdlIPC *ipc, struct CtdlServInfo *ServInfo, char *cret)
+int CtdlIPCServerInfo(CtdlIPC *ipc, char *cret)
{
register int ret;
size_t bytes;
char buf[SIZ];
if (!cret) return -2;
- if (!ServInfo) return -2;
ret = CtdlIPCGenericCommand(ipc, "INFO", NULL, 0, &listing, &bytes, cret);
if (ret / 100 == 1) {
extract_token(buf, listing, 0, '\n');
remove_token(listing, 0, '\n');
switch (line++) {
- case 0: ServInfo->serv_pid = atoi(buf);
+ case 0: ipc->ServInfo.pid = atoi(buf);
break;
- case 1: strcpy(ServInfo->serv_nodename,buf);
+ case 1: strcpy(ipc->ServInfo.nodename,buf);
break;
- case 2: strcpy(ServInfo->serv_humannode,buf);
+ case 2: strcpy(ipc->ServInfo.humannode,buf);
break;
- case 3: strcpy(ServInfo->serv_fqdn,buf);
+ case 3: strcpy(ipc->ServInfo.fqdn,buf);
break;
- case 4: strcpy(ServInfo->serv_software,buf);
+ case 4: strcpy(ipc->ServInfo.software,buf);
break;
- case 5: ServInfo->serv_rev_level = atoi(buf);
+ case 5: ipc->ServInfo.rev_level = atoi(buf);
break;
- case 6: strcpy(ServInfo->serv_bbs_city,buf);
+ case 6: strcpy(ipc->ServInfo.bbs_city,buf);
break;
- case 7: strcpy(ServInfo->serv_sysadm,buf);
+ case 7: strcpy(ipc->ServInfo.sysadm,buf);
break;
- case 9: strcpy(ServInfo->serv_moreprompt,buf);
+ case 9: strcpy(ipc->ServInfo.moreprompt,buf);
break;
- case 10: ServInfo->serv_ok_floors = atoi(buf);
+ case 10: ipc->ServInfo.ok_floors = atoi(buf);
break;
- case 11: ServInfo->serv_paging_level = atoi(buf);
+ case 11: ipc->ServInfo.paging_level = atoi(buf);
break;
- case 13: ServInfo->serv_supports_qnop = atoi(buf);
- case 14: ServInfo->serv_supports_ldap = atoi(buf);
+ case 13: ipc->ServInfo.supports_qnop = atoi(buf);
+ break;
+ case 14: ipc->ServInfo.supports_ldap = atoi(buf);
break;
}
}
/* OPEN */
int CtdlIPCFileDownload(CtdlIPC *ipc, const char *filename, void **buf,
size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)
+ (CtdlIPC*, unsigned long, unsigned long),
char *cret)
{
register int ret;
/* OPNA */
int CtdlIPCAttachmentDownload(CtdlIPC *ipc, long msgnum, const char *part,
void **buf,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)
+ (CtdlIPC*, unsigned long, unsigned long),
char *cret)
{
register int ret;
/* OIMG */
int CtdlIPCImageDownload(CtdlIPC *ipc, const char *filename, void **buf,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)
+ (CtdlIPC*, unsigned long, unsigned long),
char *cret)
{
register int ret;
/* UOPN */
int CtdlIPCFileUpload(CtdlIPC *ipc, const char *save_as, const char *comment,
const char *path,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)
+ (CtdlIPC*, unsigned long, unsigned long),
char *cret)
{
register int ret;
/* UIMG */
int CtdlIPCImageUpload(CtdlIPC *ipc, int for_real, const char *path,
const char *save_as,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)
+ (CtdlIPC*, unsigned long, unsigned long),
char *cret)
{
register int ret;
/* READ */
int CtdlIPCReadDownload(CtdlIPC *ipc, void **buf, size_t bytes, size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)
+ (CtdlIPC*, unsigned long, unsigned long),
char *cret)
{
register size_t len;
len = resume;
if (progress_gauge_callback)
- progress_gauge_callback(len, bytes);
+ progress_gauge_callback(ipc, len, bytes);
while (len < bytes) {
register size_t block;
}
len += block;
if (progress_gauge_callback)
- progress_gauge_callback(len, bytes);
+ progress_gauge_callback(ipc, len, bytes);
}
return len;
}
/* READ - pipelined */
int CtdlIPCHighSpeedReadDownload(CtdlIPC *ipc, void **buf, size_t bytes,
size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)
+ (CtdlIPC*, unsigned long, unsigned long),
char *cret)
{
register size_t len;
len = 0;
CtdlIPC_lock(ipc);
if (progress_gauge_callback)
- progress_gauge_callback(len, bytes);
+ progress_gauge_callback(ipc, len, bytes);
/* How many calls will be in the pipeline? */
calls = (bytes - resume) / 4096;
serv_read(ipc, ((*buf) + (i * 4096)), len);
}
if (progress_gauge_callback)
- progress_gauge_callback(i * 4096 + len, bytes);
+ progress_gauge_callback(ipc, i * 4096 + len, bytes);
}
CtdlIPC_unlock(ipc);
return len;
/* WRIT */
int CtdlIPCWriteUpload(CtdlIPC *ipc, const char *path,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)
+ (CtdlIPC*, unsigned long, unsigned long),
char *cret)
{
register int ret = -1;
rewind(fd);
if (progress_gauge_callback)
- progress_gauge_callback(0, bytes);
+ progress_gauge_callback(ipc, 0, bytes);
while (offset < bytes) {
register size_t to_write;
serv_write(ipc, buf, to_write);
offset += to_write;
if (progress_gauge_callback)
- progress_gauge_callback(offset, bytes);
+ progress_gauge_callback(ipc, offset, bytes);
/* Detect short reads and back up if needed */
/* offset will never be negative anyway */
fseek(fd, (signed)offset, SEEK_SET);
}
}
if (progress_gauge_callback)
- progress_gauge_callback(1, 1);
+ progress_gauge_callback(ipc, 1, 1);
return (!ferror(fd) ? ret : -2);
}
while (len < bytes) {
rlen = read(ipc->sock, &buf[len], bytes - len);
if (rlen < 1) {
- connection_died(ipc);
+ connection_died(ipc, 0);
return;
}
len += rlen;
retval = write(ipc->sock, &buf[bytes_written],
nbytes - bytes_written);
if (retval < 1) {
- connection_died(ipc);
+ connection_died(ipc, 0);
return;
}
bytes_written += retval;
serv_read(ipc, &buf[len], bytes - len);
return;
}
- error_printf("SSL_read in serv_read:\n");
- ERR_print_errors_fp(stderr);
- connection_died(ipc);
+ error_printf("SSL_read in serv_read: %s\n",
+ ERR_reason_error_string(ERR_peek_error()));
+ connection_died(ipc, 1);
return;
}
len += rlen;
nbytes - bytes_written);
return;
}
- error_printf("SSL_write in serv_write:\n");
- ERR_print_errors_fp(stderr);
- connection_died(ipc);
+ error_printf("SSL_write in serv_write: %s\n",
+ ERR_reason_error_string(ERR_peek_error()));
+ connection_died(ipc, 1);
return;
}
bytes_written += retval;
#define ifree(o) free(o);
#endif
+struct CtdlServInfo {
+ int pid;
+ char nodename[32];
+ char humannode[64];
+ char fqdn[64];
+ char software[64];
+ int rev_level;
+ char bbs_city[64];
+ char sysadm[64];
+ char moreprompt[256];
+ int ok_floors;
+ int paging_level;
+ int supports_qnop;
+ int supports_ldap;
+};
+
/* This class is responsible for the server connection */
typedef struct _CtdlIPC {
+ /* The server info for this connection */
+ struct CtdlServInfo ServInfo;
+
#if defined(HAVE_OPENSSL)
/* NULL if not encrypted, non-NULL otherwise */
SSL *ssl;
int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime,
struct ctdlipcmessage **mret, char *cret);
int CtdlIPCWhoKnowsRoom(CtdlIPC *ipc, char **listing, char *cret);
-int CtdlIPCServerInfo(CtdlIPC *ipc, struct CtdlServInfo *ServInfo, char *cret);
+int CtdlIPCServerInfo(CtdlIPC *ipc, char *cret);
/* int CtdlIPCReadDirectory(CtdlIPC *ipc, struct ctdlipcfile **files, char *cret); */
int CtdlIPCReadDirectory(CtdlIPC *ipc, char **listing, char *cret);
int CtdlIPCSetLastRead(CtdlIPC *ipc, long msgnum, char *cret);
int CtdlIPCOnlineUsers(CtdlIPC *ipc, char **listing, time_t *stamp, char *cret);
int CtdlIPCFileDownload(CtdlIPC *ipc, const char *filename, void **buf,
size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCAttachmentDownload(CtdlIPC *ipc, long msgnum, const char *part,
void **buf,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCImageDownload(CtdlIPC *ipc, const char *filename, void **buf,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCFileUpload(CtdlIPC *ipc, const char *save_as, const char *comment,
const char *path,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCImageUpload(CtdlIPC *ipc, int for_real, const char *path,
const char *save_as,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCQueryUsername(CtdlIPC *ipc, const char *username, char *cret);
int CtdlIPCFloorListing(CtdlIPC *ipc, char **listing, char *cret);
size_t bytes, char *cret);
int CtdlIPCEndUpload(CtdlIPC *ipc, int discard, char *cret);
int CtdlIPCWriteUpload(CtdlIPC *ipc, const char *path,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCEndDownload(CtdlIPC *ipc, char *cret);
int CtdlIPCReadDownload(CtdlIPC *ipc, void **buf, size_t bytes, size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCHighSpeedReadDownload(CtdlIPC *ipc, void **buf, size_t bytes,
size_t resume,
- void (*progress_gauge_callback)(unsigned long, unsigned long),
+ void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long),
char *cret);
int CtdlIPCGenericCommand(CtdlIPC *ipc, const char *command,
const char *to_send, size_t bytes_to_send, char **to_receive,
extern int (*error_printf)(char *s, ...);
void setIPCDeathHook(void (*hook)(void));
void setIPCErrorPrintf(int (*func)(char *s, ...));
-void connection_died(CtdlIPC *ipc);
+void connection_died(CtdlIPC* ipc, int using_ssl);
int CtdlIPC_getsockfd(CtdlIPC* ipc);
char CtdlIPC_get(CtdlIPC* ipc);
#define MIN(a, b) ((a) < (b) ? (a) : (b))
-extern struct CtdlServInfo serv_info;
extern char temp[];
void getline(char *, int);
strprompt("Page who", touser, 30);
/* old server -- use inline paging */
- if (serv_info.serv_paging_level == 0) {
+ if (ipc->ServInfo.paging_level == 0) {
newprompt("Message: ", msg, 69);
snprintf(buf, sizeof buf, "SEXP %s|%s", touser, msg);
CtdlIPC_putline(ipc, buf);
return;
}
/* new server -- use extended paging */
- else if (serv_info.serv_paging_level >= 1) {
+ else if (ipc->ServInfo.paging_level >= 1) {
snprintf(buf, sizeof buf, "SEXP %s||", touser);
CtdlIPC_putline(ipc, buf);
CtdlIPC_getline(ipc, buf);
fprintf(outpipe, "at %d:%02dam",
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);
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");
* server supports it) and then do nothing.
*/
if ( (keepalives_enabled == KA_HALF)
- && (serv_info.serv_supports_qnop > 0) ) {
+ && (ipc_for_signal_handlers->ServInfo.supports_qnop > 0) ) {
CtdlIPC_putline(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);
error_printf = func;
}
-void connection_died(CtdlIPC *ipc) {
+void connection_died(CtdlIPC* ipc, int using_ssl) {
if (deathHook != NULL)
deathHook();
- error_printf("\rYour connection to this Citadel server is broken.\n"
- "Last error: %s\n"
- "Please re-connect and log in again.\n",
- strerror(errno));
+ error_printf("\r\nYour connection to %s is broken.\n",
+ ipc->ServInfo.humannode);
+
+#ifdef HAVE_OPENSSL
+ if (using_ssl) {
+ error_printf("Last error: %s\n",
+ ERR_reason_error_string(ERR_get_error()));
+ } else
+#endif
+ error_printf("Last error: %s\n", strerror(errno));
+
+ error_printf("Please re-connect and log in again.\n");
fflush(stderr);
fflush(stdout);
#endif
shutdown(ipc->sock, 2);
ipc->sock = -1;
+
+ /* Hangup - let any children know as well */
+ kill(0, SIGHUP);
}
#define ASYNC_MSG 900
#define ASYNC_GEXP 01
-struct CtdlServInfo {
- int serv_pid;
- char serv_nodename[32];
- char serv_humannode[64];
- char serv_fqdn[64];
- char serv_software[64];
- int serv_rev_level;
- char serv_bbs_city[64];
- char serv_sysadm[64];
- char serv_moreprompt[256];
- int serv_ok_floors;
- int serv_paging_level;
- int serv_supports_qnop;
- int serv_supports_ldap;
-};
-
#define QR_PERMANENT 1 /* Room does not purge */
#define QR_INUSE 2 /* Set if in use, clear if avail */
#define QR_PRIVATE 4 /* Set for any type of private room */
int haschar(const char *st, int ch);
void getline(char *string, int lim);
int file_checksum(char *filename);
-void progress(unsigned long curr, unsigned long cmax);
+void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax);
unsigned long *msg_arr = NULL;
int msg_arr_size = 0;
extern char room_name[];
extern unsigned room_flags;
extern long highest_msg_read;
-extern struct CtdlServInfo serv_info;
extern char temp[];
extern char temp2[];
extern int screenwidth;
}
if (strlen(message->node)) {
if ((room_flags & QR_NETWORK)
- || ((strcasecmp(message->node, serv_info.serv_nodename)
- && (strcasecmp(message->node, serv_info.serv_fqdn))))) {
+ || ((strcasecmp(message->node, ipc->ServInfo.nodename)
+ && (strcasecmp(message->node, ipc->ServInfo.fqdn))))) {
if (strlen(message->email) == 0) {
if (dest) {
fprintf(dest, "@%s ", message->node);
}
}
}
- if (strcasecmp(message->hnod, serv_info.serv_humannode)
+ if (strcasecmp(message->hnod, ipc->ServInfo.humannode)
&& (strlen(message->hnod)) && (!strlen(message->email))) {
if (dest) {
fprintf(dest, "(%s) ", message->hnod);
size_t len;
len = (size_t)extract_long(buf, 0);
- progress(len, len);
+ progress(ipc, len, len);
scr_flush();
snprintf(tmp, sizeof tmp, "%s.%s",
tmpnam(NULL),
void sttybbs(int cmd);
void hit_any_key(void);
void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto);
-void progress(unsigned long curr, unsigned long cmax);
+void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax);
int pattern(char *search, char *patn);
int file_checksum(char *filename);
int nukedir(char *dirname);
extern unsigned userflags;
extern char *axdefs[7];
extern char sigcaught;
-extern struct CtdlServInfo serv_info;
extern char rc_floor_mode;
extern int rc_ansi_color;
extern int rc_prompt_control;
color(COLOR_PUSH);
color(DIM_RED);
- scr_printf("%s\r",serv_info.serv_moreprompt);
+ scr_printf("%s\r", ipc->ServInfo.moreprompt);
color(COLOR_POP);
sttybbs(0);
b=inkey();
- for (a=0; a<strlen(serv_info.serv_moreprompt); ++a)
+ for (a=0; a<strlen(ipc->ServInfo.moreprompt); ++a)
scr_putc(' ');
scr_putc(13);
sttybbs(1);
#endif
-void progress(unsigned long curr, unsigned long cmax)
+void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax)
{
static char dots[] =
"**************************************************";
if (curr >= cmax) {
sln_printf("\r%79s\r","");
- status_line(serv_info.serv_humannode, serv_info.serv_bbs_city,
+ status_line(ipc->ServInfo.humannode, ipc->ServInfo.bbs_city,
room_name, secure, 0);
} else {
/* a will be range 0-50 rather than 0-100 */
* NOT the same locate_host() in locate_host.c. This one just does a
* 'who am i' to try to discover where the user is...
*/
-void locate_host(char *hbuf)
+void locate_host(CtdlIPC* ipc, char *hbuf)
{
#ifndef HAVE_UTMP_H
char buf[SIZ];
who = (FILE *)popen("who am i","r");
if (who==NULL) {
- strcpy(hbuf,serv_info.serv_fqdn);
+ strcpy(hbuf, ipc->ServInfo.fqdn);
return;
}
fgets(buf,sizeof buf,who);
if ((buf[a]=='(')||(buf[a]==')')) ++b;
}
if (b<2) {
- strcpy(hbuf,serv_info.serv_fqdn);
+ strcpy(hbuf, ipc->ServInfo.fqdn);
return;
}
if (buf[a]==')') buf[a] = 0;
}
- if (strlen(buf)==0) strcpy(hbuf,serv_info.serv_fqdn);
+ if (strlen(buf)==0) strcpy(hbuf, ipc->ServInfo.fqdn);
else strncpy(hbuf,buf,24);
#else
char *tty = ttyname(0);
if (tty == NULL) {
fail:
- safestrncpy(hbuf, serv_info.serv_fqdn, 24);
+ safestrncpy(hbuf, ipc->ServInfo.fqdn, 24);
return;
}
void interr(int errnum);
int struncmp(char *lstr, char *rstr, int len);
int pattern(char *search, char *patn);
-void enter_config(CtdlIPC *ipc, int mode);
-void locate_host(char *hbuf);
+void enter_config(CtdlIPC* ipc, int mode);
+void locate_host(CtdlIPC* ipc, char *hbuf);
void misc_server_cmd(CtdlIPC *ipc, char *cmd);
int nukedir(char *dirname);
int num_parms(char *source);
void strproc(char *string);
void back(int spaces);
-void progress(unsigned long curr, unsigned long cmax);
+void progress(CtdlIPC* ipc, unsigned long curr, unsigned long cmax);
int set_attr(CtdlIPC *ipc, unsigned int sval, char *prompt, unsigned int sbit, int backwards);
striplt(diruser);
striplt(dirnode);
if ((strcasecmp(diruser, fullname))
- || (strcasecmp(dirnode, serv_info.serv_nodename))) {
+ || (strcasecmp(dirnode, ipc->ServInfo.nodename))) {
scr_printf(
"\nYou can't use %s as your address.\n",
tmpemail);
snprintf(sc[25], sizeof sc[25], "%d", a);
/* LDAP settings */
- if (serv_info.serv_supports_ldap) {
+ if (ipc->ServInfo.supports_ldap) {
a = strlen(&sc[32][0]);
a = (a ? 1 : 0); /* Set only to 1 or 0 */
a = boolprompt("Connect this Citadel to an LDAP directory", a);
*/
#include "sysdep.h"
-#include "screen.h"
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include "citadel_ipc.h"
#include "citadel_decls.h"
#include "commands.h"
+#include "screen.h"
#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
static SCREEN *myscreen = NULL;
/*
* this is not supposed to be called from a signal handler.
*/
-int scr_set_windowsize()
+int scr_set_windowsize(CtdlIPC* ipc)
{
#if defined(HAVE_CURSES_H) && !defined(DISABLE_CURSES)
if (mainwindow && caught_sigwinch) {
wresize(statuswindow, 1, screenwidth);
#endif
mvwin(statuswindow, screenheight, 0);
- status_line(serv_info.serv_humannode, serv_info.serv_bbs_city,
- room_name, secure, -1);
+ status_line(ipc->ServInfo.humannode, ipc->ServInfo.bbs_city,
+ room_name, secure, -1);
wnoutrefresh(mainwindow);
wnoutrefresh(statuswindow);
doupdate();
void scr_flush(void);
void err_flush(void);
void sln_flush(void);
-int scr_set_windowsize(void);
+int scr_set_windowsize(CtdlIPC* ipc);
void windows_new(void);
void windows_delete(void);
int scr_blockread(void);
int r; /* IPC response code */
time_t timenow;
char *listing = NULL;
- struct CtdlServInfo serv_info;
CtdlIPC *ipc = NULL;
/* If this environment variable is set, we assume that the program
logoff(atoi(buf));
}
strcpy(nodetitle, "this BBS");
- r = CtdlIPCServerInfo(ipc, &serv_info, buf);
+ r = CtdlIPCServerInfo(ipc, buf);
if (r / 100 == 1) {
- my_pid = serv_info.serv_pid;
- strcpy(nodetitle, serv_info.serv_humannode);
+ my_pid = ipc->ServInfo.pid;
+ strcpy(nodetitle, ipc->ServInfo.humannode);
}
if (www) {