Patches submitted by matt:
authorArt Cancro <ajc@citadel.org>
Sun, 22 Oct 2006 05:15:36 +0000 (05:15 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 22 Oct 2006 05:15:36 +0000 (05:15 +0000)
 Added:
 ** .RC .RS       Read configuration, Read system info (citadel.c)
 ** .> .< .+ .-   Same as <>+- But skips instead. (citadel.c)

 Fixed:
 ** .Z not displaying zapped rooms. (rooms.c)
 ** U .U Ungoto wasn't restoring the # of last read in rooms in which the last
 message read was zero (rooms visited for the first time). The work-around I
 chose was to set it to 1 instead of 0 in these cases.    (rooms.c)
 ** .aide edituser() spaces in front of 'Permission to send internet mail'
 (routines.c)
 ** .rb? list_bio() segfaults if no users have a bio (routines2.c)

citadel/citadel.c
citadel/citadel.rc
citadel/help/summary
citadel/messages/readopt
citadel/rooms.c
citadel/routines.c
citadel/routines2.c

index 9621e3528481a2b701f62ca1170cf4f9c08188cf..383ba66322ad3d3bd98da675e68b1506ee1ef981 100644 (file)
@@ -733,7 +733,7 @@ void room_tree_list_query(struct ctdlroomlisting *rp, char *findrmname, int find
 /*
  * step through rooms on current floor
  */
-void  gotoroomstep(CtdlIPC *ipc, int direction)
+void  gotoroomstep(CtdlIPC *ipc, int direction, int mode)
 {
        struct march *listing = NULL;
        struct march *mptr;
@@ -823,7 +823,13 @@ void  gotoroomstep(CtdlIPC *ipc, int direction)
        /* Free the tree */
        room_tree_list_query(rl, NULL, 0, NULL, NULL, NULL);
 
-       updatels(ipc);
+       if (mode == 0) { /* not skipping */
+           updatels(ipc);
+       } else {
+               if (rc_alt_semantics) {
+               updatelsa(ipc);
+               }
+       }
        dotgoto(ipc, rmname, 1, 0);
 }
 
@@ -831,7 +837,7 @@ void  gotoroomstep(CtdlIPC *ipc, int direction)
 /*
  * step through floors on system
  */
-void  gotofloorstep(CtdlIPC *ipc, int direction)
+void  gotofloorstep(CtdlIPC *ipc, int direction, int mode)
 {
        int  tofloor;
 
@@ -855,9 +861,124 @@ void  gotofloorstep(CtdlIPC *ipc, int direction)
                scr_printf("(%s)\n", floorlist[tofloor] );
        }
 
-       gotofloor(ipc, floorlist[tofloor], GF_GOTO);
+       gotofloor(ipc, floorlist[tofloor], mode);
 }
 
+/* 
+ * Display user 'preferences'.
+ */
+extern int rc_prompt_control;
+void read_config(CtdlIPC *ipc)
+{
+       char buf[SIZ];
+       char *resp = NULL;
+       int r;                  /* IPC response code */
+    char _fullname[USERNAME_SIZE];
+       long _usernum;
+       int _axlevel, _timescalled, _posted;
+       time_t _lastcall;
+       struct ctdluser *user = NULL;
+
+       /* get misc user info */   
+       r = CtdlIPCGetBio(ipc, fullname, &resp, buf);
+       if (r / 100 != 1) {
+               pprintf("%s\n", buf);
+               return;
+       }
+       extract_token(_fullname, buf, 1, '|', sizeof fullname);
+       _usernum = extract_long(buf, 2);
+       _axlevel = extract_int(buf, 3);
+       _lastcall = extract_long(buf, 4);
+    _timescalled = extract_int(buf, 5);
+       _posted = extract_int(buf, 6);
+       free(resp);
+       resp = NULL;
+   
+       /* get preferences */
+       r = CtdlIPCGetConfig(ipc, &user, buf);
+       if (r / 100 != 2) {
+               scr_printf("%s\n", buf);
+               free(user);
+               return;
+       }
+
+       /* show misc user info */
+       scr_printf("%s\nAccess level: %d (%s)\n"
+                  "User #%ld / %d Calls / %d Posts",
+                  _fullname, _axlevel, axdefs[(int) _axlevel],
+                  _usernum, _timescalled, _posted);
+       if (_lastcall > 0L) {
+               scr_printf(" / Curr login: %s",
+                          asctime(localtime(&_lastcall)));
+       }
+       scr_printf("\n");
+
+       /* show preferences */
+       scr_printf("Your screen width: ");                                     color(BRIGHT_CYAN); scr_printf("%d",   /*user->USscreenwidth*/ screenwidth);          color(DIM_WHITE); 
+       scr_printf(", height: ");                                              color(BRIGHT_CYAN); scr_printf("%d\n", /*user->USscreenheight*/ screenheight);        color(DIM_WHITE);  
+       scr_printf("Are you an experienced Citadel user: ");                   color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_EXPERT) ? "Yes" : "No");     color(DIM_WHITE);
+       scr_printf("Print last old message on New message request: ");         color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_LASTOLD)? "Yes" : "No");     color(DIM_WHITE);
+       scr_printf("Prompt after each message: ");                             color(BRIGHT_CYAN); scr_printf("%s\n", (!(user->flags & US_NOPROMPT))? "Yes" : "No"); color(DIM_WHITE);
+       if ((user->flags & US_NOPROMPT) == 0) {
+       scr_printf("Use 'disappearing' prompts: ");                        color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_DISAPPEAR)? "Yes" : "No");   color(DIM_WHITE);
+       }
+       scr_printf("Pause after each screenful of text: ");                    color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_PAGINATOR)? "Yes" : "No");   color(DIM_WHITE);
+    if (rc_prompt_control == 3 && (user->flags & US_PAGINATOR)) {
+       scr_printf("<N>ext and <S>top work at paginator prompt: ");        color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_PROMPTCTL)? "Yes" : "No");   color(DIM_WHITE);
+       }
+    if (rc_floor_mode == RC_DEFAULT) {
+       scr_printf("View rooms by floor: ");                               color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_FLOORS)? "Yes" : "No");          color(DIM_WHITE);
+       }
+       if (rc_ansi_color == 3) {
+           scr_printf("Enable color support: ");                              color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_COLOR)? "Yes" : "No");       color(DIM_WHITE);
+       }
+       scr_printf("Be unlisted in userlog: ");                                color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_UNLISTED)? "Yes" : "No");    color(DIM_WHITE);
+       if (strlen(editor_paths[0]) > 0) {
+       scr_printf("Always enter messages with the full-screen editor: "); color(BRIGHT_CYAN); scr_printf("%s\n", (user->flags & US_EXTEDIT)? "Yes" : "No");     color(DIM_WHITE);
+       }
+       free(user);
+}
+
+/*
+ * Display system statistics.
+ */
+void system_info(CtdlIPC *ipc)
+{
+       char buf[SIZ];
+       char *resp = NULL;
+       size_t bytes;
+       int mrtg_users, mrtg_active_users; 
+       char mrtg_server_uptime[40];
+       long mrtg_himessage;
+       int ret;                        /* IPC response code */
+
+       /* get #users, #active & server uptime */
+       ret = CtdlIPCGenericCommand(ipc, "MRTG|users", NULL, 0, &resp, &bytes, buf);
+       mrtg_users = extract_int(resp, 0);
+       remove_token(resp, 0, '\n');
+       mrtg_active_users = extract_int(resp, 0);
+       remove_token(resp, 0, '\n');
+       extract_token(mrtg_server_uptime, resp, 0, '\n', sizeof mrtg_server_uptime);
+    free(resp);
+       resp = NULL;
+
+       /* get high message# */
+       ret = CtdlIPCGenericCommand(ipc, "MRTG|messages", NULL, 0, &resp, &bytes, buf);
+       mrtg_himessage = extract_long(resp, 0);
+       free(resp);
+       resp = NULL;
+
+       /* refresh server info just in case */
+       CtdlIPCServerInfo(ipc, buf);
+
+       scr_printf("You are connected to %s (%s) @%s\n", ipc->ServInfo.nodename, ipc->ServInfo.humannode, ipc->ServInfo.fqdn);
+       scr_printf("running %s with text client v%.2f,\n", ipc->ServInfo.software, (float)REV_LEVEL/100);
+    scr_printf("and located in %s.\n", ipc->ServInfo.site_location);
+    scr_printf("Connected users %d / Active users %d / Highest message #%ld\n", mrtg_users, mrtg_active_users, mrtg_himessage);
+    scr_printf("Server uptime: %s\n", mrtg_server_uptime);
+    scr_printf("Your system administrator is %s.\n", ipc->ServInfo.sysadm);
+    scr_printf("Copyright (C)1987-2006 by the Citadel development team\n");
+}
 
 /*
  * forget all rooms on current floor
@@ -2033,19 +2154,43 @@ NEWUSR: if (strlen(rc_password) == 0) {
                                break;
 
             case 110:           /* <+> Next room */
