summaryrefslogtreecommitdiff
path: root/src/core/queries.h
blob: 77ef9c376fe2f16246e69df57fbd21ce91cadee9 (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
27
28
29
30
31
32
33
34
#ifndef __QUERIES_H
#define __QUERIES_H

#include "modules.h"

/* Returns QUERY_REC if it's query, NULL if it isn't. */
#define QUERY(query) \
	MODULE_CHECK_CAST_MODULE(query, QUERY_REC, type, \
			      "WINDOW ITEM TYPE", "QUERY")

#define IS_QUERY(query) \
	(QUERY(query) ? TRUE : FALSE)

#define STRUCT_SERVER_REC SERVER_REC
struct _QUERY_REC {
#include "query-rec.h"
};

extern GSList *queries;

void query_init(QUERY_REC *query, int automatic);
void query_destroy(QUERY_REC *query);

/* Find query by name, if `server' is NULL, search from all servers */
QUERY_REC *query_find(SERVER_REC *server, const char *nick);

void query_change_nick(QUERY_REC *query, const char *nick);
void query_change_address(QUERY_REC *query, const char *address);
void query_change_server(QUERY_REC *query, SERVER_REC *server);

void queries_init(void);
void queries_deinit(void);

#endif