modularise irc component

This commit is contained in:
Ailin Nemui 2019-07-17 13:37:19 +02:00
commit 00a7efc69f
11 changed files with 46 additions and 8 deletions

View file

@ -247,14 +247,24 @@ MODULE_REC *module_find(const char *name)
MODULE_FILE_REC *module_file_find(MODULE_REC *module, const char *name)
{
GSList *tmp;
char *tmpname, *p;
tmpname = g_strdup(name);
for (p = tmpname; *p != '\0'; p++) {
if (*p == '_')
*p = '-';
}
for (tmp = module->files; tmp != NULL; tmp = tmp->next) {
MODULE_FILE_REC *rec = tmp->data;
if (g_strcmp0(rec->name, name) == 0)
if (g_strcmp0(rec->name, name) == 0 ||
g_strcmp0(rec->name, tmpname) == 0) {
g_free(tmpname);
return rec;
}
}
g_free(tmpname);
return NULL;
}