4
0

userrec.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (C) 2000,2001 Florian Sander
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  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. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. #define S_LIST 1
  19. #define S_ADDHOSTS 2
  20. #define S_NOSTATS 4
  21. #define U_NOPASSWORD 1
  22. #define U_NOEMAIL 2
  23. static void stats_autosadd(struct stats_member *m, struct stats_chan *chan);
  24. struct stats_hostlist {
  25. struct stats_hostlist *next;
  26. char *mask;
  27. time_t lastused;
  28. time_t created;
  29. };
  30. struct stats_userlist {
  31. struct stats_userlist *next;
  32. char *user;
  33. char *password;
  34. char *email;
  35. char *homepage;
  36. int flags;
  37. int icqnr;
  38. time_t created;
  39. time_t laston;
  40. struct stats_hostlist *hosts;
  41. };
  42. #define suser_list(u) (u->flags & S_LIST)
  43. #define suser_addhosts(u) (u->flags & S_ADDHOSTS)
  44. #define suser_nostats(u) (u->flags & S_NOSTATS)
  45. #define suser_setflag(u, flag) (u->flags |= flag)
  46. #define suser_delflag(u, flag) (u->flags &= ~flag)
  47. #define TIMETOLIVE(x) (((now - x->created) * (expire_factor / 100)) + (expire_base * 86400))
  48. static struct stats_userlist *addsuser(char *, time_t, time_t);
  49. static struct stats_userlist *findsuser(char *);
  50. static struct stats_userlist *findsuser_by_name(char *);
  51. static struct stats_userlist *stats_userlist_create_entry(char *);
  52. static void stats_userlist_free_entry(struct stats_userlist *);
  53. static void saddhost(struct stats_userlist *u, char *host, time_t lastused, time_t created);
  54. static void welcome_suser(char *nick, struct stats_userlist *u, char *chan);
  55. static int listsuser(locstats *ls, char *chan);
  56. static void weed_userlink_from_chanset(struct stats_userlist *u);
  57. static void weed_statlink_from_chanset(locstats *ls);
  58. static void weed_userlink_from_locstats(struct stats_userlist *u);
  59. static void setemail(struct stats_userlist *u, char *email);
  60. static void sethomepage(struct stats_userlist *u, char *homepage);
  61. static void setpassword(struct stats_userlist *u, char *password);
  62. static time_t get_creation_time_from_locstats(char *user);
  63. static time_t get_laston_time_from_hosts(char *user);
  64. static void free_suserlist(struct stats_userlist *e);
  65. static void free_hostlist(struct stats_hostlist *e);