1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-26 20:36:38 +02:00

More win32 remote include fixes

This commit is contained in:
codemastr
2004-02-25 23:17:32 +00:00
parent 19d843e650
commit 739feded92
4 changed files with 28 additions and 24 deletions
+1
View File
@@ -2983,3 +2983,4 @@ seen. gmtime warning still there
Suggested by Zell (#0001589).
- Fixed a bug reported by Joolz that would cause problems when deleting a remote
included file from a server (#0001587).
- Fixed a few more remote include problems on Windows
+1
View File
@@ -1236,6 +1236,7 @@ struct _configitem_alias_format {
#define INCLUDE_NOTLOADED 0x1
#define INCLUDE_REMOTE 0x2
#define INCLUDE_DLQUEUED 0x4
#define INCLUDE_USED 0x8
struct _configitem_include {
ConfigItem *prev, *next;
+3 -3
View File
@@ -13,12 +13,12 @@ RC=rc
#
#
#To enable remote includes uncomment the next line:
USE_REMOTEINC=1
#USE_REMOTEINC=1
#
#If your libcurl library and include files are not in your compiler's
#default locations, specify the locations here:
LIBCURL_INC_DIR="c:\dev\curl\include"
LIBCURL_LIB_DIR="c:\dev\curl\lib"
#LIBCURL_INC_DIR="c:\dev\curl\include"
#LIBCURL_LIB_DIR="c:\dev\curl\lib"
#
#
### END REMOTE INCLUDES ##
+23 -21
View File
@@ -396,7 +396,7 @@ int config_verbose = 0;
void add_include(char *);
#ifdef USE_LIBCURL
void add_remote_include(char *, char *);
void add_remote_include(char *, char *, int);
int remote_include(ConfigEntry *ce);
#endif
void unload_notloaded_includes(void);
@@ -7305,11 +7305,11 @@ static void conf_download_complete(char *url, char *file, char *errorbuf, int ca
char *file = unreal_getfilename(urlfile);
char *tmp = unreal_mktemp("tmp", file);
unreal_copyfile(inc->file, tmp);
add_remote_include(tmp, url);
add_remote_include(tmp, url, 0);
free(urlfile);
}
else
add_remote_include(file, url);
add_remote_include(file, url, 0);
}
for (inc = conf_include; inc; inc = (ConfigItem_include *)inc->next)
{
@@ -7470,7 +7470,7 @@ int remote_include(ConfigEntry *ce)
else
{
if ((ret = load_conf(file)) >= 0)
add_remote_include(file, ce->ce_vardata);
add_remote_include(file, ce->ce_vardata, INCLUDE_USED);
free(file);
return ret;
}
@@ -7487,7 +7487,7 @@ int remote_include(ConfigEntry *ce)
if (config_verbose > 0)
config_status("Loading %s from download", ce->ce_vardata);
if ((ret = load_conf(file)) >= 0)
add_remote_include(file, ce->ce_vardata);
add_remote_include(file, ce->ce_vardata, INCLUDE_USED);
return ret;
}
return 0;
@@ -7509,12 +7509,12 @@ void add_include(char *file)
}
inc = MyMallocEx(sizeof(ConfigItem_include));
inc->file = strdup(file);
inc->flag.type = INCLUDE_NOTLOADED;
inc->flag.type = INCLUDE_NOTLOADED|INCLUDE_USED;
AddListItem(inc, conf_include);
}
#ifdef USE_LIBCURL
void add_remote_include(char *file, char *url)
void add_remote_include(char *file, char *url, int flags)
{
ConfigItem_include *inc;
@@ -7527,10 +7527,11 @@ void add_remote_include(char *file, char *url)
if (!stricmp(url, inc->url))
return;
}
inc = MyMallocEx(sizeof(ConfigItem_include));
inc->file = strdup(file);
inc->url = strdup(url);
inc->flag.type = (INCLUDE_NOTLOADED|INCLUDE_REMOTE);
inc->flag.type = (INCLUDE_NOTLOADED|INCLUDE_REMOTE|flags);
AddListItem(inc, conf_include);
}
#endif
@@ -7542,7 +7543,7 @@ void unload_notloaded_includes(void)
for (inc = conf_include; inc; inc = next)
{
next = (ConfigItem_include *)inc->next;
if (inc->flag.type & INCLUDE_NOTLOADED)
if ((inc->flag.type & INCLUDE_NOTLOADED) || !(inc->flag.type & INCLUDE_USED))
{
#ifdef USE_LIBCURL
if (inc->flag.type & INCLUDE_REMOTE)
@@ -7567,20 +7568,21 @@ void unload_loaded_includes(void)
for (inc = conf_include; inc; inc = next)
{
next = (ConfigItem_include *)inc->next;
if (inc->flag.type & INCLUDE_NOTLOADED)
continue;
#ifdef USE_LIBCURL
if (inc->flag.type & INCLUDE_REMOTE)
if (!(inc->flag.type & INCLUDE_NOTLOADED) || !(inc->flag.type & INCLUDE_USED))
{
remove(inc->file);
free(inc->url);
if (inc->errorbuf)
free(inc->errorbuf);
}
#ifdef USE_LIBCURL
if (inc->flag.type & INCLUDE_REMOTE)
{
remove(inc->file);
free(inc->url);
if (inc->errorbuf)
free(inc->errorbuf);
}
#endif
free(inc->file);
DelListItem(inc, conf_include);
free(inc);
free(inc->file);
DelListItem(inc, conf_include);
free(inc);
}
}
}