annotate sources/headers/connection.hpp @ 5:0faceb076254

code clean up added PID to the default Core argument bool => true|false
author Vlad Glagolev <enqlave@gmail.com>
date Thu, 24 Jan 2008 21:00:52 +0300
parents 19227b0b7cc1
children 8d54d9fdeca3
rev   line source
2
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
1 /**
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
2 * connection.hpp (2007-04-12)
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
3 *
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
4 * -- CABAL -- connection header
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
5 *
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
6 * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
7 * All rights reserved.
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
8 *
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
9 * Permission to use, copy, modify, and distribute this software for any
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
10 * purpose with or without fee is hereby granted, provided that the above
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
11 * copyright notice and this permission notice appear in all copies.
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
12 *
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
20 */
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
21
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
22 #ifndef _CONNECTION_HPP_
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
23 #define _CONNECTION_HPP_
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
24
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
25 #include "network.hpp"
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
26
5
0faceb076254 code clean up
Vlad Glagolev <enqlave@gmail.com>
parents: 2
diff changeset
27 class Connection: public Network
2
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
28 {
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
29 public:
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
30 Connection();
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
31 ~Connection();
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
32
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
33 void ircConnect();
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
34
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
35 void ircPass(string);
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
36 void ircNick(string);
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
37 void ircUser(string, string);
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
38 void ircAway(string);
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
39 void ircJoin(string, string);
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
40 void ircPart(string);
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
41 void ircCycle(string);
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
42
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
43 void establish();
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
44
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
45 struct host_type {
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
46 pchar host;
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
47 int port;
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
48 pchar password;
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
49 host_type *next;
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
50
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
51 host_type(pchar h, int p, pchar pw):
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
52 host(h),
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
53 port(p),
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
54 password(pw),
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
55 next(this)
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
56 {
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
57 };
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
58 host_type(pchar h, int p, pchar pw, host_type *t):
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
59 host(h),
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
60 port(p),
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
61 password(pw),
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
62 next(t)
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
63 {
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
64 };
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
65 } *hosts, *current;
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
66
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
67 host_type *addHost(host_type *, pchar, int, pchar);
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
68
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
69 pchar virtualhost, nick, user, name, chan, key;
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
70
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
71 time_t now, uptime;
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
72 };
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
73
19227b0b7cc1 .h => .hpp for the headers
Vlad Glagolev <enqlave@gmail.com>
parents:
diff changeset
74 #endif // _CONNECTION_HPP_