src/users.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  list_type
struct  user_entry_type
struct  laston_info
struct  bot_addr
struct  user_entry
struct  xtra_key
struct  filesys_stats
struct  chanuserrec
struct  userrec
struct  igrec

Defines

#define list_insert(a, b)
#define user_malloc(x)   _user_malloc(x, __FILE__, __LINE__)
#define user_realloc(x, y)   _user_realloc(x, y, __FILE__, __LINE__)
#define bot_flags(u)   ((long)get_user(&USERENTRY_BOTFL, (u)))
#define is_bot(u)   ((u) && ((u)->flags & USER_BOT))
#define is_owner(u)   ((u) && ((u)->flags & USER_OWNER))
#define IGNORE_NAME   "*ignore"
#define BAN_NAME   "*ban"
#define EXEMPT_NAME   "*exempt"
#define INVITE_NAME   "*Invite"
#define IGREC_PERM   2

Functions

 int ((int(*)(struct list_type **, struct list_type *)) global[74])(struct list_type **
struct list_typeint ((int(*)(struct list_type **, struct list_type *)) global[73])(struct list_type **
struct list_type *struct
list_type
int ((int(*)(struct list_type *, struct list_type *)) global[75])(struct list_type *
struct user_entry_type(*)(*) struct (global[196]))
struct user_entry_type(*)(*)(*) struct (global[192]))
struct user_entry_type(*)(*)(*)(*) struct (global[194]))
struct user_entry_type(*)(*)(*)(*)(*) struct (global[188]))
struct user_entry_type(*)(*)(*)(*)(*)(*) struct (global[190]))
struct user_entry_type(*)(*)(*)(*)(*)(*)(*) struct (global[191]))
struct user_entry_type(*)(*)(*)(*)(*)(*)(*)(*) struct (global[189]))
void * _user_malloc (int size, const char *file, int line)
void * _user_realloc (void *ptr, int size, const char *file, int line)
 int ((int(*)(struct user_entry_type *)) global[42])(struct user_entry_type *)
 int ((int(*)(struct user_entry_type *)) global[43])(struct user_entry_type *)
struct user_entry_type *struct
user_entry_type *char 
global (char *)
struct user_entry *struct
user_entry *struct 
global (struct user_entry_type *, struct userrec *)
 int ((int(*)(struct user_entry_type *, struct userrec *, void *)) global[41])(struct user_entry_type *
struct igrec *(*) struct (global[97]))
struct userrec *struct userrec
*struct 
global ()
struct userrec *struct userrec
*struct 
global (struct userrec *, char *)
struct userrecget_user_by_nick (char *)
struct userreccheck_chanlist ()
struct userreccheck_chanlist_hand ()
int def_unpack (struct userrec *u, struct user_entry *e)
int def_pack (struct userrec *u, struct user_entry *e)
int def_kill (struct user_entry *e)
int def_write_userfile (FILE *f, struct userrec *u, struct user_entry *e)
void *void *struct global (struct userrec *u, struct user_entry *e)
int def_set (struct userrec *u, struct user_entry *e, void *buf)
int def_gotshare (struct userrec *u, struct user_entry *e, char *data, int idx)
int def_tcl_get (Tcl_Interp *(*(Tcl_Interp **)(global[128])), struct userrec *u, struct user_entry *e, int argc, char **argv)
int def_tcl_set (Tcl_Interp *irp, struct userrec *u, struct user_entry *e, int argc, char **argv)
int def_expmem (struct user_entry *e)
void def_display (int idx, struct user_entry *e)
int def_dupuser (struct userrec *new, struct userrec *old, struct user_entry *e)

Variables

struct user_entry_type(* struct )(global[195]))

Define Documentation

#define BAN_NAME   "*ban"

Definition at line 133 of file users.h.

Referenced by write_bans().

#define bot_flags (  )     ((long)get_user(&USERENTRY_BOTFL, (u)))
#define EXEMPT_NAME   "*exempt"

Definition at line 134 of file users.h.

Referenced by write_exempts().

#define IGNORE_NAME   "*ignore"

Definition at line 132 of file users.h.

