From 57ddafdf7189793c6604acd0ac287a28a028148a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 24 Jan 1999 05:40:26 +0000 Subject: [PATCH] Minor bugfixes --- citadel/client_chat.c | 26 +++++++++++++------------- citadel/room_ops.c | 11 +++++++---- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/citadel/client_chat.c b/citadel/client_chat.c index b1bdd58a1..16ec066d0 100644 --- a/citadel/client_chat.c +++ b/citadel/client_chat.c @@ -35,6 +35,7 @@ extern struct CtdlServInfo serv_info; extern char temp[]; void citedit(FILE *fp, long int base_pos); +void getline(char *, int); void chatmode(void) { char wbuf[256]; @@ -198,7 +199,8 @@ RCL: if (send_complete_line) { void page_user() { static char last_paged[32] = ""; char buf[256], touser[256], msg[256]; - FILE *fp; + char longmsg[5][80]; + int i; strcpy(touser, last_paged); strprompt("Page who", touser, 30); @@ -225,30 +227,28 @@ void page_user() { printf("%s\n", &buf[4]); return; } - fp = fopen(temp, "w"); - fp = freopen(temp, "rb+", fp); - if (fp==NULL) printf("Error: %s\n", strerror(errno)); - unlink(temp); + printf("Type message to send. Enter a blank line when finished.\n"); - citedit(fp, 0); + bzero(longmsg, sizeof longmsg); + for (i=0; i<5; ++i) { + printf("> "); + getline(&longmsg[i][0], 77); + if (strlen(&longmsg[i][0])==0) i=5; + } snprintf(buf, sizeof buf, "SEXP %s|-", touser); serv_puts(buf); serv_gets(buf); if (buf[0]=='4') { strcpy(last_paged, touser); - rewind(fp); - while (fgets(buf, sizeof buf, fp) != NULL) { - buf[strlen(buf)-1] = 0; - if (strcmp(buf, "000")) serv_puts(buf); - unlink(temp); - } + for (i=0; i<5; ++i) + if (strlen(&longmsg[i][0])>0) + serv_puts(&longmsg[i][0]); serv_puts("000"); printf("Message sent.\n"); } else { printf("%s\n", &buf[4]); } - fclose(fp); } } diff --git a/citadel/room_ops.c b/citadel/room_ops.c index e333edb23..b48f8244e 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -998,9 +998,11 @@ void cmd_setr(char *args) { } } - new_order = extract_int(args, 6); - if (new_order < 1) new_order = 1; - if (new_order > 127) new_order = 127; + if (num_parms(args)>=7) { + new_order = extract_int(args, 6); + if (new_order < 1) new_order = 1; + if (new_order > 127) new_order = 127; + } lgetroom(&CC->quickroom, CC->quickroom.QRname); strcpy(old_name, CC->quickroom.QRname); @@ -1011,7 +1013,8 @@ void cmd_setr(char *args) { extract(buf,args,2); buf[15]=0; strncpy(CC->quickroom.QRdirname,buf,19); CC->quickroom.QRflags = ( extract_int(args,3) | QR_INUSE); - CC->quickroom.QRorder = (char)new_order; + if (num_parms(args)>=7) + CC->quickroom.QRorder = (char)new_order; /* Clean up a client boo-boo: if the client set the room to * guess-name or passworded, ensure that the private flag is -- 2.39.2