Skip to content

Commit

Permalink
Fixes for 1.15
Browse files Browse the repository at this point in the history
Tcl_AppendResult() -> Tcl_SetResult()

Fix typo: prcedure -> procedure

Cleanup
  • Loading branch information
michaelortmann committed Nov 28, 2024
1 parent 02ff991 commit 08869f7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 26 deletions.
12 changes: 6 additions & 6 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ Installation:

Stats.mod should work with eggdrop 1.8.4 and newer.

The following instructions assume, ~/eggdrop-1.9.5/ is the directory
The following instructions assume, ~/eggdrop-1.10.0/ is the directory
where you installed your eggdrop from. (of course, other source dirs
will work as well)
Unfortunately, you need to compile stats.mod within your eggdrop source,
so if you removed your original compile directory, you'll have to
compile the whole bot again... sorry.

Put stats.mod.1.14.tar.gz in ~/eggdrop-1.9.5/src/mod/,
and unpack it (tar xfz stats.mod-1.14.tar.gz). Change directory
back to ~/eggdrop-1.9.5/. Type 'make config'. Type 'make', wait until compiling
Put stats.mod.1.15.tar.gz in ~/eggdrop-1.10.0/src/mod/,
and unpack it (tar xfz stats.mod-1.15.tar.gz). Change directory
back to ~/eggdrop-1.10.0/. Type 'make config'. Type 'make', wait until compiling
is done and use 'make install' to install the bot and stats.mod.

Don't forget to copy the language files from ~/eggdrop-1.9.5/src/mod/stats.mod/
Don't forget to copy the language files from ~/eggdrop-1.10.0/src/mod/stats.mod/
to ~/eggdrop/language/ !

All settings can be found in ~/eggdrop-1.9.5/src/mod/stats.mod/stats.conf
All settings can be found in ~/eggdrop-1.10.0/src/mod/stats.mod/stats.conf
I suggest to copy it to your eggdrop directory (probably ~/eggdrop/),
edit it to fit your needs and put a 'source stats.conf' at the end of
your eggdrop config file. This will execute the config file with every
Expand Down
6 changes: 5 additions & 1 deletion UPDATES
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Changes in Stats.mod: (since v1.0.1)
--------------------
1.15
- Tcl_AppendResult() -> Tcl_SetResult()
- Fix typo: prcedure -> procedure
- Cleanup

1.14
- Fix heap-use-after-free
requires https://github.com/eggheads/eggdrop/pull/1610)

1.13
- Fix heap-buffer-overflow

Expand Down
2 changes: 1 addition & 1 deletion generic_binary_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ static void btree_recursive_free(struct generic_binary_tree *tree,
* calls the specified function for each item in the tree.
* NOTE: getall() calls the proc _before_ it proceeds into recursion. This way,
* one can safely store the tree into a file without mixing up its form.
* But if you delete an item from the called prcedure, this function
* But if you delete an item from the called procedure, this function
* WILL crash. Use btree_getall()_expanded instead.
*/
static void btree_getall(struct generic_binary_tree *tree, void (*func) (void *))
Expand Down
4 changes: 2 additions & 2 deletions stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#define MAKING_STATS
#define MODULE_NAME "stats"
#define MODULE_VERSION "1.14"
#define MODULE_VERSION "1.15"
#ifndef NO_EGG
#include "../module.h"
#include "../irc.mod/irc.h"
Expand Down Expand Up @@ -449,7 +449,7 @@ char *stats_start(Function * global_funcs)

chanlangs = NULL;
slang_glob_init();
module_register(MODULE_NAME, stats_table, 1, 14);
module_register(MODULE_NAME, stats_table, 1, 15);
if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 0)))
return "You need the irc module to use the stats module.";
if (!(server_funcs = module_depend(MODULE_NAME, "server", 1, 0)))
Expand Down
32 changes: 16 additions & 16 deletions tclstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static int tcl_incrstats STDVAR
set = 0;
type = typetoi(argv[3]);
if (type == -3) {
Tcl_AppendResult(irp, "invalid type", NULL);
Tcl_SetResult(irp, "invalid type", TCL_STATIC);
return TCL_ERROR;
}
incrstats(argv[1], argv[2], type, atoi(argv[4]), set);
Expand All @@ -41,17 +41,17 @@ static int tcl_getstats STDVAR