#define IGREC_PERM   2

Definition at line 170 of file users.h.

Referenced by equals_ignore().

#define INVITE_NAME   "*Invite"

Definition at line 135 of file users.h.

Referenced by write_invites().

#define is_bot (  )     ((u) && ((u)->flags & USER_BOT))

Definition at line 127 of file users.h.

Referenced by add_note().

#define is_owner (  )     ((u) && ((u)->flags & USER_OWNER))

Definition at line 128 of file users.h.

#define list_insert ( a,
 ) 
Value:
{                                              \
        (b)->next = *(a);                                               \
        *(a) = (b);                                                     \
}

Definition at line 35 of file users.h.

Referenced by dup_userlist(), share_change(), and tcl_setuser().

#define user_malloc (  )     _user_malloc(x, __FILE__, __LINE__)

Definition at line 115 of file users.h.

#define user_realloc ( x,
 )     _user_realloc(x, y, __FILE__, __LINE__)

Definition at line 116 of file users.h.


Function Documentation

void* _user_malloc ( int  size,
const char *  file,
int  line 
)

Definition at line 52 of file userrec.c.

References n_malloc(), nmalloc, and simple_sprintf.

00053 {
00054 #ifdef DEBUG_MEM
00055   char x[1024];
00056   const char *p;
00057 
00058   p = strrchr(file, '/');
00059   simple_sprintf(x, "userrec.c:%s", p ? p + 1 : file);
00060   return n_malloc(size, x, line);
00061 #else
00062   return nmalloc(size);
00063 #endif
00064 }

Here is the call graph for this function:

void* _user_realloc ( void *  ptr,
int  size,
const char *  file,
int  line 
)

Definition at line 66 of file userrec.c.

References n_realloc(), nrealloc, and simple_sprintf.

00067 {
00068 #ifdef DEBUG_MEM
00069   char x[1024];
00070   const char *p;
00071 
00072   p = strrchr(file, '/');
00073   simple_sprintf(x, "userrec.c:%s", p ? p + 1 : file);
00074   return n_realloc(ptr, size, x, line);
00075 #else
00076   return nrealloc(ptr, size);
00077 #endif
00078 }

Here is the call graph for this function:

struct userrec* check_chanlist (  )  [read]
struct userrec* check_chanlist_hand (  )  [read]
void def_display ( int  idx,
struct user_entry e 
)

Definition at line 183 of file userent.c.

References dprintf, user_entry_type::name, user_entry::string, user_entry::type, and user_entry::u.

00184 {
00185   dprintf(idx, "  %s: %s\n", e->type->name, e->u.string);
00186 }

int def_dupuser ( struct userrec new,
struct userrec old,
struct user_entry e 
)

Definition at line 188 of file userent.c.

References set_user, user_entry::string, user_entry::type, and user_entry::u.

00189 {
00190   return set_user(e->type, new, e->u.string);
00191 }

int def_expmem ( struct user_entry e  ) 

Definition at line 178 of file userent.c.

References user_entry::string, and user_entry::u.

00179 {
00180   return strlen(e->u.string) + 1;
00181 }

int def_gotshare ( struct userrec u,
struct user_entry e,
char *  data,
int  idx 
)

Definition at line 155 of file userent.c.

References userrec::handle, LOG_CMDS, user_entry_type::name, putlog, user_entry_type::set, and user_entry::type.

00156 {
00157   putlog(LOG_CMDS, "*", "%s: change %s %s", dcc[idx].nick, e->type->name,
00158          u->handle);
00159   return e->type->set(u, e, data);
00160 }

int def_kill ( struct user_entry e  ) 

Definition at line 98 of file userent.c.

References nfree, user_entry::string, and user_entry::u.

00099 {
00100   nfree(e->u.string);
00101   nfree(e);
00102   return 1;
00103 }

int def_pack ( struct userrec u,
struct user_entry e 
)

Definition at line 87 of file userent.c.

References list_type::extra, user_entry::list, list_type::next, NULL, user_entry::string, user_entry::u, and user_malloc.

