+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
struct CtdlServerHandle CtdlAppHandle;
struct CtdlServInfo CtdlAppServInfo;
+int CtdlErrno = 0;
+
void CtdlMain();
void logoff(exitcode) {
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;
+ }
/*
- * 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,
/* 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);
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);
#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
- 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.
}
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);
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));
}
/*
* 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);
}
*/
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);
+ }
}
/*
}
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,
usbuf.posted,
(int)usbuf.axlevel,
usbuf.usernum);
+
+ lprintf(9, "Done.\n");
}