-                 gotoroomstep(ipc, 1);
+                 gotoroomstep(ipc, 1, 0);
                             break;
 
             case 111:           /* <-> Previous room */
-                 gotoroomstep(ipc, 0);
+                 gotoroomstep(ipc, 0, 0);
                             break;
 
                        case 112:           /* <>> Next floor */
-                 gotofloorstep(ipc, 1);
+                 gotofloorstep(ipc, 1, GF_GOTO);
                             break;
 
                        case 113:           /* <<> Previous floor */
-                 gotofloorstep(ipc, 0);
+                 gotofloorstep(ipc, 0, GF_GOTO);
+                                break;
+
+            case 116:           /* <.> skip to <+> Next room */
+                 gotoroomstep(ipc, 1, 1);
+                            break;
+
+            case 117:           /* <.> skip to <-> Previous room */
+                 gotoroomstep(ipc, 0, 1);
+                            break;
+
+                       case 118:           /* <.> skip to <>> Next floor */
+                 gotofloorstep(ipc, 1, GF_SKIP);
+                            break;
+
+                       case 119:           /* <.> skip to <<> Previous floor */
+                 gotofloorstep(ipc, 0, GF_SKIP);
+                                break;
+
+                       case 114:           
+                 read_config(ipc);
+                                break;
+
+                       case 115:           
+                 system_info(ipc);
                                 break;
 
                        default: /* allow some math on the command */
