Basic multithreading support
[clinton/bobotpp.git] / source / ServerConnection.H
1 // ServerConnection.H -*- C++ -*-
2 // Copyright (c) 1997, 1998 Etienne BERNARD
3 // Copyright (c) 2002 Clinton Ebadi
4
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // any later version.
9
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 #ifndef SERVERCONNECTION_H
20 #define SERVERCONNECTION_H
21
22 #ifdef HAVE_CONFIG_H
23 #include "config.h"
24 #endif
25
26 #include <ctime>
27
28 #include "Server.H"
29 #include "ServerQueue.H"
30 #include "Connection.H"
31
32 class Bot;
33 class Parser;
34 class Channel;
35 class Commands;
36 class UserCommands;
37 #ifdef USESCRIPTS
38 class Interp;
39 class BotInterp;
40 class ScriptCommands;
41 #endif
42
43 class ServerConnection : public Connection {
44 Server * server;
45 Bot * bot;
46 ServerQueue * queue;
47 std::time_t pingTime;
48 int lag;
49 std::time_t serverLastSpoken;
50 bool debug;
51
52 public:
53 ServerConnection(Bot *, Server *, String);
54 ~ServerConnection();
55
56 bool connect();
57 bool handleInput();
58
59 friend class Bot;
60 friend class Person;
61 friend class Parser;
62 friend class Channel;
63 friend class Commands;
64 friend class UserCommands;
65 #ifdef USESCRIPTS
66 friend class Interp;
67 friend class BotInterp;
68 friend class ScriptCommands;
69 #endif
70 };
71
72 #endif