BADARGS(4, 5, " user chan type ?today?");
if (typetoi(argv[3]) < 0) {
Tcl_AppendResult(irp, "invalid type", NULL);
Tcl_SetResult(irp, "invalid type", TCL_STATIC);
return TCL_ERROR;
}
if (argc == 5)
today = atoi(argv[4]);
if ((today != 1) && (today != 0)) {
Tcl_AppendResult(irp, "invalid today parameter. Must be 0 or 1.", NULL);
Tcl_SetResult(irp, "invalid today parameter. Must be 0 or 1.", TCL_STATIC);
return TCL_ERROR;
}
sprintf(s, "%d", getstats(argv[1], argv[2], argv[3], today));
Tcl_AppendResult(irp, s, NULL);
Tcl_SetResult(irp, s, TCL_STATIC);
return TCL_OK;
}

Expand All @@ -66,7 +66,7 @@ static int tcl_livestats STDVAR
}
port = atoi(argv[1]);
if (port < 1) {
Tcl_AppendResult(irp, "invalid port", NULL);
Tcl_SetResult(irp, "invalid port", TCL_STATIC);
return TCL_ERROR;
}
start_httpd(port);
Expand All @@ -83,7 +83,7 @@ static int tcl_resetuser STDVAR
chan = argv[2];
ls = findlocstats(chan, user);
if (!ls) {
Tcl_AppendResult(irp, "couldn't find stats for user", NULL);
Tcl_SetResult(irp, "couldn't find stats for user", TCL_STATIC);
return TCL_ERROR;
}
resetlocstats(ls);
Expand All @@ -100,7 +100,7 @@ static int tcl_resetslang STDVAR
static int tcl_getslang STDVAR
{
BADARGS(2, 2, " ID");
Tcl_AppendResult(irp, getslang(atoi(argv[1])), NULL);
Tcl_SetResult(irp, getslang(atoi(argv[1])), TCL_STATIC);
return TCL_OK;
}

Expand All @@ -111,9 +111,9 @@ static int tcl_nick2suser STDVAR
BADARGS(3, 3, " nick channel");
m = getschanmember(argv[1], argv[2]);
if (m && m->user)
Tcl_AppendResult(irp, m->user->user, NULL);
Tcl_SetResult(irp, m->user->user, TCL_STATIC);
else
Tcl_AppendResult(irp, "*", NULL);
Tcl_SetResult(irp, "*", TCL_STATIC);
return TCL_OK;
}

Expand All @@ -125,13 +125,13 @@ static int tcl_findsuser STDVAR
BADARGS(2, 2, " nick!user@host");
ou = get_user_by_host(argv[1]);
if (ou)
Tcl_AppendResult(irp, ou->handle, NULL);
Tcl_SetResult(irp, ou->handle, TCL_STATIC);
else {
u = findsuser(argv[1]);
if (u)
Tcl_AppendResult(irp, u->user, NULL);
Tcl_SetResult(irp, u->user, TCL_STATIC);
else
Tcl_AppendResult(irp, "*", NULL);
Tcl_SetResult(irp, "*", TCL_STATIC);
}
return TCL_OK;
}
Expand All @@ -142,7 +142,7 @@ static int tcl_loadstatsskin STDVAR

BADARGS(2, 2, " skinfile");
if (!loadskin(argv[1])) {
Tcl_AppendResult(irp, "Couldn't load skin!!!", NULL);
Tcl_SetResult(irp, "Couldn't load skin!", TCL_STATIC);
return TCL_ERROR;
} else {
return TCL_OK;
Expand Down Expand Up @@ -170,7 +170,7 @@ static int tcl_loadstatslang STDVAR
slang = slang_find(coreslangs, shortname);
Assert(slang);
if (!slang_load(slang, filename)) {
Tcl_AppendResult(irp, "Couldn't open slang file!!!", NULL);
Tcl_SetResult(irp, "Couldn't open slang file!!!", TCL_STATIC);
return TCL_ERROR;
}
return TCL_OK;
Expand All @@ -185,13 +185,13 @@ static int tcl_schattr STDVAR
BADARGS(3, 99, " user [+/-list] [+/-addhosts] ...");
u = findsuser_by_name(argv[1]);
if (!u) {
Tcl_AppendResult(irp, "Unknown user.", NULL);
Tcl_SetResult(irp, "Unknown user.", TCL_STATIC);
return TCL_ERROR;
}
for (i = 2; i < argc; i++) {
if (!user_changeflag(u, argv[i])) {
snprintf(s, sizeof(s), "Unknown flag: %s", argv[i]);
Tcl_AppendResult(irp, s, NULL);
Tcl_SetResult(irp, s, TCL_STATIC);
return TCL_ERROR;
}
}
Expand Down

0 comments on commit 08869f7

Please sign in to comment.