Move dll_commands and find_dll_command from commands.c to modules.c

Kind of where it belongs.
This commit is contained in:
Kevin Easton
2017-11-27 20:07:28 +11:00
parent 0ba25f02a5
commit a60937a8fd
3 changed files with 31 additions and 36 deletions

View File

@@ -87,7 +87,7 @@ extern CtcpEntryDll *dll_ctcp;
extern WindowDll *dll_window; extern WindowDll *dll_window;
extern IrcVariableDll *dll_variable; extern IrcVariableDll *dll_variable;
IrcCommandDll *find_dll_command(const char *, int *);
char *BX_get_dllstring_var(char *); char *BX_get_dllstring_var(char *);
int BX_get_dllint_var(char *); int BX_get_dllint_var(char *);
void BX_set_dllstring_var(char *, char *); void BX_set_dllstring_var(char *, char *);

View File

@@ -85,6 +85,7 @@ CVS_REVISION(commands_c)
#include "hash2.h" #include "hash2.h"
#include "cset.h" #include "cset.h"
#include "notice.h" #include "notice.h"
#include "module.h"
#ifdef TRANSLATE #ifdef TRANSLATE
#include "translat.h" #include "translat.h"
@@ -152,11 +153,6 @@ static WaitCmd *start_wait_list = NULL,
char lame_wait_nick[] = "***LW***"; char lame_wait_nick[] = "***LW***";
char wait_nick[] = "***W***"; char wait_nick[] = "***W***";
#ifdef WANT_DLL
IrcCommandDll *find_dll_command (const char *, int *);
IrcCommandDll *dll_commands = NULL;
#endif
AJoinList *ajoin_list = NULL; AJoinList *ajoin_list = NULL;
BUILT_IN_COMMAND(obits); BUILT_IN_COMMAND(obits);
@@ -930,36 +926,6 @@ const IrcCommand *BX_find_command(const char *com, int *cnt)
return retval; return retval;
} }
#ifdef WANT_DLL
IrcCommandDll *find_dll_command(const char *com, int *cnt)
{
const size_t len = com ? strlen(com) : 0;
IrcCommandDll *first_match = NULL;
*cnt = 0;
if (len)
{
IrcCommandDll *cmd;
for (cmd = dll_commands; cmd; cmd = cmd->next)
{
if (!my_strnicmp(com, cmd->name, len))
{
if (!first_match)
first_match = cmd;
(*cnt)++;
}
}
if (first_match && strlen(first_match->name) == len)
*cnt *= -1;
}
return first_match;
}
#endif
/* IRCUSER command. Changes your userhost on the fly. Takes effect /* IRCUSER command. Changes your userhost on the fly. Takes effect
* the next time you connect to a server * the next time you connect to a server
*/ */

View File

@@ -41,6 +41,7 @@ CVS_REVISION(modules_c)
#define MAIN_SOURCE #define MAIN_SOURCE
#include "modval.h" #include "modval.h"
IrcCommandDll *dll_commands = NULL;
IrcVariableDll *dll_variable = NULL; IrcVariableDll *dll_variable = NULL;
extern void *default_output_function; extern void *default_output_function;
extern void *default_status_output_function; extern void *default_status_output_function;
@@ -706,6 +707,34 @@ int BX_check_module_version(unsigned long number)
} }
#ifdef WANT_DLL #ifdef WANT_DLL
IrcCommandDll *find_dll_command(const char *com, int *cnt)
{
const size_t len = com ? strlen(com) : 0;
IrcCommandDll *first_match = NULL;
*cnt = 0;
if (len)
{
IrcCommandDll *cmd;
for (cmd = dll_commands; cmd; cmd = cmd->next)
{
if (!my_strnicmp(com, cmd->name, len))
{
if (!first_match)
first_match = cmd;
(*cnt)++;
}
}
if (first_match && strlen(first_match->name) == len)
*cnt *= -1;
}
return first_match;
}
static IrcVariableDll *lookup_dllvar(char *name) static IrcVariableDll *lookup_dllvar(char *name)
{ {
IrcVariableDll *dll = NULL; IrcVariableDll *dll = NULL;