00088 {
00089   char *tmp;
00090 
00091   tmp = e->u.string;
00092   e->u.list = user_malloc(sizeof(struct list_type));
00093   e->u.list->next = NULL;
00094   e->u.list->extra = tmp;
00095   return 1;
00096 }

int def_set ( struct userrec u,
struct user_entry e,
void *  buf 
)

Definition at line 117 of file userent.c.

References userrec::flags, userrec::handle, user_entry_type::name, nfree, noshare, NULL, share_greet, shareout, user_entry::string, strncpyz, user_entry::type, user_entry::u, USER_BOT, user_realloc, USER_UNSHARED, and USERENTRY_INFO.

00118 {
00119   char *string = (char *) buf;
00120 
00121   if (string && !string[0])
00122     string = NULL;
00123   if (!string && !e->u.string)
00124     return 1;
00125   if (string) {
00126     int l = strlen(string);
00127     char *i;
00128 
00129     if (l > 160)
00130       l = 160;
00131 
00132 
00133     e->u.string = user_realloc(e->u.string, l + 1);
00134 
00135     strncpyz(e->u.string, string, l + 1);
00136 
00137     for (i = e->u.string; *i; i++)
00138       /* Allow bold, inverse, underline, color text here...
00139        * But never add cr or lf!! --rtc
00140        */
00141       if ((unsigned int) *i < 32 && !strchr("\002\003\026\037", *i))
00142         *i = '?';
00143   } else {
00144     nfree(e->u.string);
00145     e->u.string = NULL;
00146   }
00147   if (!noshare && !(u->flags & (USER_BOT | USER_UNSHARED))) {
00148     if (e->type != &USERENTRY_INFO || share_greet)
00149       shareout(NULL, "c %s %s %s\n", e->type->name, u->handle,
00150                e->u.string ? e->u.string : "");
00151   }
00152   return 1;
00153 }

int def_tcl_get ( Tcl_Interp *(Tcl_Interp **)(global[128]),
struct userrec u,
struct user_entry e,
int  argc,
char **  argv 
)

Definition at line 162 of file userent.c.

References NULL, user_entry::string, and user_entry::u.

00164 {
00165   Tcl_AppendResult(interp, e->u.string, NULL);
00166   return TCL_OK;
00167 }

int def_tcl_set ( Tcl_Interp irp,
struct userrec u,
struct user_entry e,
int  argc,
char **  argv 
)

Definition at line 169 of file userent.c.

References BADARGS, user_entry_type::set, and user_entry::type.

00171 {
00172   BADARGS(4, 4, " handle type setting");
00173 
00174   e->type->set(u, e, argv[3]);
00175   return TCL_OK;
00176 }

int def_unpack ( struct userrec u,
struct user_entry e 
)

Definition at line 76 of file userent.c.

References list_type::extra, user_entry::list, list_type_kill, NULL, user_entry::string, and user_entry::u.

00077 {
00078   char *tmp;
00079 
00080   tmp = e->u.list->extra;
00081   e->u.list->extra = NULL;
00082   list_type_kill(e->u.list);
00083   e->u.string = tmp;
00084   return 1;
00085 }

int def_write_userfile ( FILE *  f,
struct userrec u,
struct user_entry e 
)

Definition at line 105 of file userent.c.

References user_entry_type::name, user_entry::string, user_entry::type, and user_entry::u.

00106 {
00107   if (fprintf(f, "--%s %s\n", e->type->name, e->u.string) == EOF)
00108     return 0;
00109   return 1;
00110 }

struct userrec* get_user_by_nick ( char *   )  [read]

Referenced by tcl_dumpfile().

Here is the caller graph for this function:

void* void* struct global ( struct userrec u,
struct user_entry e 
)

Definition at line 112 of file userent.c.

References user_entry::string, and user_entry::u.

00113 {
00114   return e->u.string;
00115 }

struct userrec* struct userrec* struct global ( struct userrec ,
char *   
) [read]

Definition at line 200 of file userrec.c.

References cache_hit, cache_miss, check_chanlist_hand(), check_dcclist_hand(), egg_strcasecmp, userrec::handle, userrec::next, NULL, and rmspace.

