]> jfr.im git - irc/quakenet/newserv.git/commitdiff
G 2.12
authorstrutsi <redacted>
Thu, 8 Sep 2005 17:25:00 +0000 (18:25 +0100)
committerstrutsi <redacted>
Thu, 8 Sep 2005 17:25:00 +0000 (18:25 +0100)
14 files changed:
helpmod2/changelist
helpmod2/commands/lcedit [new file with mode: 0644]
helpmod2/commands/questionmark [new file with mode: 0644]
helpmod2/commands/questionmarkminus [new file with mode: 0644]
helpmod2/commands/questionmarkplus [new file with mode: 0644]
helpmod2/commands/rating [new file with mode: 0644]
helpmod2/commands/text
helpmod2/commands/writedb [new file with mode: 0644]
helpmod2/hban.c
helpmod2/hchanban.c
helpmod2/hcommands.c
helpmod2/hed.c
helpmod2/helpmod.h
helpmod2/hversions.h

index 74abc1ade496ae9ed2ac98798b965a64c7dc24a9..eea168b9bc3a063d9317cd6ac15f5236c4333729 100644 (file)
@@ -334,3 +334,15 @@ Internal lamer control changes and order of test changed
 Empty old H type helps no longer cause a crash
 Fixed the ticket command help
 Userlevel spacers added to showcommands
+
+2.12
+Fixed the . escape in ged
+Fixed a minor bug in ged
+Ban now defaults to list on 0 parameters
+Ban list ban duration width increased to accomodate longer durations
+Changed the whois output a bit
+Fixed a bug in chanban list
+Fixed the unknown error suppression bug (again)
+Fixed a bug when adding bans to authed -x users
+Added a rating command
+Added missing command help for ?+ and ?-
diff --git a/helpmod2/commands/lcedit b/helpmod2/commands/lcedit
new file mode 100644 (file)
index 0000000..a4e5438
--- /dev/null
@@ -0,0 +1,22 @@
+Syntax:  lc_edit [operation] [parameters]
+Example: lc_edit edit strict warn_limit 1
+Edits lamer control profiles. Following operations are supported:
+add [name]
+del [name]
+view [name]
+list
+edit [name] [component] [value]
+The components are:
+caps_percentage        Maximum caps percentage
+caps_count             Caps minimum count
+repeat_tolerance       Repeat tolerance
+repeat_length          Repeat minimum length
+symbol_repeat                  Symbol repeat tolerance
+character_repeat       Character repeat tolerance
+continuous_symbol      Continous symbol tolerance
+flood_tolerance        Flood tolerance
+spam_tolerance                 Spam tolerance
+spam_multiplier        Spam multiplier
+warn_limit             Warning limit
+kick_limit             Kick limit
+ban_limit              Ban limit
diff --git a/helpmod2/commands/questionmark b/helpmod2/commands/questionmark
new file mode 100644 (file)
index 0000000..41763a5
--- /dev/null
@@ -0,0 +1,3 @@
+Syntax:  ? [channel] [term]
+Example: ? #feds Q
+Command '?' is available to all users and is the same as term [channel] find.
diff --git a/helpmod2/commands/questionmarkminus b/helpmod2/commands/questionmarkminus
new file mode 100644 (file)
index 0000000..589cdda
--- /dev/null
@@ -0,0 +1,3 @@
+Syntax:  ?- [channel] [term] [user1] .. [usern]
+Example: ?- #feds Q user
+?- Is similar to the command ? but removes targeted users from queue without advancing the queue.
diff --git a/helpmod2/commands/questionmarkplus b/helpmod2/commands/questionmarkplus
new file mode 100644 (file)
index 0000000..2b68cd8
--- /dev/null
@@ -0,0 +1,4 @@
+Syntax:  ?+ [channel] [term] [user1] .. [usern]
+Example: ?+ #feds Q user
+?+ Is similar to the command ? but removes targeted users from queue and advances the queue.
+?+ Without any parameters is the same as -next.
diff --git a/helpmod2/commands/rating b/helpmod2/commands/rating
new file mode 100644 (file)
index 0000000..2e74e10
--- /dev/null
@@ -0,0 +1,3 @@
+Syntax:  rating [channel]
+Example: rating #feds
+Shows a simple rating of your activity in the last week.
index a9abafe96ccea613d4f769537eafc7825ad4cf91..bacaaa989e0374bb37719523acec4ff0e569c343 100644 (file)
@@ -2,8 +2,8 @@ Syntax:  text [operation] [parameter]
 Example: text show guide
 Manages texts. Adding or removing texts is restricted to high user levels.
 Supported operations are:
