Make /rehash help work again.

This commit is contained in:
Jilles Tjoelker 2007-12-12 22:26:17 +01:00
parent 351078d072
commit e8149a2c64
3 changed files with 9 additions and 6 deletions

View File

@ -100,10 +100,6 @@ extern void del_from_resv_hash(const char *name, struct ConfItem *aconf);
extern struct ConfItem *hash_find_resv(const char *name); extern struct ConfItem *hash_find_resv(const char *name);
extern void clear_resv_hash(void); extern void clear_resv_hash(void);
extern void add_to_help_hash(const char *name, struct cachefile *hptr);
extern void clear_help_hash(void);
extern struct cachefile *hash_find_help(const char *name, int flags);
extern void hash_stats(struct Client *); extern void hash_stats(struct Client *);
#endif /* INCLUDED_hash_h */ #endif /* INCLUDED_hash_h */

View File

@ -259,7 +259,6 @@ rehash_help(struct Client *source_p)
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s is forcing re-reading of HELP files", "%s is forcing re-reading of HELP files",
get_oper_name(source_p)); get_oper_name(source_p));
clear_help_hash();
load_help(); load_help();
} }

View File

@ -161,7 +161,8 @@ free_cachefile(struct cachefile *cacheptr)
* *
* inputs - * inputs -
* outputs - * outputs -
* side effects - contents of help directories are loaded. * side effects - old help cache deleted
* - contents of help directories are loaded.
*/ */
void void
load_help(void) load_help(void)
@ -170,11 +171,18 @@ load_help(void)
struct dirent *ldirent= NULL; struct dirent *ldirent= NULL;
char filename[MAXPATHLEN]; char filename[MAXPATHLEN];
struct cachefile *cacheptr; struct cachefile *cacheptr;
struct DictionaryIter iter;
#if defined(S_ISLNK) && defined(HAVE_LSTAT) #if defined(S_ISLNK) && defined(HAVE_LSTAT)
struct stat sb; struct stat sb;
#endif #endif
DICTIONARY_FOREACH(cacheptr, &iter, help_dict)
{
irc_dictionary_delete(help_dict, cacheptr->name);
free_cachefile(cacheptr);
}
/* opers must be done first */ /* opers must be done first */
helpfile_dir = opendir(HPATH); helpfile_dir = opendir(HPATH);