Changeset 803 for trunk/ithildin/modules/ircd/client.h
- Timestamp:
- 05/31/07 15:15:23 (5 years ago)
- File:
-
- 1 edited
-
trunk/ithildin/modules/ircd/client.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ithildin/modules/ircd/client.h
r801 r803 2 2 * client.h: client structure declarations 3 3 * 4 * Copyright 2002 the Ithildin Project.4 * Copyright 2002-2007 the Ithildin Project. 5 5 * See the COPYING file for more information on licensing and use. 6 6 * … … 78 78 char *make_client_mask(char *mask); 79 79 80 /* mode stuff here. modules/systems should acquire and release modes as they81 * need them. You may not get the mode you asked for, if something else is82 * already using it, so don't assume that you did. The function will return83 * the bitmask used to check for the mode on a user's structure, and also place84 * the actual mode letter in a character, passed as a pointer. If you don't85 * care what mode you get specify '\0' as the suggested field. Also, if you86 * want all users who set your specific mode to be placed in a 'send flag'87 * group (see send.[ch]) pass the value of the flag to use, if not pass -1.88 * The last argument is the name of the function used to determine whether a89 * user can set/unset the node. The arguments are the client setting the mode,90 * the client on which the mode is being set, the mode character, an integer91 * specifying whether the mode is being set or unset, a pointer to an argument92 * (may be NULL), and a pointer to allow the function to specify whether the93 * mode used the argument or not. */94 #define USERMODE_FUNC(x) \95 int x(client_t *by __UNUSED, client_t *cli, unsigned char mode __UNUSED, \96 int set __UNUSED, char *arg __UNUSED, int *argused __UNUSED)97 typedef int (*usermode_func)(client_t *, client_t *, unsigned char, int,98 char *, int *);99 100 uint64_t usermode_request(unsigned char, unsigned char *, int, int,101 usermode_func);102 103 /* use this function to release a mode if you no longer care about it being set104 * on users. You are still responsible for clearing out the group if the mode105 * had one */106 void usermode_release(unsigned char);107 108 /* this function provides a way to update the assigned function for a109 * usermode */110 void usermode_update_func(unsigned char, usermode_func);111 112 /* this function returns a mode string from the passed 64bit integer. the113 * string is statically allocated inside the function, if global is unset, get114 * all usermodes, otherwise, get only global modes */115 unsigned char *usermode_getstr(uint64_t, char);116 117 /* this does the opposite of the above, it returns a mask from a given string118 * of modes, if global is non-false, the mask will only contain 'global' flags,119 * otherwise, all flags are returned. */120 uint64_t usermode_getmask(unsigned char *, char);121 122 /* this performs a 'diff' on the modes, and returns a string reflecting the123 * change from old modes to new modes, and places the result in 'result' */124 void usermode_diff(uint64_t, uint64_t, char *, char);125 126 /* this does all the work to set a mode on a user. it checks to see if they127 * can set it, and places them in any appropriate groups. if the function128 * succeeds it returns 1, if the user cannot set the mode it returns 0 */129 int usermode_set(unsigned char, client_t *, client_t *, char *, int *);130 131 /* this does like above, but unsetting instead of setting. */132 int usermode_unset(unsigned char, client_t *, client_t *, char *, int *);133 134 /* returns positive if a given mode is valid and set on a client */135 #define usermode_isset(client, themode) \136 ((ircd.umodes.modes[themode].avail == 0) ? \137 (client->modes & ircd.umodes.modes[themode].mask) : \138 0)139 140 /* we know we will create some modes, create special macros to check them */141 #define INVIS(client) (client->modes & ircd.umodes.modes['i'].mask)142 #define OPER(client) (client->modes & ircd.umodes.modes['o'].mask)143 144 struct usermode {145 unsigned char mode; /* the actual mode */146 char avail; /* 1 if available, 0 otherwise */147 #define USERMODE_FL_GLOBAL 0x1 /* the usermode is spread across the148 network */149 #define USERMODE_FL_OPER 0x2 /* the usermode is operator only */150 #define USERMODE_FL_PRESERVE 0x4 /* preserve the mode once set unless151 explicitly unset by the user */152 int flags; /* flags for the usermode */153 uint64_t mask; /* the bitmask for the mode */154 usermode_func changefunc; /* the changer function for the mode */155 int sflag; /* send flag (if any) for this mode. */156 };157 158 80 TAILQ_HEAD(client_history_list, client_history); 159 81 struct client_history {
Note: See TracChangeset
for help on using the changeset viewer.
