remove unused trace function
[citadel.git] / citadel / user_ops.h
1 #ifndef __USER_OPS_H__
2 #define __USER_OPS_H__
3
4 #include <ctype.h>
5 #include <syslog.h>
6
7 int hash (char *str);
8 int is_aide (void);
9 int is_room_aide (void);
10 int CtdlCheckInternetMailPermission(struct ctdluser *who);
11 void rebuild_usersbynumber(void);
12 void session_startup (void);
13 void logged_in_response(void);
14 int purge_user (char *pname);
15 int getuserbyuid(struct ctdluser *usbuf, uid_t number);
16
17 int create_user(char *newusername, int become_user, uid_t uid);
18 enum {
19         CREATE_USER_DO_NOT_BECOME_USER,
20         CREATE_USER_BECOME_USER
21 };
22 #define NATIVE_AUTH_UID (-1)
23
24 void do_login(void);
25 int CtdlInvtKick(char *iuser, int op);
26 void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data), void *in_data);
27 void ListThisUser(struct ctdluser *usbuf, void *data);
28 int NewMailCount(void);
29 int InitialMailCheck(void);
30 void put_visit(visit *newvisit);
31 /* MailboxName is deprecated us CtdlMailboxName instead */
32 void MailboxName(char *buf, size_t n, const struct ctdluser *who,
33                  const char *prefix) __attribute__ ((deprecated));
34 int GenerateRelationshipIndex(  char *IndexBuf,
35                                 long RoomID,
36                                 long RoomGen,
37                                 long UserID);
38 int CtdlAssociateSystemUser(char *screenname, char *loginname);
39
40
41
42
43 void CtdlSetPassword(char *new_pw);
44
45 int CtdlForgetThisRoom(void);
46
47 void cmd_newu (char *cmdbuf);
48 void start_chkpwd_daemon(void);
49
50
51 #define RENAMEUSER_OK                   0       /* Operation succeeded */
52 #define RENAMEUSER_LOGGED_IN            1       /* Cannot rename a user who is currently logged in */
53 #define RENAMEUSER_NOT_FOUND            2       /* The old user name does not exist */
54 #define RENAMEUSER_ALREADY_EXISTS       3       /* An account with the desired new name already exists */
55
56 int rename_user(char *oldname, char *newname);
57
58 ///#ifndef CTDL_INLINE_USR
59 ////#define CTDL_INLINE_USR static INLINE
60 ///#endif
61
62 ///CTDL_INLINE_USR 
63 static INLINE long cutuserkey(char *username) { 
64         long len;
65         len = strlen(username);
66         if (len >= USERNAME_SIZE)
67         {
68                 syslog(LOG_INFO, "Username too long: %s", username);
69                 len = USERNAME_SIZE - 1; 
70                 username[len]='\0';
71         }
72         return len;
73 }
74
75 /*
76  * makeuserkey() - convert a username into the format used as a database key
77  *               (it's just the username converted into lower case)
78  */
79 ///CTDL_INLINE_USR 
80 static INLINE void makeuserkey(char *key, const char *username, long len) {
81         int i;
82
83         if (len >= USERNAME_SIZE)
84         {
85                 syslog(LOG_INFO, "Username too long: %s", username);
86                 len = USERNAME_SIZE - 1; 
87         }
88         for (i=0; i<=len; ++i) {
89                 key[i] = tolower(username[i]);
90         }
91 }
92
93
94 int internal_create_user(char *username, struct ctdluser *usbuf, uid_t uid);
95
96 #endif