1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 19:14:46 +02:00

- Small fix in s_conf.c and Velcro

This commit is contained in:
stskeeps
2007-06-27 11:30:08 +00:00
parent ca86e3b898
commit ea303f149d
5 changed files with 118 additions and 47 deletions
+1
View File
@@ -1823,3 +1823,4 @@ MOTDs
the user sent along in "sentcmd".
- Fixed typo in new module build switch
- Added a Config -advanced prompt for --with-moduleswhich=
- Small fix in s_conf.c and Velcro
+1 -1
View File
@@ -5948,7 +5948,7 @@ int _test_link(ConfigFile *conf, ConfigEntry *ce)
errors++;
}
#endif
if (strchr(cep->ce_vardata, '*') != NULL || strchr(cep->ce_vardata, '?'))
if (strchr(cep->ce_vardata, '*') != NULL || strchr(cep->ce_vardata, '?') != NULL)
{
has_hostname_wildcards = 1;
}
+97
View File
@@ -0,0 +1,97 @@
@version $Id$
@copyright (C) 2007 Carsten Valdemar Munk
class ILocalClient;
class IServer;
class IClient
{
public:
virtual char *getName() = 0;
virtual void *getInternal() = 0;
virtual IServer& getIServer() = 0;
virtual ILocalClient *getILocalClient() = 0;
virtual ~IClient() {}
};
class ILocalClient : public IClient
{
public:
virtual ILocalClient *getILocalClient();
virtual ~ILocalClient() {}
};
implementation:
// Glue for Unreal3
extern "C"
{
#include "config.h"
#include "struct.h"
#include "common.h"
#include "sys.h"
#include "numeric.h"
#include "msg.h"
#include "proto.h"
#include "channel.h"
#include <time.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#endif
#include <fcntl.h>
#include "h.h"
#ifdef STRIPBADWORDS
#include "badwords.h"
#endif
#ifdef _WIN32
#include "version.h"
#endif
}
class U3Client : public ILocalClient
{
public:
U3Client(aClient *instance)
{
acptr = instance;
}
virtual void *getInternal()
{
return (void *) acptr;
}
virtual char *getName()
{
return acptr->name;
}
virtual ILocalClient *getILocalClient()
{
if (acptr->from == &me)
return this;
else return NULL;
}
virtual IServer *getServer()
{
return NULL;
}
private:
aClient *acptr;
};
ILocalClient* ILocalClient::getILocalClient()
{
return this;
}
+18 -45
View File
@@ -210,55 +210,28 @@ bool Velcro::dependsOnModule(const char *who, const char *module)
}
modulesLoading.push_back(ms);
config_status("Loading module %s as a dependancy of %s", module, who);
snprintf(buf, 1024, "u4modules/%s.so", module);
void *dl = dlopen(buf, RTLD_LAZY|RTLD_LOCAL);
if (dl == NULL)
snprintf(buf, 1024, "u4modules/%s.depends", module);
void *dl;
FILE *f = fopen(buf, "r");
if (f == NULL)
{
config_status("Velcro: Error loading dependancy %s for %s: %s, possible error/RTLD_LAZY broken, trying old fashioned dependancy loading and trying again afterwards",
module, who, dlerror());
snprintf(buf, 1024, "u4modules/%s.depends", module);
FILE *f = fopen(buf, "r");
if (f == NULL)
{
config_error("Velcro: Error opening depends file for %s: %s",
module, strerror(errno));
return false;
}
char *ss;
while ((ss = fgets(buf, 1023, f)) != NULL)
{
char *p = strchr(ss, '\r');
if (p != NULL)
*p = 0;
p = strchr(ss, '\n');
if (p != NULL)
*p = 0;
if (*ss == 0)
continue;
if (!dependsOnModule(module, ss))
return false;
}
config_error("Velcro: Error opening depends file for %s: %s",
module, strerror(errno));
return false;
}
else
char *ss;
while ((ss = fgets(buf, 1023, f)) != NULL)
{
snprintf(buf, 1024, "%s_checkDepends", module);
VoidIntPointerParaFunctionPointer *depend = (VoidIntPointerParaFunctionPointer *) dlsym(dl, buf);
if (depend == NULL)
{
config_error("Velcro: Error loading dependancy %s for %s: Unable to find %s_checkDepends",
module, who, module);
char *p = strchr(ss, '\r');
if (p != NULL)
*p = 0;
p = strchr(ss, '\n');
if (p != NULL)
*p = 0;
if (*ss == 0)
continue;
if (!dependsOnModule(module, ss))
return false;
}
// kludge.. no idea why it doesn't work with int *
int ret = 0;
(*depend)(&ret);
if (ret == -1)
{
dlclose(dl);
return false;
}
dlclose(dl);
}
/* now done loading dependancies, reopen with RTLD_GLOBAL|RTLD_NOW .. */
snprintf(buf, 1024, "u4modules/%s.so", module);
+1 -1
View File
@@ -4,5 +4,5 @@ echo --- Preprocessing $1 ..
echo --- Building dependancies for $1
cat $1.depends | ../velcro/epl ../velcro/build
echo --- Building $1
g++ -Wall -DDYNAMIC_LINKING -fPIC -DPIC -shared -export-dynamic -I../extras/regexp/include -I../include -o $1.so $1.cc
g++ -g -Wall -DDYNAMIC_LINKING -fPIC -DPIC -shared -export-dynamic -I../extras/regexp/include -I../include -o $1.so $1.cc
echo --- Done building $1