* Committed matt's latest patch set
authorArt Cancro <ajc@citadel.org>
Sat, 23 Dec 2006 01:03:39 +0000 (01:03 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 23 Dec 2006 01:03:39 +0000 (01:03 +0000)
citadel/citadel.c
citadel/citadel.rc
citadel/citadel_ipc.c
citadel/commands.c
citadel/messages.c
citadel/messages/dotopt
citadel/messages/entopt
citadel/rooms.c
citadel/rooms.h
citadel/serv_imap.c

index 383ba66322ad3d3bd98da675e68b1506ee1ef981..cd7fab30a96f7817e78eecd40f9d128b452b222a 100644 (file)
@@ -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
index 2a726fe65919b2de6aa7c99e144ead20276ba311..6145bc01b3de24b13c778b55caa5464b2f4a45f7 100644 (file)
@@ -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 &<Previous floor
 
+cmd=120,0,&.,&Known,&Anonymous rooms
+cmd=121,0,&.,&Known,&Directory rooms
+cmd=68,0,&.,&Known,&Floors
+cmd=49,0,&.,&Known,room &Info
+cmd=122,0,&.,&Known,&Match rooms:
+cmd=123,0,&.,&Known,preferred &Only rooms
+cmd=124,0,&.,&Known,&Private rooms
+cmd=125,0,&.,&Known,&Read only rooms
+cmd=126,0,&.,&Known,&Shared rooms
+cmd=19,0,&.,&Known,&Zapped rooms
+
 #
 # Command 69 allows the user to enter a server command directly.  It is
 # primarily for testing and not intended for general use.  Usually there
index 71b2e89abe0e530d374190e9dace9977dffa6fac..04826e36527187104b2edf5059f5530a51746fc6 100644 (file)
@@ -327,6 +327,7 @@ int CtdlIPCKnownRooms(CtdlIPC *ipc, enum RoomList which, int floor, struct march
                }
        }
        *listing = march;
+       if (bbb) free(bbb);
        return ret;
 }
 
@@ -409,7 +410,9 @@ int CtdlIPCGotoRoom(CtdlIPC *ipc, const char *room, const char *passwd,
                rret[0]->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;
 }
 
index a575103175fcf83def5a683f961da232199b7195..8a9ea1911d4ff5440a56531516c60295b8f93ed8 100644 (file)
@@ -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<strlen(buf); ++i) {
                if (buf[i]=='<') {
-                       scr_putc(buf[i]);
+                       pprintf("%c", buf[i]);
                        color(BRIGHT_MAGENTA);
                } else {
-                       if (buf[i]=='>') {
+                       if (buf[i]=='>'&& buf[i+1] != '>') {
                                color(DIM_WHITE);
                        }
-                       scr_putc(buf[i]);
+                       pprintf("%c", buf[i]);
                }
        }
        color(DIM_WHITE);
index fea2a7c061aaa0d4535e92ab7a73b95a9c0f6f72..7788bc822b14d6006fe75cc57820ef2c50393d15 100644 (file)
@@ -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);
 }
index fc6a52e2dd0c013a3164cb9c4062cd3459809236..8c21f90bc93819228b77e69d15d2ea48aa3b7cb4 100644 (file)
@@ -1,5 +1,6 @@
 One of:
  <E>nter
+ <K>nown
  <R>ead
  <A>ide options (aides only)
  <G>oto: (type room name)
@@ -7,4 +8,5 @@ One of:
  <H>elp: (type name of help file)
  <Z>apped rooms list
  <T>erminate
-
+ <+>, <-> skip to next, previous room
+ <>>, <<> skip to next, previous floor
index 1477e1bcb891d9c40ecfd221e9ff754a97f5bc49..4335b9174a233467ccd9a839965002a034202778 100644 (file)
@@ -3,6 +3,7 @@ One of:
  <B>io
  <C>onfiguration
  message with <E>ditor
+ <F>loor
  re<G>istration
  <M>essage
  <P>assword
index c1a066bd093d2ea22145132ffea9a17bcc8a6d6c..c7b2390806450ee09c21f857b7be95551db02d15 100644 (file)
@@ -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);
 }
 
 
index 68d9d652424474060dfaf6046ac354d8782ebd62..6e323657c7d5816a2ecf5fddd5f6ed64774bfd47 100644 (file)
@@ -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);
index 9c17ccae7aac8e3d98c231a46fe120d4e6454de0..a258379a7c88c8550f6ea883cb2e9da6fca121d7 100644 (file)
@@ -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))
        );
 }