do not filter access levels if not wanted (show database errors)
[NeonServV5.git] / src / ClientSocket.h
1 /* ClientSocket.h - NeonServ v5.6
2  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
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 3 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, see <http://www.gnu.org/licenses/>. 
16  */
17 #ifndef _ClientSocket_h
18 #define _ClientSocket_h
19
20 #include "main.h"
21
22 #define SOCKET_FLAG_CONNECTED      0x02
23 #define SOCKET_FLAG_READY          0x04
24 #define SOCKET_FLAG_PREFERRED      0x08 /* prefered bot to send datas to the IRC World (NOTICE's WHO's etc pp) */
25 #define SOCKET_FLAG_USE_QUEUE      0x10
26 #define SOCKET_FLAG_RECONNECT      0x20
27 #define SOCKET_FLAG_SSL            0x40
28
29 #define SOCKET_FLAG_FAST_JUMP      0x200
30 #define SOCKET_FLAG_SILENT         0x400
31 #define SOCKET_FLAG_CHANGENICK     0x800
32 #define SOCKET_FLAG_REQUEST_INVITE 0x1000
33 #define SOCKET_FLAG_REQUEST_OP     0x2000
34 #define SOCKET_FLAG_SECRET_BOT     0x4000
35
36 #define SOCKET_HAVE_BOTCLASSVALUE1 0x10000000
37 #define SOCKET_HAVE_BOTCLASSVALUE2 0x20000000
38 #define SOCKET_HAVE_BOTCLASSVALUE3 0x40000000
39
40 #define BUF_SIZ 512
41
42 struct UserNode;
43 struct trigger_cache;
44 struct IODescriptor;
45
46 struct ClientSocket {
47     struct IODescriptor *iofd;
48     unsigned int flags;
49     char *host;
50     int port;
51     char *bind;
52     char *pass;
53     char *nick;
54     char *ident;
55     char *realname;
56     struct UserNode *user;
57     char *network_name;
58     unsigned long traffic_in;
59     unsigned long traffic_out;
60     time_t connection_time;
61     
62     struct BotQueue *queue;
63     
64     struct WHOQueueEntry *whoqueue_first;
65     struct WHOQueueEntry *whoqueue_last;
66     
67     struct HandleInfoQueueEntry *handleinfo_first;
68     struct HandleInfoQueueEntry *handleinfo_last;
69         
70         int botid : 16;
71     int clientid : 16;
72     
73     void *botclassvalue1;
74     void *botclassvalue2;
75     void *botclassvalue3;
76     
77     void *changenick_channels; //parted channels due raw 437
78     
79     struct ClientSocket *next;
80 };
81
82 #ifndef DND_FUNCTIONS
83 /* MODULAR ACCESSIBLE */ struct ClientSocket* create_socket(char *host, int port, char *bindto, char *pass, char *nick, char *ident, char *realname);
84 /* MODULAR ACCESSIBLE */ void connect_socket(struct ClientSocket *client);
85 /* MODULAR ACCESSIBLE */ int close_socket(struct ClientSocket *client);
86 /* MODULAR ACCESSIBLE */ int destroy_socket(struct ClientSocket *client);
87 int write_socket_force(struct ClientSocket *client, char* msg, int len);
88 /* MODULAR ACCESSIBLE */ int write_socket(struct ClientSocket *client, char* msg, int len);
89 #ifdef HAVE_THREADS
90 int clientsocket_parseorder_top(unsigned int tid);
91 #endif
92 /* MODULAR ACCESSIBLE */ void putsock(struct ClientSocket *client, const char *text, ...) PRINTF_LIKE(2, 3);
93 /* MODULAR ACCESSIBLE */ struct ClientSocket* getBots(int flags, struct ClientSocket* last_bot);
94 void init_sockets();
95 void free_sockets(int close_only);
96 #endif
97 #endif