#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
-#define IRSSI_ABI_VERSION 45
+#define IRSSI_ABI_VERSION 46
#define DEFAULT_SERVER_ADD_PORT 6667
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
nickmatch_rebuild(nickmatch);
}
+static void free_cache_matches(GSList *matches)
+{
+ g_slist_free(matches);
+}
+
static void ignore_nick_cache(GHashTable *list, CHANNEL_REC *channel,
NICK_REC *nick)
{
void ignore_init(void)
{
ignores = NULL;
- nickmatch = nickmatch_init(ignore_nick_cache);
+ nickmatch = nickmatch_init(ignore_nick_cache, (GDestroyNotify) free_cache_matches);
time_tag = g_timeout_add(1000, (GSourceFunc) unignore_timeout, NULL);
read_ignores();
static GSList *lists;
-NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func)
+NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func, GDestroyNotify value_destroy_func)
{
NICKMATCH_REC *rec;
rec = g_new0(NICKMATCH_REC, 1);
rec->func = func;
+ rec->value_destroy_func = value_destroy_func;
lists = g_slist_append(lists, rec);
return rec;
{
lists = g_slist_remove(lists, rec);
- g_hash_table_destroy(rec->nicks);
- g_free(rec);
+ if (rec->nicks != NULL)
+ g_hash_table_destroy(rec->nicks);
+ g_free(rec);
}
static void nickmatch_check_channel(CHANNEL_REC *channel, NICKMATCH_REC *rec)
if (rec->nicks != NULL)
g_hash_table_destroy(rec->nicks);
- rec->nicks = g_hash_table_new((GHashFunc) g_direct_hash,
- (GCompareFunc) g_direct_equal);
+ rec->nicks = g_hash_table_new_full((GHashFunc) g_direct_hash, (GCompareFunc) g_direct_equal,
+ NULL, (GDestroyNotify) rec->value_destroy_func);
g_slist_foreach(channels, (GFunc) nickmatch_check_channel, rec);
}
typedef struct {
GHashTable *nicks;
NICKMATCH_REBUILD_FUNC func;
+ GDestroyNotify value_destroy_func;
} NICKMATCH_REC;
-NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func);
+NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func, GDestroyNotify value_destroy_func);
void nickmatch_deinit(NICKMATCH_REC *rec);
/* Calls rebuild function for all nicks in all channels.
read_settings();
- nickmatch = nickmatch_init(hilight_nick_cache);
+ nickmatch = nickmatch_init(hilight_nick_cache, NULL);
read_hilight_config();
signal_add_first("print text", (SIGNAL_FUNC) sig_print_text);