]> jfr.im git - irc/quakenet/newserv.git/commitdiff
G 2.10
authorstrutsi <redacted>
Wed, 3 Aug 2005 05:57:00 +0000 (06:57 +0100)
committerstrutsi <redacted>
Wed, 3 Aug 2005 05:57:00 +0000 (06:57 +0100)
29 files changed:
helpmod2/changelist
helpmod2/commands/censor
helpmod2/haccount.c
helpmod2/hban.c
helpmod2/hcensor.c
helpmod2/hcensor.h
helpmod2/hchannel.c
helpmod2/hchannel.h
helpmod2/hcommands.c
helpmod2/hcommands.h
helpmod2/hconf.c
helpmod2/hconf.h
helpmod2/hdef.c
helpmod2/hdef.h
helpmod2/helpmod.c
helpmod2/helpmod.h
helpmod2/hgen.c
helpmod2/hgen.h
helpmod2/hhooks.c
helpmod2/hlamer.c
helpmod2/hqueue.c
helpmod2/hstat.c
helpmod2/hstat.h
helpmod2/hterm.c
helpmod2/hticket.c
helpmod2/hticket.h
helpmod2/huser.c
helpmod2/huser.h
helpmod2/hversions.h [new file with mode: 0644]

index 3b28ca67f3b6292701578907696db2e1beeb9278..9acca11b72796afe12cfe08e7895ac9438affb64 100644 (file)
@@ -286,3 +286,18 @@ A bug in listuser command was fixed
 Minor internal changes
 Fixed a bug in the dnmo command
 Trials now have access to commands voice and devoice
+
+2.10
+Added a version command
+Added censor types, censor command changed accordingly
+Changed whoami and whois to show flooding and spamming violations
+Some code cleanup
+Acconf and chanconf output changed a bit
+Fixed a welcome command error message
+Command error wordings changed a bit
+Top10 now has an all option to cover all users
+Internal changes
+Terms are now in alphabetical order
+Fixed a critical bug with the stats cycle
+hstat_cycle changed to a more sane form
+Two evilhack commands added to fix everything recently broken
index 5f971935a0c5df664c6f9a935766411d5ee0ba99..a7b95059271257093d6565ad45e07b55bbff14ae 100644 (file)
@@ -2,6 +2,7 @@ Syntax:  censor [channel] [operation] [parameters]
 Example: censor #feds add bist silly .de person
 Handles the censor for a channel. Censor allows certain patterns to result in an automatic kick.
 Following operations are supported:
-add [pattern] [reason]   Adds the pattern to censor with the given reason
-del [#pattern]           Removes the pattern for the index
+add [type] [pattern] [reason]   Adds the pattern to censor with the given reason
+del [#pattern]                  Removes the pattern for the index
 If no operation or parameters are specified, all censor entries are listed.
+The type for the add command can be either: warn, kick or ban.
index 47c93152ed881584f1bc213a4d2c48680b176e4d..5ce4e5537762fd527b3fe064e66c692d316714fc 100644 (file)
@@ -106,9 +106,9 @@ void haccount_set_level(haccount *hack, hlevel lvl)
 const char *haccount_get_state(haccount* hacc, int mask)
 {
     if (hacc->flags & mask)
-        return "On";
+        return "Yes";
     else
-        return "Off";
+        return "No";
 }
 
 int haccount_count(hlevel lvl)
@@ -140,6 +140,6 @@ const char *haccount_get_sname(int index)
     case 5:
         return "Suppress unknown command error";
     default:
-        return "error. Please contact strutsi";
+        return "Error. Please contact strutsi";
     }
 }
index 81ded2057fe724a08d5beb84ccfeaa82a5814431..314ab7805d6be704f919da47efe91853d9d1b61b 100644 (file)
@@ -39,8 +39,8 @@ hban *hban_add(const char* pat, const char* rsn, time_t exp, int now)
 
     { /* additional logic here */
         huser* tmpu;
-        for (tmpu = husers;tmpu;tmpu = tmpu->next)
-            if (nickmatchban(tmpu->real_user, tmp) && !IsOper(tmpu->real_user))
+       for (tmpu = husers;tmpu;tmpu = tmpu->next)
+           if (nickmatchban(tmpu->real_user, tmp) && !IsOper(tmpu->real_user))
             {
                 hchannel *assert_hchan = NULL;
                 while (tmpu->hchannels)
@@ -54,7 +54,7 @@ hban *hban_add(const char* pat, const char* rsn, time_t exp, int now)
                     helpmod_setban(tmpu->hchannels->hchan, bantostring(ptr->real_ban), HELPMOD_BAN_DURATION, MCB_ADD, now);
                     helpmod_kick(tmpu->hchannels->hchan, tmpu, hban_get_reason(ptr));
                 }
-            }
+           }
     }
 
     return ptr;
index 7387ddcdb7fa1e88b033bc9226734767a8145d68..8487b2a70ba0481ee041a56b38b3f8e8f94fae21 100644 (file)
@@ -3,8 +3,10 @@
 #include <string.h>
 
 #include "hcensor.h"
+#include "hcommands.h"
 #include "helpmod.h"
 #include "hgen.h"
+#include "hban.h"
 
 hcensor *hcensor_get_by_pattern(hcensor *hcens, const char *pat)
 {
@@ -36,7 +38,7 @@ hcensor *hcensor_check(hcensor *hcens, const char *str)
     return NULL;
 }
 
-hcensor *hcensor_add(hcensor **hcens, const char *pat, const char *rsn)
+hcensor *hcensor_add(hcensor **hcens, const char *pat, const char *rsn, hcensor_type type)
 {
     hcensor *tmp;
 
@@ -47,6 +49,8 @@ hcensor *hcensor_add(hcensor **hcens, const char *pat, const char *rsn)
     tmp->next = *hcens;
 
     tmp->pattern = getsstring(pat, strlen(pat));
+    tmp->type = type;
+
     if (rsn)
         tmp->reason = getsstring(rsn, strlen(rsn));
     else
@@ -87,6 +91,35 @@ int hcensor_count(hcensor *hcens)
 
 int hcensor_match(hchannel *hchan, huser *husr, hcensor *hcens)
 {
-    helpmod_kick(hchan, husr, hcens->reason?hcens->reason->content:"Improper user");
-    return !0;
+    switch (hcens->type)
+    {
+    case HCENSOR_WARN:
+        if (hcens->reason)
+           helpmod_reply(husr, NULL, hcens->reason->content);
+       return 0;
+    case HCENSOR_KICK:
+       helpmod_kick(hchan, husr, hcens->reason?hcens->reason->content:"Improper user");
+        return !0;
+    case HCENSOR_BAN:
+       hban_add(hban_ban_string(husr->real_user, HBAN_HOST), hcens->reason?hcens->reason->content:"Censor violation", HCMD_OUT_DEFAULT + time(NULL), 1);
+       return !0;
+    default:
+       Error("helpmod", ERR_ERROR, "Unknown censor type %d", hcens->type);
+        return !0;
+    }
+}
+
+const char *hcensor_get_typename(hcensor_type type)
+{
+    switch (type)
+    {
+    case HCENSOR_WARN:
+       return "warn";
+    case HCENSOR_KICK:
+       return "kick";
+    case HCENSOR_BAN:
+        return "ban";
+    default:
+        return "error";
+    }
 }
index 052aef0e64afd69d73cf1c1c5f9d5833d8ea397f..753347837edbea49f18a0ff40bcc10f70331c5fe 100644 (file)
@@ -7,20 +7,31 @@
 struct hchannel_struct;
 struct huser_struct;
 
+typedef enum
+{
+    HCENSOR_WARN,
+    HCENSOR_KICK,
+    HCENSOR_BAN
+} hcensor_type;
+
 typedef struct hcensor_struct
 {
     sstring *pattern;
     sstring *reason; /* optional */
+    hcensor_type type;
+
     struct hcensor_struct *next;
 } hcensor;
 
 hcensor *hcensor_get_by_pattern(hcensor *, const char *);
 hcensor *hcensor_get_by_index(hcensor *, int);
 hcensor *hcensor_check(hcensor *, const char *); /* first matching pattern is returned, NULL if ok */
-hcensor *hcensor_add(hcensor **, const char*, const char*);
+hcensor *hcensor_add(hcensor **, const char*, const char*, hcensor_type);
 hcensor *hcensor_del(hcensor **, hcensor *);
 /* Handle a censor match, if returnvalue is non-zero then the user was removed from channel */
 int hcensor_match(struct hchannel_struct*, struct huser_struct*, hcensor*);
+const char *hcensor_get_typename(hcensor_type);
+
 int hcensor_count(hcensor *);
 
 void hcensor_del_all(hcensor **);
index 1503c0a42c794e4c6c504552859b6fbe5225bd4e..5dcebf0f183e3e27c9b35bc57db81b02312649d6 100644 (file)
@@ -51,6 +51,8 @@ hchannel *hchannel_add(const char *cname)
 
     hchan->htickets = NULL;
 
+    hchan->last_activity = time(NULL);
+    hchan->last_staff_activity = time(NULL);
     hchan->stats = get_hstat_channel();
 
     hchan->next = hchannels;
@@ -69,11 +71,8 @@ hchannel *hchannel_add(const char *cname)
 
             if ((husr = huser_get(nck)) == NULL)
                 husr = huser_add(nck);
-/*
-            fprintf(hdebug_file, "%d ADD (hchannel_add) %s to %s\n", time(NULL), husr->real_user->nick, hchannel_get_name(hchan));
-            fflush(hdebug_file);
-*/
-            tmp = huser_add_channel(husr, hchan);
+
+           tmp = huser_add_channel(husr, hchan);
             hchannel_add_user(hchan, husr);
 
             if (hchan->real_channel->users->content[i] & CUMODE_OP)
@@ -145,14 +144,6 @@ hchannel *hchannel_get_by_channel(channel *chan)
     return NULL;
 }
 
-const char *hchannel_get_state(hchannel* hchan, int mask)
-{
-    if (hchan->flags & mask)
-        return "active";
-    else
-        return "inactive";
-}
-
 const char *hchannel_get_name(hchannel *hchan)
 {
     return hchan->real_channel->index->name->content;
@@ -301,7 +292,7 @@ void hchannels_match_accounts(void)
     for (;hchan;hchan = hchan->next)
         for (hchanuser = hchan->channel_users;hchanuser;hchanuser = hchanuser->next)
             if (hchanuser->husr->account == NULL && IsAccount(hchanuser->husr->real_user))
-                hchanuser->husr->account = haccount_get_by_name(hchanuser->husr->real_user->authname);
+                hchanuser->husr->account = haccount_get_by_name(huser_get_auth(hchanuser->husr));
 }
 
 int hchannels_on_queue(huser *husr)
@@ -462,6 +453,15 @@ void hchannel_deactivate_join_flood()
         }
 }
 
