* Added a CtdlGotoRoom() function to the CitadelAPI.
authorArt Cancro <ajc@citadel.org>
Mon, 24 Aug 1998 04:46:53 +0000 (04:46 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 24 Aug 1998 04:46:53 +0000 (04:46 +0000)
citadel/ChangeLog
citadel/citadelapi.c
citadel/ipcdef.h
citadel/techdoc/api.txt

index 6c0e2614f84d74e47f7d86b0a58f012eef1f3a04..34ad3a0a2f27ca3c4807c817e0979d7c6493df93 100644 (file)
@@ -1,3 +1,6 @@
+Mon Aug 24 00:45:55 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * Added a CtdlGotoRoom() function to the CitadelAPI.
 Sun Aug 23 21:47:00 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * sysoputil is finally dead!  Removed it from the build.
        * Added userpurge.c server extension (initial implementation)
index 36a287ed2d0a060019a1be5933d46cb3549ed085..5f01e34f93144338d481a8edaace73a16c0af905 100644 (file)
@@ -19,6 +19,7 @@ struct CtdlInternalList {
 
 struct CtdlServerHandle CtdlAppHandle;
 struct CtdlServInfo CtdlAppServInfo;
+struct CtdlRoomInfo CtdlCurrentRoom;
 int CtdlErrno = 0;
 
 void logoff(int exitcode) {
@@ -78,7 +79,7 @@ void CtdlInternalExtract(char *dest, char *source, int parmnum)
        }
 
 /*
- * CtdlInternalExtractInt()  -  CtdlInternalExtract an int parm w/o supplying a buffer
+ * CtdlInternalExtractInt()  -  Extract an int parm w/o supplying a buffer
  */
 int CtdlInternalExtractInt(char *source, int parmnum)
 {
@@ -89,7 +90,7 @@ int CtdlInternalExtractInt(char *source, int parmnum)
        }
 
 /*
- * CtdlInternalExtractLong()  -  CtdlInternalExtract an long parm w/o supplying a buffer
+ * CtdlInternalExtractLong()  -  Extract an long parm w/o supplying a buffer
  */
 long CtdlInternalExtractLong(char *source, long int parmnum)
 {
@@ -139,9 +140,11 @@ main(int argc, char *argv[])
        if (argc < 3) exit(1);
 
        /* Zeroing out the server handle neatly sets the values of
-        * CtdlAppHandle to sane default values
+        * CtdlAppHandle to sane default values.  This also holds true
+        * for the CtdlCurrentRoom.
         */
        bzero(&CtdlAppHandle, sizeof(struct CtdlServerHandle));
+       bzero(&CtdlCurrentRoom, sizeof(struct CtdlRoomInfo));
 
        /* Now parse the command-line arguments fed to us by the server */
        for (a=0; a<argc; ++a) switch(a) {
@@ -190,12 +193,8 @@ main(int argc, char *argv[])
                serv_gets(buf);
                }
 
-       sprintf(buf, "GOTO %s", CtdlAppHandle.InitialRoom);
-       serv_puts(buf);
-       serv_gets(buf);
-       if (buf[0] != '2') {
-               serv_puts("GOTO _BASEROOM_");
-               serv_gets(buf);
+       if (CtdlGotoRoom(CtdlAppHandle.InitialRoom) != 0) {
+               CtdlGotoRoom("_BASEROOM_");
                }
 
        /* Now do the loop. */
@@ -399,3 +398,21 @@ int CtdlForEachUser(int (*CallBack)(char *EachUser))  {
 
        return(0);
        }
+
+
+
+/*
+ * Goto a different room
+ */
+int CtdlGotoRoom(char *RoomName) {
+       char buf[256];
+
+       sprintf(buf, "GOTO %s", RoomName);
+       serv_puts(buf);
+       serv_gets(buf);
+       if (buf[0] != '2') {
+               CtdlErrno = atoi(buf);
+               return(CtdlErrno);
+               }
+       extract(&CtdlCurrentRoom.RoomName, &buf[4], 0);
+       }
index f6365f4fa1baeecaa8d2f69923eb20c26b958669..5d8069f89fb98ba642b8eec6874464c5f4d8af47 100644 (file)
@@ -83,3 +83,6 @@ struct CtdlServerHandle {
        int AssocClientSession;
        };
 
+struct CtdlRoomInfo {
+       char RoomName[32];
+       };
index bde1492d868e9c0f69409ce4fdf60f8ea6514cd0..bfe9e5017172d398de29b722e80123858e80037d 100644 (file)
@@ -132,3 +132,21 @@ a user number which already exists, or which has not yet been assigned.
 on the system; the single argument passed to the function will be the name of
 the user being processed.
 
+  ROOM FUNCTIONS
+  --------------
+  extern struct CtdlRoomInfo CtdlCurrentRoom;
+  This structure contains information about the current room.
+ int CtdlGotoRoom(char *RoomName)
+ Goto any room to which the extension has access.  An extension with
+administrative or privileged access may enter any room on the system.  An
+extension running in the context of an ordinary user may enter any room to
+which the user has access.