From: Art Cancro Date: Tue, 27 Apr 2021 22:31:55 +0000 (-0400) Subject: Save the text client! X-Git-Tag: v939~64 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=e0258a233ad97497b9bfa27442549e12cd84a36b Save the text client! --- diff --git a/textclient/citadel.c b/textclient/citadel.c index e5017fd95..bb165dd8e 100644 --- a/textclient/citadel.c +++ b/textclient/citadel.c @@ -158,13 +158,12 @@ void formout(CtdlIPC * ipc, char *name) } -void userlist(CtdlIPC * ipc, char *patn) -{ +void userlist(CtdlIPC * ipc, char *patn) { char buf[SIZ]; char fl[SIZ]; struct tm tmbuf; time_t lc; - int r; /* IPC response code */ + int r; // IPC response code char *listing = NULL; r = CtdlIPCUserListing(ipc, patn, &listing, buf); @@ -201,8 +200,7 @@ void userlist(CtdlIPC * ipc, char *patn) /* * grab assorted info about the user... */ -void load_user_info(char *params) -{ +void load_user_info(char *params) { extract_token(fullname, params, 0, '|', sizeof fullname); axlevel = extract_int(params, 1); timescalled = extract_int(params, 2); @@ -218,8 +216,7 @@ void load_user_info(char *params) * 'roomname' is set to _FLOOR_, in which case all rooms on the requested * floor will be removed from the march list. */ -void remove_march(char *roomname, int floornum) -{ +void remove_march(char *roomname, int floornum) { struct march *mptr, *mptr2; if (marchptr == NULL) @@ -242,7 +239,8 @@ void remove_march(char *roomname, int floornum) mptr2->next = mptr->next; free(mptr); mptr = mptr2; - } else { + } + else { mptr2 = mptr; } } @@ -382,20 +380,18 @@ void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) from_floor = curr_floor; curr_floor = room->RRfloor; - /* Determine, based on the room's default view, whether an nter message - * command will be valid here. - */ + // Determine, based on the room's default view, whether an nter message command will be valid here. switch (room->RRdefaultview) { - case VIEW_BBS: - case VIEW_MAILBOX: - entmsg_ok = ENTMSG_OK_YES; - break; - case VIEW_BLOG: - entmsg_ok = ENTMSG_OK_BLOG; - break; - default: - entmsg_ok = ENTMSG_OK_NO; - break; + case VIEW_BBS: + case VIEW_MAILBOX: + entmsg_ok = ENTMSG_OK_YES; + break; + case VIEW_BLOG: + entmsg_ok = ENTMSG_OK_BLOG; + break; + default: + entmsg_ok = ENTMSG_OK_NO; + break; } remove_march(room_name, 0); @@ -440,7 +436,8 @@ void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) color(BRIGHT_RED); if (newmailcount == 1) { scr_printf("*** A new mail message has arrived.\n"); - } else { + } + else { scr_printf("*** %d new mail messages have arrived.\n", newmailcount); } color(DIM_WHITE); @@ -458,13 +455,13 @@ void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) ipc->ServInfo.humannode, ipc->ServInfo.site_location, room_name, newmailcount); } + /* Goto next room having unread messages. * We want to skip over rooms that the user has already been to, and take the * user back to the lobby when done. The room we end up in is placed in * newroom - which is set to 0 (the lobby) initially. */ -void gotonext(CtdlIPC * ipc) -{ +void gotonext(CtdlIPC * ipc) { char buf[SIZ]; struct march *mptr, *mptr2; char next_room[ROOMNAMELEN]; @@ -475,9 +472,8 @@ void gotonext(CtdlIPC * ipc) if (marchptr == NULL) { CtdlIPCKnownRooms(ipc, SubscribedRoomsWithNewMessages, AllFloors, &marchptr, 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 - */ + // 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. mptr = (struct march *) malloc(sizeof(struct march)); mptr->next = NULL; mptr->march_order = 0; @@ -491,26 +487,25 @@ void gotonext(CtdlIPC * ipc) mptr2 = mptr2->next; mptr2->next = mptr; } -/* - * ...and remove the room we're currently in, so a oto doesn't make us - * walk around in circles - */ + + // ...and remove the room we're currently in, so a oto doesn't make us walk around in circles remove_march(room_name, 0); } if (marchptr != NULL) { strcpy(next_room, pop_march(curr_floor, marchptr)); - } else { + } + else { strcpy(next_room, "_BASEROOM_"); } remove_march(next_room, 0); dotgoto(ipc, next_room, 1, 0); } + /* * forget all rooms on a given floor */ -void forget_all_rooms_on(CtdlIPC * ipc, int ffloor) -{ +void forget_all_rooms_on(CtdlIPC *ipc, int ffloor) { char buf[SIZ]; struct march *flist = NULL; struct march *fptr = NULL; @@ -651,6 +646,7 @@ void gotofloor(CtdlIPC * ipc, char *towhere, int mode) } } + /* * Indexing mechanism for a room list, called by gotoroomstep() */ @@ -769,14 +765,17 @@ void gotoroomstep(CtdlIPC * ipc, int direction, int mode) /* If we're at the first room, wrap to the last room */ if (rmslot == 0) { rmslot = rmtotal - 1; - } else { + } + else { rmslot--; } - } else { /* Next room */ + } + else { /* Next room */ /* If we're at the last room, wrap to the first room */ if (rmslot == rmtotal - 1) { rmslot = 0; - } else { + } + else { rmslot++; } } @@ -806,8 +805,7 @@ void gotoroomstep(CtdlIPC * ipc, int direction, int mode) /* * step through floors on system */ -void gotofloorstep(CtdlIPC * ipc, int direction, int mode) -{ +void gotofloorstep(CtdlIPC * ipc, int direction, int mode) { int tofloor; if (floorlist[0][0] == 0) @@ -846,6 +844,7 @@ void gotofloorstep(CtdlIPC * ipc, int direction, int mode) } } + /* * Display user 'preferences'. */ @@ -946,6 +945,7 @@ void read_config(CtdlIPC * ipc) free(user); } + /* * Display system statistics. */ @@ -986,6 +986,7 @@ void system_info(CtdlIPC * ipc) scr_printf("Your system administrator is %s.\n", ipc->ServInfo.sysadm); } + /* * forget all rooms on current floor */ @@ -1060,7 +1061,6 @@ int set_password(CtdlIPC * ipc) } - /* * get info about the server we've connected to */ @@ -1100,7 +1100,6 @@ void get_serv_info(CtdlIPC * ipc, char *supplied_hostname) } - /* * Session username compare function for SortOnlineUsers() */ @@ -1204,7 +1203,6 @@ char *SortOnlineUsers(char *listing, int condense) } - /* * Display list of users currently logged on to the server */ @@ -1290,11 +1288,13 @@ void who_is_online(CtdlIPC * ipc, int longlist) } scr_printf("\n"); - } else { + } + else { if (isidle == 0) { if (extract_int(buf, 0) == last_session) { scr_printf(" "); - } else { + } + else { color(BRIGHT_MAGENTA); scr_printf("%-3s", flags); } @@ -1312,16 +1312,20 @@ void who_is_online(CtdlIPC * ipc, int longlist) if (idlehours > 23999) { scr_printf("fish"); /* over 10 days */ - } else if (idlehours > 239) { + } + else if (idlehours > 239) { scr_printf("%3ldd", idlehours / 24); /* over 10 hours */ - } else if (idlehours > 9) { + } + else if (idlehours > 9) { scr_printf("%1ldd%02ld", idlehours / 24, idlehours % 24); /* less than 10 hours */ - } else { + } + else { scr_printf("%1ld:%02ld", idlehours, idlemins); } - } else { + } + else { scr_printf(" "); } scr_printf(" "); @@ -1338,6 +1342,7 @@ void who_is_online(CtdlIPC * ipc, int longlist) free(listing); } + void enternew(CtdlIPC * ipc, char *desc, char *buf, int maxlen) { char bbb[128]; @@ -1346,9 +1351,7 @@ void enternew(CtdlIPC * ipc, char *desc, char *buf, int maxlen) } - -int shift(int argc, char **argv, int start, int count) -{ +int shift(int argc, char **argv, int start, int count) { int i; for (i = start; i < (argc - count); ++i) { @@ -1358,16 +1361,16 @@ int shift(int argc, char **argv, int start, int count) return argc; } -static void statusHook(char *s) -{ + +static void statusHook(char *s) { scr_printf(s); } + /* * main */ -int main(int argc, char **argv) -{ +int main(int argc, char **argv) { int a, b, mcmd; char aaa[100], bbb[100]; /* general purpose variables */ char argbuf[64]; /* command line buf */ @@ -1416,10 +1419,7 @@ int main(int argc, char **argv) arg_encrypt = RC_DEFAULT; #endif - /* - * Handle command line options as if we were called like /bin/login - * (i.e. from in.telnetd) - */ + // Handle command line options as if we were called like /bin/login (i.e. from in.telnetd) for (a = 0; a < argc; ++a) { if ((argc > a + 1) && (!strcmp(argv[a], "-h"))) { telnet_client_host = argv[a + 1]; @@ -1452,11 +1452,6 @@ int main(int argc, char **argv) */ check_screen_dims(); - -#ifdef __CYGWIN__ - newprompt("Connect to (return for local server): ", hostbuf, 64); -#endif - scr_printf("Attaching to server...\n"); ipc = CtdlIPC_new(argc, argv, hostbuf, portbuf); if (!ipc) { diff --git a/textclient/md5.c b/textclient/md5.c index 825556b05..2db76db28 100644 --- a/textclient/md5.c +++ b/textclient/md5.c @@ -1,19 +1,17 @@ -/* - * This code implements the MD5 message-digest algorithm. - * The algorithm is due to Ron Rivest. This code was - * written by Colin Plumb in 1993, no copyright is claimed. - * This code is in the public domain; do with it what you wish. - * - * Equivalent code is available from RSA Data Security, Inc. - * This code has been tested against that, and is equivalent, - * except that you don't need to include two pages of legalese - * with every copy. - * - * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which - * will fill a supplied 16-byte array with the digest. - */ +// This code implements the MD5 message-digest algorithm. +// The algorithm is due to Ron Rivest. This code was +// written by Colin Plumb in 1993, no copyright is claimed. +// This code is in the public domain; do with it what you wish. +// +// Equivalent code is available from RSA Data Security, Inc. +// This code has been tested against that, and is equivalent, +// except that you don't need to include two pages of legalese +// with every copy. +// +// To compute the message digest of a chunk of bytes, declare an +// MD5Context structure, pass it to MD5Init, call MD5Update as +// needed on buffers full of bytes, and then call MD5Final, which +// will fill a supplied 16-byte array with the digest. #include "textclient.h" diff --git a/textclient/messages.c b/textclient/messages.c index 31ca9011f..3fc717300 100644 --- a/textclient/messages.c +++ b/textclient/messages.c @@ -137,7 +137,6 @@ void add_newline(struct cittext *textlist) while (ptr->text[strlen(ptr->text) - 1] == 32) ptr->text[strlen(ptr->text) - 1] = 0; - /* strcat(ptr->text,"\n"); */ ptr->next = (struct cittext *) malloc(sizeof(struct cittext)); @@ -551,7 +550,8 @@ int read_message(CtdlIPC *ipc, if (dest) { fprintf(dest, "\n"); - } else { + } + else { scr_printf("\n"); } @@ -560,7 +560,8 @@ int read_message(CtdlIPC *ipc, if ((message->email != NULL) && (!IsEmptyStr(message->email))) { if (!IsEmptyStr(message->author)) { snprintf(reply_to, sizeof reply_to, "%s <%s>", message->author, message->email); - } else { + } + else { safestrncpy(reply_to, message->email, sizeof reply_to); } } @@ -575,10 +576,11 @@ int read_message(CtdlIPC *ipc, safestrncpy(reply_inreplyto, message->msgid, sizeof reply_inreplyto); } - if (message->references != NULL) + if (message->references != NULL) { if (!IsEmptyStr(message->references)) { safestrncpy(reply_references, message->references, sizeof reply_references); } + } if (message->subject != NULL) { safestrncpy(reply_subject, message->subject, sizeof reply_subject); @@ -657,7 +659,8 @@ int read_message(CtdlIPC *ipc, */ if (format_type == 0) { fr = fmout(screenwidth, NULL, message->text, dest, 1); - } else { + } + else { /* renderer for text/plain */ lineptr = message->text; @@ -1083,7 +1086,8 @@ int entmsg(CtdlIPC * ipc, int is_reply, /* nonzero if this was a eply command if (c > 0) { mode = 1; - } else { + } + else { mode = 0; } diff --git a/textclient/routines2.c b/textclient/routines2.c index 5105ee082..bca697cd2 100644 --- a/textclient/routines2.c +++ b/textclient/routines2.c @@ -12,7 +12,7 @@ #include "textclient.h" -/* work around solaris include files */ +// work around solaris include files #ifdef reg #undef reg #endif @@ -26,24 +26,19 @@ extern unsigned room_flags; extern int screenwidth; -/* - * return proper room prompt character - */ -int room_prompt(unsigned int qrflags) -{ +// return proper room prompt character +int room_prompt(unsigned int qrflags) { int a; a = '>'; - if (qrflags & QR_DIRECTORY) + if (qrflags & QR_DIRECTORY) { a = ']'; + } return (a); } -/* - * Register with name and address - */ -void entregis(CtdlIPC * ipc) -{ +// Register with name and address +void entregis(CtdlIPC * ipc) { char buf[SIZ]; char tmpname[30]; @@ -236,7 +231,8 @@ void cli_image_upload(CtdlIPC * ipc, char *keyname) r = CtdlIPCImageUpload(ipc, 1, flnm, keyname, progress, buf); if (r / 100 == 5) { scr_printf("%s\n", buf); - } else if (r < 0) { + } + else if (r < 0) { scr_printf("Cannot upload '%s': %s\n", flnm, strerror(errno)); } /* else upload succeeded */ @@ -317,10 +313,10 @@ void upload(CtdlIPC * ipc, int c) execlp("rz", "rz", NULL); exit(1); } - } else - do { - b = ka_wait(&a); - } while ((b != xfer_pid) && (b != (-1))); + } + else do { + b = ka_wait(&a); + } while ((b != xfer_pid) && (b != (-1))); stty_ctdl(0); if (a != 0) { @@ -345,6 +341,7 @@ void upload(CtdlIPC * ipc, int c) nukedir(tempdir); } + /* * validate a user (returns 0 for successful validation, nonzero if quitting) */ @@ -453,6 +450,7 @@ void validate(CtdlIPC * ipc) } while (finished == 0); } + void subshell(void) { int a, b; @@ -537,11 +535,8 @@ void list_bio(CtdlIPC * ipc) } -/* - * read bio - */ -void read_bio(CtdlIPC * ipc) -{ +// read bio +void read_bio(CtdlIPC * ipc) { char who[256]; char buf[256]; char *resp = NULL; diff --git a/textclient/textclient.h b/textclient/textclient.h index 169f6935d..51be11247 100644 --- a/textclient/textclient.h +++ b/textclient/textclient.h @@ -14,7 +14,7 @@ #define CLIENT_VERSION 926 #define CLIENT_TYPE 0 -/* commands we can send to the stty_ctdl() routine */ +// commands we can send to the stty_ctdl() routine #define SB_NO_INTR 0 // set to Citadel client mode, i/q disabled #define SB_YES_INTR 1 // set to Citadel client mode, i/q enabled #define SB_SAVE 2 // save settings @@ -37,31 +37,29 @@ #define NEXT_KEY 15 #define STOP_KEY 3 -/* citadel.rc stuff */ -#define RC_NO 0 /* always no */ -#define RC_YES 1 /* always yes */ -#define RC_DEFAULT 2 /* setting depends on user config */ +// citadel.rc stuff +#define RC_NO 0 // always no +#define RC_YES 1 // always yes +#define RC_DEFAULT 2 // setting depends on user config -/* keepalives */ +// keepalives enum { - KA_NO, /* no keepalives */ - KA_YES, /* full keepalives */ - KA_HALF /* half keepalives */ + KA_NO, // no keepalives + KA_YES, // full keepalives + KA_HALF // half keepalives }; -/* for <;G>oto and <;S>kip commands */ -#define GF_GOTO 0 /* <;G>oto floor mode */ -#define GF_SKIP 1 /* <;S>kip floor mode */ -#define GF_ZAP 2 /* <;Z>ap floor mode */ +// for <;G>oto and <;S>kip commands +#define GF_GOTO 0 // <;G>oto floor mode +#define GF_SKIP 1 // <;S>kip floor mode +#define GF_ZAP 2 // <;Z>ap floor mode -/* Can messages be entered in this room? */ -#define ENTMSG_OK_NO 0 /* You may not enter messages here */ -#define ENTMSG_OK_YES 1 /* Go ahead! */ -#define ENTMSG_OK_BLOG 2 /* Yes, but warn the user about how blog rooms work */ +// Can messages be entered in this room? +#define ENTMSG_OK_NO 0 // You may not enter messages here +#define ENTMSG_OK_YES 1 // Go ahead! +#define ENTMSG_OK_BLOG 2 // Yes, but warn the user about how blog rooms work -/* - * Colors for color() command - */ +// Colors for color() command #define DIM_BLACK 0 #define DIM_RED 1 #define DIM_GREEN 2 @@ -78,9 +76,9 @@ enum { #define BRIGHT_MAGENTA 13 #define BRIGHT_CYAN 14 #define BRIGHT_WHITE 15 -#define COLOR_PUSH 16 /* Save current color */ -#define COLOR_POP 17 /* Restore saved color */ -#define ORIGINAL_PAIR -1 /* Default terminal colors */ +#define COLOR_PUSH 16 // Save current color +#define COLOR_POP 17 // Restore saved color +#define ORIGINAL_PAIR -1 // Default terminal colors typedef void (*sighandler_t)(int); @@ -99,7 +97,6 @@ typedef void (*sighandler_t)(int); #include #include #include -// #include not needed if we have termios.h #include #include #include @@ -154,9 +151,7 @@ struct CtdlServInfo { }; -/* - * This class is responsible for the server connection - */ +// This class is responsible for the server connection typedef struct _CtdlIPC { struct CtdlServInfo ServInfo; /* The server info for this connection */ #if defined(HAVE_OPENSSL) @@ -212,17 +207,15 @@ extern int secure; void remove_march(char *roomname, int floornum); void calc_dirs_n_files(int relh, int home, const char *relhome, char *ctdldir, int dbg); -/* - * This struct stores a list of rooms with new messages which the client - * fetches from the server. This allows the client to "march" through - * relevant rooms without having to ask the server each time where to go next. - */ typedef struct ExpirePolicy ExpirePolicy; struct ExpirePolicy { int expire_mode; int expire_value; }; +// This struct stores a list of rooms with new messages which the client +// fetches from the server. This allows the client to "march" through +// relevant rooms without having to ask the server each time where to go next. typedef struct march march; struct march { struct march *next; @@ -390,51 +383,36 @@ int CtdlIPCLogout(CtdlIPC *ipc); int CtdlIPCTryLogin(CtdlIPC *ipc, const char *username, char *cret); int CtdlIPCTryPassword(CtdlIPC *ipc, const char *passwd, char *cret); int CtdlIPCTryApopPassword(CtdlIPC *ipc, const char *response, char *cret); -int CtdlIPCCreateUser(CtdlIPC *ipc, const char *username, int selfservice, - char *cret); +int CtdlIPCCreateUser(CtdlIPC *ipc, const char *username, int selfservice, char *cret); int CtdlIPCChangePassword(CtdlIPC *ipc, const char *passwd, char *cret); -int CtdlIPCKnownRooms(CtdlIPC *ipc, enum RoomList which, int floor, - struct march **listing, char *cret); +int CtdlIPCKnownRooms(CtdlIPC *ipc, enum RoomList which, int floor, struct march **listing, char *cret); int CtdlIPCGetConfig(CtdlIPC *ipc, struct ctdluser **uret, char *cret); int CtdlIPCSetConfig(CtdlIPC *ipc, struct ctdluser *uret, char *cret); -int CtdlIPCGotoRoom(CtdlIPC *ipc, const char *room, const char *passwd, - struct ctdlipcroom **rret, char *cret); -int CtdlIPCGetMessages(CtdlIPC *ipc, enum MessageList which, int whicharg, - const char *mtemplate, unsigned long **mret, char *cret); -int CtdlIPCGetSingleMessage(CtdlIPC *ipc, long msgnum, int headers, int as_mime, - struct ctdlipcmessage **mret, char *cret); +int CtdlIPCGotoRoom(CtdlIPC *ipc, const char *room, const char *passwd, struct ctdlipcroom **rret, char *cret); +int CtdlIPCGetMessages(CtdlIPC *ipc, enum MessageList which, int whicharg, const char *mtemplate, unsigned long **mret, char *cret); +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, 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 CtdlIPCInviteUserToRoom(CtdlIPC *ipc, const char *username, char *cret); int CtdlIPCKickoutUserFromRoom(CtdlIPC *ipc, const char *username, char *cret); int CtdlIPCGetRoomAttributes(CtdlIPC *ipc, struct ctdlroom **qret, char *cret); -int CtdlIPCSetRoomAttributes(CtdlIPC *ipc, int forget, struct ctdlroom *qret, - char *cret); +int CtdlIPCSetRoomAttributes(CtdlIPC *ipc, int forget, struct ctdlroom *qret, char *cret); int CtdlIPCGetRoomAide(CtdlIPC *ipc, char *cret); int CtdlIPCSetRoomAide(CtdlIPC *ipc, const char *username, char *cret); -int CtdlIPCPostMessage(CtdlIPC *ipc, int flag, int *subject_required, - struct ctdlipcmessage *mr, - char *cret); +int CtdlIPCPostMessage(CtdlIPC *ipc, int flag, int *subject_required, struct ctdlipcmessage *mr, char *cret); int CtdlIPCRoomInfo(CtdlIPC *ipc, char **iret, char *cret); int CtdlIPCDeleteMessage(CtdlIPC *ipc, long msgnum, char *cret); -int CtdlIPCMoveMessage(CtdlIPC *ipc, int copy, long msgnum, - const char *destroom, char *cret); +int CtdlIPCMoveMessage(CtdlIPC *ipc, int copy, long msgnum, const char *destroom, char *cret); int CtdlIPCDeleteRoom(CtdlIPC *ipc, int for_real, char *cret); -int CtdlIPCCreateRoom(CtdlIPC *ipc, int for_real, const char *roomname, - int type, const char *password, int floor, char *cret); +int CtdlIPCCreateRoom(CtdlIPC *ipc, int for_real, const char *roomname, int type, const char *password, int floor, char *cret); int CtdlIPCForgetRoom(CtdlIPC *ipc, char *cret); -int CtdlIPCSystemMessage(CtdlIPC *ipc, const char *message, char **mret, - char *cret); +int CtdlIPCSystemMessage(CtdlIPC *ipc, const char *message, char **mret, char *cret); int CtdlIPCNextUnvalidatedUser(CtdlIPC *ipc, char *cret); -int CtdlIPCGetUserRegistration(CtdlIPC *ipc, const char *username, char **rret, - char *cret); -int CtdlIPCValidateUser(CtdlIPC *ipc, const char *username, int axlevel, - char *cret); -int CtdlIPCSetRoomInfo(CtdlIPC *ipc, int for_real, const char *info, - char *cret); +int CtdlIPCGetUserRegistration(CtdlIPC *ipc, const char *username, char **rret, char *cret); +int CtdlIPCValidateUser(CtdlIPC *ipc, const char *username, int axlevel, char *cret); +int CtdlIPCSetRoomInfo(CtdlIPC *ipc, int for_real, const char *info, char *cret); int CtdlIPCUserListing(CtdlIPC *ipc, char *searchstring, char **list, char *cret); int CtdlIPCSetRegistration(CtdlIPC *ipc, const char *info, char *cret); int CtdlIPCMiscCheck(CtdlIPC *ipc, struct ctdlipcmisc *chek, char *cret); @@ -442,33 +420,17 @@ int CtdlIPCDeleteFile(CtdlIPC *ipc, const char *filename, char *cret); int CtdlIPCMoveFile(CtdlIPC *ipc, const char *filename, const char *destroom, char *cret); int CtdlIPCNetSendFile(CtdlIPC *ipc, const char *filename, const char *destnode, 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)(CtdlIPC*, unsigned long, unsigned long), - char *cret); -int CtdlIPCAttachmentDownload(CtdlIPC *ipc, long msgnum, const char *part, - void **buf, - void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long), - char *cret); -int CtdlIPCImageDownload(CtdlIPC *ipc, const char *filename, void **buf, - 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)(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)(CtdlIPC*, unsigned long, unsigned long), - char *cret); +int CtdlIPCFileDownload(CtdlIPC *ipc, const char *filename, void **buf, size_t resume, 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)(CtdlIPC*, unsigned long, unsigned long), char *cret); +int CtdlIPCImageDownload(CtdlIPC *ipc, const char *filename, void **buf, 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)(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)(CtdlIPC*, unsigned long, unsigned long), char *cret); int CtdlIPCQueryUsername(CtdlIPC *ipc, const char *username, char *cret); int CtdlIPCFloorListing(CtdlIPC *ipc, char **listing, char *cret); int CtdlIPCCreateFloor(CtdlIPC *ipc, int for_real, const char *name, char *cret); int CtdlIPCDeleteFloor(CtdlIPC *ipc, int for_real, int floornum, char *cret); int CtdlIPCEditFloor(CtdlIPC *ipc, int floornum, const char *floorname, char *cret); -int CtdlIPCIdentifySoftware(CtdlIPC *ipc, int developerid, int clientid, - int revision, const char *software_name, const char *hostname, - char *cret); +int CtdlIPCIdentifySoftware(CtdlIPC *ipc, int developerid, int clientid, int revision, const char *software_name, const char *hostname, char *cret); int CtdlIPCSendInstantMessage(CtdlIPC *ipc, const char *username, const char *text, char *cret); int CtdlIPCGetInstantMessage(CtdlIPC *ipc, char **listing, char *cret); int CtdlIPCEnableInstantMessageReceipt(CtdlIPC *ipc, int mode, char *cret); @@ -509,26 +471,16 @@ char *CtdlIPCReadListing(CtdlIPC *ipc, char *dest); int CtdlIPCSendListing(CtdlIPC *ipc, const char *listing); size_t CtdlIPCPartialRead(CtdlIPC *ipc, void **buf, size_t offset, size_t bytes, char *cret); int CtdlIPCEndUpload(CtdlIPC *ipc, int discard, char *cret); -int CtdlIPCWriteUpload(CtdlIPC *ipc, FILE *uploadFP, - void (*progress_gauge_callback)(CtdlIPC*, unsigned long, unsigned long), - char *cret); +int CtdlIPCWriteUpload(CtdlIPC *ipc, FILE *uploadFP, 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)(CtdlIPC*, unsigned long, unsigned long), - char *cret); -int CtdlIPCHighSpeedReadDownload(CtdlIPC *ipc, void **buf, size_t bytes, - size_t resume, - 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, - size_t *bytes_to_receive, char *proto_response); +int CtdlIPCReadDownload(CtdlIPC *ipc, void **buf, size_t bytes, size_t resume, 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)(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, size_t *bytes_to_receive, char *proto_response); /* Internals */ int starttls(CtdlIPC *ipc); void setCryptoStatusHook(void (*hook)(char *s)); void CtdlIPC_SetNetworkStatusCallback(CtdlIPC *ipc, void (*hook)(int state)); -/* This is all Ford's doing. FIXME: figure out what it's doing */ extern int (*error_printf)(char *s, ...); void setIPCDeathHook(void (*hook)(void)); void setIPCErrorPrintf(int (*func)(char *s, ...)); @@ -545,21 +497,9 @@ void stealth_mode(CtdlIPC *ipc); extern char last_paged[]; void determine_pwfilename(char *pwfile, size_t n); -void get_stored_password( - char *host, - char *port, - char *username, - char *password); -void set_stored_password( - char *host, - char *port, - char *username, - char *password); -void offer_to_remember_password(CtdlIPC *ipc, - char *host, - char *port, - char *username, - char *password); +void get_stored_password( char *host, char *port, char *username, char *password); +void set_stored_password( char *host, char *port, char *username, char *password); +void offer_to_remember_password(CtdlIPC *ipc, char *host, char *port, char *username, char *password); void load_command_set(void); void stty_ctdl(int cmd); @@ -609,8 +549,7 @@ struct MD5Context { }; void MD5Init(struct MD5Context *context); -void MD5Update(struct MD5Context *context, unsigned char const *buf, - unsigned len); +void MD5Update(struct MD5Context *context, unsigned char const *buf, unsigned len); void MD5Final(unsigned char digest[16], struct MD5Context *context); void MD5Transform(uint32_t buf[4], uint32_t const in[16]); char *make_apop_string(char *realpass, char *nonce, char *buffer, size_t n); @@ -628,7 +567,7 @@ typedef struct MD5Context MD5_CTX; #endif /* !MD5_H */ -#define MAXURLS 50 /* Max embedded URL's per message */ +#define MAXURLS 50 // Max embedded URL's per message (oooh, can we use our elastic array class here?) extern int num_urls; extern char urls[MAXURLS][SIZ];