Empty handlers for closing tags of <bind> and <query> stanzas. We handled those...
[citadel.git] / citadel / user_ops.c
index 0b50d129b651133086a1e96f1dc89528419dc14a..92cf99e24c8164c65cf316ac6ac59f60afbaa68e 100644 (file)
@@ -29,17 +29,6 @@ int chkpwd_write_pipe[2];
 int chkpwd_read_pipe[2];
 
 
-
-/*
- * getuser()  -  retrieve named user into supplied buffer.
- *            returns 0 on success
- */
-int getuser(struct ctdluser *usbuf, char name[])
-{
-       return CtdlGetUser(usbuf, name);
-}
-
-
 /*
  * CtdlGetUser()  -  retrieve named user into supplied buffer.
  *            returns 0 on success
@@ -76,6 +65,12 @@ int CtdlGetUser(struct ctdluser *usbuf, char *name)
        return CtdlGetUserLen(usbuf, name, cutuserkey(name));
 }
 
+int CtdlLockGetCurrentUser(void)
+{
+       CitContext *CCC = CC;
+
+       return CtdlGetUserLen(&CCC->user, CCC->curr_user, cutuserkey(CCC->curr_user));
+}
 
 /*
  * CtdlGetUserLock()  -  same as getuser() but locks the record
@@ -92,15 +87,6 @@ int CtdlGetUserLock(struct ctdluser *usbuf, char *name)
 }
 
 
-/*
- * lgetuser()  -  same as getuser() but locks the record
- */
-int lgetuser(struct ctdluser *usbuf, char *name)
-{
-       return CtdlGetUserLock(usbuf, name);
-}
-
-
 /*
  * CtdlPutUser()  -  write user buffer into the correct place on disk
  */
@@ -119,13 +105,9 @@ void CtdlPutUser(struct ctdluser *usbuf)
 
 }
 
-
-/*
- * putuser()  -  write user buffer into the correct place on disk
- */
-void putuser(struct ctdluser *usbuf)
+void CtdlPutCurrentUserLock()
 {
-       CtdlPutUser(usbuf);
+       CtdlPutUser(&CC->user);
 }
 
 
@@ -139,14 +121,6 @@ void CtdlPutUserLock(struct ctdluser *usbuf)
 }
 
 
-/*
- * lputuser()  -  same as putuser() but locks the record
- */
-void lputuser(struct ctdluser *usbuf)
-{
-       CtdlPutUserLock(usbuf);
-}
-
 
 /*
  * rename_user()  -  this is tricky because the user's display name is the database key
@@ -447,19 +421,6 @@ int CtdlGetUserByNumber(struct ctdluser *usbuf, long number)
        return(r);
 }
 
-/*
- * getuserbynumber() - get user by number
- *                     returns 0 if user was found
- *
- * Note: fetching a user this way requires one additional database operation.
- */
-int getuserbynumber(struct ctdluser *usbuf, long number)
-{
-       return CtdlGetUserByNumber(usbuf, number);
-}
-
-
-
 /*
  * Helper function for rebuild_usersbynumber()
  */
@@ -567,10 +528,12 @@ int CtdlLoginExistingUser(char *authname, const char *trythisname)
 
        /* If a "master user" is defined, handle its authentication if specified */
        CC->is_master = 0;
-       if (strlen(config.c_master_user) > 0) if (strlen(config.c_master_pass) > 0) if (authname) {
-               if (!strcasecmp(authname, config.c_master_user)) {
-                       CC->is_master = 1;
-               }
+       if ((configlen.c_master_user > 0) && 
+           (configlen.c_master_pass > 0) &&
+           (authname != NULL) &&
+           (!strcasecmp(authname, config.c_master_user)))
+       {
+               CC->is_master = 1;
        }
 
        /* Continue attempting user validation... */
@@ -653,7 +616,7 @@ int CtdlLoginExistingUser(char *authname, const char *trythisname)
        else {
                /* native auth mode */
 
-               struct recptypes *valid = NULL;
+               recptypes *valid = NULL;
        
                /* First, try to log in as if the supplied name is a display name */
                found_user = CtdlGetUser(&CC->user, username);
@@ -743,7 +706,7 @@ void do_login(void)
        PerformSessionHooks(EVT_LOGIN);
 
        /* Enter the lobby */
-       CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
+       CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
 }
 
 
@@ -1291,7 +1254,7 @@ int CtdlForgetThisRoom(void) {
        CtdlPutUserLock(&CC->user);
 
        /* Return to the Lobby, so we don't end up in an undefined room */
-       CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL);
+       CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
        return(0);
 
 }