00201 {
00202   struct userrec *u, *ret;
00203 
00204   if (!handle)
00205     return NULL;
00206   /* FIXME: This should be done outside of this function. */
00207   rmspace(handle);
00208   if (!handle[0] || (handle[0] == '*'))
00209     return NULL;
00210   if (bu == userlist) {
00211     if (lastuser && !egg_strcasecmp(lastuser->handle, handle)) {
00212       cache_hit++;
00213       return lastuser;
00214     }
00215     ret = check_dcclist_hand(handle);
00216     if (ret) {
00217       cache_hit++;
00218       return ret;
00219     }
00220     ret = check_chanlist_hand(handle);
00221     if (ret) {
00222       cache_hit++;
00223       return ret;
00224     }
00225     cache_miss++;
00226   }
00227   for (u = bu; u; u = u->next)
00228     if (!egg_strcasecmp(u->handle, handle)) {
00229       if (bu == userlist)
00230         lastuser = u;
00231       return u;
00232     }
00233   return NULL;
00234 }

Here is the call graph for this function:

struct userrec* struct userrec* struct global (  )  [read]
struct user_entry* struct user_entry* struct global ( struct user_entry_type ,
struct userrec  
) [read]
struct user_entry_type* struct user_entry_type* char global ( char *   )  [read]

Definition at line 308 of file userrec.c.

References cache_hit, cache_miss, check_chanlist(), list_type::extra, fixfrom, get_user, match_useraddr, list_type::next, userrec::next, NULL, rmspace, set_chanlist(), strncpyz, UHOSTLEN, and USERENTRY_HOSTS.

00309 {
00310   struct userrec *u, *ret;
00311   struct list_type *q;
00312   int cnt, i;
00313   char host2[UHOSTLEN];
00314 
00315   if (host == NULL)
00316     return NULL;
00317   rmspace(host);
00318   if (!host[0])
00319     return NULL;
00320   ret = check_chanlist(host);
00321   cnt = 0;
00322   if (ret != NULL) {
00323     cache_hit++;
00324     return ret;
00325   }
00326   cache_miss++;
00327   strncpyz(host2, host, sizeof host2);
00328   host = fixfrom(host);
00329   for (u = userlist; u; u = u->next) {
00330     q = get_user(&USERENTRY_HOSTS, u);
00331     for (; q; q = q->next) {
00332       i = match_useraddr(q->extra, host);
00333       if (i > cnt) {
00334         ret = u;
00335         cnt = i;
00336       }
00337     }
00338   }
00339   if (ret != NULL) {
00340     lastuser = ret;
00341     set_chanlist(host2, ret);
00342   }
00343   return ret;
00344 }

Here is the call graph for this function:

int ( (int(*)(struct user_entry_type *, struct userrec *, void *))  global[41]  ) 
int ( (int(*)(struct user_entry_type *))  global[43]  ) 
int ( (int(*)(struct user_entry_type *))  global[42]  ) 
struct list_type* struct list_type* int ( (int(*)(struct list_type *, struct list_type *))  global[75]  )  [read]
struct list_type* int ( (int(*)(struct list_type **, struct list_type *))  global[73]  )  [read]
int ( (int(*)(struct list_type **, struct list_type *))  global[74]  ) 
struct igrec*(*) struct ( global  [97]  )  [read]
struct user_entry_type(*)(*)(*)(*)(*)(*)(*)(*) struct ( global  [189]  ) 
struct user_entry_type(*)(*)(*)(*)(*)(*)(*) struct ( global  [191]  )  [read]
struct user_entry_type(*)(*)(*)(*)(*)(*) struct ( global  [190]  )  [read]
struct user_entry_type(*)(*)(*)(*)(*) struct ( global  [188]  )  [read]
struct user_entry_type(*)(*)(*)(*) struct ( global  [194]  )  [read]
struct user_entry_type(*)(*)(*) struct ( global  [192]  ) 
struct user_entry_type(*)(*) struct ( global  [196]  )  [read]

Variable Documentation

struct igrec*(* struct)(global[97])) ( global  [195]  )  [read]

Generated on 7 Sep 2016 for Eggdrop by  doxygen 1.6.1