#include <sys/ioctl.h>
#include <signal.h>
#include <pwd.h>
-#include <setjmp.h>
#include <stdarg.h>
#include <errno.h>
struct march *march = NULL;
/* globals associated with the client program */
-char temp[PATH_MAX]; /* Name of general temp file */
-char temp2[PATH_MAX]; /* Name of general temp file */
-char tempdir[PATH_MAX]; /* Name of general temp dir */
-char editor_path[SIZ]; /* path to external editor */
+char temp[PATH_MAX]; /* Name of general-purpose temp file */
+char temp2[PATH_MAX]; /* Name of general-purpose temp file */
+char tempdir[PATH_MAX]; /* Name of general-purpose temp directory */
+char editor_paths[MAX_EDITORS][SIZ]; /* paths to external editors */
char printcmd[SIZ]; /* print command */
int editor_pid = (-1);
char fullname[USERNAME_SIZE];
-jmp_buf nextbuf;
struct CtdlServInfo serv_info; /* Info on the server connected */
int screenwidth;
int screenheight;
*/
void logoff(CtdlIPC *ipc, int code)
{
- int lp;
+ int lp;
+
if (editor_pid > 0) { /* kill the editor if it's running */
kill(editor_pid, SIGHUP);
}
- /* Free the ungoto list */
- for (lp = 0; lp < uglistsize; lp++)
- free (uglist[lp]);
+ /* Free the ungoto list */
+ for (lp = 0; lp < uglistsize; lp++) {
+ free(uglist[lp]);
+ }
-/* shut down the server... but not if the logoff code is 3, because
- * that means we're exiting because we already lost the server
+/* Shut down the server connection ... but not if the logoff code is 3,
+ * because that means we're exiting because we already lost the server.
*/
- if (code != 3)
+ if (code != 3) {
CtdlIPCQuit(ipc);
+ }
/*
* now clean up various things
*/
-
screen_delete();
unlink(temp);
}
-
/* general purpose routines */
+
/* display a file */
void formout(CtdlIPC *ipc, char *name)
{
uglistlsn[lp] = uglistlsn[lp+1];
}
ugpos--;
- } else
+ } else {
uglistsize++;
+ }
uglist[ugpos] = malloc(strlen(room_name)+1);
strcpy(uglist[ugpos], room_name);
best_match = 0;
strcpy(bbb, "");
- r = CtdlIPCKnownRooms(ipc, AllAccessibleRooms, -1, &march, aaa);
+ r = CtdlIPCKnownRooms(ipc, AllAccessibleRooms, AllFloors, &march, aaa);
if (r / 100 == 1) {
/* Run the roomlist; free the data as we go */
struct march *mp = march; /* Current */
* If it is, pop the first room off the list and go there.
*/
if (march == NULL) {
- r = CtdlIPCKnownRooms(ipc, SubscribedRoomsWithNewMessages, -1, &march, buf);
+ r = CtdlIPCKnownRooms(ipc, SubscribedRoomsWithNewMessages, AllFloors, &march, buf);
/* add _BASEROOM_ to the end of the march list, so the user will end up
* in the system base room (usually the Lobby>) at the end of the loop
*/
/* be nice and identify ourself to the server */
CtdlIPCIdentifySoftware(ipc, SERVER_TYPE, 0, REV_LEVEL,
(ipc->isLocal ? "local" : CITADEL),
- (supplied_hostname) ? supplied_hostname : "", buf);
- /* (locate_host(buf), buf)); */
+ (supplied_hostname) ? supplied_hostname :
+ /* Look up the , in the bible if you're confused */
+ (locate_host(buf), buf), buf);
/* Tell the server what our preferred content formats are */
if ((CtdlIPCSpecifyPreferredFormats(ipc, buf, "text/html|text/plain") / 100 )== 2) {
}
scr_printf("<< wrong password >>\n");
if (strlen(rc_password) > 0)
- logoff(ipc, 0);
+ logoff(ipc, 2);
goto GSTA;
NEWUSR: if (strlen(rc_password) == 0) {
uglistsize = 0;
if (newnow == 1)
- readmsgs(ipc, 3, 1, 5);
+ readmsgs(ipc, LastMessages, ReadForward, 5);
else
- readmsgs(ipc, 1, 1, 0);
+ readmsgs(ipc, NewMessages, ReadForward, 0);
/* MAIN COMMAND LOOP */
do {
dotgoto(ipc, "_MAIL_", 1, 0);
break;
case 20:
- updatels(ipc);
- dotgoto(ipc, argbuf, 0, 0);
+ if (strlen(argbuf) > 0) {
+ updatels(ipc);
+ dotgoto(ipc, argbuf, 0, 0);
+ }
break;
case 52:
- if (rc_alt_semantics)
- updatelsa(ipc);
- dotgoto(ipc, argbuf, 0, 0);
+ if (strlen(argbuf) > 0) {
+ if (rc_alt_semantics) {
+ updatelsa(ipc);
+ }
+ dotgoto(ipc, argbuf, 0, 0);
+ }
+ break;
+ case 95: /* what exactly is the numbering scheme supposed to be anyway? */
+ dotungoto(ipc, argbuf);
break;
case 10:
- readmsgs(ipc, 0, 1, 0);
+ readmsgs(ipc, AllMessages, ReadForward, 0);
break;
case 9:
- readmsgs(ipc, 3, 1, 5);
+ readmsgs(ipc, LastMessages, ReadForward, 5);
break;
case 13:
- readmsgs(ipc, 1, 1, 0);
+ readmsgs(ipc, NewMessages, ReadForward, 0);
break;
case 11:
- readmsgs(ipc, 0, (-1), 0);
+ readmsgs(ipc, AllMessages, ReadReverse, 0);
break;
case 12:
- readmsgs(ipc, 2, (-1), 0);
+ readmsgs(ipc, OldMessages, ReadReverse, 0);
break;
case 71:
- readmsgs(ipc, 3, 1, atoi(argbuf));
+ readmsgs(ipc, LastMessages, ReadForward,
+ atoi(argbuf));
break;
case 7:
forget(ipc);
break;
case 29:
case 30:
- if (!rc_alt_semantics)
+ if (!rc_alt_semantics) {
updatels(ipc);
+ }
termn8 = 1;
break;
case 48:
page_user(ipc);
break;
+ default: /* allow some math on the command */
+ /* commands 100... to 100+MAX_EDITORS-1 will
+ call the appropriate editor... in other
+ words, command numbers 100+ will match
+ the citadel.rc keys editor0, editor1, etc.*/
+ if (mcmd >= 100 && mcmd < (100+MAX_EDITORS))
+ {
+ /* entmsg mode >=2 select editor */
+ entmsg(ipc, 0, mcmd - 100 + 2);
+ break;
+ }
} /* end switch */
} while (termn8 == 0);
TERMN8: scr_printf("%s logged out.", fullname);
+ termn8 = 0;
color(ORIGINAL_PAIR);
scr_printf("\n");
while (march != NULL) {