/*
- * $Id$
- *
* Server functions which perform operations on user objects.
- *
*/
#include "sysdep.h"
/*
* Back end for CtdlSetRelationship()
*/
-void put_visit(struct visit *newvisit)
+void put_visit(visit *newvisit)
{
char IndexBuf[32];
int IndexLen = 0;
/* Store the record */
cdb_store(CDB_VISIT, IndexBuf, IndexLen,
- newvisit, sizeof(struct visit)
+ newvisit, sizeof(visit)
);
}
/*
* Define a relationship between a user and a room
*/
-void CtdlSetRelationship(struct visit *newvisit,
+void CtdlSetRelationship(visit *newvisit,
struct ctdluser *rel_user,
struct ctdlroom *rel_room)
{
/*
* Locate a relationship between a user and a room
*/
-void CtdlGetRelationship(struct visit *vbuf,
+void CtdlGetRelationship(visit *vbuf,
struct ctdluser *rel_user,
struct ctdlroom *rel_room)
{
rel_user->usernum);
/* Clear out the buffer */
- memset(vbuf, 0, sizeof(struct visit));
+ memset(vbuf, 0, sizeof(visit));
cdbvisit = cdb_fetch(CDB_VISIT, IndexBuf, IndexLen);
if (cdbvisit != NULL) {
memcpy(vbuf, cdbvisit->ptr,
- ((cdbvisit->len > sizeof(struct visit)) ?
- sizeof(struct visit) : cdbvisit->len));
+ ((cdbvisit->len > sizeof(visit)) ?
+ sizeof(visit) : cdbvisit->len));
cdb_free(cdbvisit);
}
else {
CtdlCreateRoom(MAILROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
CtdlCreateRoom(SENTITEMS, 4, "", 0, 1, 0, VIEW_MAILBOX);
CtdlCreateRoom(USERTRASHROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
- /* CtdlCreateRoom(USERDRAFTROOM, 4, "", 0, 1, 0, VIEW_MAILBOX); temporarily disabled for 7.60 */
+ CtdlCreateRoom(USERDRAFTROOM, 4, "", 0, 1, 0, VIEW_MAILBOX);
/* Run any startup routines registered by loadable modules */
PerformSessionHooks(EVT_LOGIN);
void CtdlUserLogout(void)
{
- CitContext *CCC = CC; /* CachedCitContext - performance boost */
+ CitContext *CCC = MyContext();
/*
* If there is a download in progress, abort it.
*/
strproc(pw);
strproc(CC->user.password);
code = strcasecmp(CC->user.password, pw);
+ free (pw);
}
if (!code) {
usbuf->timescalled = 0;
usbuf->posted = 0;
usbuf->axlevel = config.c_initax;
- usbuf->USscreenwidth = 80;
- usbuf->USscreenheight = 24;
usbuf->lastcall = time(NULL);
/* fetch a new user number */
return;
CtdlGetUser(&CC->user, CC->curr_user);
- cprintf("%d %d|%d|%d|\n",
+ cprintf("%d 80|24|%d|\n",
CIT_OK,
- CC->user.USscreenwidth,
- CC->user.USscreenheight,
(CC->user.flags & US_USER_SET)
- );
+ );
}
/*
return;
}
CtdlGetUserLock(&CC->user, CC->curr_user);
- CC->user.USscreenwidth = extract_int(new_parms, 0);
- CC->user.USscreenheight = extract_int(new_parms, 1);
CC->user.flags = CC->user.flags & (~US_USER_SET);
- CC->user.flags = CC->user.flags |
- (extract_int(new_parms, 2) & US_USER_SET);
-
+ CC->user.flags = CC->user.flags | (extract_int(new_parms, 2) & US_USER_SET);
CtdlPutUserLock(&CC->user);
cprintf("%d Ok\n", CIT_OK);
}
void cmd_slrp(char *new_ptr)
{
long newlr;
- struct visit vbuf;
- struct visit original_vbuf;
+ visit vbuf;
+ visit original_vbuf;
if (CtdlAccessCheck(ac_logged_in)) {
return;
CtdlGetUserLock(&CC->user, CC->curr_user);
CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
- memcpy(&original_vbuf, &vbuf, sizeof(struct visit));
+ memcpy(&original_vbuf, &vbuf, sizeof(visit));
vbuf.v_lastseen = newlr;
snprintf(vbuf.v_seen, sizeof vbuf.v_seen, "*:%ld", newlr);
void cmd_gtsn(char *argbuf) {
- char buf[SIZ];
+ visit vbuf;
if (CtdlAccessCheck(ac_logged_in)) {
return;
}
- CtdlGetSeen(buf, ctdlsetseen_seen);
- cprintf("%d %s\n", CIT_OK, buf);
+ /* Learn about the user and room in question */
+ CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
+
+ cprintf("%d ", CIT_OK);
+ client_write(vbuf.v_seen, strlen(vbuf.v_seen));
+ client_write(HKEY("\n"));
}
*/
int CtdlInvtKick(char *iuser, int op) {
struct ctdluser USscratch;
- struct visit vbuf;
+ visit vbuf;
char bbb[SIZ];
if (CtdlGetUser(&USscratch, iuser) != 0) {
* These commands are only allowed by aides, room aides,
* and room namespace owners
*/
- if (is_room_aide()
- || (atol(CC->room.QRname) == CC->user.usernum) ) {
+ if (is_room_aide()) {
+ /* access granted */
+ } else if ( ((atol(CC->room.QRname) == CC->user.usernum) ) && (CC->user.usernum != 0) ) {
/* access granted */
} else {
/* access denied */
* Returns 0 on success
*/
int CtdlForgetThisRoom(void) {
- struct visit vbuf;
+ visit vbuf;
/* On some systems, Aides are not allowed to forget rooms */
if (is_aide() && (config.c_aide_zap == 0)
int a;
char mailboxname[ROOMNAMELEN];
struct ctdlroom mailbox;
- struct visit vbuf;
+ visit vbuf;
struct cdbdata *cdbfr;
long *msglist = NULL;
int num_msgs = 0;
*/
void cmd_view(char *cmdbuf) {
int requested_view;
- struct visit vbuf;
+ visit vbuf;
if (CtdlAccessCheck(ac_logged_in)) {
return;
CtdlRegisterProtoHook(cmd_newu, "NEWU", "Autoconverted. TODO: document me.");
}
/* return our Subversion id for the Log */
- return "$Id$";
+ return "user_ops";
}