index 2ad908f51535a0ae1025ae3dab469423023413aa..2a726fe65919b2de6aa7c99e144ead20276ba311 100644 (file)
@@ -332,6 +332,8 @@ cmd=71,0,&.,read &Last:
 cmd=9,0,&.,&Read,&Last five msgs
 cmd=14,0,&.,&Read,&Directory
 cmd=49,0,&.,&Read,&Info file
+cmd=114,0,&.,&Read,&Configuration
+cmd=115,0,&.,&Read,&System info
 cmd=35,0,&.,&Enter,&Password
 cmd=36,0,&.,&Enter,&ASCII message
 cmd=37,0,&.,&Enter,&Configuration
@@ -382,6 +384,10 @@ cmd=110,0,&+Next room
 cmd=111,0,&-Previous room
 cmd=112,0,&>Next floor
 cmd=113,0,&<Previous floor
+cmd=116,0,&.,skip to &+Next room
+cmd=117,0,&.,skip to &-Previous room
+cmd=118,0,&.,skip to &>Next floor
+cmd=119,0,&.,skip to &<Previous floor
 
 #
 # Command 69 allows the user to enter a server command directly.  It is
index d951fbd7facd49e7a7a886664e6019396a031425..83d3c5c7c7061ba343d1974e47a0ef98400d3a82 100644 (file)
@@ -46,7 +46,9 @@ commands are available:
 
  <.> <R>ead <I>nfo file                   Read the room info file.
  <.> <R>ead <B>io                         Read other users' "bio" files.
