]> jfr.im git - irc/quakenet/newserv.git/blobdiff - helpmod2/hstat.h
CHANSERV: fix issue where chanserv_relay doesn't wait for db to be loaded before...
[irc/quakenet/newserv.git] / helpmod2 / hstat.h
index 27e26196d3794d3ba7d76e54b96b7a272b716de3..42fb8a8390b820c0e40b3070ee5710a1912fda9f 100644 (file)
@@ -6,7 +6,11 @@
 extern int hstat_cycle;
 extern time_t hstat_last_cycle;
 
-#define HSTAT_ACTIVITY_TRESHOLD (3 * 60)
+/* forward declarations */
+struct hchannel_struct;
+struct huser_struct;
+
+#define HSTAT_ACTIVITY_TRESHOLD (3 * HDEF_m)
 
 #define HSTAT_ACCOUNT_SUM(sum, op1, op2)\
 {\
@@ -26,6 +30,8 @@ extern time_t hstat_last_cycle;
 
 #define HSTAT_CHANNEL_SUM(sum, op1, op2)\
 {\
+    (sum).active_time = (op1).active_time + (op2).active_time;\
+    (sum).staff_active_time = (op1).staff_active_time + (op2).staff_active_time;\
     (sum).time_spent = (op1).time_spent + (op2).time_spent;\
     (sum).prime_time_spent = (op1).prime_time_spent + (op2).prime_time_spent;\
     (sum).lines = (op1).lines + (op2).lines;\
@@ -36,6 +42,8 @@ extern time_t hstat_last_cycle;
 
 #define HSTAT_CHANNEL_ZERO(target)\
 {\
+    (target).active_time = 0;\
+    (target).staff_active_time = 0;\
     (target).time_spent = 0;\
     (target).prime_time_spent = 0;\
     (target).lines = 0;\
@@ -66,11 +74,14 @@ typedef struct hstat_account_entry_sum_struct
     int prime_time_spent;
     int lines;
     int words;
-    void *owner; /* haccount* */
+    struct haccount_struct *owner; /* haccount* */
 } hstat_account_entry_sum;
 
 typedef struct hstat_channel_entry_struct
 {
+    int active_time;
+    int staff_active_time;
+
     int time_spent;
     int prime_time_spent;
 
@@ -104,8 +115,14 @@ typedef struct hstat_accounts_array_struct
     int arrlen;
 } hstat_accounts_array;
 
+typedef enum
+{
+    HSTAT_ACCOUNT_ARRAY_TOP10,
+    HSTAT_ACCOUNT_ARRAY_WEEKSTATS
+} hstat_account_array_type;
+
 /* free() this.entries, arguments: channel, level to list */
-hstat_accounts_array create_hstat_account_array(void*, hlevel);
+hstat_accounts_array create_hstat_account_array(struct hchannel_struct*, hlevel, hstat_account_array_type);
 
 hstat_channel *get_hstat_channel(void);
 hstat_account *get_hstat_account(void);
@@ -116,15 +133,13 @@ const char *hstat_channel_print(hstat_channel_entry*, int);
 
 const char *hstat_account_print(hstat_account_entry*, int);
 
-/* void* = hchannel*, huser* */
-void hstat_calculate_general(void*, void*, const char *);
+void hstat_calculate_account(struct hchannel_struct*, struct huser_struct*, const char *);
+void hstat_calculate_channel(struct hchannel_struct*, struct huser_struct*, const char *);
 
-/* void* = hchannel* */
-void hstat_add_join(void*);
-void hstat_del_channel(void*);
+void hstat_add_join(struct hchannel_struct*);
+void hstat_del_channel(struct hchannel_struct*);
 
-/* void* = hchannel* */
-void hstat_add_queue(void*, int);
+void hstat_add_queue(struct hchannel_struct*, int);
 
 int is_prime_time(void); /* tells if now is the "main" time in #feds */