Modified the behavior of ForEachUser() to do the two phase load/perform cycle
[citadel.git] / citadel / user_ops.h
1 /* 
2  * Header file for server functions which perform operations on user objects.
3  *
4  * Copyright (c) 1987-2019 by the citadel.org team
5  *
6  * This program is open source software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License, version 3.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14
15 #ifndef __USER_OPS_H__
16 #define __USER_OPS_H__
17
18 #include <ctype.h>
19 #include <syslog.h>
20
21 int hash (char *str);
22 int is_aide (void);
23 int is_room_aide (void);
24 int CtdlCheckInternetMailPermission(struct ctdluser *who);
25 void rebuild_usersbynumber(void);
26 void session_startup (void);
27 void logged_in_response(void);
28 int purge_user (char *pname);
29 int getuserbyuid(struct ctdluser *usbuf, uid_t number);
30
31 int create_user(char *newusername, int become_user, uid_t uid);
32 enum {
33         CREATE_USER_DO_NOT_BECOME_USER,
34         CREATE_USER_BECOME_USER
35 };
36 #define NATIVE_AUTH_UID (-1)
37
38 void do_login(void);
39 int CtdlInvtKick(char *iuser, int op);
40 void ForEachUser(void (*CallBack) (char *, void *out_data), void *in_data);
41 int NewMailCount(void);
42 int InitialMailCheck(void);
43 void put_visit(visit *newvisit);
44 /* MailboxName is deprecated us CtdlMailboxName instead */
45 void MailboxName(char *buf, size_t n, const struct ctdluser *who,
46                  const char *prefix) __attribute__ ((deprecated));
47 int GenerateRelationshipIndex(  char *IndexBuf,
48                                 long RoomID,
49                                 long RoomGen,
50                                 long UserID);
51 int CtdlAssociateSystemUser(char *screenname, char *loginname);
52
53
54
55
56 void CtdlSetPassword(char *new_pw);
57
58 int CtdlForgetThisRoom(void);
59
60 void cmd_newu (char *cmdbuf);
61 void start_chkpwd_daemon(void);
62
63
64 #define RENAMEUSER_OK                   0       /* Operation succeeded */
65 #define RENAMEUSER_LOGGED_IN            1       /* Cannot rename a user who is currently logged in */
66 #define RENAMEUSER_NOT_FOUND            2       /* The old user name does not exist */
67 #define RENAMEUSER_ALREADY_EXISTS       3       /* An account with the desired new name already exists */
68
69 int rename_user(char *oldname, char *newname);
70
71 long cutusername(char *username);
72 void makeuserkey(char *key, const char *username, long len);
73 int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid);
74
75 #endif