+ <.> <R>ead <C>onfiguration               Display your 'preferences'.
+ <.> <R>ead <S>ystem info                 Display system statistics.
+
  
  Enter commands:
 
index 6a5a4acfa8c2d55e5bb828ff94433f7c4c3a73ab..f206d172cd4aa3beaf0f7b7c81059be697168299 100644 (file)
@@ -1,12 +1,14 @@
 One of:
  <B>io
  <D>irectory
+ <C>onfiguration
  <F>ile unformatted
  <I>nfo file
  <L>ast five messages
  <N>ew messages
  <O>ld messages
  <R>everse
+ <S>ystem info
  <T>extfile
  <U>serlist
  file using <X>modem
index ca9219c797bbd32972fc03fcc1b17164d6cc4662..c1a066bd093d2ea22145132ffea9a17bcc8a6d6c 100644 (file)
@@ -248,7 +248,7 @@ void list_other_floors(void)
 
 /*
  * List known rooms.  kn_floor_mode should be set to 0 for a 'flat' listing,
- * 1 to list rooms on the current floor, or 1 to list rooms on all floors.
+ * 1 to list rooms on the current floor, or 2 to list rooms on all floors.
  */
 void knrooms(CtdlIPC *ipc, int kn_floor_mode)
 {
@@ -326,7 +326,7 @@ void listzrooms(CtdlIPC *ipc)
 
 
        /* Ask the server for a room list */
-       r = CtdlIPCKnownRooms(ipc, UnsubscribedRooms, 1, &listing, buf);
+       r = CtdlIPCKnownRooms(ipc, UnsubscribedRooms, (-1), &listing, buf);
        if (r / 100 != 1) {
                listing = NULL;
        }
@@ -649,7 +649,7 @@ void dotungoto(CtdlIPC *ipc, char *towhere)
                scr_printf("%s\n", buf);
                return;
        }
-       r = CtdlIPCSetLastRead(ipc, uglistlsn[found], buf);
+       r = CtdlIPCSetLastRead(ipc, uglistlsn[found] ? uglistlsn[found] : 1, buf);
        if (r / 100 != 2) {
                scr_printf("%s\n", buf);
        }
@@ -675,7 +675,7 @@ void ungoto(CtdlIPC *ipc)
                scr_printf("%s\n", buf);
                return;
        }
-       r = CtdlIPCSetLastRead(ipc, uglistlsn[uglistsize-1], buf);
+       r = CtdlIPCSetLastRead(ipc, uglistlsn[uglistsize-1] ? uglistlsn[uglistsize-1] : 1, buf);
        if (r / 100 != 2) {
                scr_printf("%s\n", buf);
        }
index 65798e27f7065491ecbff55d45bb1c03f7918dc6..a023dafe8354154ed15f872ca74849a2d0b4a4e4 100644 (file)
@@ -136,11 +136,13 @@ void edituser(CtdlIPC *ipc, int cmd)
                }
        
                user->axlevel = intprompt("Access level", user->axlevel, 0, 6);
-       
-               user->flags = set_attr(ipc, user->flags,
+/*             user->flags = set_attr(ipc, user->flags,
                        "Permission to send Internet mail",
-                       US_INTERNET, 0);
-       
+                       US_INTERNET, 0); */
+               if (boolprompt("Permission to send Internet mail", (user->flags & US_INTERNET)))
+                       user->flags |= US_INTERNET;
+               else
+                       user->flags &= ~US_INTERNET;
                if (boolprompt("Ask user to register again", !(user->flags & US_REGIS)))
                        user->flags &= ~US_REGIS;
                else
index 5264df344f21425491c74dfa90c6d827521bca7f..07012ab1a6f16a306415aa744100ad12bf9525d3 100644 (file)
@@ -592,7 +592,7 @@ void list_bio(CtdlIPC *ipc)
                pprintf("%s\n", buf);
                return;
        }
-       while (strlen(resp)) {
+       while (resp && strlen(resp)) {
                extract_token(buf, resp, 0, '\n', sizeof buf);
                remove_token(resp, 0, '\n');
                if ((pos + strlen(buf) + 5) > screenwidth) {