* Updated citmail.c with the latest stuff from the production system.
authorArt Cancro <ajc@citadel.org>
Mon, 17 Aug 1998 04:08:48 +0000 (04:08 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 17 Aug 1998 04:08:48 +0000 (04:08 +0000)
        * Implemented AGUP and ASUP commands, but AGUP crashes the server
          after its first successful use (user-not-found's don't affect it).
          Haven't figured this one out yet...

citadel/ChangeLog
citadel/citadelapi.c
citadel/citmail.c
citadel/citserver.c
citadel/ipcdef.h
citadel/techdoc/api.txt
citadel/user_ops.c

index e4186819f250c29cd99e9b9a0bf1abb477ce27f0..6d67000e9d3c047aa4db69e68b9665899b6827af 100644 (file)
@@ -1,3 +1,9 @@
+Mon Aug 17 00:06:52 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * Updated citmail.c with the latest stuff from the production system.
+       * Implemented AGUP and ASUP commands, but AGUP crashes the server
+         after its first successful use (user-not-found's don't affect it).
+         Haven't figured this one out yet...
+
 Thu Aug  6 19:25:01 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Got the CitadelAPI library to the point where the server can start
          up an extension, and the extension will connect to the server, do
index ffdc6ca6d39a637c30f0c0f72acb9488d04f223d..68bd7f5805ee06c6f081b65e82ed429629d7c3b6 100644 (file)
@@ -9,6 +9,8 @@
 
 struct CtdlServerHandle CtdlAppHandle;
 struct CtdlServInfo CtdlAppServInfo;
+int CtdlErrno = 0;
+
 void CtdlMain();
 
 void logoff(exitcode) {
@@ -110,3 +112,26 @@ char *argv[]; {
        serv_puts("QUIT");
        exit(0);
        }
+
+
+int CtdlGetLastError() {
+       return CtdlErrno;
+       }
+
+
+int CtdlSendExpressMessage(char *ToUser, char *MsgText) {
+       char buf[256];
+
+       if (strlen(ToUser) + strlen(MsgText) > 248) {
+               CtdlErrno = ERROR + TOO_BIG;
+               return CtdlErrno;
+               }
+
+       sprintf(buf, "SEXP %s|%s", ToUser, MsgText);
+       serv_puts(buf);
+       serv_gets(buf);
+       
+       CtdlErrno = atoi(buf);
+       if (CtdlErrno == OK) CtdlErrno = 0;
+       return CtdlErrno;
+       }
index 720b4ed95b20ba26618de5c64c7993f21552f852..f2c367fccbe689f2da6b592e2108057471a2bc3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * citmail.c v4.0
+ * citmail.c v4.1
  *
  * This program may be used as a local mail delivery agent, which will allow
  * all Citadel users to receive Internet e-mail.  To enable this functionality,
@@ -368,19 +368,18 @@ void do_citmail(char recp[], int dtype) {
 
                /* chop the system name out, so we're left with a user */
                while (haschar(recp,'!')) strcpy(recp,&recp[1]);
+               }
 
-               /* now convert underscores to spaces */
-               for (a=0; a<strlen(recp); ++a) if (recp[a]=='_') recp[a]=' ';
-
-               /* Are we delivering to a room instead of a user? */
-               if (!strncasecmp(recp, "room ", 5)) {
-                       strcpy(targetroom, &recp[5]);
-                       strcpy(recp, "");
-                       }
-               else {
-                       strcpy(targetroom, "");
-                       }
+       /* Convert underscores to spaces */
+       for (a=0; a<strlen(recp); ++a) if (recp[a]=='_') recp[a]=' ';
 
+       /* Are we delivering to a room instead of a user? */
+       if (!strncasecmp(recp, "room ", 5)) {
+               strcpy(targetroom, &recp[5]);
+               strcpy(recp, "");
+               }
+       else {
+               strcpy(targetroom, "Mail");
                }
 
        time(&now);
index a61e09ffa41f8b0cb99f5f6014478e9bdcb71029..3c6d61dfde7dac925ea47956b7b29f4003feaede 100644 (file)
@@ -1053,33 +1053,41 @@ void *context_loop(struct CitContext *con)
                else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
                        cmd_uimg(&cmdbuf[5]);
                        }
+
                else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
                        cmd_uchg(&cmdbuf[5]);
                        }
+
                else if (!strncasecmp(cmdbuf, "TIME", 4)) {
                        cmd_time(&cmdbuf[5]);
                        }
+
                else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
                        cmd_hchg(&cmdbuf[5]);
                        }
+
                else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
                        cmd_rchg(&cmdbuf[5]);
                        }
+
                else if (!strncasecmp(cmdbuf, "EXTN", 4)) {
                        cmd_extn(&cmdbuf[5]);
                        }
+
                else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
                        cmd_agup(&cmdbuf[5]);
                        }