-add [name]     Adds a new text entry
-del [name]     Removes an existing text entry
-show [name]    Shows a text entry
-list           Lists all texts
+add [name]      Adds a new text entry
+del [name]      Removes an existing text entry
+show [name]     Shows a text entry
+list            Lists all texts
 Stored texts can be edited with ged.
diff --git a/helpmod2/commands/writedb b/helpmod2/commands/writedb
new file mode 100644 (file)
index 0000000..909ec21
--- /dev/null
@@ -0,0 +1,3 @@
+Syntax:  writedb
+Example: writedb
+Writes the database do disk
index 314ab7805d6be704f919da47efe91853d9d1b61b..aeda1462810fcf79d4aec921e7d853006d26cd08 100644 (file)
@@ -165,7 +165,7 @@ const char *hban_ban_string(nick *nck, int banflags)
 
     strcat(buffer, "@");
 
-    if ((banflags & HBAN_HOST) && IsAccount(nck))
+    if ((banflags & HBAN_HOST) && IsAccount(nck) && IsHideHost(nck))
     {
         strcat(buffer, nck->authname);
         strcat(buffer, ".users.quakenet.org");
index 180f2076935cebc2ab1bb59ef22a3f8a5fb93aef..75e4aa087ae588584aaec9304be7049028b2cd73 100644 (file)
@@ -49,7 +49,7 @@ hchanban *hchanban_get(hchannel* hchan, const char* banmask)
 {
     hchanban *ptr = hchanbans;
     for (;ptr;ptr = ptr->next)
-        if (ptr->hchan == hchan && ircd_strcmp(ptr->banmask->content, banmask))
+        if (ptr->hchan == hchan && !ircd_strcmp(ptr->banmask->content, banmask))
             return ptr;
     return NULL;
 }
index 7fe16dae1484e1edef5f174aa155a042a7c42e53..61c21552efc122c368b1caecc1bb21b4da62c1bf 100644 (file)
@@ -25,6 +25,7 @@
 #include "hchanban.h"
 
 #include "hticket.h"
+#include "hconf.h"
 
 /* following are macros for use ONLY IN HERE
  they may not look pretty, but work surprisingly well */
@@ -182,9 +183,12 @@ 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, "Cannot get user information: User %s not found", argv[i]);
-            continue;
+       {
+           if (getnickbynick(argv[i]) == NULL)
+                helpmod_reply(sender, returntype, "Cannot get user information: User %s does not exist in the network", argv[i]);
+           else
+               helpmod_reply(sender, returntype, "Cannot get user information: User %s exists but is not known to me", argv[i]);
+           continue;
         }
         helpmod_reply(sender, returntype, "User %s has userlevel %s", huser_get_nick(husr), hlevel_name(huser_get_level(husr)));
        if (husr->account == NULL)
