/*
* here is our 'clean up gracefully and exit' routine
*/
-void ctdl_logoff(char *file, int line, CtdlIPC * ipc, int code)
-{
+void ctdl_logoff(char *file, int line, CtdlIPC * ipc, int code) {
int lp;
if (editor_pid > 0) { /* kill the editor if it's running */
/*
* signal catching function for hangups...
*/
-void dropcarr(int signum)
-{
+void dropcarr(int signum) {
logoff(NULL, 3); /* No IPC when server's already gone! */
}
* catch SIGCONT to reset terminal modes when were are put back into the
* foreground.
*/
-void catch_sigcont(int signum)
-{
+void catch_sigcont(int signum) {
stty_ctdl(SB_LAST);
signal(SIGCONT, catch_sigcont);
}
/* general purpose routines */
/* display a file */
-void formout(CtdlIPC * ipc, char *name)
-{
+void formout(CtdlIPC * ipc, char *name) {
int r; /* IPC return code */
char buf[SIZ];
char *text = NULL;
* Locate the room on the march list which we most want to go to. Each room
* is measured given a "weight" of preference based on various factors.
*/
-char *pop_march(int desired_floor, struct march *_march)
-{
+char *pop_march(int desired_floor, struct march *_march) {
static char TheRoom[ROOMNAMELEN];
int TheWeight = 0;
int weight;
/*
* jump directly to a room
*/
-void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto)
-{
+void dotgoto(CtdlIPC * ipc, char *towhere, int display_name, int fromungoto) {
char aaa[SIZ], bbb[SIZ];
static long ls = 0L;
int newmailcount = 0;
uglistlsn[lp] = uglistlsn[lp + 1];
}
ugpos--;
- } else {
+ }
+ else {
uglistsize++;
}
// Determine, based on the room's default view, whether an <E>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);
strcpy(mptr->march_name, "_BASEROOM_");
if (marchptr == NULL) {
marchptr = mptr;
- } else {
+ }
+ else {
mptr2 = marchptr;
while (mptr2->next != NULL)
mptr2 = mptr2->next;
/*
* 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;
/*
* routine called by gotofloor() to move to a new room on a new floor
*/
-void gf_toroom(CtdlIPC * ipc, char *towhere, int mode)
-{
+void gf_toroom(CtdlIPC * ipc, char *towhere, int mode) {
int floor_being_left;
floor_being_left = curr_floor;
if (mode == GF_GOTO) { /* <;G>oto mode */
updatels(ipc);
dotgoto(ipc, towhere, 1, 0);
- } else if (mode == GF_SKIP) { /* <;S>kip mode */
+ }
+ else if (mode == GF_SKIP) { /* <;S>kip mode */
dotgoto(ipc, towhere, 1, 0);
remove_march("_FLOOR_", floor_being_left);
- } else if (mode == GF_ZAP) { /* <;Z>ap mode */
+ }
+ else if (mode == GF_ZAP) { /* <;Z>ap mode */
dotgoto(ipc, towhere, 1, 0);
remove_march("_FLOOR_", floor_being_left);
forget_all_rooms_on(ipc, floor_being_left);
/*
* go to a new floor
*/
-void gotofloor(CtdlIPC * ipc, char *towhere, int mode)
-{
+void gotofloor(CtdlIPC * ipc, char *towhere, int mode) {
int a, tofloor;
int r; /* IPC response code */
struct march *mptr;
}
if (!IsEmptyStr(targ)) {
gf_toroom(ipc, targ, mode);
- } else {
+ }
+ else {
scr_printf("There are no rooms on '%s'.\n", &floorlist[tofloor][0]);
}
}
/*
* Indexing mechanism for a room list, called by gotoroomstep()
*/
-void room_tree_list_query(struct ctdlroomlisting *rp, char *findrmname, int findrmslot, char *rmname, int *rmslot, int *rmtotal)
-{
+void room_tree_list_query(struct ctdlroomlisting *rp, char *findrmname, int findrmslot, char *rmname, int *rmslot, int *rmtotal) {
char roomname[ROOMNAMELEN];
static int cur_rmslot = 0;
/*
* step through rooms on current floor
*/
-void gotoroomstep(CtdlIPC * ipc, int direction, int mode)
-{
+void gotoroomstep(CtdlIPC * ipc, int direction, int mode) {
struct march *listing = NULL;
struct march *mptr;
int r; /* IPC response code */
rs = rl;
if (rl == NULL) {
rl = rp;
- } else {
+ }
+ else {
while (rp != NULL) {
if (rordercmp(rp, rs) < 0) {
if (rs->lnext == NULL) {
rs->lnext = rp;
rp = NULL;
- } else {
+ }
+ else {
rs = rs->lnext;
}
- } else {
+ }
+ else {
if (rs->rnext == NULL) {
rs->rnext = rp;
rp = NULL;
- } else {
+ }
+ else {
rs = rs->rnext;
}
}
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;
while (!floorlist[tofloor][0])
tofloor--;
- } else { /* Next floor */
+ }
+ else { /* Next floor */
if (curr_floor < 127)
tofloor = curr_floor + 1;
else
* Display user 'preferences'.
*/
extern int rc_prompt_control;
-void read_config(CtdlIPC * ipc)
-{
+void read_config(CtdlIPC * ipc) {
char buf[SIZ];
char *resp = NULL;
int r; /* IPC response code */
/*
* Display system statistics.
*/
-void system_info(CtdlIPC * ipc)
-{
+void system_info(CtdlIPC * ipc) {
char buf[SIZ];
char *resp = NULL;
size_t bytes;
/*
* forget all rooms on current floor
*/
-void forget_this_floor(CtdlIPC * ipc)
-{
+void forget_this_floor(CtdlIPC * ipc) {
if (curr_floor == 0) {
scr_printf("Can't forget this floor.\n");
return;
/*
* set floor mode depending on client, server, and user settings
*/
-void set_floor_mode(CtdlIPC * ipc)
-{
+void set_floor_mode(CtdlIPC * ipc) {
if (ipc->ServInfo.ok_floors == 0) {
floor_mode = 0; /* Don't use floors if the server */
}
/*
* Set or change the user's password
*/
-int set_password(CtdlIPC * ipc)
-{
+int set_password(CtdlIPC * ipc) {
char pass1[20];
char pass2[20];
char buf[SIZ];
if (!IsEmptyStr(rc_password)) {
strcpy(pass1, rc_password);
strcpy(pass2, rc_password);
- } else {
+ }
+ else {
IFNEXPERT formout(ipc, "changepw");
newprompt("Enter a new password: ", pass1, -19);
newprompt("Enter it again to confirm: ", pass2, -19);
scr_printf("%s\n", buf);
offer_to_remember_password(ipc, hostbuf, portbuf, fullname, pass1);
return (0);
- } else {
+ }
+ else {
scr_printf("*** They don't match... try again.\n");
return (1);
}
/*
* get info about the server we've connected to
*/
-void get_serv_info(CtdlIPC * ipc, char *supplied_hostname)
-{
+void get_serv_info(CtdlIPC * ipc, char *supplied_hostname) {
char buf[SIZ];
CtdlIPCServerInfo(ipc, buf);
/*
* Session username compare function for SortOnlineUsers()
*/
-int rwho_username_cmp(const void *rec1, const void *rec2)
-{
+int rwho_username_cmp(const void *rec1, const void *rec2) {
char *u1, *u2;
u1 = strchr(rec1, '|');
/*
* Idle time compare function for SortOnlineUsers()
*/
-int idlecmp(const void *rec1, const void *rec2)
-{
+int idlecmp(const void *rec1, const void *rec2) {
time_t i1, i2;
i1 = extract_long(rec1, 5);
* If 'condense' is nonzero, multiple sessions for the same user will be
* combined into one for brevity.
*/
-char *SortOnlineUsers(char *listing, int condense)
-{
+char *SortOnlineUsers(char *listing, int condense) {
int rows;
char *sortbuf;
char *retbuf;
/*
* Display list of users currently logged on to the server
*/
-void who_is_online(CtdlIPC * ipc, int longlist)
-{
+void who_is_online(CtdlIPC * ipc, int longlist) {
char buf[SIZ], username[SIZ], roomname[SIZ], fromhost[SIZ];
char flags[SIZ];
char actual_user[SIZ], actual_room[SIZ], actual_host[SIZ];
}
-void enternew(CtdlIPC * ipc, char *desc, char *buf, int maxlen)
-{
+void enternew(CtdlIPC * ipc, char *desc, char *buf, int maxlen) {
char bbb[128];
snprintf(bbb, sizeof bbb, "Enter in your new %s: ", desc);
newprompt(bbb, buf, maxlen);
do {
if (!IsEmptyStr(rc_username)) {
strcpy(fullname, rc_username);
- } else {
+ }
+ else {
newprompt("Enter your name: ", fullname, 29);
}
strproc(fullname);
/* password authentication */
if (!IsEmptyStr(rc_password)) {
strcpy(password, rc_password);
- } else {
+ }
+ else {
newprompt("\rPlease enter your password: ", password, -(SIZ - 1));
}
if (atoi(aaa)) {
scr_printf
("The Citadel server will terminate when all users are logged off.\n");
- } else {
+ }
+ else {
scr_printf("The Citadel server will not terminate.\n");
}
}
#define INADDR_NONE 0xffffffff
#endif
-static void (*status_hook) (char *s) = NULL;
+static void (*status_hook)(char *s) = NULL;
char ctdl_autoetc_dir[PATH_MAX] = "";
char file_citadel_rc[PATH_MAX] = "";
char ctdl_run_dir[PATH_MAX] = "";
DBG_PRINT(file_citadel_rc);
}
-void setCryptoStatusHook(void (*hook) (char *s)) {
+void setCryptoStatusHook(void (*hook)(char *s)) {
status_hook = hook;
}
-void CtdlIPC_SetNetworkStatusCallback(CtdlIPC * ipc, void (*hook) (int state)) {
+void CtdlIPC_SetNetworkStatusCallback(CtdlIPC * ipc, void (*hook)(int state)) {
ipc->network_status_cb = hook;
}
/* LKRN */
+
/* Caller must free the march list */
+
/* Room types are defined in enum RoomList; keep these in sync! */
+
/* floor is -1 for all, or floornum */
int CtdlIPCKnownRooms(CtdlIPC * ipc, enum RoomList which, int floor, struct march **listing, char *cret) {
int ret;
/* GETU */
+
/* Caller must free the struct ctdluser; caller may pass an existing one */
int CtdlIPCGetConfig(CtdlIPC * ipc, struct ctdluser **uret, char *cret) {
int ret;
return -1;
}
sprintf(aaa, "GOTO %s|%s", room, passwd);
- } else {
+ }
+ else {
aaa = (char *) malloc(strlen(room) + 6);
if (!aaa) {
free(*rret);
rret[0]->RRdefaultview = extract_int(cret, 12);
/* position 13 is a trash folder flag ... irrelevant in this client */
rret[0]->RRflags2 = extract_int(cret, 14);
- } else {
+ }
+ else {
free(*rret);
*rret = NULL;
}
/* MSGS */
+
/* which is 0 = all, 1 = old, 2 = new, 3 = last, 4 = first, 5 = gt, 6 = lt */
+
/* whicharg is number of messages, applies to last, first, gt, lt */
-int CtdlIPCGetMessages(CtdlIPC * ipc, enum MessageList which, int whicharg, const char *mtemplate, unsigned long **mret, char *cret)
-{
+int CtdlIPCGetMessages(CtdlIPC * ipc, enum MessageList which, int whicharg, const char *mtemplate, unsigned long **mret, char *cret) {
int ret;
unsigned long count = 0;
static char *proto[] = { "ALL", "OLD", "NEW", "LAST", "FIRST", "GT", "LT" };
if (*mret) {
(*mret)[count++] = atol(aaa);
(*mret)[count] = 0L;
- } else {
+ }
+ else {
break;
}
}
/* MSG0, MSG2 */
-int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime, struct ctdlipcmessage **mret, char *cret)
-{
+int CtdlIPCGetSingleMessage(CtdlIPC * ipc, long msgnum, int headers, int as_mime, struct ctdlipcmessage **mret, char *cret) {
int ret;
char aaa[SIZ];
char *bbb = NULL;
if (!strcasecmp(multipart_prefix, "multipart/alternative")) {
++multipart_hunting;
}
- } else if (!strncasecmp(aaa, "suff=", 5)) {
+ }
+ else if (!strncasecmp(aaa, "suff=", 5)) {
extract_token(multipart_prefix, &aaa[5], 1, '|', sizeof multipart_prefix);
if (!strcasecmp(multipart_prefix, "multipart/alternative")) {
++multipart_hunting;
ccc = malloc(strlen(bbb) + 32768);
if (!strcasecmp(encoding, "base64")) {
bytes_decoded = CtdlDecodeBase64(ccc, bbb, strlen(bbb));
- } else if (!strcasecmp(encoding, "quoted-printable")) {
+ }
+ else if (!strcasecmp(encoding, "quoted-printable")) {
bytes_decoded = CtdlDecodeQuotedPrintable(ccc, bbb, strlen(bbb));
}
ccc[bytes_decoded] = 0;
/* FIXME: Strip trailing whitespace */
bbb = (char *) realloc(bbb, (size_t) (strlen(bbb) + 1));
- } else {
+ }
+ else {
bbb = (char *) realloc(bbb, 1);
*bbb = '\0';
}
/* WHOK */
-int CtdlIPCWhoKnowsRoom(CtdlIPC * ipc, char **listing, char *cret)
-{
+int CtdlIPCWhoKnowsRoom(CtdlIPC * ipc, char **listing, char *cret) {
int ret;
size_t bytes;
/* INFO */
-int CtdlIPCServerInfo(CtdlIPC * ipc, char *cret)
-{
+int CtdlIPCServerInfo(CtdlIPC * ipc, char *cret) {
int ret;
size_t bytes;
char *listing = NULL;
/* RDIR */
-int CtdlIPCReadDirectory(CtdlIPC * ipc, char **listing, char *cret)
-{
+int CtdlIPCReadDirectory(CtdlIPC * ipc, char **listing, char *cret) {
int ret;
size_t bytes;
/*
* Set last-read pointer in this room to msgnum, or 0 for HIGHEST.
*/
-int CtdlIPCSetLastRead(CtdlIPC * ipc, long msgnum, char *cret)
-{
+int CtdlIPCSetLastRead(CtdlIPC * ipc, long msgnum, char *cret) {
int ret;
char aaa[64];
if (msgnum) {
sprintf(aaa, "SLRP %ld", msgnum);
- } else {
+ }
+ else {
sprintf(aaa, "SLRP HIGHEST");
}
ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
/* INVT */
-int CtdlIPCInviteUserToRoom(CtdlIPC * ipc, const char *username, char *cret)
-{
+int CtdlIPCInviteUserToRoom(CtdlIPC * ipc, const char *username, char *cret) {
int ret;
char *aaa;
/* KICK */
-int CtdlIPCKickoutUserFromRoom(CtdlIPC * ipc, const char *username, char *cret)
-{
+int CtdlIPCKickoutUserFromRoom(CtdlIPC * ipc, const char *username, char *cret) {
int ret;
char *aaa;
/* GETR */
-int CtdlIPCGetRoomAttributes(CtdlIPC * ipc, struct ctdlroom **qret, char *cret)
-{
+int CtdlIPCGetRoomAttributes(CtdlIPC * ipc, struct ctdlroom **qret, char *cret) {
int ret;
if (!cret)
/* SETR */
-int CtdlIPCSetRoomAttributes(CtdlIPC *ipc,
- int forget, // if nonzero, kick all users out of the room
- struct ctdlroom *qret,
- char *cret
-) {
+int CtdlIPCSetRoomAttributes(CtdlIPC * ipc, int forget, // if nonzero, kick all users out of the room
+ struct ctdlroom *qret, char *cret) {
int ret;
char *cmd;
/* GETA */
-int CtdlIPCGetRoomAide(CtdlIPC *ipc, char *cret)
-{
+int CtdlIPCGetRoomAide(CtdlIPC * ipc, char *cret) {
if (!cret)
return -1;
/* SETA */
-int CtdlIPCSetRoomAide(CtdlIPC *ipc, const char *username, char *cret) {
+int CtdlIPCSetRoomAide(CtdlIPC * ipc, const char *username, char *cret) {
int ret;
char *aaa;
/* ENT0 */
-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 ret;
char cmd[SIZ];
char *ptr;
/* CRE8 */
-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 ret;
char *aaa;
/* GNUR */
-int CtdlIPCNextUnvalidatedUser(CtdlIPC *ipc, char *cret) {
+int CtdlIPCNextUnvalidatedUser(CtdlIPC * ipc, char *cret) {
if (!cret)
return -2;
/* EINF */
-int CtdlIPCSetRoomInfo(CtdlIPC * ipc, int for_real, const char *info, char *cret)
-{
+int CtdlIPCSetRoomInfo(CtdlIPC * ipc, int for_real, const char *info, char *cret) {
char aaa[64];
if (!cret)
/* LIST */
-int CtdlIPCUserListing(CtdlIPC * ipc, char *searchstring, char **listing, char *cret)
-{
+int CtdlIPCUserListing(CtdlIPC * ipc, char *searchstring, char **listing, char *cret) {
size_t bytes;
char *cmd;
int ret;
/* REGI */
-int CtdlIPCSetRegistration(CtdlIPC * ipc, const char *info, char *cret)
-{
+int CtdlIPCSetRegistration(CtdlIPC * ipc, const char *info, char *cret) {
if (!cret)
return -1;
if (!info)
/* CHEK */
-int CtdlIPCMiscCheck(CtdlIPC * ipc, struct ctdlipcmisc *chek, char *cret)
-{
+int CtdlIPCMiscCheck(CtdlIPC * ipc, struct ctdlipcmisc *chek, char *cret) {
int ret;
if (!cret)
/* DELF */
-int CtdlIPCDeleteFile(CtdlIPC * ipc, const char *filename, char *cret)
-{
+int CtdlIPCDeleteFile(CtdlIPC * ipc, const char *filename, char *cret) {
int ret;
char *aaa;
/* MOVF */
-int CtdlIPCMoveFile(CtdlIPC * ipc, const char *filename, const char *destroom, char *cret)
-{
+int CtdlIPCMoveFile(CtdlIPC * ipc, const char *filename, const char *destroom, char *cret) {
int ret;
char *aaa;
/* RWHO */
-int CtdlIPCOnlineUsers(CtdlIPC * ipc, char **listing, time_t * stamp, char *cret)
-{
+int CtdlIPCOnlineUsers(CtdlIPC * ipc, char **listing, time_t * stamp, char *cret) {
int ret;
size_t bytes;
/* OPEN */
int CtdlIPCFileDownload(CtdlIPC * ipc, const char *filename, void **buf, size_t resume, void (*progress_gauge_callback)
- (CtdlIPC *, unsigned long, unsigned long), char *cret)
-{
+ (CtdlIPC *, unsigned long, unsigned long), char *cret) {
int ret;
size_t bytes;
time_t last_mod;
/* OPNA */
int CtdlIPCAttachmentDownload(CtdlIPC * ipc, long msgnum, const char *part, void **buf, void (*progress_gauge_callback)
- (CtdlIPC *, unsigned long, unsigned long), char *cret)
-{
+ (CtdlIPC *, unsigned long, unsigned long), char *cret) {
int ret;
size_t bytes;
time_t last_mod;
/* OIMG */
int CtdlIPCImageDownload(CtdlIPC * ipc, const char *filename, void **buf, void (*progress_gauge_callback)
- (CtdlIPC *, unsigned long, unsigned long), char *cret)
-{
+ (CtdlIPC *, unsigned long, unsigned long), char *cret) {
int ret;
size_t bytes;
time_t last_mod;
bytes = extract_long(cret, 0);
last_mod = extract_int(cret, 1);
extract_token(mimetype, cret, 2, '|', sizeof mimetype);
+
/* ret = CtdlIPCReadDownload(ipc, buf, bytes, 0, progress_gauge_callback, cret); */
ret = CtdlIPCHighSpeedReadDownload(ipc, buf, bytes, 0, progress_gauge_callback, cret);
ret = CtdlIPCEndDownload(ipc, cret);
/* UOPN */
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)
-{
+ (CtdlIPC *, unsigned long, unsigned long), char *cret) {
int ret;
char *aaa;
FILE *uploadFP;
/* UIMG */
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)
-{
+ (CtdlIPC *, unsigned long, unsigned long), char *cret) {
int ret;
FILE *uploadFP;
char *aaa;
/* QUSR */
-int CtdlIPCQueryUsername(CtdlIPC * ipc, const char *username, char *cret)
-{
+int CtdlIPCQueryUsername(CtdlIPC * ipc, const char *username, char *cret) {
int ret;
char *aaa;
/* LFLR */
-int CtdlIPCFloorListing(CtdlIPC * ipc, char **listing, char *cret)
-{
+int CtdlIPCFloorListing(CtdlIPC * ipc, char **listing, char *cret) {
size_t bytes;
if (!cret)
/* CFLR */
-int CtdlIPCCreateFloor(CtdlIPC * ipc, int for_real, const char *name, char *cret)
-{
+int CtdlIPCCreateFloor(CtdlIPC * ipc, int for_real, const char *name, char *cret) {
int ret;
char aaa[SIZ];
/* KFLR */
-int CtdlIPCDeleteFloor(CtdlIPC * ipc, int for_real, int floornum, char *cret)
-{
+int CtdlIPCDeleteFloor(CtdlIPC * ipc, int for_real, int floornum, char *cret) {
char aaa[SIZ];
if (!cret)
/* EFLR */
-int CtdlIPCEditFloor(CtdlIPC * ipc, int floornum, const char *floorname, char *cret)
-{
+int CtdlIPCEditFloor(CtdlIPC * ipc, int floornum, const char *floorname, char *cret) {
int ret;
char aaa[SIZ];
* other fields are not set properly.
*/
int CtdlIPCIdentifySoftware(CtdlIPC * ipc, int developerid, int clientid,
- int revision, const char *software_name, const char *hostname, char *cret)
-{
+ int revision, const char *software_name, const char *hostname, char *cret) {
int ret;
char *aaa;
/* SEXP */
-int CtdlIPCSendInstantMessage(CtdlIPC * ipc, const char *username, const char *text, char *cret)
-{
+int CtdlIPCSendInstantMessage(CtdlIPC * ipc, const char *username, const char *text, char *cret) {
int ret;
char *aaa;
if (text) {
sprintf(aaa, "SEXP %s|-", username);
ret = CtdlIPCGenericCommand(ipc, aaa, text, strlen(text), NULL, NULL, cret);
- } else {
+ }
+ else {
sprintf(aaa, "SEXP %s||", username);
ret = CtdlIPCGenericCommand(ipc, aaa, NULL, 0, NULL, NULL, cret);
}
/* GEXP */
-int CtdlIPCGetInstantMessage(CtdlIPC * ipc, char **listing, char *cret)
-{
+int CtdlIPCGetInstantMessage(CtdlIPC * ipc, char **listing, char *cret) {
size_t bytes;
if (!cret)
/* DEXP */
+
/* mode is 0 = enable, 1 = disable, 2 = status */
-int CtdlIPCEnableInstantMessageReceipt(CtdlIPC * ipc, int mode, char *cret)
-{
+int CtdlIPCEnableInstantMessageReceipt(CtdlIPC * ipc, int mode, char *cret) {
char aaa[64];
if (!cret)
/* EBIO */
-int CtdlIPCSetBio(CtdlIPC * ipc, char *bio, char *cret)
-{
+int CtdlIPCSetBio(CtdlIPC * ipc, char *bio, char *cret) {
if (!cret)
return -2;
if (!bio)
/* RBIO */
-int CtdlIPCGetBio(CtdlIPC * ipc, const char *username, char **listing, char *cret)
-{
+int CtdlIPCGetBio(CtdlIPC * ipc, const char *username, char **listing, char *cret) {
int ret;
size_t bytes;
char *aaa;
/* LBIO */
-int CtdlIPCListUsersWithBios(CtdlIPC * ipc, char **listing, char *cret)
-{
+int CtdlIPCListUsersWithBios(CtdlIPC * ipc, char **listing, char *cret) {
size_t bytes;
if (!cret)
/* STEL */
-int CtdlIPCStealthMode(CtdlIPC * ipc, int mode, char *cret)
-{
+int CtdlIPCStealthMode(CtdlIPC * ipc, int mode, char *cret) {
char aaa[64];
if (!cret)
/* TERM */
-int CtdlIPCTerminateSession(CtdlIPC * ipc, int sid, char *cret)
-{
+int CtdlIPCTerminateSession(CtdlIPC * ipc, int sid, char *cret) {
char aaa[64];
if (!cret)
/* DOWN */
-int CtdlIPCTerminateServerNow(CtdlIPC * ipc, char *cret)
-{
+int CtdlIPCTerminateServerNow(CtdlIPC * ipc, char *cret) {
if (!cret)
return -1;
/* SCDN */
-int CtdlIPCTerminateServerScheduled(CtdlIPC * ipc, int mode, char *cret)
-{
+int CtdlIPCTerminateServerScheduled(CtdlIPC * ipc, int mode, char *cret) {
char aaa[16];
if (!cret)
/* EMSG */
-int CtdlIPCEnterSystemMessage(CtdlIPC * ipc, const char *filename, const char *text, char *cret)
-{
+int CtdlIPCEnterSystemMessage(CtdlIPC * ipc, const char *filename, const char *text, char *cret) {
int ret;
char *aaa;
/* TIME */
+
/* This function returns the actual server time reported, or 0 if error */
-time_t CtdlIPCServerTime(CtdlIPC * ipc, char *cret)
-{
+time_t CtdlIPCServerTime(CtdlIPC * ipc, char *cret) {
time_t tret;
int ret;
ret = CtdlIPCGenericCommand(ipc, "TIME", NULL, 0, NULL, NULL, cret);
if (ret / 100 == 2) {
tret = extract_long(cret, 0);
- } else {
+ }
+ else {
tret = 0L;
}
return tret;
/* AGUP */
-int CtdlIPCAideGetUserParameters(CtdlIPC * ipc, const char *who, struct ctdluser **uret, char *cret)
-{
+int CtdlIPCAideGetUserParameters(CtdlIPC * ipc, const char *who, struct ctdluser **uret, char *cret) {
int ret;
char aaa[SIZ];
/* ASUP */
-int CtdlIPCAideSetUserParameters(CtdlIPC * ipc, const struct ctdluser *uret, char *cret)
-{
+int CtdlIPCAideSetUserParameters(CtdlIPC * ipc, const struct ctdluser *uret, char *cret) {
int ret;
char *aaa;
/* AGEA */
-int CtdlIPCAideGetEmailAddresses(CtdlIPC * ipc, const char *who, char *target_buf, char *cret)
-{
+int CtdlIPCAideGetEmailAddresses(CtdlIPC * ipc, const char *who, char *target_buf, char *cret) {
int ret;
char aaa[SIZ];
char *emailaddrs = NULL;
/* ASEA */
-int CtdlIPCAideSetEmailAddresses(CtdlIPC * ipc, const char *who, char *emailaddrs, char *cret)
-{
+int CtdlIPCAideSetEmailAddresses(CtdlIPC * ipc, const char *who, char *emailaddrs, char *cret) {
char aaa[SIZ];
int ret;
/* GPEX */
+
/* which is 0 = room, 1 = floor, 2 = site, 3 = default for mailboxes */
+
/* caller must free the struct ExpirePolicy */
-int CtdlIPCGetMessageExpirationPolicy(CtdlIPC * ipc, GPEXWhichPolicy which, struct ExpirePolicy **policy, char *cret)
-{
+int CtdlIPCGetMessageExpirationPolicy(CtdlIPC * ipc, GPEXWhichPolicy which, struct ExpirePolicy **policy, char *cret) {
static char *proto[] = {
strof(roompolicy),
strof(floorpolicy),
/* SPEX */
+
/* which is 0 = room, 1 = floor, 2 = site, 3 = default for mailboxes */
+
/* policy is 0 = inherit, 1 = no purge, 2 = by count, 3 = by age (days) */
-int CtdlIPCSetMessageExpirationPolicy(CtdlIPC * ipc, int which, struct ExpirePolicy *policy, char *cret)
-{
+int CtdlIPCSetMessageExpirationPolicy(CtdlIPC * ipc, int which, struct ExpirePolicy *policy, char *cret) {
char aaa[38];
char *whichvals[] = { "room", "floor", "site", "mailboxes" };
/* CONF GET */
-int CtdlIPCGetSystemConfig(CtdlIPC * ipc, char **listing, char *cret)
-{
+int CtdlIPCGetSystemConfig(CtdlIPC * ipc, char **listing, char *cret) {
size_t bytes;
if (!cret)
/* CONF SET */
-int CtdlIPCSetSystemConfig(CtdlIPC * ipc, const char *listing, char *cret)
-{
+int CtdlIPCSetSystemConfig(CtdlIPC * ipc, const char *listing, char *cret) {
if (!cret)
return -2;
if (!listing)
/* CONF GETSYS */
-int CtdlIPCGetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, char **listing, char *cret)
-{
+int CtdlIPCGetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, char **listing, char *cret) {
int ret;
char *aaa;
size_t bytes;
/* CONF PUTSYS */
-int CtdlIPCSetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, const char *listing, char *cret)
-{
+int CtdlIPCSetSystemConfigByType(CtdlIPC * ipc, const char *mimetype, const char *listing, char *cret) {
int ret;
char *aaa;
/* GNET */
-int CtdlIPCGetRoomNetworkConfig(CtdlIPC * ipc, char **listing, char *cret)
-{
+int CtdlIPCGetRoomNetworkConfig(CtdlIPC * ipc, char **listing, char *cret) {
size_t bytes;
if (!cret)
/* SNET */
-int CtdlIPCSetRoomNetworkConfig(CtdlIPC * ipc, const char *listing, char *cret)
-{
+int CtdlIPCSetRoomNetworkConfig(CtdlIPC * ipc, const char *listing, char *cret) {
if (!cret)
return -2;
if (!listing)
/* REQT */
-int CtdlIPCRequestClientLogout(CtdlIPC * ipc, int session, char *cret)
-{
+int CtdlIPCRequestClientLogout(CtdlIPC * ipc, int session, char *cret) {
char aaa[64];
if (!cret)
/* SEEN */
-int CtdlIPCSetMessageSeen(CtdlIPC * ipc, long msgnum, int seen, char *cret)
-{
+int CtdlIPCSetMessageSeen(CtdlIPC * ipc, long msgnum, int seen, char *cret) {
char aaa[27];
if (!cret)
/* STLS */
-int CtdlIPCStartEncryption(CtdlIPC * ipc, char *cret)
-{
+int CtdlIPCStartEncryption(CtdlIPC * ipc, char *cret) {
int a;
int r;
char buf[SIZ];
#ifdef HAVE_OPENSSL
-static void endtls(SSL * ssl)
-{
+static void endtls(SSL * ssl) {
if (ssl) {
SSL_shutdown(ssl);
SSL_free(ssl);
/* QDIR */
-int CtdlIPCDirectoryLookup(CtdlIPC * ipc, const char *address, char *cret)
-{
+int CtdlIPCDirectoryLookup(CtdlIPC * ipc, const char *address, char *cret) {
int ret;
char *aaa;
/* IPGM */
-int CtdlIPCInternalProgram(CtdlIPC * ipc, int secret, char *cret)
-{
+int CtdlIPCInternalProgram(CtdlIPC * ipc, int secret, char *cret) {
char aaa[30];
if (!cret)
/* ************************************************************************** */
+
/* Stuff below this line is not for public consumption */
+
/* ************************************************************************** */
/* Read a listing from the server up to 000. Append to dest if it exists */
-char *CtdlIPCReadListing(CtdlIPC * ipc, char *dest)
-{
+char *CtdlIPCReadListing(CtdlIPC * ipc, char *dest) {
size_t length = 0;
size_t linelength;
char *ret = NULL;
ret = dest;
if (ret != NULL) {
length = strlen(ret);
- } else {
+ }
+ else {
length = 0;
}
/* Send a listing to the server; generate the ending 000. */
-int CtdlIPCSendListing(CtdlIPC * ipc, const char *listing)
-{
+int CtdlIPCSendListing(CtdlIPC * ipc, const char *listing) {
char *text;
text = (char *) malloc(strlen(listing) + 6);
CtdlIPC_putline(ipc, text);
free(text);
text = NULL;
- } else {
+ }
+ else {
/* Malloc failed but we are committed to send */
/* This may result in extra blanks at the bottom */
CtdlIPC_putline(ipc, text);
/* Partial read of file from server */
-size_t CtdlIPCPartialRead(CtdlIPC * ipc, void **buf, size_t offset, size_t bytes, char *cret)
-{
+size_t CtdlIPCPartialRead(CtdlIPC * ipc, void **buf, size_t offset, size_t bytes, char *cret) {
size_t len = 0;
char aaa[SIZ];
if (*buf) {
/* I know what I'm doing */
serv_read(ipc, ((char *) (*buf) + offset), len);
- } else {
+ }
+ else {
/* We have to read regardless */
serv_read(ipc, aaa, len);
len = 0;
/* CLOS */
-int CtdlIPCEndDownload(CtdlIPC * ipc, char *cret)
-{
+int CtdlIPCEndDownload(CtdlIPC * ipc, char *cret) {
int ret;
if (!cret)
/* MSGP */
-int CtdlIPCSpecifyPreferredFormats(CtdlIPC * ipc, char *cret, char *formats)
-{
+int CtdlIPCSpecifyPreferredFormats(CtdlIPC * ipc, char *cret, char *formats) {
int ret;
char cmd[SIZ];
/* READ */
int CtdlIPCReadDownload(CtdlIPC * ipc, void **buf, size_t bytes, size_t resume, void (*progress_gauge_callback)
- (CtdlIPC *, unsigned long, unsigned long), char *cret)
-{
+ (CtdlIPC *, unsigned long, unsigned long), char *cret) {
size_t len;
if (!cret)
/* READ - pipelined */
int CtdlIPCHighSpeedReadDownload(CtdlIPC * ipc, void **buf, size_t bytes, size_t resume, void (*progress_gauge_callback)
- (CtdlIPC *, unsigned long, unsigned long), char *cret)
-{
+ (CtdlIPC *, unsigned long, unsigned long), char *cret) {
size_t len;
int calls; /* How many calls in the pipeline */
int i; /* iterator */
/* UCLS */
-int CtdlIPCEndUpload(CtdlIPC * ipc, int discard, char *cret)
-{
+int CtdlIPCEndUpload(CtdlIPC * ipc, int discard, char *cret) {
int ret;
char cmd[8];
/* WRIT */
int CtdlIPCWriteUpload(CtdlIPC * ipc, FILE * uploadFP, void (*progress_gauge_callback)
- (CtdlIPC *, unsigned long, unsigned long), char *cret)
-{
+ (CtdlIPC *, unsigned long, unsigned long), char *cret) {
int ret = -1;
size_t offset = 0;
size_t bytes;
/* Detect short reads and back up if needed */
/* offset will never be negative anyway */
fseek(fd, (signed) offset, SEEK_SET);
- } else {
+ }
+ else {
break;
}
}
* protocol_response as described above. Some commands send additional
* data in this string.
*/
-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 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) {
char buf[SIZ];
int ret;
case 1: /* LISTING_FOLLOWS */
if (to_receive && !*to_receive && bytes_to_receive) {
*to_receive = CtdlIPCReadListing(ipc, NULL);
- } else { /* Drain */
+ }
+ else { /* Drain */
while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000"));
ret = -ret;
}
case 4: /* SEND_LISTING */
if (to_send) {
CtdlIPCSendListing(ipc, to_send);
- } else {
+ }
+ else {
/* No listing given, fake it */
CtdlIPC_putline(ipc, "000");
ret = -ret;
if (to_receive && !*to_receive && bytes_to_receive) {
*bytes_to_receive = extract_long(proto_response, 0);
*to_receive = (char *)
- malloc((size_t) * bytes_to_receive);
+ malloc((size_t) *bytes_to_receive);
if (!*to_receive) {
ret = -1;
- } else {
+ }
+ else {
serv_read(ipc, *to_receive, *bytes_to_receive);
}
- } else {
+ }
+ else {
/* Drain */
size_t drain;
case 7: /* SEND_BINARY */
if (to_send && bytes_to_send) {
serv_write(ipc, to_send, bytes_to_send);
- } else if (bytes_to_send) {
+ }
+ else if (bytes_to_send) {
/* Fake it, send nulls */
size_t fake;
#ifdef HAVE_OPENSSL
+
/*
* input binary data from encrypted connection
*/
buf[i--] = 0;
if (i >= 0 && buf[i] == 13)
buf[i--] = 0;
- } else
+ }
+ else
#endif
{
if (ipc->Buf == NULL) {
/* is there more in the buffer we need to read later? */
if (ipc->Buf + ipc->BufUsed > aptr) {
ipc->BufPtr = aptr;
- } else {
+ }
+ else {
ipc->BufUsed = 0;
ipc->BufPtr = ipc->Buf;
}
/*
* Disconnect and delete the IPC class (destructor)
*/
-void CtdlIPC_delete(CtdlIPC *ipc) {
+void CtdlIPC_delete(CtdlIPC * ipc) {
#ifdef HAVE_OPENSSL
if (ipc->ssl) {
SSL_shutdown(ipc->ssl);
* Disconnect and delete the IPC class (destructor)
* Also NULLs out the pointer
*/
-void CtdlIPC_delete_ptr(CtdlIPC **pipc) {
+void CtdlIPC_delete_ptr(CtdlIPC ** pipc) {
CtdlIPC_delete(*pipc);
*pipc = NULL;
}
extern char temp[];
char last_paged[SIZ] = "";
-void chatmode(CtdlIPC *ipc) {
+void chatmode(CtdlIPC * ipc) {
char wbuf[SIZ];
char buf[SIZ];
char response[SIZ];
ch = scr_getc(SCR_BLOCK);
if ((ch == 10) || (ch == 13)) {
send_complete_line = 1;
- } else if ((ch == 8) || (ch == 127)) {
+ }
+ else if ((ch == 8) || (ch == 127)) {
if (!IsEmptyStr(wbuf)) {
wbuf[strlen(wbuf) - 1] = 0;
scr_printf("%c %c", 8, 8);
}
- } else {
+ }
+ else {
scr_putc(ch);
wbuf[strlen(wbuf) + 1] = 0;
wbuf[strlen(wbuf)] = ch;
}
strcpy(wbuf, "");
send_complete_line = 0;
- } else {
+ }
+ else {
wbuf[pos] = 0;
CtdlIPC_chat_send(ipc, "RCHT send");
CtdlIPC_chat_recv(ipc, response);
scr_printf("\r%79s\r", "");
if (!strcmp(c_user, fullname)) {
color(BRIGHT_YELLOW);
- } else if (!strcmp(c_user, ":")) {
+ }
+ else if (!strcmp(c_user, ":")) {
color(BRIGHT_RED);
- } else {
+ }
+ else {
color(BRIGHT_GREEN);
}
if (strcmp(c_user, last_user)) {
snprintf(buf, sizeof buf, "%s: %s", c_user, c_text);
- } else {
+ }
+ else {
size_t i = MIN(sizeof buf - 1, strlen(c_user) + 2);
memset(buf, ' ', i);
strncpy(&buf[i], c_text, sizeof buf - i);
}
-void quiet_mode(CtdlIPC * ipc)
-{
+void quiet_mode(CtdlIPC * ipc) {
static int quiet = 0;
char cret[SIZ];
int r;
if (r / 100 == 2) {
quiet = !quiet;
scr_printf("Quiet mode %sabled (%sother users may page you)\n", (quiet) ? "en" : "dis", (quiet) ? "no " : "");
- } else {
+ }
+ else {
scr_printf("Unable to change quiet mode: %s\n", cret);
}
}
-void stealth_mode(CtdlIPC * ipc)
-{
+void stealth_mode(CtdlIPC * ipc) {
static int stealth = 0;
char cret[SIZ];
int r;
stealth = !stealth;
scr_printf("Stealth mode %sabled (you are %s)\n",
(stealth) ? "en" : "dis", (stealth) ? "invisible" : "listed as online");
- } else {
+ }
+ else {
scr_printf("Unable to change stealth mode: %s\n", cret);
}
}
#define PWFILENAME "%s/.citadel.passwords"
-void determine_pwfilename(char *pwfile, size_t n)
-{
+void determine_pwfilename(char *pwfile, size_t n) {
struct passwd *p;
p = getpwuid(getuid());
* Check the password file for a host/port match; if found, stuff the user
* name and password into the user/pass buffers
*/
-void get_stored_password(char *host, char *port, char *username, char *password)
-{
+void get_stored_password(char *host, char *port, char *username, char *password) {
char pwfile[PATH_MAX];
FILE *fp;
/*
* Set (or clear) stored passwords.
*/
-void set_stored_password(char *host, char *port, char *username, char *password)
-{
+void set_stored_password(char *host, char *port, char *username, char *password) {
char pwfile[PATH_MAX];
FILE *fp, *oldfp;
/*
* Set the password if the user wants to, clear it otherwise
*/
-void offer_to_remember_password(CtdlIPC * ipc, char *host, char *port, char *username, char *password)
-{
+void offer_to_remember_password(CtdlIPC * ipc, char *host, char *port, char *username, char *password) {
if (rc_remember_passwords) {
if (boolprompt("Remember username/password for this site", 0)) {
set_stored_password(host, port, username, password);
- } else {
+ }
+ else {
set_stored_password(host, port, "", "");
}
}
" In addition, there are dot commands. You hit the . (dot), then press the\n"
"first letter of each word of the command. As you hit the letters, the words\n"
"pop onto your screen. Exceptions: after you hit .Help or .Goto, the remainder\n"
- "of the command is a help file name or room name.\n"
- " \n"
- " *** USE .<H>elp ? for additional help *** \n",
+ "of the command is a help file name or room name.\n" " \n" " *** USE .<H>elp ? for additional help *** \n",
// <.H>elp ADMIN
"The following commands are available only to Admins. A subset of these\n"
// these variables are local to this module
-char keepalives_enabled = KA_YES; // send NOOPs to server when idle
-int ok_to_interrupt = 0; // print instant msgs asynchronously
-time_t AnsiDetect; // when did we send the detect code?
-int enable_color = 0; // nonzero for ANSI color
+char keepalives_enabled = KA_YES; // send NOOPs to server when idle
+int ok_to_interrupt = 0; // print instant msgs asynchronously
+time_t AnsiDetect; // when did we send the detect code?
+int enable_color = 0; // nonzero for ANSI color
// If an interesting key has been pressed, return its value, otherwise 0
// Function to read a line of text from the terminal.
//
-// string Pointer to string buffer
-// lim Maximum length
-// noshow Echo asterisks instead of keystrokes?
-// bs Allow backspacing out of the prompt? (returns -1 if this happens)
+// string Pointer to string buffer
+// lim Maximum length
+// noshow Echo asterisks instead of keystrokes?
+// bs Allow backspacing out of the prompt? (returns -1 if this happens)
//
// returns: string length
int ctdl_getline(char *string, int lim, int noshow, int bs) {
while (num_stars--) {
scr_putc('*');
}
- } else {
+ }
+ else {
scr_printf("%s", string);
}
while (1) {
ch = inkey();
- if ((ch == 8) && (pos > 0)) { // backspace
+ if ((ch == 8) && (pos > 0)) { // backspace
--pos;
scr_putc(8);
scr_putc(32);
return (-1);
}
- else if ((ch == 23) && (pos > 0)) { // Ctrl-W deletes a word
+ else if ((ch == 23) && (pos > 0)) { // Ctrl-W deletes a word
while ((pos > 0) && !isspace(string[pos])) {
--pos;
scr_putc(8);
}
}
- else if (ch == 10) { // return
+ else if (ch == 10) { // return
string[pos] = 0;
scr_printf("\n");
return (pos);
}
- else if (isprint(ch)) { // payload characters
+ else if (isprint(ch)) { // payload characters
scr_putc((noshow ? '*' : ch));
string[pos] = ch;
++pos;
#ifdef HAVE_OPENSSL
else if (!strcasecmp(&buf[8], "no")) {
rc_encrypt = RC_NO;
- } else if (!strcasecmp(&buf[8], "default")) {
+ }
+ else if (!strcasecmp(&buf[8], "default")) {
rc_encrypt = RC_DEFAULT;
}
#endif
if (!strncasecmp(&buf[11], "on", 2))
rc_ansi_color = 1;
if (!strncasecmp(&buf[11], "auto", 4))
- rc_ansi_color = 2; // autodetect
+ rc_ansi_color = 2; // autodetect
if (!strncasecmp(&buf[11], "user", 4))
- rc_ansi_color = 3; // user config
+ rc_ansi_color = 3; // user config
}
if (!strncasecmp(buf, "status_line=", 12)) {
if (!strncasecmp(&buf[12], "on", 2))
if (!strncasecmp(&buf[15], "on", 2))
rc_prompt_control = 1;
if (!strncasecmp(&buf[15], "user", 4))
- rc_prompt_control = 3; // user config
+ rc_prompt_control = 3; // user config
}
if (!strncasecmp(buf, "username=", 9))
strcpy(rc_username, &buf[9]);
// If this command is one that changes rooms, then the next lazy-command
// (space bar) should be "read new" instead of "goto"
- if ( (cptr->c_cmdnum == 5)
- || (cptr->c_cmdnum == 6)
- || (cptr->c_cmdnum == 47)
- || (cptr->c_cmdnum == 52)
- || (cptr->c_cmdnum == 16)
- || (cptr->c_cmdnum == 20)
- ) {
+ if ((cptr->c_cmdnum == 5)
+ || (cptr->c_cmdnum == 6)
+ || (cptr->c_cmdnum == 47)
+ || (cptr->c_cmdnum == 52)
+ || (cptr->c_cmdnum == 16)
+ || (cptr->c_cmdnum == 20)
+ ) {
next_lazy_cmd = 13;
}
// fmout() - Citadel text formatter and paginator
int fmout(int width, // screen width to use
- FILE * fpin, // file to read from, or NULL to format given text
- char *text, // text to be formatted (when fpin is NULL
- FILE * fpout, // file to write to, or NULL to write to screen
- int subst) { // nonzero if we should use hypertext mode
+ FILE * fpin, // file to read from, or NULL to format given text
+ char *text, // text to be formatted (when fpin is NULL
+ FILE * fpout, // file to write to, or NULL to write to screen
+ int subst) { // nonzero if we should use hypertext mode
char *buffer = NULL; // The current message
char *word = NULL; // What we are about to actually print
char *e; // Pointer to position in text
e++;
continue;
}
- if (*e == '\n') { // newline?
+ if (*e == '\n') { // newline?
e++;
- if (*e == ' ') { // paragraph?
+ if (*e == ' ') { // paragraph?
if (fpout) {
fprintf(fpout, "\n");
- } else {
+ }
+ else {
scr_printf("\n");
}
column = 0;
}
- else if (old != ' ') { // Don't print two spaces
+ else if (old != ' ') { // Don't print two spaces
if (fpout) {
fprintf(fpout, " ");
}
if (buf[i] == '<') {
scr_printf("%c", buf[i]);
color(BRIGHT_MAGENTA);
- } else {
+ }
+ else {
if (buf[i] == '>' && buf[i + 1] != '>') {
color(DIM_WHITE);
}
/* Note that some of these functions may not work with multiple instances. */
-static void (*deathHook) (void) = NULL;
-int (*error_printf) (char *s, ...) = (int (*)(char *, ...)) printf;
+static void (*deathHook)(void) = NULL;
+int (*error_printf)(char *s, ...) =(int(*)(char *, ...)) printf;
-void setIPCDeathHook(void (*hook) (void))
-{
+void setIPCDeathHook(void (*hook)(void)) {
deathHook = hook;
}
-void setIPCErrorPrintf(int (*func) (char *s, ...))
-{
+void setIPCErrorPrintf(int (*func)(char *s, ...)) {
error_printf = func;
}
-void connection_died(CtdlIPC * ipc, int using_ssl)
-{
+void connection_died(CtdlIPC * ipc, int using_ssl) {
if (deathHook != NULL) {
deathHook();
}
fprintf(stderr, "Last error: %s\n", ERR_reason_error_string(ERR_get_error()));
SSL_free(ipc->ssl);
ipc->ssl = NULL;
- } else
+ }
+ else
#endif
fprintf(stderr, "Last error: %s\n", strerror(errno));
int num_urls = 0;
char urls[MAXURLS][SIZ];
char imagecmd[SIZ];
-int has_images = 0; /* Current msg has images */
+int has_images = 0; /* Current msg has images */
struct parts *last_message_parts = NULL; /* Parts from last msg */
* We can do this "in place" because the converted string will always be smaller than the source string.
*/
void mini_2047_decode(char *s) {
- if (!s) { // no null strings allowed!
+ if (!s) { // no null strings allowed!
return;
}
- char *qstart = strstr(s, "=?UTF-8?Q?"); // Must start with this string
+ char *qstart = strstr(s, "=?UTF-8?Q?"); // Must start with this string
if (!qstart) {
return;
}
- char *qend = strstr(qstart+10, "?="); // Must end with this string
+ char *qend = strstr(qstart + 10, "?="); // Must end with this string
if (!qend) {
return;
}
- if (qend <= qstart) { // And there must be something in between them.
+ if (qend <= qstart) { // And there must be something in between them.
return;
}
// The string has qualified for conversion.
- strcpy(qend, ""); // Strip the trailer
- strcpy(qstart, &qstart[10]); // Strip the header
+ strcpy(qend, ""); // Strip the trailer
+ strcpy(qstart, &qstart[10]); // Strip the header
- char *r = qstart; // Pointer to where in the string we're reading
- char *w = s; // Pointer to where in the string we're writing
+ char *r = qstart; // Pointer to where in the string we're reading
+ char *w = s; // Pointer to where in the string we're writing
- while(*r) { // Loop through the source string
- if (r[0] == '=') { // "=" means read a hex character
+ while (*r) { // Loop through the source string
+ if (r[0] == '=') { // "=" means read a hex character
char ch[3];
ch[0] = r[1];
ch[1] = r[2];
r += 3;
++w;
}
- else if (r[0] == '_') { // "_" is a space
+ else if (r[0] == '_') { // "_" is a space
w[0] = ' ';
++r;
++w;
}
- else { // anything else pass through literally
+ else { // anything else pass through literally
w[0] = r[0];
++r;
++w;
}
}
- w[0] = 0; // null terminate
+ w[0] = 0; // null terminate
}
/*
* Read a message from the server
*/
-int read_message(CtdlIPC *ipc,
- long num, /* message number */
- int pagin, /* 0 = normal read, 1 = read with pagination, 2 = header */
- FILE *dest /* Destination file, NULL for screen */
-) {
+int read_message(CtdlIPC * ipc, long num, /* message number */
+ int pagin, /* 0 = normal read, 1 = read with pagination, 2 = header */
+ FILE * dest /* Destination file, NULL for screen */
+ ) {
char buf[SIZ];
char now[256];
int format_type = 0;
if (rc_display_message_numbers) {
if (dest) {
fprintf(dest, "[#%s] ", message->msgid);
- } else {
+ }
+ else {
color(DIM_WHITE);
scr_printf("[");
color(BRIGHT_WHITE);
}
if (dest) {
fprintf(dest, "%s\n", lineptr);
- } else {
+ }
+ else {
scr_printf("%s\n", lineptr);
}
}
if (!final_line_is_blank) {
if (dest) {
fprintf(dest, "\n");
- } else {
+ }
+ else {
scr_printf("\n");
fr = sigcaught;
}
// Function to begin composing a new message
-int client_make_message(CtdlIPC * ipc,
- char *filename, // temporary file name
+int client_make_message(CtdlIPC * ipc, char *filename, // temporary file name
char *recipient, // NULL if it's not mail
- int is_anonymous,
- int format_type,
- int mode,
- char *subject, // buffer to store subject line
- int subject_required
-) {
+ int is_anonymous, int format_type, int mode, char *subject, // buffer to store subject line
+ int subject_required) {
FILE *fp;
int a, b, e_ex_code;
long beg;
if (room_flags & QR_ANONONLY && !recipient) {
snprintf(header, sizeof header, " ****");
}
- else {
+ else {
snprintf(header, sizeof header, " %s from %s", datestr, (is_anonymous ? "[anonymous]" : fullname));
if (!IsEmptyStr(recipient)) {
size_t tmp = strlen(header);
}
}
-ME1: switch (mode) {
+ ME1:switch (mode) {
case 0:
fp = fopen(filename, "r+");
break;
}
-MECR: if (mode >= 2) {
+ MECR:if (mode >= 2) {
if (file_checksum(filename) == cksum) {
scr_printf("*** Aborted message.\n");
e_ex_code = 1;
}
b = keymenu("Entry command (? for options)",
- "<A>bort|"
- "<C>ontinue|"
- "<S>ave message|"
- "<P>rint formatted|"
- "add s<U>bject|"
- "<R>eplace string|"
- "<H>old message"
- );
+ "<A>bort|"
+ "<C>ontinue|" "<S>ave message|" "<P>rint formatted|" "add s<U>bject|" "<R>eplace string|" "<H>old message");
if (b == 'a')
goto MEABT;
goto MECR;
}
-MEFIN: return (0);
+ MEFIN:return (0);
-MEABT: scr_printf("Are you sure? ");
+ MEABT:scr_printf("Are you sure? ");
if (yesno() == 0) {
goto ME1;
}
-MEABT2: unlink(filename);
+ MEABT2:unlink(filename);
return (2);
}
int entmsg(CtdlIPC * ipc, int is_reply, /* nonzero if this was a <R>eply command */
int c, /* mode */
int masquerade /* prompt for a non-default display name? */
-) {
+ ) {
char buf[SIZ];
int a, b;
int need_recp = 0;
scr_printf("If you want to leave a comment or reply to a comment, use the '<R>eply' command.\n");
scr_printf("Do you really want to create a new blog post? ");
if (!yesno()) {
- return(1);
+ return (1);
}
}
}
r = CtdlIPCAttachmentDownload(ipc, msg, ptr->number, &file, progress, buf);
if (r / 100 != 2) {
scr_printf("%s\n", buf);
- } else {
+ }
+ else {
size_t len;
len = (size_t) extract_long(buf, 0);
/*
* Read the messages in the current room
*/
-void readmsgs(CtdlIPC *ipc,
- enum MessageList c, // see listing in citadel_ipc.h
- enum MessageDirection rdir, // 1=Forward (-1)=Reverse
- int q // Number of msgs to read (if c==3)
-) {
+void readmsgs(CtdlIPC * ipc, enum MessageList c, // see listing in citadel_ipc.h
+ enum MessageDirection rdir, // 1=Forward (-1)=Reverse
+ int q // Number of msgs to read (if c==3)
+ ) {
int a, e, f, g, start;
int savedpos;
int hold_sw = 0;
if ((quotflag) || (arcflag)) {
screenwidth = hold_sw;
}
-RMSGREAD:
+ RMSGREAD:
highest_msg_read = msg_arr[a];
if (quotflag) {
fclose(dest);
do {
e = (inkey() & 127);
e = tolower(e);
+
/* return key same as <N> */ if (e == 10)
e = 'n';
+
/* space key same as <N> */ if (e == 32)
e = 'n';
+
/* del/move for aides only */
if ((!is_room_aide)
&& ((room_flags & QR_MAILBOX) == 0)
if ((e == 'd') || (e == 'm'))
e = 0;
}
+
/* print only if available */
if ((e == 'p') && (IsEmptyStr(printcmd)))
e = 0;
+
/* can't file if not allowed */
if ((e == 'f')
&& (rc_allow_attachments == 0))
e = 0;
+
/* link only if browser avail*/
if ((e == 'u')
&& (IsEmptyStr(rc_url_cmd)))
extern char floorlist[128][SIZ];
-void load_floorlist(CtdlIPC * ipc)
-{
+void load_floorlist(CtdlIPC * ipc) {
int a;
char buf[SIZ];
char *listing = NULL;
}
-void room_tree_list(struct ctdlroomlisting *rp)
-{
+void room_tree_list(struct ctdlroomlisting *rp) {
static int c = 0;
char rmname[ROOMNAMELEN];
int f;
}
if (f & QR_MAILBOX) {
color(BRIGHT_YELLOW);
- } else if (f & QR_PRIVATE) {
+ }
+ else if (f & QR_PRIVATE) {
color(BRIGHT_RED);
- } else {
+ }
+ else {
color(DIM_WHITE);
}
scr_printf("%s", rmname);
if (f & QR_DIRECTORY) {
scr_printf("] ");
- } else {
+ }
+ else {
scr_printf("> ");
}
c = c + strlen(rmname) + 3;
/*
* Room ordering stuff (compare first by floor, then by order)
*/
-int rordercmp(struct ctdlroomlisting *r1, struct ctdlroomlisting *r2)
-{
+int rordercmp(struct ctdlroomlisting *r1, struct ctdlroomlisting *r2) {
if ((r1 == NULL) && (r2 == NULL))
return (0);
if (r1 == NULL)
/*
* Common code for all room listings
*/
-static void listrms(struct march *listing, int new_only, int floor_only, unsigned int flags, char *match)
-{
+static void listrms(struct march *listing, int new_only, int floor_only, unsigned int flags, char *match) {
struct march *mptr;
struct ctdlroomlisting *rl = NULL;
struct ctdlroomlisting *rp;
rs = rl;
if (rl == NULL) {
rl = rp;
- } else {
+ }
+ else {
while (rp != NULL) {
if (rordercmp(rp, rs) < 0) {
if (rs->lnext == NULL) {
rs->lnext = rp;
rp = NULL;
- } else {
+ }
+ else {
rs = rs->lnext;
}
- } else {
+ }
+ else {
if (rs->rnext == NULL) {
rs->rnext = rp;
rp = NULL;
- } else {
+ }
+ else {
rs = rs->rnext;
}
}
}
-void list_other_floors(void)
-{
+void list_other_floors(void) {
int a, c;
c = 1;
* List known rooms. kn_floor_mode should be set to 0 for a 'flat' listing,
* 1 to list rooms on the current floor, or 2 to list rooms on all floors.
*/
-void knrooms(CtdlIPC * ipc, int kn_floor_mode)
-{
+void knrooms(CtdlIPC * ipc, int kn_floor_mode) {
int a;
struct march *listing = NULL;
struct march *mptr;
}
-void listzrooms(CtdlIPC * ipc)
-{ /* list public forgotten rooms */
+void listzrooms(CtdlIPC * ipc) { /* list public forgotten rooms */
struct march *listing = NULL;
struct march *mptr;
int r; /* IPC response code */
color(DIM_WHITE);
}
-void dotknown(CtdlIPC * ipc, int what, char *match)
-{ /* list rooms according to attribute */
+void dotknown(CtdlIPC * ipc, int what, char *match) { /* list rooms according to attribute */
struct march *listing = NULL;
struct march *mptr;
int r; /* IPC response code */
}
-int set_room_attr(CtdlIPC * ipc, unsigned int ibuf, char *prompt, unsigned int sbit)
-{
+int set_room_attr(CtdlIPC * ipc, unsigned int ibuf, char *prompt, unsigned int sbit) {
int a;
a = boolprompt(prompt, (ibuf & sbit));
* The supplied argument is the 'default' floor number.
* This function returns the selected floor number.
*/
-int select_floor(CtdlIPC * ipc, int rfloor)
-{
+int select_floor(CtdlIPC * ipc, int rfloor) {
int a, newfloor;
char floorstr[SIZ];
/*
* .<A>ide <E>dit room
*/
-void editthisroom(CtdlIPC * ipc)
-{
+void editthisroom(CtdlIPC * ipc) {
int rbump = 0;
char room_admin_name[USERNAME_SIZE];
char buf[SIZ];
r = CtdlIPCGetRoomAide(ipc, buf);
if (r / 100 == 2) {
strncpy(room_admin_name, buf, sizeof room_admin_name);
- } else {
+ }
+ else {
strcpy(room_admin_name, "");
}
if (IsEmptyStr(room_admin_name)) {
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Read-only room", QR_READONLY);
attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Allow message deletion by anyone who can post", QR2_COLLABDEL);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Permanent room", QR_PERMANENT);
- attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, "Subject Required (Force users to specify a message subject)", QR2_SUBJECTREQ);
+ attr->QRflags2 =
+ set_room_attr(ipc, attr->QRflags2, "Subject Required (Force users to specify a message subject)", QR2_SUBJECTREQ);
attr->QRflags = set_room_attr(ipc, attr->QRflags, "Directory room", QR_DIRECTORY);
if (attr->QRflags & QR_DIRECTORY) {
strprompt("Directory name", attr->QRdirname, 14);
if (IsEmptyStr(save_dir)) {
if (getenv("HOME") == NULL) {
strcpy(save_dir, ".");
- } else {
+ }
+ else {
sprintf(save_dir, "%s/Desktop", getenv("HOME"));
if (access(save_dir, W_OK) != 0) {
sprintf(save_dir, "%s", getenv("HOME"));
strcpy(save_dir, dest);
if (strrchr(save_dir, '/') != NULL) {
strcpy(strrchr(save_dir, '/'), "");
- } else {
+ }
+ else {
strcpy(save_dir, ".");
}
}
char tempname[PATH_MAX];
char transmit_cmd[SIZ];
FILE *tpipe = NULL;
+
/* int broken = 0;*/
int r;
int rv = 0;
/* FIXME: display internally instead */
snprintf(transmit_cmd, sizeof transmit_cmd,
"SHELL=/dev/null; export SHELL; TERM=dumb; export TERM; exec more -d <%s", tempname);
- } else if (proto == 1)
+ }
+ else if (proto == 1)
snprintf(transmit_cmd, sizeof transmit_cmd, "exec sx %s", tempname);
else if (proto == 3)
snprintf(transmit_cmd, sizeof transmit_cmd, "exec sb %s", tempname);
/*
* read directory of this room
*/
-void roomdir(CtdlIPC * ipc)
-{
+void roomdir(CtdlIPC * ipc) {
char flnm[256];
char flsz[32];
char comment[256];
/*
* add a user to a private room
*/
-void invite(CtdlIPC * ipc)
-{
+void invite(CtdlIPC * ipc) {
char username[USERNAME_SIZE];
char buf[SIZ];
/*
* kick a user out of a room
*/
-void kickout(CtdlIPC * ipc)
-{
+void kickout(CtdlIPC * ipc) {
char username[USERNAME_SIZE];
char buf[SIZ];
/*
* aide command: kill the current room
*/
-void killroom(CtdlIPC * ipc)
-{
+void killroom(CtdlIPC * ipc) {
char aaa[100];
int r;
dotgoto(ipc, "_BASEROOM_", 0, 0);
}
-void forget(CtdlIPC * ipc)
-{ /* forget the current room */
+void forget(CtdlIPC * ipc) { /* forget the current room */
char buf[SIZ];
scr_printf("Are you sure you want to forget this room? ");
/*
* create a new room
*/
-void entroom(CtdlIPC * ipc)
-{
+void entroom(CtdlIPC * ipc) {
char buf[SIZ];
char new_room_name[ROOMNAMELEN];
int new_room_type;
for (a = 0; !IsEmptyStr(&new_room_pass[a]); ++a)
if (new_room_pass[a] == '|')
new_room_pass[a] = '_';
- } else {
+ }
+ else {
strcpy(new_room_pass, "");
}
-void readinfo(CtdlIPC * ipc)
-{ /* read info file for current room */
+void readinfo(CtdlIPC * ipc) { /* read info file for current room */
char buf[SIZ];
char room_admin_name[64];
int r; /* IPC response code */
/*
* <W>ho knows room...
*/
-void whoknows(CtdlIPC * ipc)
-{
+void whoknows(CtdlIPC * ipc) {
char buf[256];
char *listing = NULL;
int r;
}
-void do_edit(CtdlIPC * ipc, char *desc, char *read_cmd, char *check_cmd, char *write_cmd)
-{
+void do_edit(CtdlIPC * ipc, char *desc, char *read_cmd, char *check_cmd, char *write_cmd) {
FILE *fp;
char cmd[SIZ];
int b, cksum, editor_exit;
editor_pid = (-1);
scr_printf("Executed %s\n", editor_path);
stty_ctdl(0);
- } else {
+ }
+ else {
scr_printf("Entering %s. Press return twice when finished.\n", desc);
fp = fopen(temp, "r+");
citedit(fp);
}
-void enterinfo(CtdlIPC * ipc)
-{ /* edit info file for current room */
+void enterinfo(CtdlIPC * ipc) { /* edit info file for current room */
do_edit(ipc, "the Info file for this room", "RINF", "EINF 0", "EINF 1");
}
-void enter_bio(CtdlIPC * ipc)
-{
+void enter_bio(CtdlIPC * ipc) {
char cmd[SIZ];
snprintf(cmd, sizeof cmd, "RBIO %s", fullname);
do_edit(ipc, "your Bio", cmd, "NOOP", "EBIO");
/*
* create a new floor
*/
-void create_floor(CtdlIPC * ipc)
-{
+void create_floor(CtdlIPC * ipc) {
char buf[SIZ];
char newfloorname[SIZ];
int r; /* IPC response code */
r = CtdlIPCCreateFloor(ipc, 1, newfloorname, buf);
if (r / 100 == 2) {
scr_printf("Floor has been created.\n");
- } else {
+ }
+ else {
scr_printf("%s\n", buf);
}
/*
* edit the current floor
*/
-void edit_floor(CtdlIPC * ipc)
-{
+void edit_floor(CtdlIPC * ipc) {
char buf[SIZ];
struct ExpirePolicy *ep = NULL;
/*
* kill the current floor
*/
-void kill_floor(CtdlIPC * ipc)
-{
+void kill_floor(CtdlIPC * ipc) {
int floornum_to_delete, a;
char buf[SIZ];
extern int rc_prompt_control;
/* Destructive backspace */
-void back(int spaces)
-{
+void back(int spaces) {
int a;
for (a = 0; a < spaces; ++a) {
scr_putc(8);
/*
* Edit a user's Internet email addresses
*/
-void edit_user_internet_email_addresses(CtdlIPC * ipc, char *who)
-{
+void edit_user_internet_email_addresses(CtdlIPC * ipc, char *who) {
char buf[SIZ];
char *resp = NULL;
int num_recs = 0;
++num_recs;
if (num_recs == 1) {
recs = malloc(sizeof(char *));
- } else {
+ }
+ else {
recs = realloc(recs, (sizeof(char *)) * num_recs);
}
recs[num_recs - 1] = strdup(buf);
r = CtdlIPCAideSetEmailAddresses(ipc, who, resp, buf);
if (r / 100 != 4) {
scr_printf("%s\n", buf);
- } else {
+ }
+ else {
scr_printf("Saved %d addresses.\n", num_recs);
modified = 0;
quitting = 1;
/*
* Edit or delete a user (cmd=25 to edit/create, 96 to delete)
*/
-void edituser(CtdlIPC * ipc, int cmd)
-{
+void edituser(CtdlIPC * ipc, int cmd) {
char buf[SIZ];
char who[USERNAME_SIZE];
char newname[USERNAME_SIZE];
r = CtdlIPCRenameUser(ipc, user->fullname, newname, buf);
if (r / 100 != 2) {
scr_printf("%s\n", buf);
- } else {
+ }
+ else {
strcpy(user->fullname, newname);
change_name = 0;
}
- } else {
+ }
+ else {
change_name = 0;
}
}
user->axlevel = intprompt("Access level", user->axlevel, 0, 6);
if (boolprompt("Permission to send Internet mail", (user->flags & US_INTERNET))) {
user->flags |= US_INTERNET;
- } else {
+ }
+ else {
user->flags &= ~US_INTERNET;
}
if (boolprompt("Ask user to register again", !(user->flags & US_REGIS))) {
user->flags &= ~US_REGIS;
- } else {
+ }
+ else {
user->flags |= US_REGIS;
}
user->timescalled = intprompt("Times called", user->timescalled, 0, INT_MAX);
* yes or no. Yes=1 and No=0, unless 'backwards' is set to a nonzero value
* in which case No=1 and Yes=0.
*/
-int set_attr(CtdlIPC * ipc, unsigned int sval, char *prompt, unsigned int sbit, int backwards)
-{
+int set_attr(CtdlIPC * ipc, unsigned int sval, char *prompt, unsigned int sbit, int backwards) {
int a;
int temp;
if (backwards) {
scr_printf("%3s", ((temp & sbit) ? "No" : "Yes"));
- } else {
+ }
+ else {
scr_printf("%3s", ((temp & sbit) ? "Yes" : "No"));
}
* modes are: 0 - .EC command, 1 - .EC for new user,
* 2 - toggle Xpert mode 3 - toggle floor mode
*/
-void enter_config(CtdlIPC * ipc, int mode)
-{
+void enter_config(CtdlIPC * ipc, int mode) {
char buf[SIZ];
struct ctdluser *user = NULL;
int r; /* IPC response code */
if (user->flags & US_EXPERT) {
user->flags ^= US_EXPERT;
scr_printf("Expert mode now OFF\n");
- } else {
+ }
+ else {
user->flags |= US_EXPERT;
scr_printf("Expert mode now ON\n");
}
if (user->flags & US_FLOORS) {
user->flags ^= US_FLOORS;
scr_printf("Floor mode now OFF\n");
- } else {
+ }
+ else {
user->flags |= US_FLOORS;
scr_printf("Floor mode now ON\n");
}
* getstring() - get a line of text from a file
* ignores lines beginning with "#"
*/
-int getstring(FILE * fp, char *string)
-{
+int getstring(FILE * fp, char *string) {
int a, c;
do {
strcpy(string, "");
/* Searches for patn in search string */
-int pattern(char *search, char *patn)
-{
+int pattern(char *search, char *patn) {
int a, b, len;
len = strlen(patn);
}
-void strproc(char *string)
-{
+void strproc(char *string) {
int a;
if (IsEmptyStr(string))
}
-void progress(CtdlIPC * ipc, unsigned long curr, unsigned long cmax)
-{
+void progress(CtdlIPC * ipc, unsigned long curr, unsigned long cmax) {
static char dots[] = "**************************************************";
char dots_printed[51];
char fmt[42];
if (curr >= cmax) {
scr_printf("\r%79s\r", "");
- } else {
+ }
+ else {
/* a will be range 0-50 rather than 0-100 */
a = (curr * 50) / cmax;
sprintf(fmt, "[%%s%%%lds] %%3ld%%%% %%10ld/%%10ld\r", 50 - a);
* 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(CtdlIPC * ipc, char *hbuf)
-{
+void locate_host(CtdlIPC * ipc, char *hbuf) {
FILE *who = (FILE *) popen("who am i", "r");
if (who == NULL) {
strcpy(hbuf, ipc->ServInfo.fqdn);
/*
* miscellaneous server commands (testing, etc.)
*/
-void misc_server_cmd(CtdlIPC * ipc, char *cmd)
-{
+void misc_server_cmd(CtdlIPC * ipc, char *cmd) {
char buf[SIZ];
CtdlIPC_chat_send(ipc, cmd);
/*
* compute the checksum of a file
*/
-int file_checksum(char *filename)
-{
+int file_checksum(char *filename) {
int cksum = 0;
int ch;
FILE *fp;
/*
* nuke a directory and its contents
*/
-int nukedir(char *dirname)
-{
+int nukedir(char *dirname) {
DIR *dp;
struct dirent *d;
char filename[SIZ];
/*
* make all messages old in current room
*/
-void updatels(CtdlIPC * ipc)
-{
+void updatels(CtdlIPC * ipc) {
char buf[256];
int r; /* IPC response code */
/*
* only make messages old in this room that have been read
*/
-void updatelsa(CtdlIPC * ipc)
-{
+void updatelsa(CtdlIPC * ipc) {
char buf[256];
int r; /* IPC response code */
/*
* client-based uploads (for users with their own clientware)
*/
-void cli_upload(CtdlIPC * ipc)
-{
+void cli_upload(CtdlIPC * ipc) {
char flnm[PATH_MAX];
char desc[151];
char buf[256];
/*
* Function used for various image upload commands
*/
-void cli_image_upload(CtdlIPC * ipc, char *keyname)
-{
+void cli_image_upload(CtdlIPC * ipc, char *keyname) {
char flnm[PATH_MAX];
char buf[256];
int r;
/*
* protocol-based uploads (Xmodem, Ymodem, Zmodem)
*/
-void upload(CtdlIPC * ipc, int c)
-{ /* c = upload mode */
+void upload(CtdlIPC * ipc, int c) { /* c = upload mode */
char flnm[PATH_MAX];
char desc[151];
char buf[256];
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) {
/*
* validate a user (returns 0 for successful validation, nonzero if quitting)
*/
-int val_user(CtdlIPC * ipc, char *user, int do_validate)
-{
+int val_user(CtdlIPC * ipc, char *user, int do_validate) {
int a;
char cmd[256];
char buf[256];
* Webcit limits to 6 as does the code here but there are 7 in axdefs.h
*/
scr_printf("Current access level: %d (%s)\n", ax, axdefs[ax]);
- } else {
+ }
+ else {
scr_printf("%s\n%s\n", user, &cmd[4]);
}
if (resp)
/*
* Validate new users
*/
-void validate(CtdlIPC * ipc)
-{
+void validate(CtdlIPC * ipc) {
char cmd[256];
char buf[256];
int finished = 0;
}
-void subshell(void)
-{
+void subshell(void) {
int a, b;
stty_ctdl(SB_RESTORE);
/*
* <.A>ide <F>ile <D>elete command
*/
-void deletefile(CtdlIPC * ipc)
-{
+void deletefile(CtdlIPC * ipc) {
char filename[32];
char buf[256];
/*
* <.A>ide <F>ile <M>ove command
*/
-void movefile(CtdlIPC * ipc)
-{
+void movefile(CtdlIPC * ipc) {
char filename[64];
char newroom[ROOMNAMELEN];
char buf[256];
/*
* list of users who have filled out a bio
*/
-void list_bio(CtdlIPC * ipc)
-{
+void list_bio(CtdlIPC * ipc) {
char buf[256];
char *resp = NULL;
int pos = 1;
strprompt("Initial access level for new users", &sc[6][0], 1);
strprompt("Access level required to create rooms", &sc[19][0], 1);
snprintf(sc[67], sizeof sc[67], "%d", (boolprompt("Allow anonymous guest logins", atoi(&sc[67][0]))));
- snprintf(sc[4], sizeof sc[4], "%d", (boolprompt("Automatically give room admin privs to a user who creates a private room", atoi(&sc[4][0]))));
+ snprintf(sc[4], sizeof sc[4], "%d",
+ (boolprompt("Automatically give room admin privs to a user who creates a private room", atoi(&sc[4][0]))));
snprintf(sc[8], sizeof sc[8], "%d", (boolprompt("Automatically move problem user messages to twit room", atoi(&sc[8][0]))));
strprompt("Name of twit room", &sc[9][0], ROOMNAMELEN);
- snprintf(sc[11], sizeof sc[11], "%d", (boolprompt("Restrict Internet mail to only those with that privilege", atoi(&sc[11][0]))));
+ snprintf(sc[11], sizeof sc[11], "%d",
+ (boolprompt("Restrict Internet mail to only those with that privilege", atoi(&sc[11][0]))));
snprintf(sc[26], sizeof sc[26], "%d", (boolprompt("Allow admins to Zap (forget) rooms", atoi(&sc[26][0]))));
if (!IsEmptyStr(&sc[18][0])) {
a = (a ? 0 : 1);
snprintf(sc[61], sizeof sc[61], "%d", a);
- snprintf(sc[45], sizeof sc[45], "%d", (boolprompt("Allow unauthenticated SMTP clients to spoof my domains", atoi(&sc[45][0]))));
- snprintf(sc[57], sizeof sc[57], "%d", (boolprompt("Perform RBL checks at greeting instead of after RCPT", atoi(&sc[57][0]))));
+ snprintf(sc[45], sizeof sc[45], "%d",
+ (boolprompt("Allow unauthenticated SMTP clients to spoof my domains", atoi(&sc[45][0]))));
+ snprintf(sc[57], sizeof sc[57], "%d",
+ (boolprompt("Perform RBL checks at greeting instead of after RCPT", atoi(&sc[57][0]))));
// LDAP settings
if (ipc->ServInfo.supports_ldap) {
strprompt("Default frequency to run POP3 collection (in seconds)", &sc[64][0], 5);
strprompt("Fastest frequency to run POP3 collection (in seconds)", &sc[65][0], 5);
strprompt("Hour to run purges (0-23)", &sc[31][0], 2);
- snprintf(sc[42], sizeof sc[42], "%d", (boolprompt("Enable full text search index (warning: resource intensive)", atoi(&sc[42][0]))));
+ snprintf(sc[42], sizeof sc[42], "%d",
+ (boolprompt("Enable full text search index (warning: resource intensive)", atoi(&sc[42][0]))));
snprintf(sc[46], sizeof sc[46], "%d", (boolprompt("Perform journaling of email messages", atoi(&sc[46][0]))));
snprintf(sc[47], sizeof sc[47], "%d", (boolprompt("Perform journaling of non-email messages", atoi(&sc[47][0]))));
if ((atoi(&sc[46][0])) || (atoi(&sc[47][0]))) {
++num_recs;
if (num_recs == 1) {
recs = malloc(sizeof(char *));
- } else {
+ }
+ else {
recs = realloc(recs, (sizeof(char *)) * num_recs);
}
strcpy(buf, "pop3client|");