From: Art Cancro Date: Sat, 23 Dec 2006 01:03:39 +0000 (+0000) Subject: * Committed matt's latest patch set X-Git-Tag: v7.86~3761 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=bb64ba0e4402c955ad456c62ff10583c95764c32;p=citadel.git * Committed matt's latest patch set --- diff --git a/citadel/citadel.c b/citadel/citadel.c index 383ba6632..cd7fab30a 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -423,7 +423,6 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto) scr_printf("No room '%s'.\n", towhere); return; } - room = NULL; r = CtdlIPCGotoRoom(ipc, bbb, "", &room, aaa); } if (r / 100 != 1 && r / 100 != 2) { @@ -489,6 +488,7 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto) } status_line(ipc->ServInfo.humannode, ipc->ServInfo.site_location, room_name, secure, newmailcount); + free(room); } /* Goto next room having unread messages. @@ -571,6 +571,7 @@ void forget_all_rooms_on(CtdlIPC *ipc, int ffloor) flist = flist->next; free(fptr); } + if (room) free(room); } @@ -830,6 +831,14 @@ void gotoroomstep(CtdlIPC *ipc, int direction, int mode) updatelsa(ipc); } } + + /* Free the room list */ + while (listing) { + mptr = listing->next; + free(listing); + listing = mptr; + }; + dotgoto(ipc, rmname, 1, 0); } @@ -844,6 +853,8 @@ void gotofloorstep(CtdlIPC *ipc, int direction, int mode) if (floorlist[0][0] == 0) load_floorlist(ipc); + empty_keep_going: + if (direction == 0) { /* Previous floor */ if (curr_floor) tofloor = curr_floor - 1; else tofloor = 127; @@ -862,6 +873,10 @@ void gotofloorstep(CtdlIPC *ipc, int direction, int mode) } gotofloor(ipc, floorlist[tofloor], mode); + if (curr_floor != tofloor) { /* gotofloor failed */ + curr_floor = tofloor; + goto empty_keep_going; + } } /* @@ -1165,6 +1180,8 @@ char *SortOnlineUsers(char *listing) { strcat(retbuf, &sortbuf[i*SIZ]); if (i<(rows-1)) strcat(retbuf, "\n"); } + free(listing); + free(sortbuf); return(retbuf); } @@ -1349,7 +1366,7 @@ int main(int argc, char **argv) int home=0; char relhome[PATH_MAX]=""; char ctdldir[PATH_MAX]=CTDLDIR; - + calc_dirs_n_files(relh, home, relhome, ctdldir); @@ -1708,6 +1725,7 @@ NEWUSR: if (strlen(rc_password) == 0) { dotgoto(ipc, "_BASEROOM_", 1, 0); /* Main loop for the system... user is logged in. */ + free(uglist[0]); uglistsize = 0; if (newnow == 1) @@ -2154,7 +2172,7 @@ NEWUSR: if (strlen(rc_password) == 0) { break; case 110: /* <+> Next room */ - gotoroomstep(ipc, 1, 0); + gotoroomstep(ipc, 1, 0); break; case 111: /* <-> Previous room */ @@ -2193,6 +2211,34 @@ NEWUSR: if (strlen(rc_password) == 0) { system_info(ipc); break; + case 120: /* .KAnonymous */ + dotknown(ipc, 0, NULL); + break; + + case 121: /* .KDirectory */ + dotknown(ipc, 1, NULL); + break; + + case 122: /* .KMatch */ + dotknown(ipc, 2, argbuf); + break; + + case 123: /* .KpreferredOnly */ + dotknown(ipc, 3, NULL); + break; + + case 124: /* .KPrivate */ + dotknown(ipc, 4, NULL); + break; + + case 125: /* .KRead only */ + dotknown(ipc, 5, NULL); + break; + + case 126: /* .KShared */ + dotknown(ipc, 6, NULL); + break; + default: /* allow some math on the command */ /* commands 100... to 100+MAX_EDITORS-1 will call the appropriate editor... in other diff --git a/citadel/citadel.rc b/citadel/citadel.rc index 2a726fe65..6145bc01b 100644 --- a/citadel/citadel.rc +++ b/citadel/citadel.rc @@ -365,6 +365,7 @@ cmd=46,0,&.,&Enter,message with &Editor cmd=59,0,&;,&Configure floor mode cmd=60,0,&;,&Goto floor: +cmd=60,0,&.,&Enter,&Floor: cmd=61,0,&;,&Skip to floor: cmd=62,0,&;,&Zap (forget) floor cmd=63,2,&;,&Aide,&Create floor @@ -389,6 +390,17 @@ cmd=117,0,&.,skip to &-Previous room cmd=118,0,&.,skip to &>Next floor cmd=119,0,&.,skip to &RRfloor = extract_int(cret, 10); } else { free(*rret); + *rret = NULL; } + free(aaa); return ret; } @@ -674,6 +677,7 @@ int CtdlIPCServerInfo(CtdlIPC *ipc, char *cret) } } + if (listing) free(listing); return ret; } diff --git a/citadel/commands.c b/citadel/commands.c index a57510317..8a9ea1911 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -1188,11 +1188,13 @@ int getcmd(CtdlIPC *ipc, char *argbuf) for (cptr = cmdlist; cptr != NULL; cptr = cptr->next) { if (cmdmatch(cmdbuf, cptr, cmdpos)) { for (a = 0; a < 5; ++a) { - pprintf("%s ", cmd_expand(cptr->c_keys[a], 1)); + keyopt(cmd_expand(cptr->c_keys[a], 1)); + pprintf(" "); } pprintf("\n"); } } + sigcaught = 0; pprintf("\n%s%c ", room_name, room_prompt(room_flags)); got = 0; @@ -1596,13 +1598,13 @@ void keyopt(char *buf) { color(DIM_WHITE); for (i=0; i') { + if (buf[i]=='>'&& buf[i+1] != '>') { color(DIM_WHITE); } - scr_putc(buf[i]); + pprintf("%c", buf[i]); } } color(DIM_WHITE); diff --git a/citadel/messages.c b/citadel/messages.c index fea2a7c06..7788bc822 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -1281,6 +1281,7 @@ int entmsg(CtdlIPC *ipc, scr_printf("*** %d additional messages have been entered " "in this room by other users.\n", b); } + free(message.text); return(0); } diff --git a/citadel/messages/dotopt b/citadel/messages/dotopt index fc6a52e2d..8c21f90bc 100644 --- a/citadel/messages/dotopt +++ b/citadel/messages/dotopt @@ -1,5 +1,6 @@ One of: nter + nown ead ide options (aides only) oto: (type room name) @@ -7,4 +8,5 @@ One of: elp: (type name of help file) apped rooms list erminate - + <+>, <-> skip to next, previous room + <>>, <<> skip to next, previous floor diff --git a/citadel/messages/entopt b/citadel/messages/entopt index 1477e1bcb..4335b9174 100644 --- a/citadel/messages/entopt +++ b/citadel/messages/entopt @@ -3,6 +3,7 @@ One of: io onfiguration message with ditor + loor reistration essage

assword diff --git a/citadel/rooms.c b/citadel/rooms.c index c1a066bd0..c7b239080 100644 --- a/citadel/rooms.c +++ b/citadel/rooms.c @@ -165,7 +165,7 @@ int rordercmp(struct ctdlroomlisting *r1, struct ctdlroomlisting *r2) /* * Common code for all room listings */ -static void listrms(struct march *listing, int new_only, int floor_only) +static void listrms(struct march *listing, int new_only, int floor_only, unsigned int flags, char *match) { struct march *mptr; struct ctdlroomlisting *rl = NULL; @@ -188,6 +188,12 @@ static void listrms(struct march *listing, int new_only, int floor_only) && (mptr->march_floor != floor_only)) list_it = 0; + if (flags && (mptr->march_flags & flags) == 0) + list_it = 0; + + if (match && (pattern(mptr->march_name, match) == -1)) + list_it = 0; + if (list_it) { rp = malloc(sizeof(struct ctdlroomlisting)); strncpy(rp->rlname, mptr->march_name, ROOMNAMELEN); @@ -271,10 +277,10 @@ void knrooms(CtdlIPC *ipc, int kn_floor_mode) if (kn_floor_mode == 0) { color(BRIGHT_CYAN); pprintf("\n Rooms with unread messages:\n"); - listrms(listing, LISTRMS_NEW_ONLY, -1); + listrms(listing, LISTRMS_NEW_ONLY, -1, 0, NULL); color(BRIGHT_CYAN); pprintf("\n\n No unseen messages in:\n"); - listrms(listing, LISTRMS_OLD_ONLY, -1); + listrms(listing, LISTRMS_OLD_ONLY, -1, 0, NULL); pprintf("\n"); } @@ -282,11 +288,11 @@ void knrooms(CtdlIPC *ipc, int kn_floor_mode) color(BRIGHT_CYAN); pprintf("\n Rooms with unread messages on %s:\n", floorlist[(int) curr_floor]); - listrms(listing, LISTRMS_NEW_ONLY, curr_floor); + listrms(listing, LISTRMS_NEW_ONLY, curr_floor, 0, NULL); color(BRIGHT_CYAN); pprintf("\n\n Rooms with no new messages on %s:\n", floorlist[(int) curr_floor]); - listrms(listing, LISTRMS_OLD_ONLY, curr_floor); + listrms(listing, LISTRMS_OLD_ONLY, curr_floor, 0, NULL); color(BRIGHT_CYAN); pprintf("\n\n Other floors:\n"); list_other_floors(); @@ -299,7 +305,7 @@ void knrooms(CtdlIPC *ipc, int kn_floor_mode) color(BRIGHT_CYAN); pprintf("\n Rooms on %s:\n", floorlist[a]); - listrms(listing, LISTRMS_ALL, a); + listrms(listing, LISTRMS_ALL, a, 0, NULL); pprintf("\n"); } } @@ -333,7 +339,7 @@ void listzrooms(CtdlIPC *ipc) color(BRIGHT_CYAN); pprintf("\n Forgotten public rooms:\n"); - listrms(listing, LISTRMS_ALL, -1); + listrms(listing, LISTRMS_ALL, -1, 0, NULL); pprintf("\n"); /* Free the room list */ @@ -347,6 +353,70 @@ void listzrooms(CtdlIPC *ipc) IFNEXPERT hit_any_key(ipc); } +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 */ + char buf[SIZ]; + + /* Ask the server for a room list */ + r = CtdlIPCKnownRooms(ipc, AllAccessibleRooms, (-1), &listing, buf); + if (r / 100 != 1) { + listing = NULL; + } + + color(BRIGHT_CYAN); + + switch (what) { + case 0: + pprintf("\n Anonymous rooms:\n"); + listrms(listing, LISTRMS_ALL, -1, QR_ANONONLY|QR_ANONOPT, NULL); + pprintf("\n"); + break; + case 1: + pprintf("\n Directory rooms:\n"); + listrms(listing, LISTRMS_ALL, -1, QR_DIRECTORY, NULL); + pprintf("\n"); + break; + case 2: + pprintf("\n Matching \"%s\" rooms:\n", match); + listrms(listing, LISTRMS_ALL, -1, 0, match); + pprintf("\n"); + break; + case 3: + pprintf("\n Preferred only rooms:\n"); + listrms(listing, LISTRMS_ALL, -1, QR_PREFONLY, NULL); + pprintf("\n"); + break; + case 4: + pprintf("\n Private rooms:\n"); + listrms(listing, LISTRMS_ALL, -1, QR_PRIVATE, NULL); + pprintf("\n"); + break; + case 5: + pprintf("\n Read only rooms:\n"); + listrms(listing, LISTRMS_ALL, -1, QR_READONLY, NULL); + pprintf("\n"); + break; + case 6: + pprintf("\n Shared rooms:\n"); + listrms(listing, LISTRMS_ALL, -1, QR_NETWORK, NULL); + pprintf("\n"); + break; + } + + /* Free the room list */ + while (listing) { + mptr = listing->next; + free(listing); + listing = mptr; + }; + + color(DIM_WHITE); + IFNEXPERT hit_any_key(ipc); +} + int set_room_attr(CtdlIPC *ipc, unsigned int ibuf, char *prompt, unsigned int sbit) { @@ -859,7 +929,7 @@ void roomdir(CtdlIPC *ipc) extract_token(flnm, buf, 1, '|', sizeof flnm); pprintf("\nDirectory of %s on %s\n", flnm, comment); pprintf("-----------------------\n"); - while (*listing && strlen(listing)) { + while (listing && *listing && strlen(listing)) { extract_token(buf, listing, 0, '\n', sizeof buf); remove_token(listing, 0, '\n'); @@ -872,6 +942,7 @@ void roomdir(CtdlIPC *ipc) pprintf("%s\n%14s %8s %s\n", flnm, "", flsz, comment); } + if (listing) free(listing); } diff --git a/citadel/rooms.h b/citadel/rooms.h index 68d9d6524..6e323657c 100644 --- a/citadel/rooms.h +++ b/citadel/rooms.h @@ -14,6 +14,7 @@ void dotungoto(CtdlIPC *ipc, char *towhere); void whoknows(CtdlIPC *ipc); void enterinfo(CtdlIPC *ipc); void knrooms(CtdlIPC *ipc, int kn_floor_mode); +void dotknown(CtdlIPC *ipc, int what, char *match); void load_floorlist(CtdlIPC *ipc); void create_floor(CtdlIPC *ipc); void edit_floor(CtdlIPC *ipc); diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index 9c17ccae7..a258379a7 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -1617,8 +1617,9 @@ void imap_command_loop(void) imap_free_transmitted_message(); gettimeofday(&tv2, NULL); - lprintf(CTDL_DEBUG, "IMAP %s took %ld microseconds\n", + lprintf(CTDL_DEBUG, "IMAP %s %s took %ld microseconds\n", parms[1], + (!strcasecmp(parms[1], "uid") ? parms[2] : ""), (tv2.tv_usec + (tv2.tv_sec * 1000000)) - (tv1.tv_usec + (tv1.tv_sec * 1000000)) ); }