summaryrefslogtreecommitdiff
path: root/src/common/HPM.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/HPM.c')
-rw-r--r--src/common/HPM.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index 971eb83bd..f39954175 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -1,25 +1,31 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
+#define HERCULES_CORE
+
+#include "../config/core.h" // CONSOLE_INPUT
+#include "HPM.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "../common/cbasetypes.h"
-#include "../common/mmo.h"
+#include "../common/conf.h"
+#include "../common/console.h"
#include "../common/core.h"
#include "../common/malloc.h"
+#include "../common/mmo.h"
#include "../common/showmsg.h"
#include "../common/socket.h"
+#include "../common/sql.h"
+#include "../common/strlib.h"
+#include "../common/sysinfo.h"
#include "../common/timer.h"
-#include "../common/conf.h"
#include "../common/utils.h"
-#include "../common/console.h"
-#include "../common/strlib.h"
-#include "../common/sql.h"
-#include "HPM.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#ifndef WIN32
-#include <unistd.h>
+# include <unistd.h>
#endif
struct malloc_interface iMalloc_HPM;
@@ -404,7 +410,7 @@ void hplugins_addToHPData(enum HPluginDataTypes type, unsigned int pluginID, voi
*(action.hdatac) += 1;
RECREATE(*(action.HPDataSRCPtr),struct HPluginData *,*(action.hdatac));
- /* RECREATE modified the addresss */
+ /* RECREATE modified the address */
HPDataSRC = *(action.HPDataSRCPtr);
HPDataSRC[*(action.hdatac) - 1] = HPData;
}
@@ -499,7 +505,7 @@ bool hplugins_addpacket(unsigned short cmd, short length,void (*receive) (int fd
return true;
}
-/*
+/*
0 = unknown
1 = OK
2 = incomplete
@@ -572,7 +578,7 @@ void* HPM_reallocz(void *p, size_t size, const char *file, int line, const char
char* HPM_astrdup(const char *p, const char *file, int line, const char *func) {
return iMalloc->astrdup(p,HPM_file2ptr(file),line,func);
}
-/* todo: add ability for tracking using pID for the upcoming runtime load/unload support. */
+/* TODO: add ability for tracking using pID for the upcoming runtime load/unload support. */
bool HPM_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) {
if( !HPM->hooking ) {
ShowError("HPM:AddHook Fail! '%s' tried to hook to '%s' but HPMHooking is disabled!\n",HPM->pid2name(pID),target);
@@ -629,7 +635,7 @@ bool hpm_add_arg(unsigned int pluginID, char *name, bool has_param, void (*func)
CREATE(data, struct HPMArgData, 1);
- data->pluginID = pluginID;
+ data->pluginID = pluginID;
data->name = aStrdup(name);
data->func = func;
data->help = help;
@@ -685,7 +691,7 @@ bool hplugins_parse_conf(const char *w1, const char *w2, enum HPluginConfType po
void hplugins_share_defaults(void) {
/* console */
#ifdef CONSOLE_INPUT
- HPM->share(console->addCommand,"addCPCommand");
+ HPM->share(console->input->addCommand,"addCPCommand");
#endif
/* our own */
HPM->share(hplugins_addpacket,"addPacket");
@@ -703,8 +709,6 @@ void hplugins_share_defaults(void) {
HPM->share(&arg_c,"arg_c");
HPM->share(SERVER_NAME,"SERVER_NAME");
HPM->share(&SERVER_TYPE,"SERVER_TYPE");
- HPM->share((void*)get_svn_revision,"get_svn_revision");
- HPM->share((void*)get_git_hash,"get_git_hash");
HPM->share(DB, "DB");
HPM->share(HPMiMalloc, "iMalloc");
/* socket */
@@ -719,6 +723,8 @@ void hplugins_share_defaults(void) {
HPM->share(timer,"timer");
/* libconfig */
HPM->share(libconfig,"libconfig");
+ /* sysinfo */
+ HPM->share(sysinfo,"sysinfo");
}
void hpm_init(void) {
@@ -754,7 +760,7 @@ void hpm_init(void) {
HPM->symbol_defaults();
#ifdef CONSOLE_INPUT
- console->addCommand("plugins",CPCMD_A(plugins));
+ console->input->addCommand("plugins",CPCMD_A(plugins));
#endif
return;
}