static void read_hilight_config(void) { CONFIG_NODE *node; HILIGHT_REC *rec; GSList *tmp; char *text, *color; hilights_destroy_all(); node = iconfig_node_traverse("hilights", FALSE); if (node == NULL) { reset_cache(); return; } tmp = config_node_first(node->value); for (; tmp != NULL; tmp = config_node_next(tmp)) { node = tmp->data; if (node->type != NODE_TYPE_BLOCK) continue; text = config_node_get_str(node, "text", NULL); if (text == NULL || *text == '\0') continue; rec = g_new0(HILIGHT_REC, 1); hilights = g_slist_append(hilights, rec); rec->text = g_strdup(text); color = config_node_get_str(node, "color", NULL); rec->color = color == NULL || *color == '\0' ? NULL : g_strdup(color); color = config_node_get_str(node, "act_color", NULL); rec->act_color = color == NULL || *color == '\0' ? NULL : g_strdup(color); rec->level = config_node_get_int(node, "level", 0); rec->priority = config_node_get_int(node, "priority", 0); rec->nick = config_node_get_bool(node, "nick", TRUE); rec->word = config_node_get_bool(node, "word", TRUE); rec->case_sensitive = config_node_get_bool(node, "matchcase", FALSE); rec->nickmask = config_node_get_bool(node, "mask", FALSE); rec->fullword = config_node_get_bool(node, "fullword", FALSE); rec->regexp = config_node_get_bool(node, "regexp", FALSE); rec->servertag = config_node_get_str(node, "servertag", NULL); hilight_init_rec(rec); node = iconfig_node_section(node, "channels", -1); if (node != NULL) rec->channels = config_node_get_list(node); } reset_cache(); }
void hilight_create(HILIGHT_REC *rec) { if (g_slist_find(hilights, rec) != NULL) { hilight_remove_config(rec); hilights = g_slist_remove(hilights, rec); } hilights = g_slist_append(hilights, rec); hilight_add_config(rec); hilight_init_rec(rec); signal_emit("hilight created", 1, rec); }