@@ -1238,19 +1242,13 @@ static void helpmod_cmd_dnmo (huser *sender, channel* returntype, char* ostr, in
 
 static void helpmod_cmd_ban (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
 {
-    if (argc == 0)
-    {
-        helpmod_reply(sender, returntype, "Cannot global handle bans: Operation not defined");
-        return;
-    }
-
-    else if (!ci_strcmp(argv[0], "list"))
+    if (argc == 0 || !ci_strcmp(argv[0], "list"))
     {
         hban *ptr = hbans;
         char *pattern;
         int count = 0;
 
-        if (argc == 1)
+        if (argc <= 1)
             pattern = "*";
         else
             pattern = argv[1];
@@ -1260,13 +1258,12 @@ static void helpmod_cmd_ban (huser *sender, channel* returntype, char* ostr, int
         for (;ptr;ptr = ptr->next)
             if (strregexp(bantostring(ptr->real_ban), pattern))
             {
-                helpmod_reply(sender, returntype, "%-64s %-15s %s", bantostring(ptr->real_ban), helpmod_strtime(ptr->expiration - time(NULL)), ptr->reason?ptr->reason->content:"");
+                helpmod_reply(sender, returntype, "%-64s %-20s %s", bantostring(ptr->real_ban), helpmod_strtime(ptr->expiration - time(NULL)), ptr->reason?ptr->reason->content:"");
                 count++;
             }
 
         helpmod_reply(sender, returntype, "%d Global bans match pattern %s", count, pattern);
     }
-
     else if (!ci_strcmp(argv[0], "add"))
     {
         int duration = 4 * HDEF_h;
@@ -1363,8 +1360,8 @@ static void helpmod_cmd_chanban (huser *sender, channel* returntype, char* ostr,
             if (strregexp((cban = bantostring(ptr)), pattern))
             {
                 count++;
-                if (hchanban_get(hchan,cban))
-                    helpmod_reply(sender, returntype, "%s Expires in %s", bantostring(ptr), helpmod_strtime(hchanban_get(hchan, cban)->expiration - time(NULL)));
+                if (hchanban_get(hchan,cban) != NULL)
+                   helpmod_reply(sender, returntype, "%s Expires in %s", bantostring(ptr), helpmod_strtime(hchanban_get(hchan, cban)->expiration - time(NULL)));
                 else
                     helpmod_reply(sender, returntype, "%s", bantostring(ptr));
             }
@@ -3113,13 +3110,7 @@ static void helpmod_cmd_text (huser *sender, channel* returntype, char* ostr, in
     hchannel *hchan;
     DEFINE_HCHANNEL;
     FILE *in;
-/*
-    if (argc == 0)
-    {
-       helpmod_reply(sender, returntype, "Can not handle text: No command specified");
-        return;
-    }
-*/
+
     if (argc == 0 || !ci_strcmp(argv[0], "list"))
     {
        DIR *dir;
@@ -3252,6 +3243,55 @@ static void helpmod_cmd_text (huser *sender, channel* returntype, char* ostr, in
     }
 }
 
+static void helpmod_cmd_rating (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
+{
+    hchannel *hchan;
+    hstat_account_entry sum = {0,0,0,0};
+    hstat_account *ptr;
+    int i;
+
+    DEFINE_HCHANNEL;
+
+    HCHANNEL_VERIFY_AUTHORITY(hchan, sender);
+
+    if (hchan == NULL)
+    {
+       helpmod_reply(sender, returntype, "Can not show rating: Unknown channel");
+        return;
+    }
+    if (sender->account == NULL)
+    {
+       helpmod_reply(sender, returntype, "Can not show rating: You do not have an account");
+        return;
+    }
+    for (ptr = sender->account->stats;ptr != NULL;ptr = ptr->next)
+       if (ptr->hchan == hchan)
+       {
+           if (hstat_day() == 0)
+           { /* Sunday screws the indexing */
+               for (i = 0;i < 7;i++)
+                   HSTAT_ACCOUNT_SUM(sum, sum, ptr->week[i]);
+           }
+           else
+           { /* Normal case */
+               for (i = 1;i <= hstat_day();i++)
+                   HSTAT_ACCOUNT_SUM(sum, sum, ptr->week[i]);
+           }
+
+           helpmod_reply(sender, returntype, "Your rating for channel %s for this week is: %s", hchannel_get_name(hchan), helpmod_strtime(sum.time_spent));
+           return;
+       }
+    helpmod_reply(sender, returntype, "Can not show rating: You do not have any statistics for channel %s", hchannel_get_name(hchan));
+}
+
+static void helpmod_cmd_writedb (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
+{
+    rename(HELPMOD_DEFAULT_DB, HELPMOD_DEFAULT_DB".old");
+    helpmod_config_write(HELPMOD_DEFAULT_DB);
+
+    helpmod_reply(sender, returntype, "Database written");
+}
+
 static void helpmod_cmd_evilhack1 (huser *sender, channel* returntype, char* ostr, int argc, char *argv[])
 {
     int tmp;
@@ -3399,9 +3439,13 @@ void helpmod_cmd_command(huser* sender, channel* returntype, char* arg, int argc
     while (*(ptr++))
         *ptr = tolower(*ptr);
 
-    /* ? is handled like this because windows is shit */
+    /* ?,?+.?- is handled like this because windows is shit */
     if (!ci_strcmp(argv[0], "?"))
        sprintf(buffer, "./helpmod2/commands/questionmark");
+    else if (!ci_strcmp(argv[0], "?+"))
+       sprintf(buffer, "./helpmod2/commands/questionmarkplus");
+    else if (!ci_strcmp(argv[0], "?-"))
+       sprintf(buffer, "./helpmod2/commands/questionmarkminus");
     else
        sprintf(buffer, "./helpmod2/commands/%s", argv[0]);
 
@@ -3550,13 +3594,14 @@ void hcommands_add(void)
     hcommand_add("lcedit", H_ADMIN, helpmod_cmd_lcedit, "Lamer control profile manager");
     hcommand_add("ged", H_STAFF, helpmod_cmd_ged, "Ged IRC text editor");
     hcommand_add("text", H_PEON, helpmod_cmd_text, "Lists or shows text files");
-
     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("statsdump", H_ADMIN, helpmod_cmd_statsdump, "Statistics dump command");
     hcommand_add("statsrepair", H_ADMIN, helpmod_cmd_statsrepair, "Statistics repair command");
     hcommand_add("statsreset", H_ADMIN, helpmod_cmd_statsreset, "Statistics reset command");
-
+    hcommand_add("rating", H_TRIAL, helpmod_cmd_rating, "Simple rating for the current week");
+    hcommand_add("writedb", H_OPER, helpmod_cmd_writedb, "Writes the " HELPMOD_NICK " database to disk");
 
     /*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");*/
@@ -3636,8 +3681,8 @@ void helpmod_command(huser *sender, channel* returntype, char *args)
 
        if (hcom == NULL)
        {
-           if ((sender->account == NULL && returntype == NULL) ||
-               (sender->account != NULL && !(sender->account->flags & H_NO_CMD_ERROR) && returntype == NULL))
+           if ((returntype == NULL) ||
+               (sender->account != NULL && !(sender->account->flags & H_NO_CMD_ERROR)))
                helpmod_reply(sender, returntype, "Unknown command '%s', please see showcommands for a list of all commands available to you", parsed_args[0]);
        }
         else
index c9d1fb3a4e5dcf367f78a5777235dd07b2356993..e3d8866601f631558eea5fa90acbd1e1ad1ce7e1 100644 (file)
@@ -426,9 +426,13 @@ void hed_command (huser *sender, channel* returntype, char* ostr, int argc, char
     }
     else
     { /* HED_INPUT */
-        char *str;
+       char *str;
+
+       if (argc == 0)
+           ostr[0] = '\0';
+
        /* return to command mode */
-       if (!strcmp(argv[0], "."))
+       if (!strcmp(ostr, "."))
        {
             editor->state = HED_COMMAND;
            return;
index 045198a88765f87f5366ac5e9029d950d01446af..e49e49315465b51748c3cedeef00076b48498bd7 100644 (file)
@@ -12,8 +12,8 @@
 /* configuration */
 
 /* These should always be equal */
-#define HELPMOD_VERSION_INTERNAL HELPMOD_VERSION_2_11
-#define HELPMOD_VERSION "2.11"
+#define HELPMOD_VERSION_INTERNAL HELPMOD_VERSION_2_12
+#define HELPMOD_VERSION "2.12"
 
 #define HELPMOD_USER_TIMEOUT 1200
 
index 5a920e06257b1a0c376ca78ff578e4db420783ed..7dfcf6612f5ff8e17508bbd187547542db1588b1 100644 (file)
@@ -6,6 +6,8 @@
 
 #define HELPMOD_VERSION_2_10 10 /* July 2005 */
 
-#define HELPMOD_VERSION_2_11 11 /*  */
+#define HELPMOD_VERSION_2_11 11 /* August 2005 */
+
+#define HELPMOD_VERSION_2_12 12 /* */
 
 #endif