]> jfr.im git - irc/thales.git/blob - src/db.h
- server.lastsplit is not overwritten when a server rejoins.
[irc/thales.git] / src / db.h
1 /* GNU Thales - IRC to Relational Database Gateway
2 * Copyright (C) 2002 Lucas Nussbaum <lucas@lucas-nussbaum.net>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 /* GNU Thales' database interface */
19
20 #ifndef _DB_H_
21 #define _DB_H_
22
23 #include "thales.h"
24 #include "log.h"
25
26 void db_connect();
27 int db_query(const char *fmt, ...);
28 char *db_escape(char *);
29 int db_checkserver(char *serv);
30 int db_getserver(char *serv);
31 int db_getservfromnick(char *nick);
32 int db_checknick(char *nick);
33 int db_getnick(char *nick);
34 int db_insertid();
35 void db_chgnick(char *newnick, char *oldnick);
36 void db_addserver(char *server, int servid);
37 void db_delserver(char *server);
38 void db_addnick(char *nick, int nickid);
39 void db_delnick(char *nick);
40 int db_getchannel(char *chan);
41 int db_getchancreate(char *chan);
42 void db_removefromchans(int nickid);
43 void db_removenick(char *nick);
44 void db_checkemptychan(int chanid, char *chan);
45 void db_close();
46 void db_cleanserver();
47 void db_cleanuser();
48 int db_getlusers(int type);
49 #define LUSERS_USERS 1
50 #define LUSERS_USERSINV 2
51 #define LUSERS_OPERS 3
52 #define LUSERS_SERV 4
53 #define LUSERS_CHAN 5
54 #define LUSERS_USERSGLOB 6
55 #define LUSERS_USERSMAX 7
56
57 #ifndef TBL_PREFIX
58 #define TBL_PREFIX ""
59 #endif
60
61 /* Tables names */
62 #define TBL_USER TBL_PREFIX"user"
63 #define TBL_CHAN TBL_PREFIX"chan"
64 #define TBL_ISON TBL_PREFIX"ison"
65 #define TBL_SERV TBL_PREFIX"server"
66 #define TBL_MAXV TBL_PREFIX"maxvalues"
67
68 #endif