stats.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 MAXSLANGLENGTH 2000
  19. // #define RANGESTR today ? ((today == S_DAILY) ? SLDAILY : ((today == S_WEEKLY) ? SLWEEKLY : SLMONTHLY)) : SLTOTAL
  20. #define ISLINK(x) x ? "" : "!"
  21. #define ISTEXT(x, y) x ? y : " "
  22. struct stats_clientinfo {
  23. int traffic;
  24. int code;
  25. char *browser;
  26. char *referer;
  27. char *cmd;
  28. };
  29. #define stats_info_access(i) ((struct stats_clientinfo *) dcc[(i)].u.other)
  30. /*
  31. static void countvocables(globstats *);
  32. static int localstats_expmem(struct stats_local *);
  33. static int wordstats_expmem(wordstats *);
  34. static void free_stats();
  35. static void free_localstats(struct stats_local *);
  36. static void free_wordstats(wordstats *);
  37. static void reset_tstats();
  38. static void free_urls(struct stats_url *);
  39. static char *tell_ntop(char *, char *, int);
  40. static char *tell_place(char *, char *, char *, char *);
  41. static char *tell_stat(char *, char *, char *);
  42. static void incrstats(char *, char *, int, int, int);
  43. static int getstats(char *, char *, char *, int);
  44. static locstats *findlocstats(char *, char *);
  45. static globstats *findglobstats(char *);
  46. static int countwords(char *);
  47. static void write_stats();
  48. static void read_stats();
  49. static int countsmileys(char *);
  50. static int countstatmembers(globstats *);
  51. static int countallstatmembers(globstats *);
  52. static int countactivestatmembers(globstats *, int, int, int, int);
  53. static int gettotal(globstats *, int, int);
  54. static int matchattr(struct userrec *, char *, char *);
  55. static void deloldstatusers();
  56. static void purgestats();
  57. static void sensor_minutely();
  58. static int validchan(char *);
  59. static int stat_flood();
  60. static void resetlocstats(locstats *);
  61. static void calcwordstats(locstats *stats, char *text);
  62. static void strlower(char *);
  63. static void tell_wordstats(char *, char *, char *, char *, char *);
  64. static void tell_topwords(char *, char *, char *, char *);
  65. static void nincrwordstats(globstats *, char *, int);
  66. static void addquote(locstats *stats, char *quote);
  67. static int stats_globstats_expmem(struct stats_global *);
  68. static void free_quotes(quotestr *);
  69. static int quotes_expmem(quotestr *);
  70. static void do_globwordstats(globstats *);
  71. static int topics_expmem(topicstr *);
  72. static int urls_expmem(struct stats_url *);
  73. static int hosts_expmem(hoststr *);
  74. static void free_topics(topicstr *);
  75. static void free_hosts(hoststr *);
  76. static void addtopic(char *, char *, char *);
  77. static int countquestions(char *);
  78. static int inactivechan(char *);
  79. static int gethour();
  80. static int getmonth();
  81. static void reset_mwstats(int);
  82. static int secretchan(char *);
  83. static int nostats(char *);
  84. static void sorthosts(struct stats_global *);
  85. static void addhost(char *, globstats *);
  86. static char *tell_top_word(char *, char *, int, globstats *);
  87. static int quietstats(char *);
  88. static int track_stat_user(char *, char *);
  89. static void check_for_url(char *, char *, char *);
  90. static void free_kicks(struct stats_kick *);
  91. static int kicks_expmem(struct stats_kick *);
  92. static char *stats_duration(int, int);
  93. */
  94. /* eggdrop-userfile-independent user management */
  95. static int suserlist_expmem(struct stats_userlist *);
  96. static int hostlist_expmem(struct stats_hostlist *);
  97. static void free_suserlist(struct stats_userlist *);
  98. static void free_hostlist(struct stats_hostlist *);
  99. //static void free_one_chan(char *);
  100. static struct stats_userlist *stats_userlist_create_entry(char *);
  101. static void stats_userlist_free_entry(struct stats_userlist *);
  102. static int stats_userlist_expmem_entry(struct stats_userlist *);
  103. static void delsuser(char *);
  104. static void saddhost(struct stats_userlist *, char *, time_t, time_t);
  105. static int sdelhost(struct stats_userlist *, char *);
  106. static void welcome_suser(char *, struct stats_userlist *, char *);
  107. static void nincrstats(locstats *, int, int);
  108. static locstats *initstats(char *, char *);
  109. static int listsuser(locstats *, char *);
  110. static int countsusers();
  111. static int counthosts();
  112. static void weed_userlink_from_chanset(struct stats_userlist *);
  113. static void weed_statlink_from_chanset(locstats *);
  114. static void weed_userlink_from_locstats(struct stats_userlist *);
  115. static void dump_suser(int, struct stats_userlist *);
  116. static void setemail(struct stats_userlist *, char *);
  117. static void sethomepage(struct stats_userlist *, char *);
  118. static void setpassword(struct stats_userlist *, char *);
  119. static void maskstricthost(const char *, char *);
  120. static int getplace(globstats *, int, int, char *);
  121. static char *inverted_csplit(char **, char);
  122. static int get_timerange(char *);
  123. static time_t get_laston_time_from_hosts(char *user);
  124. static time_t get_creation_time_from_locstats(char *user);
  125. static int secretchan(char *chan);