+const char *hchannel_get_state(hchannel* hchan, int mask)
+{
+    if (hchan->flags & mask)
+        return "Yes";
+    else
+        return "No";
+}
+
+
 const char *hchannel_get_sname(int flag)
 {
     if (flag < 0 || flag > HCHANNEL_CONF_COUNT)
index c4c32e6337495ab5a856513cb370c4793789a679..d929eb0d3e2081075fa78c4bffd290cd48bbe308 100644 (file)
@@ -69,6 +69,8 @@ typedef struct hchannel_struct
     /* this is also the queue, so it's "sorted" */
     struct hchannel_user_struct *channel_users;
 
+    time_t last_activity;
+    time_t last_staff_activity;
     hstat_channel *stats;
 
     hlc_profile *lc_profile;
index 0e1d3e3c04bd182efa86f42603dd178bbf12eadf..1856fd8beb9e152aac759753f90f839154fef930 100644 (file)
@@ -24,8 +24,6 @@
 
 #include "hticket.h"
 
-#define HCMD_OUT_DEFAULT (10 * HDEF_m)
-
 /* following are macros for use ONLY IN HERE
  they may not look pretty, but work surprisingly well */
 
@@ -82,7 +80,7 @@ static void helpmod_cmd_addchan (huser *sender, channel* returntype, char* ostr,
 {
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not add channel: Channel not defined");
+        helpmod_reply(sender, returntype, "Cannot add channel: Channel not defined");
         return;
     }
 
@@ -129,7 +127,7 @@ static void helpmod_cmd_delchan (huser *sender, channel* returntype, char* ostr,
 
 static void helpmod_cmd_whoami (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
 {
-    helpmod_reply(sender, returntype, "You are %s", sender->real_user->nick);
+    helpmod_reply(sender, returntype, "You are %s", huser_get_nick(sender));
     helpmod_reply(sender, returntype, "Your userlevel is %s", hlevel_name(huser_get_level(sender)));
     if (sender->account == NULL)
         helpmod_reply(sender, returntype, "You do not have an account with me");
@@ -137,9 +135,9 @@ static void helpmod_cmd_whoami (huser *sender, channel* returntype, char* ostr,
         helpmod_reply(sender, returntype, "Your accounts name is %s", sender->account->name->content);
     if (huser_get_level(sender) < H_TRIAL)
     {
-        if (sender->lc[0] || sender->lc[1] || sender->lc[2])
-            helpmod_reply(sender, returntype, "You violated the following rules: Excessive use of capital letters %d, repeating %d and improper use of language %d", sender->lc[0], sender->lc[1], sender->lc[2]);
-        else
+       if (sender->lc[0] || sender->lc[1] || sender->lc[2] || sender->lc[3] || sender->lc[4])
+           helpmod_reply(sender, returntype, "You violated the following rules: Excessive use of capital letters: %d, repeating: %d, improper use of language: %d, flooding: %d and spamming: %d", sender->lc[0], sender->lc[1], sender->lc[2], sender->lc[3], sender->lc[4]);
+       else
             helpmod_reply(sender, returntype, "You have not violated any rules");
     }
 
@@ -158,7 +156,7 @@ static void helpmod_cmd_whoami (huser *sender, channel* returntype, char* ostr,
         for (hchan = hchannels;hchan;hchan = hchan->next)
             if (hchan->flags & H_REQUIRE_TICKET)
             {
-                htick = hticket_get(sender->real_user->authname, hchan);
+                htick = hticket_get(huser_get_auth(sender), hchan);
                 if (htick != NULL)
                     helpmod_reply(sender, returntype, "You have an invite ticket for channel %s that expires in %s", hchannel_get_name(hchan), helpmod_strtime(time(NULL) - htick->time_expiration));
             }
@@ -172,7 +170,7 @@ static void helpmod_cmd_whois (huser *sender, channel* returntype, char* ostr, i
 
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not get user information: User not specified");
+        helpmod_reply(sender, returntype, "Cannot get user information: User not specified");
         return;
     }
     if (argc > H_CMD_MAX_ARGS)
@@ -183,20 +181,20 @@ static void helpmod_cmd_whois (huser *sender, channel* returntype, char* ostr, i
         husr = huser_get(getnickbynick(argv[i]));
         if (husr == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not get user information: User %s not found", argv[i]);
+            helpmod_reply(sender, returntype, "Cannot get user information: User %s not found", argv[i]);
             continue;
         }
-        helpmod_reply(sender, returntype, "User %s has userlevel %s", husr->real_user->nick,hlevel_name(huser_get_level(husr)));
+        helpmod_reply(sender, returntype, "User %s has userlevel %s", huser_get_nick(husr), hlevel_name(huser_get_level(husr)));
        if (husr->account == NULL)
-            helpmod_reply(sender, returntype, "User %s does not have an account with me", husr->real_user->nick);
+            helpmod_reply(sender, returntype, "User %s does not have an account with me", huser_get_nick(husr));
         else
-            helpmod_reply(sender, returntype, "User %s has account named %s", husr->real_user->nick,husr->account->name->content);
+            helpmod_reply(sender, returntype, "User %s has account named %s", huser_get_nick(husr),husr->account->name->content);
         if (huser_get_level(husr) < H_TRIAL)
         {
-            if (husr->lc[0] || husr->lc[1] || husr->lc[2])
-                helpmod_reply(sender, returntype, "User %s has lamercontrol entries: Excessive use of capital letters %d, repeating %d and improper use of language %d", husr->real_user->nick, husr->lc[0], husr->lc[1], husr->lc[2]);
-            else
-                helpmod_reply(sender, returntype, "User %s has no lamercontrol entries", husr->real_user->nick);
+           if (husr->lc[0] || husr->lc[1] || husr->lc[2] || husr->lc[3] || husr->lc[4])
+               helpmod_reply(sender, returntype, "User %s has lamercontrol entries: Excessive use of capital letters: %d, repeating: %d, improper use of language: %d, flooding: %d and spamming: %d", huser_get_nick(husr), husr->lc[0], husr->lc[1], husr->lc[2], husr->lc[3], husr->lc[4]);
+           else
+               helpmod_reply(sender, returntype, "User %s has no lamercontrol entries", huser_get_nick(husr));
         }
         {
             int pos;
@@ -204,9 +202,9 @@ static void helpmod_cmd_whois (huser *sender, channel* returntype, char* ostr, i
             for (;huserchan;huserchan = huserchan->next)
             {
                 if ((pos = hqueue_get_position(huserchan->hchan, husr)) > -1)
-                    helpmod_reply(sender, returntype, "User %s has queue queue position #%d on channel %s", husr->real_user->nick, pos, hchannel_get_name(huserchan->hchan));
+                    helpmod_reply(sender, returntype, "User %s has queue queue position #%d on channel %s", huser_get_nick(husr), pos, hchannel_get_name(huserchan->hchan));
                 if (on_desk(husr, huserchan))
-                    helpmod_reply(sender, returntype, "User %s is receiving support on channel %s", husr->real_user->nick, hchannel_get_name(huserchan->hchan));
+                    helpmod_reply(sender, returntype, "User %s is receiving support on channel %s", huser_get_nick(husr), hchannel_get_name(huserchan->hchan));
             }
         }
         if (IsAccount(husr->real_user))
@@ -216,9 +214,9 @@ static void helpmod_cmd_whois (huser *sender, channel* returntype, char* ostr, i
             for (hchan = hchannels;hchan;hchan = hchan->next)
                 if (hchan->flags & H_REQUIRE_TICKET)
                 {
-                    htick = hticket_get(husr->real_user->authname, hchan);
+                    htick = hticket_get(huser_get_auth(husr), hchan);
                     if (htick != NULL)
-                        helpmod_reply(sender, returntype, "User %s has an invite ticket for channel %s that expires in %s", husr->real_user->nick, hchannel_get_name(hchan), helpmod_strtime(time(NULL) - htick->time_expiration));
+                        helpmod_reply(sender, returntype, "User %s has an invite ticket for channel %s that expires in %s", huser_get_nick(husr), hchannel_get_name(hchan), helpmod_strtime(time(NULL) - htick->time_expiration));
                 }
         }
     }
@@ -227,22 +225,11 @@ static void helpmod_cmd_whois (huser *sender, channel* returntype, char* ostr, i
 void helpmod_cmd_megod (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
 {
     if (sender->account == NULL)
-        sender->account = haccount_add(sender->real_user->nick, H_ADMIN);
+        sender->account = haccount_add(huser_get_nick(sender), H_ADMIN);
 
     sender->account->level = H_ADMIN;
     }
     */
-/*
-void helpmod_cmd_test (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
-{
-    //lpmod_config_write("helpmod.db.test");
-    hchannel *hchan;
-
-    DEFINE_HCHANNEL;
-
-    helpmod_channick_modes(huser_get(getnickbynick(argv[0])), hchan, MC_DEVOICE, 1);
-}
-*/
 
 static void helpmod_cmd_seen (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
 {
@@ -286,7 +273,7 @@ static void helpmod_cmd_seen (huser *sender, channel* returntype, char* ostr, in
                 helpmod_reply(sender, returntype, "User %s not found", argv[i]);
                 continue;
             }
-            helpmod_reply(sender, returntype, "User %s's last recorded activity was %s ago", target_huser->real_user->nick, helpmod_strtime(time(NULL) - target_huser->last_activity));
+            helpmod_reply(sender, returntype, "User %s's last recorded activity was %s ago", huser_get_nick(target_huser), helpmod_strtime(time(NULL) - target_huser->last_activity));
         }
     }
 }
@@ -313,18 +300,18 @@ static void helpmod_cmd_change_userlevel(huser *sender, hlevel target_level, cha
             target_haccount = haccount_get_by_name(argv[i]);
             if (target_haccount == NULL)
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: Account '%s' not found", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot change userlevel: Account '%s' not found", argv[i]);
                 continue;
             }
             if (target_haccount->level > huser_get_level(sender))
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: Account '%s' has a userlevel higher than yours", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot change userlevel: Account '%s' has a userlevel higher than yours", argv[i]);
                 continue;
             }
 
             if (target_haccount->level == target_level)
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: Account '%s' already has userlevel %s", argv[i], hlevel_name(target_level));
+                helpmod_reply(sender, returntype, "Cannot change userlevel: Account '%s' already has userlevel %s", argv[i], hlevel_name(target_level));
                 continue;
             }
 
@@ -338,45 +325,45 @@ static void helpmod_cmd_change_userlevel(huser *sender, hlevel target_level, cha
             target_huser = huser_get(getnickbynick(argv[i]));
             if (target_huser == NULL)
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: User '%s' not found", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot change userlevel: User '%s' not found", argv[i]);
                 continue;
             }
             if (huser_get_level(target_huser) > huser_get_level(sender))
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: User '%s' has a userlevel higher than yours", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot change userlevel: User '%s' has a userlevel higher than yours", argv[i]);
                 continue;
             }
             if (huser_get_level(target_huser) == H_STAFF && huser_get_level(sender) == H_STAFF)
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: User '%s' has the same userlevel as you have", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot change userlevel: User '%s' has the same userlevel as you have", argv[i]);
                 continue;
             }
 
             if (huser_get_level(target_huser) == target_level)
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: User '%s' already has userlevel %s", argv[i], hlevel_name(target_level));
+                helpmod_reply(sender, returntype, "Cannot change userlevel: User '%s' already has userlevel %s", argv[i], hlevel_name(target_level));
                 continue;
             }
             if (target_huser == sender)
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: Sanity check, you're changing your own userlevel, use #account instead of nick if you really wish to do this");
+                helpmod_reply(sender, returntype, "Cannot change userlevel: Sanity check, you're changing your own userlevel, use #account instead of nick if you really wish to do this");
                 continue;
             }
             if (!IsAccount(target_huser->real_user))
             {
-                helpmod_reply(sender, returntype, "Can not change userlevel: User '%s' is not authed", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot change userlevel: User '%s' is not authed", argv[i]);
                 continue;
             }
 
             if (target_huser->account == NULL)
             {
-                if (haccount_get_by_name(target_huser->real_user->authname) != NULL)
+                if (haccount_get_by_name(huser_get_auth(target_huser)) != NULL)
                 {
-                    helpmod_reply(sender, returntype, "Can not change userlevel: Unable to create an account. Account %s already exists", target_huser->real_user->authname);
+                    helpmod_reply(sender, returntype, "Cannot change userlevel: Unable to create an account. Account %s already exists", huser_get_auth(target_huser));
                     continue;
                 }
                 else
-                    target_huser->account = haccount_add(target_huser->real_user->authname, target_level);
+                    target_huser->account = haccount_add(huser_get_auth(target_huser), target_level);
             }
 
             target_huser->account->level = target_level;
@@ -498,7 +485,7 @@ static void helpmod_cmd_censor (huser *sender, channel* returntype, char* ostr,
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not handle the censor: Channel not specified or found");
+        helpmod_reply(sender, returntype, "Cannot handle the censor: Channel not specified or found");
         return;
     }
 
@@ -510,7 +497,7 @@ static void helpmod_cmd_censor (huser *sender, channel* returntype, char* ostr,
         {
             helpmod_reply(sender, returntype, "Censored patterns for channel %s (%s):", hchan->real_channel->index->name->content, (hchan->flags & H_CENSOR)?"active":"inactive");
             for (hcens = hchan->censor;hcens;hcens = hcens->next)
-                helpmod_reply(sender, returntype, "#%d %s%s%s", i++, hcens->pattern->content, hcens->reason?" :: ":"", hcens->reason?hcens->reason->content:"");
+                helpmod_reply(sender, returntype, "#%d %-8s %s%s%s", i++, hcensor_get_typename(hcens->type), hcens->pattern->content, hcens->reason?" :: ":"", hcens->reason?hcens->reason->content:"");
         }
     }
     else
@@ -519,9 +506,36 @@ static void helpmod_cmd_censor (huser *sender, channel* returntype, char* ostr,
         {
             char *pattern;
             char *reason;
+           int type = HCENSOR_KICK;
 
             SKIP_WORD;
-            pattern = argv[0];
+
+            /* not very elegant but will have to do */
+           if (argc > 1)
+           {
+               if (!ci_strcmp(argv[0], "warn"))
+               {
+                   type = HCENSOR_WARN;
+                   if (argc <= 2)
+                   {
+                       helpmod_reply(sender, returntype, "Cannot add censor entry: Entries of type warn require a reason");
+                       return;
+                   }
+                    SKIP_WORD;
+               }
+               else if (!ci_strcmp(argv[0], "kick"))
+               {
+                    type = HCENSOR_KICK;
+                    SKIP_WORD;
+               }
+               else if (!ci_strcmp(argv[0], "ban"))
+               {
+                    type = HCENSOR_BAN;
+                    SKIP_WORD;
+               }
+           }
+
+           pattern = argv[0];
             SKIP_WORD;
             if (argc)
                 reason = ostr;
@@ -530,14 +544,14 @@ static void helpmod_cmd_censor (huser *sender, channel* returntype, char* ostr,
 
             if (hcensor_get_by_pattern(hchan->censor, pattern))
             {
-                helpmod_reply(sender, returntype, "Cannot add censor entry: Pattern '%s' already censored", pattern);
+                helpmod_reply(sender, returntype, "Cannot add censor entry: Pattern '%s' is already censored", pattern);
                 return;
             }
 
-            if (hcensor_add(&hchan->censor, pattern, reason))
-                helpmod_reply(sender, returntype, "Pattern '%s' (%s) censored succesfully", pattern, reason?reason:"no reason specified");
-            else
-                helpmod_reply(sender, returntype, "Cannot add censor entry: Pattern '%s' already censored", pattern);
+            if (hcensor_add(&hchan->censor, pattern, reason, type))
+               helpmod_reply(sender, returntype, "Pattern '%s' (%s) with type %s, censored succesfully", pattern, reason?reason:"no reason specified", hcensor_get_typename(type));
+           else
+               helpmod_reply(sender, returntype, "Cannot add censor entry: Pattern '%s' is already censored", pattern);
 
         }
         else if (!ci_strcmp(argv[0], "del"))
@@ -580,7 +594,7 @@ static void helpmod_cmd_chanconf (huser *sender, channel* returntype, char* ostr
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not change or view channel configuration: Channel not specified or found");
+        helpmod_reply(sender, returntype, "Cannot change or view channel configuration: Channel not specified or found");
         return;
     }
 
@@ -617,7 +631,7 @@ static void helpmod_cmd_chanconf (huser *sender, channel* returntype, char* ostr
 
             if (!sscanf(argv[i], "%d", &tmp) || (tmp < 0) || (tmp > HCHANNEL_CONF_COUNT))
             {
-                helpmod_reply(sender, returntype, "Can not change channel configuration: Expected integer between [0, %d]", HCHANNEL_CONF_COUNT);
+                helpmod_reply(sender, returntype, "Cannot change channel configuration: Expected integer between [0, %d]", HCHANNEL_CONF_COUNT);
                 continue;
             }
 
@@ -682,7 +696,7 @@ static void helpmod_cmd_acconf (huser *sender, channel* returntype, char* ostr,
 
             if (!sscanf(argv[i], "%d", &tmp) || (tmp < 0) || (tmp > HACCOUNT_CONF_COUNT))
             {
-                helpmod_reply(sender, returntype, "Can not change account configuration: Expected integer between [0, %d]", HACCOUNT_CONF_COUNT);
+                helpmod_reply(sender, returntype, "Cannot change account configuration: Expected integer between [0, %d]", HACCOUNT_CONF_COUNT);
                 continue;
             }
 
@@ -714,18 +728,18 @@ static void helpmod_cmd_welcome (huser *sender, channel* returntype, char* ostr,
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not change or view chanflags: Channel not specified or found");
+        helpmod_reply(sender, returntype, "Cannot change or view the welcome message: Channel not specified or found");
         return;
     }
 
     if (argc == 0) /* view  */
     {
-        helpmod_reply(sender, returntype, "Welcome for channel %s (%s): %s", hchan->real_channel->index->name->content, hchannel_get_state(hchan, H_WELCOME), hchan->welcome);
+        helpmod_reply(sender, returntype, "Welcome message for channel %s (%s): %s", hchan->real_channel->index->name->content, hchannel_get_state(hchan, H_WELCOME), hchan->welcome);
     }
     else
     {
         strcpy(hchan->welcome, ostr);
-        helpmod_reply(sender, returntype, "Welcome for channel %s (%s) is now: %s", hchan->real_channel->index->name->content, hchannel_get_state(hchan, H_WELCOME), hchan->welcome);
+        helpmod_reply(sender, returntype, "Welcome message for channel %s (%s) is now: %s", hchan->real_channel->index->name->content, hchannel_get_state(hchan, H_WELCOME), hchan->welcome);
     }
 }
 
@@ -804,7 +818,7 @@ static void helpmod_cmd_lamercontrol (huser *sender, channel* returntype, char*
     ptr = hlc_get(argv[0]);
     if (ptr == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not set the lamercontrol profile: Profile %s does not exist:", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot set the lamercontrol profile: Profile %s does not exist:", argv[0]);
         return;
     }
     else
@@ -835,7 +849,7 @@ static void helpmod_cmd_term_find_general (huser *sender, channel* returntype, i
         if (type == H_TERM_PLUS)
             hqueue_advance(hchan, sender, 1);
         else
-            helpmod_reply(sender, returntype, "Can not find term: Term not specified");
+            helpmod_reply(sender, returntype, "Cannot find term: Term not specified");
         return;
     }
     htrm = hterm_get_and_find(source, argv[0]);
@@ -874,7 +888,7 @@ static void helpmod_cmd_term_find_general (huser *sender, channel* returntype, i
             for (i=0;i<ntargets;i++)
             {
                 strcat(buffer, " ");
-                strcat(buffer, targets[i]->real_user->nick);
+                strcat(buffer, huser_get_nick(targets[i]));
             }
 
             helpmod_message_channel_long(hchannel_get_by_channel(returntype), "%s: (%s) %s", buffer, htrm->name->content, htrm->description->content);
@@ -925,7 +939,7 @@ static void helpmod_cmd_klingon (huser *sender, channel* returntype, char* ostr,
     if (hchan == NULL)
     {
         rand_val = rand() % KLINGON_NTARGETED;
-        helpmod_reply(sender, NULL, "%s: %s", sender->real_user->nick, klingon_targeted[rand_val]);
+        helpmod_reply(sender, NULL, "%s: %s", huser_get_nick(sender), klingon_targeted[rand_val]);
         return;
     }
 
@@ -935,7 +949,7 @@ static void helpmod_cmd_klingon (huser *sender, channel* returntype, char* ostr,
     if (target)
     {
         rand_val = rand() % KLINGON_NTARGETED;
-        helpmod_message_channel(hchan, "%s: %s", target->real_user->nick, klingon_targeted[rand_val]);
+        helpmod_message_channel(hchan, "%s: %s", huser_get_nick(target), klingon_targeted[rand_val]);
     }
     else
     {
@@ -961,7 +975,7 @@ static void helpmod_cmd_term (huser *sender, channel* returntype, char* ostr, in
 
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not handle terms: Operation not specified");
+        helpmod_reply(sender, returntype, "Cannot handle terms: Operation not specified");
         return;
     }
     if (!ci_strcmp(argv[0], "list"))
@@ -1007,23 +1021,23 @@ static void helpmod_cmd_term (huser *sender, channel* returntype, char* ostr, in
     {
         if (argc < 2)
         {
-            helpmod_reply(sender, returntype, "Can not get term: Term not specified");
+            helpmod_reply(sender, returntype, "Cannot get term: Term not specified");
             return;
         }
         htrm = hterm_get(*source, argv[1]);
         if (htrm == NULL)
-            helpmod_reply(sender, returntype, "Can not get term: Term %s not found", argv[1]);
+            helpmod_reply(sender, returntype, "Cannot get term: Term %s not found", argv[1]);
         else
             helpmod_reply(sender, returntype, "(%s): %s", htrm->name->content, htrm->description->content);
     }
     else if (!ci_strcmp(argv[0], "add"))
     {
         if (argc < 2)
-            helpmod_reply(sender, returntype, "Can not add term: Term name not specified");
+            helpmod_reply(sender, returntype, "Cannot add term: Term name not specified");
         else if (argc < 3)
-            helpmod_reply(sender, returntype, "Can not add term: Term description not specified");
+            helpmod_reply(sender, returntype, "Cannot add term: Term description not specified");
         else if ((htrm = hterm_get(*source, argv[1])) != NULL)
-            helpmod_reply(sender, returntype, "Can not add term: Term %s is already added", argv[1]);
+            helpmod_reply(sender, returntype, "Cannot add term: Term %s is already added", argv[1]);
         else
         {
             char *name = argv[1], *description;
@@ -1038,7 +1052,7 @@ static void helpmod_cmd_term (huser *sender, channel* returntype, char* ostr, in
         int i;
         if (argc < 2)
         {
-            helpmod_reply(sender, returntype, "Can not delete term: Term name not specified");
+            helpmod_reply(sender, returntype, "Cannot delete term: Term name not specified");
             return;
         }
         if (argc > H_CMD_MAX_ARGS)
@@ -1048,7 +1062,7 @@ static void helpmod_cmd_term (huser *sender, channel* returntype, char* ostr, in
             htrm = hterm_get(*source, argv[i]);
             if (htrm == NULL)
             {
-                helpmod_reply(sender, returntype, "Can not delete term: Term %s not found", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot delete term: Term %s not found", argv[i]);
                 continue;
             }
             hterm_del(source != NULL?source:&hterms, htrm);
@@ -1059,7 +1073,7 @@ static void helpmod_cmd_term (huser *sender, channel* returntype, char* ostr, in
     {
         if (argc < 2)
         {
-            helpmod_reply(sender, returntype, "Can not find term: Term name not specified");
+            helpmod_reply(sender, returntype, "Cannot find term: Term name not specified");
             return;
         }
         htrm = hterm_get_and_find(*source, argv[1]);
@@ -1076,7 +1090,7 @@ static void helpmod_cmd_term (huser *sender, channel* returntype, char* ostr, in
     }
     else
     {
-        helpmod_reply(sender, returntype, "Can not handle terms: Operation not specified");
+        helpmod_reply(sender, returntype, "Cannot handle terms: Operation not specified");
     }
 }
 
@@ -1091,7 +1105,7 @@ static void helpmod_cmd_queue (huser *sender, channel* returntype, char* ostr, i
 
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not handle queue: Operation not specified");
+        helpmod_reply(sender, returntype, "Cannot handle queue: Operation not specified");
         return;
     }
 
@@ -1164,7 +1178,7 @@ static void helpmod_cmd_dnmo (huser *sender, channel* returntype, char* ostr, in
     int i;
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not correct the luser: User not defined");
+        helpmod_reply(sender, returntype, "Cannot correct the luser: User not defined");
         return;
     }
     if (argc > H_CMD_MAX_ARGS)
@@ -1174,18 +1188,18 @@ static void helpmod_cmd_dnmo (huser *sender, channel* returntype, char* ostr, in
         huser *husr = huser_get(getnickbynick(argv[i]));
         if (husr == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not correct the luser: User %s not found", argv[i]);
+            helpmod_reply(sender, returntype, "Cannot correct the luser: User %s not found", argv[i]);
             continue;
        }
        if (huser_get_level(husr) > H_PEON)
        {
-           helpmod_reply(sender, returntype, "Can not correct the luser: User %s is not a peon", argv[i]);
+           helpmod_reply(sender, returntype, "Cannot correct the luser: User %s is not a peon", argv[i]);
             continue;
        }
         /*
         if (!hchannels_on_queue(husr) && !hchannels_on_desk(husr))
         {
-            helpmod_reply(sender, returntype, "Can not correct the luser: User %s is not in any queue", argv[i]);
+            helpmod_reply(sender, returntype, "Cannot correct the luser: User %s is not in any queue", argv[i]);
             continue;
         }
         */
@@ -1205,7 +1219,7 @@ static void helpmod_cmd_ban (huser *sender, channel* returntype, char* ostr, int
 {
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not global handle bans: Operation not defined");
+        helpmod_reply(sender, returntype, "Cannot global handle bans: Operation not defined");
         return;
     }
 
@@ -1240,14 +1254,14 @@ static void helpmod_cmd_ban (huser *sender, channel* returntype, char* ostr, int
 
         if (argc == 1)
         {
-            helpmod_reply(sender, returntype, "Can not add global ban: Target hostmask not defined");
+            helpmod_reply(sender, returntype, "Cannot add global ban: Target hostmask not defined");
             return;
         }
         if (argc >= 3)
         {
             if ((duration = helpmod_read_strtime(argv[2])) < 0)
             {
-                helpmod_reply(sender, returntype, "Can not add global ban: Invalid time %s", argv[2]);
+                helpmod_reply(sender, returntype, "Cannot add global ban: Invalid time %s", argv[2]);
                 return;
             }
         }
@@ -1267,7 +1281,7 @@ static void helpmod_cmd_ban (huser *sender, channel* returntype, char* ostr, int
         int i;
         if (argc == 1)
         {
-            helpmod_reply(sender, returntype, "Can not remove global ban: Target hostmask not defined");
+            helpmod_reply(sender, returntype, "Cannot remove global ban: Target hostmask not defined");
             return;
         }
         if (argc > H_CMD_MAX_ARGS)
@@ -1277,7 +1291,7 @@ static void helpmod_cmd_ban (huser *sender, channel* returntype, char* ostr, int
             hban *ptr = hban_get(argv[i]);
             if (ptr == NULL)
             {
-                helpmod_reply(sender, returntype, "Can not remove global ban: Hostmask %s is not banned", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot remove global ban: Hostmask %s is not banned", argv[i]);
                 continue;
             }
             helpmod_reply(sender, returntype, "Global ban for hostmask %s removed", argv[i]);
@@ -1286,7 +1300,7 @@ static void helpmod_cmd_ban (huser *sender, channel* returntype, char* ostr, int
     }
     else
     {
-        helpmod_reply(sender, returntype, "Can not handle global bans: Unknown operation %s", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot handle global bans: Unknown operation %s", argv[0]);
         return;
     }
 }
@@ -1300,7 +1314,7 @@ static void helpmod_cmd_chanban (huser *sender, channel* returntype, char* ostr,
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not handle channel bans: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot handle channel bans: Channel not defined or not found");
         return;
     }
 
@@ -1308,7 +1322,7 @@ static void helpmod_cmd_chanban (huser *sender, channel* returntype, char* ostr,
 
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not handle channel bans: Operation not defined");
+        helpmod_reply(sender, returntype, "Cannot handle channel bans: Operation not defined");
         return;
     }
 
@@ -1339,7 +1353,7 @@ static void helpmod_cmd_chanban (huser *sender, channel* returntype, char* ostr,
     {
         if (argc == 1)
         {
-            helpmod_reply(sender, returntype, "Can not add channel bans: Pattern not defined");
+            helpmod_reply(sender, returntype, "Cannot add channel bans: Pattern not defined");
             return;
         }
         if (argc > H_CMD_MAX_ARGS)
@@ -1355,7 +1369,7 @@ static void helpmod_cmd_chanban (huser *sender, channel* returntype, char* ostr,
     {
         if (argc == 1)
         {
-            helpmod_reply(sender, returntype, "Can not remove channel bans: Pattern not defined");
+            helpmod_reply(sender, returntype, "Cannot remove channel bans: Pattern not defined");
             return;
         }
         if (argc > H_CMD_MAX_ARGS)
@@ -1371,12 +1385,12 @@ static void helpmod_cmd_chanban (huser *sender, channel* returntype, char* ostr,
                     break;
                 }
             if (ptr == NULL)
-                helpmod_reply(sender, returntype, "Can not remove channel ban: Pattern %s not banned on channel %s", argv[i], hchannel_get_name(hchan));
+                helpmod_reply(sender, returntype, "Cannot remove channel ban: Pattern %s not banned on channel %s", argv[i], hchannel_get_name(hchan));
         }
     }
     else
     {
-        helpmod_reply(sender, returntype, "Can not handle channel bans: Unknown operation %s", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot handle channel bans: Unknown operation %s", argv[0]);
         return;
     }
 }
@@ -1392,7 +1406,7 @@ static void helpmod_cmd_idlekick (huser *sender, channel* returntype, char* ostr
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not handle the idlekick: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot handle the idlekick: Channel not defined or not found");
         return;
     }
     if (argc == 0) /* view */
@@ -1402,7 +1416,7 @@ static void helpmod_cmd_idlekick (huser *sender, channel* returntype, char* ostr
     }
     else if ((tmp = helpmod_read_strtime(argv[0])) < 0 || tmp < HDEF_m || tmp > HDEF_w)
     {
-        helpmod_reply(sender, returntype, "Can not set the idlekick: Invalid time given '%s'", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot set the idlekick: Invalid time given '%s'", argv[0]);
         return;
     }
     else /* set it ! */
@@ -1421,7 +1435,7 @@ static void helpmod_cmd_topic (huser *sender, channel* returntype, char* ostr, i
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not handle the topic: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot handle the topic: Channel not defined or not found");
         return;
     }
     if (!(hchan -> flags & H_HANDLE_TOPIC))
@@ -1508,7 +1522,7 @@ static void helpmod_cmd_topic (huser *sender, channel* returntype, char* ostr, i
         hchannel_set_topic(hchan);
     }
     else
-        helpmod_reply(sender, returntype, "Can not handle the topic of channel %s: Unknown operation %s", hchannel_get_name(hchan), argv[0]);
+        helpmod_reply(sender, returntype, "Cannot handle the topic of channel %s: Unknown operation %s", hchannel_get_name(hchan), argv[0]);
 }
 
 static void helpmod_cmd_out (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
@@ -1521,7 +1535,7 @@ static void helpmod_cmd_out (huser *sender, channel* returntype, char* ostr, int
 
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not get rid of the user: User not specified");
+        helpmod_reply(sender, returntype, "Cannot get rid of the user: User not specified");
         return;
     }
 
@@ -1533,7 +1547,7 @@ static void helpmod_cmd_out (huser *sender, channel* returntype, char* ostr, int
        {
            if (i == 0)
            {
-               helpmod_reply(sender, returntype, "Can not get rid of users: No users specified");
+               helpmod_reply(sender, returntype, "Cannot get rid of users: No users specified");
                return;
            }
            while (i--)
@@ -1547,12 +1561,12 @@ static void helpmod_cmd_out (huser *sender, channel* returntype, char* ostr, int
        husr = huser_get(getnickbynick(argv[i]));
         if (husr == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not get rid of the user: User %s not found", argv[i]);
+            helpmod_reply(sender, returntype, "Cannot get rid of the user: User %s not found", argv[i]);
             continue;
         }
         if (huser_get_level(husr) > H_PEON)
         {
-            helpmod_reply(sender, returntype, "Can not get rid of the user: User %s is not a peon", husr->real_user->nick);
+            helpmod_reply(sender, returntype, "Cannot get rid of the user: User %s is not a peon", huser_get_nick(husr));
             continue;
        }
         targets[ntargets++] = husr;
@@ -1564,7 +1578,7 @@ static void helpmod_cmd_out (huser *sender, channel* returntype, char* ostr, int
 
        hban_add(banmask, reason, time(NULL) + HCMD_OUT_DEFAULT, 0);
 
-       helpmod_reply(sender, returntype, "User %s is now gone", targets[i]->real_user->nick);
+       helpmod_reply(sender, returntype, "User %s is now gone", huser_get_nick(targets[i]));
     }
 }
 
@@ -1581,7 +1595,7 @@ static void helpmod_cmd_everyoneout (huser *sender, channel* returntype, char* o
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not clear channel: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot clear channel: Channel not defined or not found");
         return;
     }
 
@@ -1626,13 +1640,13 @@ static void helpmod_cmd_kick (huser *sender, channel* returntype, char* ostr, in
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not kick the user: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot kick the user: Channel not defined or not found");
        return;
     }
 
     if (argc == 0)
     {
-       helpmod_reply(sender, returntype, "Can not kick users: No users specified");
+       helpmod_reply(sender, returntype, "Cannot kick users: No users specified");
        return;
     }
 
@@ -1644,7 +1658,7 @@ static void helpmod_cmd_kick (huser *sender, channel* returntype, char* ostr, in
         {
            if (i == 0)
            {
-               helpmod_reply(sender, returntype, "Can not kick the user: No users defined");
+               helpmod_reply(sender, returntype, "Cannot kick the user: No users defined");
                return;
            }
            while (i--)
@@ -1657,17 +1671,17 @@ static void helpmod_cmd_kick (huser *sender, channel* returntype, char* ostr, in
         husr = huser_get(getnickbynick(argv[i]));
         if (husr == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not kick the user: User %s not found", argv[i]);
+            helpmod_reply(sender, returntype, "Cannot kick the user: User %s not found", argv[i]);
             continue;
         }
         if (huser_on_channel(husr, hchan) == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not kick the user: User %s is not on channel %s", husr->real_user->nick, hchannel_get_name(hchan));
+            helpmod_reply(sender, returntype, "Cannot kick the user: User %s is not on channel %s", huser_get_nick(husr), hchannel_get_name(hchan));
             continue;
         }
         if (huser_get_level(husr) > H_PEON)
         {
-            helpmod_reply(sender, returntype, "Can not kick the user: User %s is not a peon", husr->real_user->nick);
+            helpmod_reply(sender, returntype, "Cannot kick the user: User %s is not a peon", huser_get_nick(husr));
             continue;
         }
         targets[ntargets++] = husr;
@@ -1697,7 +1711,7 @@ static void helpmod_cmd_stats (huser *sender, channel* returntype, char* ostr, i
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not show user statistics: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot show user statistics: Channel not defined or not found");
         return;
     }
 
@@ -1708,7 +1722,7 @@ static void helpmod_cmd_stats (huser *sender, channel* returntype, char* ostr, i
             target = haccount_get_by_name(argv[0]+1);
             if (target == NULL)
             {
-                helpmod_reply(sender, returntype, "Can not show user statistics: Account %s not found", argv[0]);
+                helpmod_reply(sender, returntype, "Cannot show user statistics: Account %s not found", argv[0]);
                 return;
             }
             SKIP_WORD;
@@ -1717,7 +1731,7 @@ static void helpmod_cmd_stats (huser *sender, channel* returntype, char* ostr, i
 
     if (target == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not show user statistics: You do not have an account");
+        helpmod_reply(sender, returntype, "Cannot show user statistics: You do not have an account");
         return;
     }
     
@@ -1740,7 +1754,7 @@ static void helpmod_cmd_stats (huser *sender, channel* returntype, char* ostr, i
         {
             if (days < 0 || days > 7)
             {
-                helpmod_reply(sender, returntype, "Can not show user statistics: Expected integer between [0, 7]");
+                helpmod_reply(sender, returntype, "Cannot show user statistics: Expected integer between [0, 7]");
                 return;
             }
             else
@@ -1754,7 +1768,7 @@ static void helpmod_cmd_stats (huser *sender, channel* returntype, char* ostr, i
         {
             if (weeks < 0 || weeks > 10)
             {
-                helpmod_reply(sender, returntype, "Can not show user statistics: Expected integer between [0, 10]");
+                helpmod_reply(sender, returntype, "Cannot show user statistics: Expected integer between [0, 10]");
                 return;
             }
             else
@@ -1769,7 +1783,7 @@ static void helpmod_cmd_stats (huser *sender, channel* returntype, char* ostr, i
 
     if (ptr == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not show user statistics: User %s has no statistics for channel %s", target->name->content, hchannel_get_name(hchan));
+        helpmod_reply(sender, returntype, "Cannot show user statistics: User %s has no statistics for channel %s", target->name->content, hchannel_get_name(hchan));
         return;
     }
 
@@ -1822,7 +1836,7 @@ static void helpmod_cmd_chanstats (huser *sender, channel* returntype, char* ost
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not show channel statistics: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot show channel statistics: Channel not defined or not found");
         return;
     }
 
@@ -1845,7 +1859,7 @@ static void helpmod_cmd_chanstats (huser *sender, channel* returntype, char* ost
         {
             if (days < 0 || days > 7)
             {
-                helpmod_reply(sender, returntype, "Can not show channel statistics: Expected integer between [0, 7]");
+                helpmod_reply(sender, returntype, "Cannot show channel statistics: Expected integer between [0, 7]");
                 return;
             }
             else
@@ -1859,7 +1873,7 @@ static void helpmod_cmd_chanstats (huser *sender, channel* returntype, char* ost
         {
             if (weeks < 0 || weeks > 10)
             {
-                helpmod_reply(sender, returntype, "Can not show channel statistics: Expected integer between [0, 10]");
+                helpmod_reply(sender, returntype, "Cannot show channel statistics: Expected integer between [0, 10]");
                 return;
             }
             else
@@ -1911,7 +1925,7 @@ static void helpmod_cmd_activestaff (huser *sender, channel* returntype, char* o
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not list active staff: Channel not specified or not found");
+        helpmod_reply(sender, returntype, "Cannot list active staff: Channel not specified or not found");
         return;
     }
 
@@ -1974,7 +1988,7 @@ static void helpmod_cmd_top10 (huser *sender, channel* returntype, char* ostr, i
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not list channel Top10: Channel not specified or not found");
+        helpmod_reply(sender, returntype, "Cannot list channel Top10: Channel not specified or not found");
         return;
     }
 
@@ -1982,8 +1996,10 @@ static void helpmod_cmd_top10 (huser *sender, channel* returntype, char* ostr, i
     {
         if (!ci_strcmp(argv[0], "opers") || !ci_strcmp(argv[0], "o"))
             lvl = H_OPER;
-        else if (!ci_strcmp(argv[0], "staff") || !ci_strcmp(argv[0], "s"))
-            lvl = H_STAFF;
+       else if (!ci_strcmp(argv[0], "staff") || !ci_strcmp(argv[0], "s"))
+           lvl = H_STAFF;
+       else if (!ci_strcmp(argv[0], "all") || !ci_strcmp(argv[0], "a"))
+            lvl = H_ANY;
     }
     if (argc == 3)
     {
@@ -2016,7 +2032,7 @@ static void helpmod_cmd_report (huser *sender, channel* returntype, char* ostr,
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not view or set channel reporting: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot view or set channel reporting: Channel not defined or not found");
         return;
     }
     if (argc != 1)
@@ -2029,7 +2045,7 @@ static void helpmod_cmd_report (huser *sender, channel* returntype, char* ostr,
     }
     if ((target = hchannel_get_by_name(argv[0])) == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not set channel reporting: Channel %s not found", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot set channel reporting: Channel %s not found", argv[0]);
         return;
     }
     hchan->report_to = target;
@@ -2049,14 +2065,14 @@ static void helpmod_cmd_mode(huser *sender, channel* returntype, int change, cha
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not change mode: Channel not specified or not found");
+        helpmod_reply(sender, returntype, "Cannot change mode: Channel not specified or not found");
         return;
     }
 
     if (argc==0) /* for a simple opme */
     {
         argc = 1;
-        argv[0] = sender->real_user->nick;
+        argv[0] = (char*)huser_get_nick(sender);
     }
 
     if (argc > H_CMD_MAX_ARGS)
@@ -2067,13 +2083,13 @@ static void helpmod_cmd_mode(huser *sender, channel* returntype, int change, cha
         husr = huser_get(getnickbynick(argv[i]));
         if (husr == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not change mode: User %s not found", argv[i], hchannel_get_name(hchan));
+            helpmod_reply(sender, returntype, "Cannot change mode: User %s not found", argv[i], hchannel_get_name(hchan));
             continue;
         }
         huserchan = huser_on_channel(husr, hchan);
         if (huserchan == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not change mode: User %s it not on channel %s", husr->real_user->nick, hchannel_get_name(hchan));
+            helpmod_reply(sender, returntype, "Cannot change mode: User %s it not on channel %s", huser_get_nick(husr), hchannel_get_name(hchan));
             continue;
         }
 
@@ -2092,12 +2108,12 @@ static void helpmod_cmd_mode(huser *sender, channel* returntype, int change, cha
                 }
                 if (huserchan->flags & HCUMODE_OP)
                 {
-                    helpmod_reply(sender, returntype, "Can not change mode: User %s is already +o on channel %s", husr->real_user->nick, hchannel_get_name(hchan));
+                    helpmod_reply(sender, returntype, "Cannot change mode: User %s is already +o on channel %s", huser_get_nick(husr), hchannel_get_name(hchan));
                     continue;
                 }
                 if (huser_get_level(husr) < H_STAFF)
                 {
-                    helpmod_reply(sender, returntype, "Can not change mode: User %s is not allowed to have +o on channel %s", husr->real_user->nick, hchannel_get_name(hchan));
+                    helpmod_reply(sender, returntype, "Cannot change mode: User %s is not allowed to have +o on channel %s", huser_get_nick(husr), hchannel_get_name(hchan));
                     continue;
                 }
                 helpmod_channick_modes(husr, hchan, MC_OP, HLAZY);
@@ -2116,12 +2132,12 @@ static void helpmod_cmd_mode(huser *sender, channel* returntype, int change, cha
                 }
                 if (!(huserchan->flags & HCUMODE_OP))
                 {
-                    helpmod_reply(sender, returntype, "Can not change mode: User %s is already -o on channel %s", husr->real_user->nick, hchannel_get_name(hchan));
+                    helpmod_reply(sender, returntype, "Cannot change mode: User %s is already -o on channel %s", huser_get_nick(husr), hchannel_get_name(hchan));
                     continue;
                 }
                 if (huser_get_level(husr) > huser_get_level(sender))
                 {
-                    helpmod_reply(sender, returntype, "Can not change mode: User %s is meant to have +o on channel %s", husr->real_user->nick, hchannel_get_name(hchan));
+                    helpmod_reply(sender, returntype, "Cannot change mode: User %s is meant to have +o on channel %s", huser_get_nick(husr), hchannel_get_name(hchan));
                     continue;
                 }
                 helpmod_channick_modes(husr, hchan, MC_DEOP, HLAZY);
@@ -2140,7 +2156,7 @@ static void helpmod_cmd_mode(huser *sender, channel* returntype, int change, cha
                 }
                 if (huserchan->flags & HCUMODE_VOICE)
                 {
-                    helpmod_reply(sender, returntype, "Can not change mode: User %s is already +v on channel %s", husr->real_user->nick, hchannel_get_name(hchan));
+                    helpmod_reply(sender, returntype, "Cannot change mode: User %s is already +v on channel %s", huser_get_nick(husr), hchannel_get_name(hchan));
                     continue;
                 }
                 helpmod_channick_modes(husr, hchan, MC_VOICE, HLAZY);
@@ -2159,7 +2175,7 @@ static void helpmod_cmd_mode(huser *sender, channel* returntype, int change, cha
                 }
                 if (!(huserchan->flags & HCUMODE_VOICE))
                 {
-                    helpmod_reply(sender, returntype, "Can not change mode: User %s is already -v on channel %s", husr->real_user->nick, hchannel_get_name(hchan));
+                    helpmod_reply(sender, returntype, "Cannot change mode: User %s is already -v on channel %s", huser_get_nick(husr), hchannel_get_name(hchan));
                     continue;
                 }
                 helpmod_channick_modes(husr, hchan, MC_DEVOICE, HLAZY);
@@ -2181,7 +2197,7 @@ static void helpmod_cmd_invite (huser *sender, channel *returntype, char* arg, i
 
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not invite: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot invite: Channel not defined or not found");
         return;
     }
 
@@ -2191,26 +2207,26 @@ static void helpmod_cmd_invite (huser *sender, channel *returntype, char* arg, i
         hchan = hchannel_get_by_name(argv[0]);
         if (hchan == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not invite: Unknown channel %s", argv[0]);
+            helpmod_reply(sender, returntype, "Cannot invite: Unknown channel %s", argv[0]);
             return;
         }
         /* if tickets don't work, it's better that the user doesn't know that the channel really exists */
         if (!(hchan->flags & H_REQUIRE_TICKET))
         {
-            helpmod_reply(sender, returntype, "Can not invite: Unknown channel %s", argv[0]);
+            helpmod_reply(sender, returntype, "Cannot invite: Unknown channel %s", argv[0]);
             return;
         }
-        htick = hticket_get(sender->real_user->authname, hchan);
+        htick = hticket_get(huser_get_auth(sender), hchan);
 
         if (htick == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not invite: You do not have an invite ticket for channel %s", argv[0]);
+            helpmod_reply(sender, returntype, "Cannot invite: You do not have an invite ticket for channel %s", argv[0]);
             return;
         }
 
         if (nickbanned(sender->real_user, hchan->real_channel))
         {
-            helpmod_reply(sender, returntype, "Can not invite: You are banned from channel %s", argv[0]);
+            helpmod_reply(sender, returntype, "Cannot invite: You are banned from channel %s", argv[0]);
             return;
         }
 
@@ -2227,17 +2243,17 @@ static void helpmod_cmd_invite (huser *sender, channel *returntype, char* arg, i
         hchan = hchannel_get_by_name(argv[0]);
         if (hchan == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not invite: Unknown channel %s", argv[i]);
+            helpmod_reply(sender, returntype, "Cannot invite: Unknown channel %s", argv[i]);
             continue;
         }
-        if (!(hchannel_authority(hchan, sender) || hticket_get(sender->real_user->authname, hchan)))
+        if (!(hchannel_authority(hchan, sender) || hticket_get(huser_get_auth(sender), hchan)))
         {
             helpmod_reply(sender, returntype, "Sorry, channel %s is oper only", hchannel_get_name(hchan));
             continue;
         }
         if (huser_on_channel(sender, hchan) != NULL)
         {
-            helpmod_reply(sender, returntype, "Can not invite: You are already on channel %s", hchannel_get_name(hchan));
+            helpmod_reply(sender, returntype, "Cannot invite: You are already on channel %s", hchannel_get_name(hchan));
             continue;
         }
         helpmod_invite(hchan, sender);
@@ -2254,41 +2270,41 @@ static void helpmod_cmd_ticket (huser *sender, channel* returntype, char* ostr,
 
     if (argc < 1)
     {
-        helpmod_reply(sender, returntype, "Can not issue a ticket: Channel not specified");
+        helpmod_reply(sender, returntype, "Cannot issue a ticket: Channel not specified");
         return;
     }
 
     hchan = hchannel_get_by_name(argv[0]);
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not issue a ticket: Unknown channel %s", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot issue a ticket: Unknown channel %s", argv[0]);
         return;
     }
     if (!(hchan->flags & H_REQUIRE_TICKET))
     {
-        helpmod_reply(sender, returntype, "Can not issue a ticket: Tickets are not enabled for channel %s", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot issue a ticket: Tickets are not enabled for channel %s", argv[0]);
         return;
     }
     if (argc < 2)
     {
-        helpmod_reply(sender, returntype, "Can not issue a ticket: Target user not specified");
+        helpmod_reply(sender, returntype, "Cannot issue a ticket: Target user not specified");
         return;
     }
 
     husr = huser_get(getnickbynick(argv[1]));
     if (husr == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not issue a ticket: Unknown user %s", argv[1]);
+        helpmod_reply(sender, returntype, "Cannot issue a ticket: Unknown user %s", argv[1]);
         return;
     }
     if (!IsAccount(husr->real_user))
     {
-        helpmod_reply(sender, returntype, "Can not issue a ticket: User %s is not authed", argv[1]);
+        helpmod_reply(sender, returntype, "Cannot issue a ticket: User %s is not authed", argv[1]);
         return;
     }
     if (huser_get_level(husr) < H_PEON)
     {
-        helpmod_reply(sender, returntype, "Can not issue a ticket: User %s is considered improper and not worthy of a ticket", argv[1]);
+        helpmod_reply(sender, returntype, "Cannot issue a ticket: User %s is considered improper and not worthy of a ticket", argv[1]);
         return;
     }
     if (argc >= 3)
@@ -2299,14 +2315,14 @@ static void helpmod_cmd_ticket (huser *sender, channel* returntype, char* ostr,
             expiration = tmp;
     }
 
-    htick = hticket_get(husr->real_user->authname, hchan);
+    htick = hticket_get(huser_get_auth(husr), hchan);
 
     if (htick != NULL)
         htick->time_expiration = time(NULL) + expiration;
     else
-        hticket_add(husr->real_user->authname, time(NULL) + expiration, hchan);
+        hticket_add(huser_get_auth(husr), time(NULL) + expiration, hchan);
 
-    helpmod_reply(sender, returntype, "Issued an invite ticket to user %s for channel %s expiring in %s", husr->real_user->nick, hchannel_get_name(hchan), helpmod_strtime(expiration));
+    helpmod_reply(sender, returntype, "Issued an invite ticket to user %s for channel %s expiring in %s", huser_get_nick(husr), hchannel_get_name(hchan), helpmod_strtime(expiration));
     helpmod_reply(husr, NULL, "You have been issued an invite ticket for channel %s. This ticket is valid for a period of %s. You can use my invite command to get to the channel now. Type /msg %s invite %s",hchannel_get_name(hchan), helpmod_strtime(HTICKET_EXPIRATION_TIME), helpmodnick->nick, hchannel_get_name(hchan));
 }
 
@@ -2326,7 +2342,7 @@ static void helpmod_cmd_resolve (huser *sender, channel* returntype, char* ostr,
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not resolve a ticket: The channel is not specified");
+        helpmod_reply(sender, returntype, "Cannot resolve a ticket: The channel is not specified");
         return;
     }
 
@@ -2337,7 +2353,7 @@ static void helpmod_cmd_resolve (huser *sender, channel* returntype, char* ostr,
             htick = hticket_get(&argv[i][1], hchan);
             if (htick == NULL)
             {
-                helpmod_reply(sender, returntype, "Can not resolve a ticket: Authname %s does not have a ticket for channel %s", &argv[i][1], hchannel_get_name(hchan));
+                helpmod_reply(sender, returntype, "Cannot resolve a ticket: Authname %s does not have a ticket for channel %s", &argv[i][1], hchannel_get_name(hchan));
                 continue;
             }
             hticket_del(htick, hchan);
@@ -2348,18 +2364,18 @@ static void helpmod_cmd_resolve (huser *sender, channel* returntype, char* ostr,
             husr = huser_get(getnickbynick(argv[i]));
             if (husr == NULL)
             {
-                helpmod_reply(sender, returntype, "Can not resolve a ticket: User %s not found", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot resolve a ticket: User %s not found", argv[i]);
                 continue;
             }
             if (!IsAccount(husr->real_user))
             {
-                helpmod_reply(sender, returntype, "Can not resolve a ticket: User %s is not authed", argv[i]);
+                helpmod_reply(sender, returntype, "Cannot resolve a ticket: User %s is not authed", argv[i]);
                 continue;
             }
-            htick = hticket_get(husr->real_user->authname,hchan);
+            htick = hticket_get(huser_get_auth(husr),hchan);
             if (htick == NULL)
             {
-                helpmod_reply(sender, returntype, "Can not resolve a ticket: User %s does not have a ticket for channel %s", argv[i], hchannel_get_name(hchan));
+                helpmod_reply(sender, returntype, "Cannot resolve a ticket: User %s does not have a ticket for channel %s", argv[i], hchannel_get_name(hchan));
                 continue;
             }
             hticket_del(htick, hchan);
@@ -2380,13 +2396,13 @@ static void helpmod_cmd_tickets (huser *sender, channel* returntype, char* ostr,
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not list tickets: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot list tickets: Channel not defined or not found");
         return;
     }
 
     if (!(hchan->flags & H_REQUIRE_TICKET))
     {
-        helpmod_reply(sender, returntype, "Can not list tickets: Channel %s does not use the ticket system", hchannel_get_name(hchan));
+        helpmod_reply(sender, returntype, "Cannot list tickets: Channel %s does not use the ticket system", hchannel_get_name(hchan));
         return;
     }
 
@@ -2422,7 +2438,7 @@ static void helpmod_cmd_showticket (huser *sender, channel* returntype, char* os
 
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not show the ticket: Channel not defined or not found");
+        helpmod_reply(sender, returntype, "Cannot show the ticket: Channel not defined or not found");
         return;
     }
     for (i = 0;i < argc;i++)
@@ -2430,18 +2446,18 @@ static void helpmod_cmd_showticket (huser *sender, channel* returntype, char* os
         husr = huser_get(getnickbynick(argv[i]));
         if (husr == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not show the ticket: User %s not found", argv[i]);
+            helpmod_reply(sender, returntype, "Cannot show the ticket: User %s not found", argv[i]);
             continue;
         }
         if (!IsAccount(husr->real_user))
         {
-            helpmod_reply(sender, returntype, "Can not show the ticket: User %s is not authed", argv[i]);
+            helpmod_reply(sender, returntype, "Cannot show the ticket: User %s is not authed", argv[i]);
             continue;
         }
-        htick = hticket_get(husr->real_user->authname, hchan);
+        htick = hticket_get(huser_get_auth(husr), hchan);
         if (htick == NULL)
         {
-            helpmod_reply(sender, returntype, "Can not show the ticket: User %s does not have a valid ticket for channel %s", argv[i], hchannel_get_name(hchan));
+            helpmod_reply(sender, returntype, "Cannot show the ticket: User %s does not have a valid ticket for channel %s", argv[i], hchannel_get_name(hchan));
             continue;
         }
         helpmod_reply(sender, returntype, "User %s has a ticket for channel %s expiring in %s", argv[i], hchannel_get_name(hchan), helpmod_strtime(htick->time_expiration - time(NULL)));
@@ -2470,7 +2486,7 @@ static void helpmod_cmd_termstats(huser *sender, channel* returntype, char* ostr
 
     if (count == 0)
     {
-        helpmod_reply(sender, returntype, "Can not list term usage statistics: No terms available");
+        helpmod_reply(sender, returntype, "Cannot list term usage statistics: No terms available");
         return;
     }
 
@@ -2524,14 +2540,14 @@ static void helpmod_cmd_checkchannel(huser *sender, channel* returntype, char* o
 
     if (argc == 0)
     {
-        helpmod_reply(sender, returntype, "Can not check channel: Channel not defined");
+        helpmod_reply(sender, returntype, "Cannot check channel: Channel not defined");
         return;
     }
 
     chan = findchannel(argv[0]);
     if (chan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not check channel: Channel %s not found", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot check channel: Channel %s not found", argv[0]);
         return;
     }
     if (argc > 1 && !ci_strcmp(argv[1], "summary"))
@@ -2551,7 +2567,7 @@ static void helpmod_cmd_checkchannel(huser *sender, channel* returntype, char* o
 
             if (IsOper(nck) && strlen(nck->nick) > 1)
             {
-                helpmod_reply(sender, returntype, "Can not check channel: Permission denied. Channel %s has an oper on it", argv[0]);
+                helpmod_reply(sender, returntype, "Cannot check channel: Permission denied. Channel %s has an oper on it", argv[0]);
                 return;
             }
        }
@@ -2607,7 +2623,7 @@ static void helpmod_cmd_checkchannel(huser *sender, channel* returntype, char* o
 
            visiblehostmask(getnickbynumeric(numeric_array[i]), buf);
            if (IsAccount(getnickbynumeric(numeric_array[i])))
-               helpmod_reply(sender, returntype, "%c%s (%s)", status, buf, getnickbynumeric(numeric_array[i])->authname);//nick_array[i]->authname);
+               helpmod_reply(sender, returntype, "%c%s (%s)", status, buf, getnickbynumeric(numeric_array[i])->authname);
            else
                helpmod_reply(sender, returntype, "%c%s", status, buf);
        }
@@ -2794,20 +2810,88 @@ static void helpmod_cmd_message (huser *sender, channel* returntype, char* ostr,
 
     if (argc < 2)
     {
-        helpmod_reply(sender, returntype, "Can not send a message: Insufficient arguments");
+        helpmod_reply(sender, returntype, "Cannot send a message: Insufficient arguments");
         return;
     }
     hchan = hchannel_get_by_name(argv[0]);
     if (hchan == NULL)
     {
-        helpmod_reply(sender, returntype, "Can not send a message: Invalid channel %s", argv[0]);
+        helpmod_reply(sender, returntype, "Cannot send a message: Invalid channel %s", argv[0]);
         return;
     }
     SKIP_WORD;
-    helpmod_message_channel(hchan, "(%s) %s", sender->real_user->nick, ostr);
+    helpmod_message_channel(hchan, "(%s) %s", huser_get_nick(sender), ostr);
     helpmod_reply(sender, returntype, "Message sent to %s", hchannel_get_name(hchan));
 }
 
+static void helpmod_cmd_version (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
+{
+    helpmod_reply(sender, returntype, "HelpMod version " HELPMOD_VERSION " by strutsi (strutsi@quakenet.org)");
+}
+
+static void helpmod_cmd_evilhack1 (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
+{
+    int tmp;
+
+    if (argc == 0)
+       helpmod_reply(sender, returntype, "hstat_cycle: %d", hstat_cycle);
+    else
+    {
+       if (!sscanf(argv[0], "%d", &tmp) || tmp < 0)
+       {
+            helpmod_reply(sender, returntype, "Invalid argument");
+            return;
+       }
+       hstat_cycle = tmp;
+       helpmod_reply(sender, returntype, "hstat_cycle is now: %d", hstat_cycle);
+    }
+}
+
+static void helpmod_cmd_evilhack2 (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
+{
+    haccount *hacc = haccounts;
+    hchannel *hchan;
+    hstat_account *ptr;
+    hstat_account_entry tmp_account;
+    hstat_channel_entry tmp_channel;
+    int first, second;
+
+    if (argc != 2)
+    {
+       helpmod_reply(sender, returntype, "Syntax error: evilhack2 <first> <second>");
+       return;
+    }
+
+    if (!sscanf(argv[0],"%d", &first) || first < 0 || first > 9)
+    {
+       helpmod_reply(sender, returntype, "Syntax error: Invalid first");
+       return;
+    }
+
+    if (!sscanf(argv[1],"%d", &second) || second < 0 || second > 9)
+    {
+       helpmod_reply(sender, returntype, "Syntax error: Invalid second");
+       return;
+    }
+
+    for (;hacc;hacc = hacc->next)
+        for (ptr = hacc->stats;ptr;ptr = ptr->next)
+       {
+           tmp_account = ptr->longterm[first];
+           ptr->longterm[first] = ptr->longterm[second];
+            ptr->longterm[second] = tmp_account;
+       }
+
+    for (hchan = hchannels;hchan;hchan = hchan->next)
+    {
+           tmp_channel = hchan->stats->longterm[first];
+           hchan->stats->longterm[first] = hchan->stats->longterm[second];
+           hchan->stats->longterm[second] = tmp_channel;
+    }
+
+    helpmod_reply(sender, returntype, "Evilhack2 done: Swapped %d and %d", first, second);
+}
+
 /* old H stuff */
 void helpmod_cmd_load (huser *sender, channel *returntype, char* arg, int argc, char *argv[])
 {
@@ -3041,6 +3125,12 @@ void hcommands_add(void)
     hcommand_add("statsreset", H_ADMIN, helpmod_cmd_statsreset, "Statistics reset command");
 
     hcommand_add("message", H_TRIAL, helpmod_cmd_message, "Sends a message to a channel");
+    hcommand_add("version", H_PEON, helpmod_cmd_version, "G version information");
+
+    hcommand_add("evilhack1", H_ADMIN, helpmod_cmd_evilhack1, "An evil hack, don't use");
+    hcommand_add("evilhack2", H_ADMIN, helpmod_cmd_evilhack2, "Another evil hack, don't use");
+
+
     /*hcommand_add("megod", H_PEON, helpmod_cmd_megod, "Gives you userlevel 4, if you see this in the final version, please kill strutsi");*/
     /*hcommand_add("test", H_PEON, helpmod_cmd_test, "Gives you userlevel 4, if you see this in the final version, please kill strutsi");*/
 }
@@ -3114,7 +3204,7 @@ void helpmod_command(huser *sender, channel* returntype, char *args)
     }
 
     {
-        char *ostr = args, **argv = (char**)&parsed_args; // for SKIP_WORD
+        char *ostr = args, **argv = (char**)&parsed_args;
         hcommand *hcom = hcommand_get(parsed_args[0], huser_get_level(sender));
 
        if (hcom == NULL)
index 231f4c2128cacafcaf992a22de142cf6a15d479c..4ab9d00f1ba69c112f7c3f3a56f35f8525dc81f7 100644 (file)
@@ -8,6 +8,8 @@
 
 #define H_CMD_MAX_ARGS 6
 
+#define HCMD_OUT_DEFAULT (10 * HDEF_m)
+
 void hcommands_add(void);
 
 void helpmod_command(huser *, channel*, char*);
index c62140586e29a8f1d809e12f13cc8460e12f4b63..50ab25495652267e4cb1ac6dcb069cd46404b67d 100644 (file)
@@ -9,6 +9,7 @@
 #include "helpmod.h"
 #include "hterm.h"
 
+static int hconf_version;
 
 static void helpmod_line_fix(char **ptr)
 {
@@ -28,6 +29,9 @@ int helpmod_config_read(const char *fname)
     FILE *in;
     char buf[512], *ptr;
 
+    /* Assume G 2.0 configuration */
+    hconf_version = HELPMOD_VERSION_2_0;
+
     if ((in = fopen(fname,"rt")) == NULL)
         return -1;
 
@@ -48,7 +52,15 @@ int helpmod_config_read(const char *fname)
             continue;
 
         /* check what kind of a line it was */
-        if (!strcmp(ptr, "channel"))
+       if (!strcmp(ptr, "version"))
+       { /* If no version is present, then the assumed G 2.0 version is used */
+           if (helpmod_config_read_version(in))
+               Error("helpmod", ERR_WARNING, "Reading of database entry 'version' failed");
+
+           if (hconf_version > HELPMOD_VERSION_INTERNAL)
+               Error("helpmod", ERR_WARNING, "Database version is higher than the current version");
+       }
+       else if (!strcmp(ptr, "channel"))
         {
             if (helpmod_config_read_channel(in))
                 Error("helpmod", ERR_WARNING, "Reading of database entry 'channel' failed");
@@ -88,7 +100,7 @@ int helpmod_config_read(const char *fname)
             if (helpmod_config_read_ticket(in))
                 Error("helpmod", ERR_WARNING, "Reading of database entry 'ticket' failed");
         }
-        else
+       else
             Error("helpmod", ERR_WARNING, "Unknown database entry '%s'", ptr);
     }
 
@@ -101,16 +113,29 @@ int helpmod_config_read(const char *fname)
 int helpmod_config_write(const char *fname)
 {
     FILE *out;
-    /*char buf[512];*/
     time_t timer = time(NULL);
 
     if ((out = fopen(fname,"wt")) == NULL)
         return -1;
 
-    fprintf(out, "%% H2 version %s database\n", HELPMOD_VERSION);
+    fprintf(out, "%% G2 version %s database\n", HELPMOD_VERSION);
     fprintf(out, "%% %s\n\n", asctime(localtime(&timer)));
 
 
+    { /* version */
+       fprintf(out, "%% G internal version\n");
+        fprintf(out, "version\n");
+        helpmod_config_write_version(out);
+    }
+
+    { /* globals */
+
+        fprintf(out,"\n%% global variables\n");
+        fprintf(out,"%%  hstat_cycle\n");
+        fprintf(out,"globals\n");
+        helpmod_config_write_globals(out);
+    }
+
     { /* lamercontrol profiles */
         hlc_profile *ptr = hlc_profiles;
 
@@ -223,14 +248,6 @@ int helpmod_config_write(const char *fname)
         }
     }
 
-    { /* globals */
-
-        fprintf(out,"\n%% global variables\n");
-        fprintf(out,"%%  hstat_cycle\n");
-        fprintf(out,"globals\n");
-        helpmod_config_write_globals(out);
-    }
-
     fclose(out);
 
     return 0;
@@ -286,19 +303,36 @@ int helpmod_config_read_channel(FILE *in)
         return -1;
     for (i = 0;i<entries;i++)
     {
-        char buf2[512], *ptr2;
+       char buf2[512], *ptr2;
+       int type;
 
         fgets((ptr = buf), 256, in);
-        if (feof(in))
+       if (feof(in))
             return -1;
         helpmod_line_fix(&ptr);
 
+       if (hconf_version >= HELPMOD_VERSION_2_10)
+       {
+           if (!sscanf(ptr, "%d", &type))
+               return -1;
+
+           fgets((ptr = buf), 256, in);
+           if (feof(in))
+               return -1;
+           helpmod_line_fix(&ptr);
+       }
+       else
+            type = HCENSOR_KICK;
+
         fgets((ptr2 = buf2), 256, in);
         if (feof(in))
             return -1;
         helpmod_line_fix(&ptr2);
 
-        hcensor_add(&hchan->censor, ptr, ptr2);
+       if (ptr2[0] == '\0')
+            ptr2 = NULL;
+
+        hcensor_add(&hchan->censor, ptr, ptr2, type);
     }
     /* channel specific hterms */
     fgets((ptr = buf), 256, in);
@@ -334,9 +368,10 @@ int helpmod_config_write_channel(FILE *out, hchannel *target)
     {
         hcensor *hcens = target->censor;
         for (;hcens;hcens = hcens->next)
-        {
+       {
+            fprintf(out, "\t\t%d\n", hcens->type);
             fprintf(out, "\t\t%s\n", hcens->pattern->content);
-            fprintf(out, "\t\t%s\n", hcens->reason->content);
+           fprintf(out, "\t\t%s\n", hcens->reason?hcens->reason->content:"");
         }
     }
 
@@ -447,7 +482,7 @@ int helpmod_config_write_ban(FILE *out, hban *hb)
 {
     fprintf(out, "\t%s\n", bantostring(hb->real_ban));
     fprintf(out, "\t%s\n", hb->reason?hb->reason->content:NULL);
-    fprintf(out, "\t%u\n", hb->expiration);
+    fprintf(out, "\t%u\n", (unsigned int)hb->expiration);
     return 0;
 }
 
@@ -592,8 +627,16 @@ int helpmod_config_read_chanstats(FILE *in, hstat_channel *hs_chan)
         else /* weeks */
             entry = &hs_chan->longterm[(hstat_week() + (i-7)) % 10];
 
-        if (sscanf(buf, "%d %d %d %d %d %d", &entry->time_spent, &entry->prime_time_spent, &entry->joins, &entry->queue_use, &entry->lines, &entry->words) != 6)
+       if (hconf_version < HELPMOD_VERSION_2_10)
+       {
+           if (sscanf(buf, "%d %d %d %d %d %d", &entry->time_spent, &entry->prime_time_spent, &entry->joins, &entry->queue_use, &entry->lines, &entry->words) != 6)
             return -1;
+       }
+       else
+       {
+           if (sscanf(buf, "%d %d %d %d %d %d %d %d", &entry->active_time, &entry->staff_active_time, &entry->time_spent, &entry->prime_time_spent, &entry->joins, &entry->queue_use, &entry->lines, &entry->words) != 8)
+               return -1;
+       }
     }
     return 0;
 }
@@ -610,7 +653,7 @@ int helpmod_config_write_chanstats(FILE *out, hstat_channel *hs_chan)
         else /* weeks */
             entry = &hs_chan->longterm[(hstat_week() + (i-7)) % 10];
 
-        fprintf(out, "\t%d %d %d %d %d %d\n", entry->time_spent, entry->prime_time_spent, entry->joins, entry->queue_use, entry->lines, entry->words);
+        fprintf(out, "\t%d %d %d %d %d %d %d %d\n", entry->active_time, entry->staff_active_time, entry->time_spent, entry->prime_time_spent, entry->joins, entry->queue_use, entry->lines, entry->words);
     }
     return 0;
 }
@@ -758,7 +801,29 @@ int helpmod_config_write_ticket(FILE *out, hticket *htick, hchannel *hchan)
 {
     fprintf(out, "\t%s\n", hchannel_get_name(hchan));
     fprintf(out, "\t%s\n", htick->authname);
-    fprintf(out, "\t%u\n", htick->time_expiration);
+    fprintf(out, "\t%u\n", (unsigned int)htick->time_expiration);
+
+    return 0;
+}
+
+int helpmod_config_read_version(FILE *in)
+{
+    char buf[256], *ptr=(char*)buf;
+
+    fgets(ptr = buf, 256, in);
+    if (feof(in))
+        return -1;
+    helpmod_line_fix(&ptr);
+
+    if (sscanf(ptr, "%d", &hconf_version) != 1)
+        return -1;
+
+    return 0;
+}
+
+int helpmod_config_write_version(FILE *out)
+{
+    fprintf(out, "\t%d\n", HELPMOD_VERSION_INTERNAL);
 
     return 0;
 }
index 2ca5e753ad973f070234748f6e556b552ce82311..3dcbc0ffe1f2aa5c9bbb3eaf030928f0f1dd1075 100644 (file)
@@ -44,12 +44,16 @@ int helpmod_config_write_report(FILE *, hchannel*);
 int helpmod_config_read_ticket(FILE *);
 int helpmod_config_write_ticket(FILE *, hticket*, hchannel*);
 
+int helpmod_config_read_version(FILE *);
+int helpmod_config_write_version(FILE *);
+
 void helpmod_config_scheduled_events(void);
 
 /* FILEFORMAT
 
 Any line starting with '%' is considered a comment and ignored
 Empty lines between sections are allowed
+White space is allowed in the entries
 
 */
 
index cd0261bf55208d672a036d5abf6e937e5108c438..3137e4576aa0fc94a3ef7cc3df36a89b26ff3688 100644 (file)
@@ -18,6 +18,8 @@ const char *hlevel_name(hlevel lvl)
         return "administrator";
     case H_SERVICE:
         return "network service";
+    case H_ANY:
+        return "user";
     default:
         return "error, please contact strutsi";
     }
index caeb50f3469a09ca3bbcd30a31a785f37ed15122..e9eec722afb23e06e0c07aa60ead77e99b8017dc 100644 (file)
@@ -38,8 +38,9 @@ typedef enum
     H_OPER,
     H_ADMIN,
     H_SERVICE,
-    H_NONE, /* _NOT_ a real level, just used for resetting */
-    H_ANY /* for the count function, NOT a real level */
+    /* The following are not real user levels and they're only used internally */
+    H_NONE, 
+    H_ANY
 } hlevel;
 
 const char *hlevel_name(hlevel);
index de6d5e33655deb07cc428b4d8bfb28eeae0fe298..00d888d5bfe6f34c3bd08023cf230a25b0f8876e 100644 (file)
@@ -206,7 +206,7 @@ void helpmod_channick_modes(huser *target, hchannel *hchan, short mode, int now)
 
     if (huser_on_channel(target, hchan) == NULL)
     {
-        Error("helpmod", ERR_WARNING, "Channick mode for user %s not on channel %s", target->real_user->nick, hchannel_get_name(hchan));
+        Error("helpmod", ERR_WARNING, "Channick mode for user %s not on channel %s", huser_get_nick(target), hchannel_get_name(hchan));
         return;
     }
 
@@ -308,8 +308,11 @@ void helpmod_chan_privmsg(void **args)
         sender_huser = huser_add(sender_nick);
 
     if (hchan->flags & H_DO_STATS)
-        hstat_calculate_general(hchan, sender_huser, message);
-
+    {
+        if (sender_huser->account != NULL)
+           hstat_calculate_account(hchan, sender_huser, message);
+        hstat_calculate_channel(hchan, sender_huser, message);
+    }
     huser_activity(sender_huser, hchan);
 
     if (huser_get_level(sender_huser) < H_TRIAL) /* staff and staff trials are not subject to any control */
@@ -323,7 +326,7 @@ void helpmod_chan_privmsg(void **args)
             return;
         if ((hchan->flags & H_DISALLOW_LAME_TEXT) && helpmod_is_lame_line(message))
         {
-            helpmod_kick(hchan, sender_huser, "Please use only normal text on %s", hchannel_get_name(hchan));
+            helpmod_kick(hchan, sender_huser, "Please only use normal text on %s", hchannel_get_name(hchan));
             return;
         }
     }
index 28956183d942a10da330af735e012c699e8afd14..15972059da710e985accdc69f698c710ac201271 100644 (file)
@@ -7,10 +7,13 @@
 #include "../nick/nick.h"
 #include "../localuser/localuserchannel.h"
 #include "huser.h"
+#include "hversions.h"
 
 /* configuration */
 
-#define HELPMOD_VERSION "2.09"
+/* These should always be equal */
+#define HELPMOD_VERSION_INTERNAL HELPMOD_VERSION_2_10
+#define HELPMOD_VERSION "2.10"
 
 #define HELPMOD_USER_TIMEOUT 1200
 
index d7b52f11cb77b5a7b5ca95cf19c23b4f72621cc8..443e261b7d6125914f9936c0adec72d37e890383 100644 (file)
@@ -204,17 +204,8 @@ int helpmod_is_lame_line(const char *line)
     const char lamechars[] = {(char)2, (char)3, (char)22, (char)31, (char)0};
     if (strpbrk(line, lamechars) != NULL)
         return 1;
-    /*
-     if (strchr(line, (char)2))  bold
-     return 1;
-     if (strchr(line, (char)3))  colour
-        return 1;
-    if (strchr(line, (char)22)) reverse
-        return 1;
-    if (strchr(line, (char)31)) underline
-        return 1;
-*/
-    return 0;
+    else
+       return 0;
 }
 
 int strislower(const char *str)
@@ -249,3 +240,11 @@ int strnumcount(const char *str)
             count++;
     return count;
 }
+
+float helpmod_percentage(int larger, int smaller)
+{
+    if (larger == 0)
+       return 0.0;
+
+    return 100.0 * ((float)smaller / (float)larger);
+}
index efdbd825294e4c362e3c108df83a13902ddf572e..f4d29db44eca00e0b5aece5c179115139d2fbdf1 100644 (file)
@@ -24,4 +24,6 @@ int strisupper(const char*);
 int strisalpha(const char*);
 int strnumcount(const char*);
 
+float helpmod_percentage(int, int);
+
 #endif
index ccc731fa40fe07275157cd20b6febb24444d167a..ab8edda0d64cc7b9b69fa1d80737cf91dec5e80f 100644 (file)
@@ -109,10 +109,7 @@ void helpmod_hook_channel_newnick(int unused, void *args)
 
     if ((husr = huser_get(nck)) == NULL)
         husr = huser_add(nck);
-/*
-    fprintf(hdebug_file, "%d ADD %s to %s\n", time(NULL), husr->real_user->nick, hchannel_get_name(hchan));
-    fflush(hdebug_file);
-*/
+
     assert(huser_on_channel(husr, hchan) == NULL);
     assert(hchannel_on_channel(hchan, husr) == NULL);
 
@@ -165,10 +162,7 @@ void helpmod_hook_channel_lostnick(int unused, void *args)
     assert(husr != NULL);
 
     huserchan = huser_on_channel(husr, hchan);
-/*
-    fprintf(hdebug_file, "%d DEL %s from %s\n", time(NULL), husr->real_user->nick, hchannel_get_name(hchan));
-    fflush(hdebug_file);
-*/
+
     assert(hchannel_on_channel(hchan, husr) != NULL);
     assert(huserchan != NULL);
 
@@ -187,10 +181,6 @@ void helpmod_hook_channel_lostnick(int unused, void *args)
     { /* if H left the channel, we remove all the users from the channel */
         while (hchan->channel_users)
         {
-            /*
-            fprintf(hdebug_file, "%d DEL %s from %s\n", time(NULL), hchan->channel_users->husr->real_user->nick, hchannel_get_name(hchan));
-            fflush(hdebug_file);
-            */
             huser_del_channel(hchan->channel_users->husr, hchan);
             hchannel_del_user(hchan, hchan->channel_users->husr);
         }
@@ -236,7 +226,7 @@ void helpmod_hook_channel_opped(int unused, void *args)
         return;
 
     /* if the +o was given by a network service, G will not interfere */
-    if (husr2 == NULL || strlen(husr2->real_user->nick) == 1)
+    if (husr2 == NULL || strlen(huser_get_nick(husr2)) == 1)
         return;
 
     if (huser_get_level(husr) < H_STAFF)
@@ -316,11 +306,6 @@ void helpmod_hook_channel_devoiced(int unused, void *args)
         if (serverlist[homeserver(husr->real_user->numeric)].linkstate != LS_SQUIT)
         { /* if it was a netsplit, we do not trigger autoqueue */
             hqueue_handle_queue(hchan, huserchan->responsible_oper);
-            /*if (huser_valid(huserchan->responsible_oper) && huser_on_channel(huserchan->responsible_oper, hchan))
-                hqueue_advance(hchan, huserchan->responsible_oper, 1);
-            else
-            hqueue_advance(hchan, huserchan->responsible_oper, 1);
-            */
         }
     }
 }
index ecc9fa2e26e15925a4215965b1cd156815076090..5f4746584500b65ff803167f21ebdd1130bd9764 100644 (file)
@@ -90,7 +90,7 @@ static int hlc_violation_handle(hchannel *hchan, huser* husr, int violation)
             }
 
             if (IsAccount(husr->real_user))
-                haccount_add(husr->real_user->authname, H_LAMER);
+                haccount_add(huser_get_auth(husr), H_LAMER);
 
             return !0;
         }
@@ -99,19 +99,19 @@ static int hlc_violation_handle(hchannel *hchan, huser* husr, int violation)
             switch (violation)
             {
             case HLC_CAPS:
-                helpmod_kick(hchan, husr, "channel rule violation: Excessive use of capital letters");
+                helpmod_kick(hchan, husr, "Channel rule violation: Excessive use of capital letters");
                 break;
             case HLC_REPEAT:
-                helpmod_kick(hchan, husr, "channel rule violation: Repeating");
+                helpmod_kick(hchan, husr, "Channel rule violation: Repeating");
                 break;
             case HLC_CHARACTER_REPEAT:
-                helpmod_kick(hchan, husr, "channel rule violation: Improper use of language");
+                helpmod_kick(hchan, husr, "Channel rule violation: Improper use of language");
                 break;
             case HLC_FLOOD:
-                helpmod_kick(hchan, husr, "channel rule violation: Flooding");
+                helpmod_kick(hchan, husr, "Channel rule violation: Flooding");
                 break;
             case HLC_SPAM:
-                helpmod_kick(hchan, husr, "channel rule violation: Spamming");
+                helpmod_kick(hchan, husr, "Channel rule violation: Spamming");
                 break;
             }
             return !0;
@@ -251,9 +251,6 @@ static int hlc_check_spam(hlc_profile *hlc_prof, huser *husr, const char *line)
 /* checks a string for lameness, returns non-zero if lameness is present */
 int hlc_check(hchannel *hchan, huser* husr, const char *line)
 {
-//    hchannel *hchan = (hchannel*)hchan_ptr;
-//    huser *husr = (huser*)husr_ptr;
-
     if (hchan == NULL || hchan->lc_profile == NULL)
         return 0;
 
index fd32c50744860cf0488e4a38356ccd143d32ca43..c0b8fd6acdfb0ccc4c6a9e61b1cc50a70b9c51a8 100644 (file)
@@ -143,7 +143,7 @@ void hqueue_advance(hchannel *hchan, huser *oper, int nadv)
 
         counter--;
 
-        strcat(buffer, hchanuser->husr->real_user->nick);
+        strcat(buffer, huser_get_nick(hchanuser->husr));
         strcat(buffer, " ");
 
         if (hchan->flags & H_DO_STATS)
@@ -151,9 +151,9 @@ void hqueue_advance(hchannel *hchan, huser *oper, int nadv)
 
         if ((hchan->flags & H_QUEUE_SPAMMY) && (oper != NULL))
         {
-           helpmod_reply(hchanuser->husr, hchan->real_channel, "It is now your time to state your problem. Please do so on channel %s and direct your questions to %s %s", (huser_get_level(oper) < H_OPER)?hlevel_name(H_STAFF):hlevel_name(H_OPER), hchannel_get_name(hchan), oper->real_user->nick);
+           helpmod_reply(hchanuser->husr, hchan->real_channel, "It is now your time to state your problem. Please do so on channel %s and direct your questions to %s %s", (huser_get_level(oper) < H_OPER)?hlevel_name(H_STAFF):hlevel_name(H_OPER), hchannel_get_name(hchan), huser_get_nick(oper));
             if (!(huser_get_account_flags(oper) & H_NOSPAM))
-                helpmod_reply(oper, hchan->real_channel, "User %s (%s@%s) is yours, he has been in queue for %s", hchanuser->husr->real_user->nick, hchanuser->husr->real_user->ident, hchanuser->husr->real_user->host->name->content, helpmod_strtime(time(NULL) - hchanuser->time_joined));
+                helpmod_reply(oper, hchan->real_channel, "User %s (%s@%s) is yours, he has been in queue for %s", huser_get_nick(hchanuser->husr), huser_get_ident(hchanuser->husr), huser_get_host(hchanuser->husr), helpmod_strtime(time(NULL) - hchanuser->time_joined));
         }
 
         helpmod_channick_modes(hchanuser->husr, hchan, MC_VOICE, HLAZY);
@@ -162,7 +162,7 @@ void hqueue_advance(hchannel *hchan, huser *oper, int nadv)
         hchanuser = hchanuser->next;
     }
     if (oper != NULL)
-        helpmod_message_channel(hchan, "user%s %s: Please state your questions on this channel and direct them to %s %s", (nadv - counter == 1)?"":"s", buffer, (huser_get_level(oper) < H_OPER)?hlevel_name(H_STAFF):hlevel_name(H_OPER), oper->real_user->nick);
+        helpmod_message_channel(hchan, "user%s %s: Please state your questions on this channel and direct them to %s %s", (nadv - counter == 1)?"":"s", buffer, (huser_get_level(oper) < H_OPER)?hlevel_name(H_STAFF):hlevel_name(H_OPER), huser_get_nick(oper));
     else
         helpmod_message_channel(hchan, "user%s %s: Please state your questions on this channel", (nadv - counter == 1)?"":"s", buffer);
 
@@ -238,7 +238,6 @@ void helpmod_queue_handler (huser *sender, channel* returntype, hchannel *hchan,
             for (i=0;i<argc;i++)
             {
                 huser *husr = huser_get(getnickbynick(argv[i]));
-                /*huser_channel *husrchan;*/
                 if (husr == NULL)
                 {
                     helpmod_reply(sender, returntype, "Can not advance queue: User %s not found", argv[i]);
@@ -246,14 +245,7 @@ void helpmod_queue_handler (huser *sender, channel* returntype, hchannel *hchan,
                 }
                 helpmod_channick_modes(husr, hchan, MC_DEVOICE, HLAZY);
             }
-            /*
-            if ((hchan->flags & H_QUEUE_MAINTAIN) && hchan->autoqueue)
-            {
-                int dif = hchan->autoqueue - hqueue_count_off_queue(hchan);
-                if (dif)
-                    hqueue_advance(hchan, sender, dif);
-                    }
-                    */
+
             hqueue_handle_queue(hchan, sender);
         }
         return;
@@ -323,7 +315,7 @@ void helpmod_queue_handler (huser *sender, channel* returntype, hchannel *hchan,
                     buffer[0] = '\0';
                 }
                 if (hqueue_on_queue(hqueue))
-                    sprintf(buffer+strlen(buffer) /* :) */, "%s (%s@%s) [%s] ", hqueue->hchanuser->husr->real_user->nick, hqueue->hchanuser->husr->real_user->ident, hqueue->hchanuser->husr->real_user->host->name->content, helpmod_strtime(time(NULL) - hqueue->hchanuser->time_joined));
+                    sprintf(buffer+strlen(buffer) /* :) */, "%s (%s@%s) [%s] ", huser_get_nick(hqueue->hchanuser->husr), huser_get_ident(hqueue->hchanuser->husr), huser_get_host(hqueue->hchanuser->husr), helpmod_strtime(time(NULL) - hqueue->hchanuser->time_joined));
             }
             if  (buffer[0])
                 helpmod_reply(sender, returntype, "%s", buffer);
index 0091f806b2565e8a482f9ce9af375195029cdd4b..cc28e07e6b46aaf1984142d8915a5cfe3fbc1904 100644 (file)
@@ -25,10 +25,6 @@ void hstat_scheduler(void)
     int is_sunday = (tstruct->tm_wday == 0); /* is it sunday ? */
     int i;
 
-    /* Fix the hstat_cycle in case it's broken */
-    if (is_sunday)
-        hstat_cycle = hstat_cycle - (hstat_cycle % 7) + 6;
-
     {   /* accounts */
         haccount *ptr = haccounts;
        for (;ptr;ptr = ptr->next)
@@ -46,11 +42,6 @@ void hstat_scheduler(void)
                        }
                    }
                    HSTAT_ACCOUNT_ZERO(ptr2->week[(hstat_day() + 1) % 7]);
-                   /*                        ptr2->longterm[(hstat_week() - 1) % 10] = ptr2->longterm[hstat_week()];
-                    for (i=0;i<7;i++)
-                    {
-                    HSTAT_ACCOUNT_ZERO(ptr2->day[i]);
-                    }*/
                }
            }
     }
@@ -73,17 +64,13 @@ void hstat_scheduler(void)
                 {
                     HSTAT_CHANNEL_SUM(ptr2->longterm[(hstat_week() + 1) % 10], ptr2->longterm[(hstat_week() + 1) % 10], ptr2->week[i]);
                 }
-/*                ptr2->longterm[(hstat_week() - 1) % 10] = ptr2->longterm[hstat_week()];
-                for (i=0;i<7;i++)
-               {
-                    HSTAT_CHANNEL_ZERO(ptr2->day[i]);
-                }*/
            }
            HSTAT_CHANNEL_ZERO(ptr2->week[(hstat_day() + 1) % 7]);
         }
     }
 
-    hstat_cycle++;
+    if (is_sunday)
+       hstat_cycle++;
 }
 
 int hstat_get_schedule_time(void)
@@ -133,11 +120,10 @@ hstat_account *get_hstat_account(void)
     return tmp;
 }
 
-void hstat_calculate_general(hchannel *hchan, huser* husr, const char *message)
+void hstat_calculate_account(hchannel *hchan, huser* husr, const char *message)
 {
     hstat_account **acc_stat;
     hstat_account_entry *acc_entry;
-    hstat_channel_entry *chan_entry;
     huser_channel *huserchan = huser_on_channel(husr, hchan);
 
     int wordc = 0, time_spent;
@@ -156,28 +142,65 @@ void hstat_calculate_general(hchannel *hchan, huser* husr, const char *message)
     }
 
     acc_entry = &(*acc_stat)->week[hstat_day()];
-    chan_entry = &hchan->stats->week[hstat_day()];
 
     time_spent = time(NULL) - huserchan->last_activity;
 
     if (time_spent > 0 && time_spent < HSTAT_ACTIVITY_TRESHOLD)
     {
         acc_entry->time_spent+=time_spent;
-        chan_entry->time_spent+=time_spent;
 
         if (hstat_is_prime_time())
-        {
             acc_entry->prime_time_spent+=time_spent;
-            chan_entry->prime_time_spent+=time_spent;
-        }
     }
 
     acc_entry->lines++;
-    chan_entry->lines++;
 
     wordc = hword_count(message);
-
     acc_entry->words+=wordc;
+}
+
+void hstat_calculate_channel(hchannel *hchan, huser* husr, const char *message)
+{
+    hstat_channel_entry *chan_entry;
+    huser_channel *huserchan = huser_on_channel(husr, hchan);
+
+    int wordc = 0, time_spent, activity_channel, activity_staff_channel;
+
+    if (huserchan == NULL)
+        return;
+
+    chan_entry = &hchan->stats->week[hstat_day()];
+
+    activity_channel = time(NULL) - hchan->last_activity;
+    activity_staff_channel = time(NULL) - hchan->last_staff_activity;
+
+    time_spent = time(NULL) - huserchan->last_activity;
+
+    if (time_spent > 0 && time_spent < HSTAT_ACTIVITY_TRESHOLD)
+    {
+        chan_entry->time_spent+=time_spent;
+
+        if (hstat_is_prime_time())
+            chan_entry->prime_time_spent+=time_spent;
+    }
+
+
+    { /* everyone */
+       if (activity_channel > 0 && activity_channel < HSTAT_ACTIVITY_TRESHOLD)
+           chan_entry->active_time+=activity_channel;
+        hchan->last_activity = time(NULL);
+    }
+
+    if (huser_get_level(husr) > H_PEON)
+    { /* staff */
+       if (activity_staff_channel > 0 && activity_staff_channel < HSTAT_ACTIVITY_TRESHOLD)
+           chan_entry->staff_active_time+=activity_staff_channel;
+        hchan->last_staff_activity = time(NULL);
+    }
+
+    chan_entry->lines++;
+
+    wordc = hword_count(message);
     chan_entry->words+=wordc;
 }
 
@@ -198,8 +221,9 @@ const char *hstat_channel_print(hstat_channel_entry *entry, int type)
     switch (type)
     {
     case HSTAT_CHANNEL_LONG:
-        sprintf(buffer, "%-18s %-18s %-10d %-10d %-10d %-10d", helpmod_strtime(entry->time_spent), helpmod_strtime(entry->prime_time_spent), entry->joins, entry->queue_use, entry->lines, entry->words);
-        break;
+       /* sprintf(buffer, "%-18s %-18s %-10d %-10d %-10d %-10d", helpmod_strtime(entry->time_spent), helpmod_strtime(entry->prime_time_spent), entry->joins, entry->queue_use, entry->lines, entry->words); */
+       sprintf(buffer, "%-16s %-5.1f%%  %-16s %-5.1f%%  %-8d %-8d %-8d %-10d", helpmod_strtime(entry->time_spent), helpmod_percentage(entry->time_spent, entry->prime_time_spent), helpmod_strtime(entry->active_time), helpmod_percentage(entry->active_time, entry->staff_active_time), entry->joins, entry->queue_use, entry->lines, entry->words);
+       break;
     case HSTAT_CHANNEL_SHORT:
         sprintf(buffer, "%-18s %-18s", helpmod_strtime(entry->time_spent), helpmod_strtime(entry->prime_time_spent));
         break;
@@ -223,6 +247,7 @@ const char *hstat_account_print(hstat_account_entry *entry, int type)
     return buffer;
 }
 
+
 const char *hstat_header(hstat_type type)
 {
     switch (type)
@@ -234,7 +259,8 @@ const char *hstat_header(hstat_type type)
     case HSTAT_CHANNEL_SHORT:
         return "TimeSpent          PrimeTimeSpent";
     case HSTAT_CHANNEL_LONG:
-        return "TimeSpent          PrimeTimeSpent     Joins      QueueUse   Lines      Words";
+        /*return "TimeSpent          PrimeTimeSpent     Joins      QueueUse   Lines      Words";*/
+       return "TimeSpent        Prime-% Activity         Staff-% Joins    QueueUse Lines    Words";
     default:
         return "Error: please contact strutsi";
     }
@@ -242,7 +268,7 @@ const char *hstat_header(hstat_type type)
 
 int hstat_week(void)
 {
-    return (hstat_cycle / 7) % 10;
+    return hstat_cycle % 10;
 }
 
 int hstat_day(void)
@@ -286,7 +312,7 @@ hstat_account_entry_sum hstat_account_last_month(hstat_account *hs_acc)
 
 hstat_channel_entry hstat_channel_last_week(hstat_channel *hs_chan)
 {
-    hstat_channel_entry tmp = {0,0,0,0,0,0};
+    hstat_channel_entry tmp = {0,0,0,0,0,0,0,0};
     int i;
     for (i=0;i<7;i++)
     {
@@ -297,10 +323,9 @@ hstat_channel_entry hstat_channel_last_week(hstat_channel *hs_chan)
 
 hstat_channel_entry hstat_channel_last_month(hstat_channel *hs_chan)
 {
-    hstat_channel_entry tmp = {0,0,0,0,0,0};
+    hstat_channel_entry tmp = {0,0,0,0,0,0,0,0};
     int i;
 
-    //HSTAT_CHANNEL_SUM(tmp, tmp, hstat_channel_last_week(hs_chan));
     for (i=0;i<4;i++)
     {
         HSTAT_CHANNEL_SUM(tmp, tmp, hs_chan->longterm[(hstat_week() - i + 10) % 10]);
@@ -325,7 +350,7 @@ hstat_accounts_array create_hstat_account_array(hchannel *hchan, hlevel lvl)
         initial_arrlen = haccount_count(H_OPER) + haccount_count(H_ADMIN);
     else if (lvl == H_STAFF)
         initial_arrlen = haccount_count(H_STAFF) + haccount_count(H_TRIAL);
-    else
+    else /* works fine for H_ANY */
         initial_arrlen = haccount_count(lvl);
 
     if (!initial_arrlen)
@@ -333,8 +358,9 @@ hstat_accounts_array create_hstat_account_array(hchannel *hchan, hlevel lvl)
 
     arr.array = (hstat_account_entry_sum*)malloc(sizeof(hstat_account_entry_sum) * initial_arrlen);
     for (;hacc;hacc = hacc->next)
-        if ((lvl == H_OPER && (hacc->level == H_OPER || hacc->level == H_ADMIN)) ||
-            (lvl == H_STAFF && (hacc->level == H_TRIAL || hacc->level == H_STAFF)))
+       if ((lvl == H_ANY) ||
+           (lvl == H_OPER && (hacc->level == H_OPER || hacc->level == H_ADMIN)) ||
+           (lvl == H_STAFF && (hacc->level == H_TRIAL || hacc->level == H_STAFF)))
            for (ptr = hacc->stats;ptr;ptr = ptr->next)
                if (ptr->hchan == hchan)
                {
index 56ac16d052010b4d28e6ac35ddabc93b748ebfe9..ffffced9a28aefbb2b137d1281765e4d2fc1239d 100644 (file)
@@ -30,6 +30,8 @@ struct huser_struct;
 
 #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;\
@@ -40,6 +42,8 @@ struct huser_struct;
 
 #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;\
@@ -75,6 +79,9 @@ typedef struct hstat_account_entry_sum_struct
 
 typedef struct hstat_channel_entry_struct
 {
+    int active_time;
+    int staff_active_time;
+
     int time_spent;
     int prime_time_spent;
 
@@ -120,7 +127,8 @@ const char *hstat_channel_print(hstat_channel_entry*, int);
 
 const char *hstat_account_print(hstat_account_entry*, int);
 
-void hstat_calculate_general(struct hchannel_struct*, struct huser_struct*, 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 hstat_add_join(struct hchannel_struct*);
 void hstat_del_channel(struct hchannel_struct*);
index fbe4acfd7d10f26d4726ef8b906566b067c7bb6f..33356835f87876272f5dc2615b05d04484b0f671 100644 (file)
@@ -18,6 +18,8 @@ hterm *hterm_add(hterm** ptr, const char *name, const char *desc)
     if (name == NULL || desc == NULL || hterm_get(*ptr, name))
         return NULL;
 
+    for (;*ptr && strcmp(name, (*ptr)->name->content) > 0;ptr = &(*ptr)->next);
+
     htrm = (hterm*)malloc(sizeof(hterm));
     htrm->name = getsstring(name, strlen(name));
     htrm->description = getsstring(desc, strlen(desc));
index 20e50324d8dfca5c2b51580e0dda4a4247ab3989..05fc6c496e8a347e884c3fbb3e9fcbf9df9c8714 100644 (file)
@@ -6,7 +6,7 @@
 #include "hticket.h"
 #include "hgen.h"
 
-hticket *hticket_get(char *authname, struct hchannel_struct *hchan)
+hticket *hticket_get(const char *authname, struct hchannel_struct *hchan)
 {
     hticket *tmp;
     if (hchan == NULL)
@@ -32,7 +32,7 @@ hticket *hticket_del(hticket *htick, struct hchannel_struct *hchan)
     return htick;
 }
 
-hticket *hticket_add(char *authname, time_t expiration, struct hchannel_struct *hchan)
+hticket *hticket_add(const char *authname, time_t expiration, struct hchannel_struct *hchan)
 {
     hticket *tmp = hticket_get(authname, hchan);
 
index 85b79971696c8d153f5ae5b4f54e47cebb2cb956..293c6d8961573a2510a1577f47d540a8fad51abe 100644 (file)
@@ -18,9 +18,9 @@ typedef struct hticket_struct
     struct hticket_struct *next;
 } hticket;
 
-hticket *hticket_get(char *, struct hchannel_struct*);
+hticket *hticket_get(const char *, struct hchannel_struct*);
 hticket *hticket_del(hticket *, struct hchannel_struct*);
-hticket *hticket_add(char *, time_t expiration, struct hchannel_struct*);
+hticket *hticket_add(const char *, time_t expiration, struct hchannel_struct*);
 int hticket_count(void);
 void hticket_remove_expired(void);
 
index 699bc532c7bc167f7749a4faaf66256fd8e3944d..2402f21cdbac5b803ca4148e2ab32c688688d7c4 100644 (file)
@@ -177,8 +177,8 @@ void huser_reset_states(void)
 
 hlevel huser_get_level(huser *husr)
 {
-    if ((strlen(husr->real_user->nick)) == 1 && isalpha(husr->real_user->nick[0]))
-        return H_SERVICE; /* network services, keeps them out of harms way */
+    if ((strlen(huser_get_nick(husr))) == 1 && isalpha(huser_get_nick(husr)[0]))
+       return H_SERVICE; /* network services, keeps them out of harms way */
 
     if (husr->account != NULL)
     {
@@ -232,11 +232,52 @@ int huser_get_account_flags(huser *husr)
         return H_ACCFLAGS_DEFAULT;
 }
 
+const char *huser_get_nick(huser *husr)
+{
+    if (husr == NULL)
+       return "Error";
+    else
+        return husr->real_user->nick;
+}
+
+const char *huser_get_ident(huser *husr)
+{
+    if (husr == NULL)
+       return "Error";
+    else
+        return husr->real_user->ident;
+}
+
+const char *huser_get_host(huser *husr)
+{
+    if (husr == NULL)
+       return "Error";
+    else
+        return husr->real_user->host->name->content;
+}
+
+const char *huser_get_auth(huser *husr)
+{
+    if (husr == NULL || !IsAccount(husr->real_user))
+       return "Error";
+    else
+        return husr->real_user->authname;
+}
+
+const char *huser_get_realname(huser *husr)
+{
+    if (husr == NULL)
+       return "Error";
+    else
+        return husr->real_user->realname->name->content;
+
+}
+
 int huser_valid(huser* husr)
 {
     huser *ptr = husers;
     for (;ptr;ptr = ptr->next)
-        if (ptr == husr)
+       if (ptr == husr)
             return !0;
     return 0;
 }
@@ -250,26 +291,21 @@ int huser_is_trojan(huser *husr)
         return 0;
 
     if (!IsAccount(husr->real_user))
-        if (strisupper(husr->real_user->nick) && (strnumcount(husr->real_user->nick) >= 2))
+        if (strisupper(huser_get_nick(husr)) && (strnumcount( huser_get_nick(husr)) >= 2))
         {
-            sprintf(buffer, "*%s*", husr->real_user->nick);
-            if (hword_count(husr->real_user->realname->name->content) == 1)
-                if (strregexp(husr->real_user->realname->name->content, buffer))
+            sprintf(buffer, "*%s*",  huser_get_nick(husr));
+            if (hword_count(huser_get_realname(husr)) == 1)
+                if (strregexp(huser_get_realname(husr), buffer))
                     return 1;
         }
 
     /* case 2 */
-    if (!IsAccount(husr->real_user) && (husr->real_user->ident[0] == '~'))
-        if (strislower(husr->real_user->nick) && strisalpha(husr->real_user->nick))
-            if (strislower(husr->real_user->ident) && strisalpha(husr->real_user->ident))
-                if (strislower(husr->real_user->realname->name->content) && strisalpha(husr->real_user->realname->name->content))
-                    if (hword_count(husr->real_user->realname->name->content) == 1)
-                        /*if (strregexp(husr->real_user->host->name->content, "8?.*") ||
-                            strregexp(husr->real_user->host->name->content, "*.fr") ||
-                            strregexp(husr->real_user->host->name->content, "*.de") ||
-                            strregexp(husr->real_user->host->name->content, "*.be") ||
-                            strregexp(husr->real_user->host->name->content, "*.net"))*/
-                        return 1;
+    if (!IsAccount(husr->real_user) && (huser_get_ident(husr)[0] == '~'))
+        if (strislower(huser_get_nick(husr)) && strisalpha( huser_get_nick(husr)))
+            if (strislower(huser_get_ident(husr)) && strisalpha(huser_get_ident(husr)))
+                if (strislower(huser_get_realname(husr)) && strisalpha(huser_get_realname(husr)))
+                    if (hword_count(huser_get_realname(husr)) == 1)
+                       return 1;
 
     return 0;
-    }
+}
index 8471ab151080ab4d89444f4ac0b50d71a9641637..f5444b04afee3457bbdb16a1568925f74644ead8 100644 (file)
@@ -79,6 +79,12 @@ void huser_reset_states(void);
 hlevel huser_get_level(huser*);
 int huser_get_account_flags(huser*);
 
+const char *huser_get_nick(huser *);
+const char *huser_get_ident(huser *);
+const char *huser_get_host(huser *);
+const char *huser_get_auth(huser *);
+const char *huser_get_realname(huser *);
+
 /* defines the "being on queue" and being on desk (getting service) */
 int on_queue(huser*, huser_channel*);
 int on_desk(huser*, huser_channel*);
diff --git a/helpmod2/hversions.h b/helpmod2/hversions.h
new file mode 100644 (file)
index 0000000..a66743f
--- /dev/null
@@ -0,0 +1,9 @@
+/* Helpmod versions, used mainly by conf for compatibility */
+#ifndef HVERSIONS_H
+#define HVERSIONS_H
+
+#define HELPMOD_VERSION_2_0 0   /* Initial release, 2005 something */
+
+#define HELPMOD_VERSION_2_10 10 /*  */
+
+#endif