summaryrefslogtreecommitdiff
path: root/src/core/nickmatch-cache.h
blob: c4140a49f8f7f02aa801b52c1d650601a3cd4b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef __NICKMATCH_CACHE_H
#define __NICKMATCH_CACHE_H

typedef void (*NICKMATCH_REBUILD_FUNC) (GHashTable *list,
					CHANNEL_REC *channel, NICK_REC *nick);

typedef struct {
        GHashTable *nicks;
	NICKMATCH_REBUILD_FUNC func;
} NICKMATCH_REC;

NICKMATCH_REC *nickmatch_init(NICKMATCH_REBUILD_FUNC func);
void nickmatch_deinit(NICKMATCH_REC *rec);

/* Calls rebuild function for all nicks in all channels.
   This must be called soon after nickmatch_init(), before any nicklist
   signals get sent. */
void nickmatch_rebuild(NICKMATCH_REC *rec);

#define nickmatch_find(rec, nick) \
        g_hash_table_lookup((rec)->nicks, nick)

void nickmatch_cache_init(void);
void nickmatch_cache_deinit(void);

#endif