+
                else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
                        cmd_asup(&cmdbuf[5]);
                        }
+
                else {
                        cprintf("%d Unrecognized or unsupported command.\n",
                                ERROR);
                        }
 
-               } while(strncasecmp(cmdbuf,"QUIT",4));
+               } while(strncasecmp(cmdbuf, "QUIT", 4));
 
        cleanup(EXIT_NORMAL);
        return(NULL);
index a953ffadf299a47e7be1c5ec2c27d4864f4b66d4..c7bbcc67edc02f5f7407097eb361b35b627b5107 100644 (file)
@@ -12,6 +12,7 @@
 #define START_CHAT_MODE                800
 
 #define INTERNAL_ERROR         10
+#define TOO_BIG                        11
 #define NOT_LOGGED_IN          20
 #define CMD_NOT_SUPPORTED      30
 #define PASSWORD_REQUIRED      40
index 3666a3026d4d59c7c8c8f63b612641a62871c5cf..421c06f3d45710b4f0ba4b1fc2e78d241c2eca45 100644 (file)
@@ -62,28 +62,9 @@ to facilitate a consistent development experience.
 
 
 
USER ACCOUNT RELATED FUNCTIONS
- ------------------------------
INTERPROCESS COMMUNICATION FUNCTIONS
+ ------------------------------------
  
- These are functions which access or manipulate user records.  Each function
-requires a user name, but a zero-length string may be substituted to request
-the currently-logged-in user.  If a lookup fails, ERROR+NOT_LOGGED_IN or
-ERROR+NO_SUCH_USER may be set.
-
-  
- int CtdlGetUserAccessLevel(char *UserName)
- This function returns a user's access level, or -1 in the event of an error.
-The defined access levels are 1 through 6 and may be referenced in "axdefs.h"
-
-
- long CtdlGetUserNumber(char *UserName)
- This function returns a user's user number, or -1 in the event of an error.
-User numbers are always unique to the entire system and never reused, even if
-the user account is deleted.
- time_t CtdlGetUserLastCall(char *UserName)
+ int CtdlSendExpressMessage(char *ToUser, char *MsgText)
  
- This function returns the date and time (in standard Unix timestamp format)
-when the user last logged on to the server.
+ This function sends an express message (page) to the named user.
index ce832d949101d5383b52c90c1636ccef63e99438..1f61859b072cec24f5259bb3e20755cc815fe861 100644 (file)
@@ -50,8 +50,8 @@ int getuser(struct usersupp *usbuf, char name[]) {
                }
 
        cdbus = cdb_fetch(CDB_USERSUPP, lowercase_name, strlen(lowercase_name));
-       if (cdbus == NULL) {    /* not found */
-               return(1);
+       if (cdbus == NULL) {
+               return(1);      /* user not found */
                }
 
        memcpy(usbuf, cdbus->ptr, cdbus->len);
@@ -87,7 +87,8 @@ void putuser(struct usersupp *usbuf, char *name)
                lowercase_name[a] = tolower(name[a]);
                }
 
-       cdb_store(CDB_USERSUPP, lowercase_name, strlen(lowercase_name),
+       cdb_store(CDB_USERSUPP,
+               lowercase_name, strlen(lowercase_name),
                usbuf, sizeof(struct usersupp));
 
        }
@@ -96,8 +97,7 @@ void putuser(struct usersupp *usbuf, char *name)
 /*
  * lputuser()  -  same as putuser() but locks the record
  */
-void lputuser(struct usersupp *usbuf, char *name)
-{
+void lputuser(struct usersupp *usbuf, char *name) {
        putuser(usbuf,name);
        end_critical_section(S_USERSUPP);
        }
@@ -117,8 +117,12 @@ int is_aide(void) {
  */
 int is_room_aide(void) {
        if ( (CC->usersupp.axlevel >= 6)
-               || (CC->quickroom.QRroomaide == CC->usersupp.usernum) ) return(1);
-       else return(0);
+          || (CC->quickroom.QRroomaide == CC->usersupp.usernum) ) {
+               return(1);
+               }
+       else {
+               return(0);
+               }
        }
 
 /*
@@ -1112,10 +1116,12 @@ void cmd_agup(char *cmdbuf) {
                }
 
        extract(requested_user, cmdbuf, 0);
+       lprintf(9, "Requesting <%s>\n", requested_user);
        if (getuser(&usbuf, requested_user) != 0) {
                cprintf("%d No such user.\n", ERROR + NO_SUCH_USER);
                return;
                }
+       lprintf(9, "getuser() returned zero\n");
 
        cprintf("%d %s|%s|%u|%d|%d|%d|%ld\n", 
                OK,
@@ -1126,6 +1132,8 @@ void cmd_agup(char *cmdbuf) {
                usbuf.posted,
                (int)usbuf.axlevel,
                usbuf.usernum);
+
+       lprintf(9, "Done.\n");
        }