Thu, 28 Jan 2021 11:39:30 +0200
reduce delta with protocol5
73
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
1 | /* |
190 | 2 | Copyright 2014 - 2021 Teemu Piippo |
73
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
3 | All rights reserved. |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
4 | |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
5 | Redistribution and use in source and binary forms, with or without |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
6 | modification, are permitted provided that the following conditions |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
7 | are met: |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
8 | |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
9 | 1. Redistributions of source code must retain the above copyright |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
10 | notice, this list of conditions and the following disclaimer. |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
11 | 2. Redistributions in binary form must reproduce the above copyright |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
12 | notice, this list of conditions and the following disclaimer in the |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
13 | documentation and/or other materials provided with the distribution. |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
14 | 3. Neither the name of the copyright holder nor the names of its |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
15 | contributors may be used to endorse or promote products derived from |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
16 | this software without specific prior written permission. |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
17 | |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
20 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
21 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
23 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
24 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
25 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
26 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
27 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
29 | */ |
07dda51a7a8e
Update license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
30 | |
81
a18aaf460648
Allow compilation on Windows/MinGW
Teemu Piippo <crimsondusk64@gmail.com>
parents:
73
diff
changeset
|
31 | #include <time.h> |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | #include "rconsession.h" |
23
f7221183a994
- the prompt is now colored
Teemu Piippo <crimsondusk64@gmail.com>
parents:
22
diff
changeset
|
33 | #include "../interface.h" |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
34 | #include "../md5.h" |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
83
diff
changeset
|
35 | BEGIN_ZFC_NAMESPACE |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | // |
92 | 39 | RCONSession::RCONSession() : |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
40 | m_state(RCON_DISCONNECTED), |
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
41 | m_lastPing(0), |
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
42 | m_adminCount(0), |
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
43 | m_interface(nullptr) |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | { |
189
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
45 | std::stringstream errors; |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
46 | if (not m_socket.set_blocking(false, errors)) |
15
33da84af4bba
- log area done, re-enabled the rcon connection
Teemu Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
47 | { |
189
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
48 | fprintf(stderr, "unable to set socket as non-blocking: %s\n", errors.str().data()); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
49 | exit(EXIT_FAILURE); |
15
33da84af4bba
- log area done, re-enabled the rcon connection
Teemu Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
50 | } |
24
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
51 | } |
15
33da84af4bba
- log area done, re-enabled the rcon connection
Teemu Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
52 | |
24
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
53 | // ------------------------------------------------------------------------------------------------- |
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
54 | // |
58
d175243ad169
- rcon sessions are no longer allocated on the heap
Teemu Piippo <crimsondusk64@gmail.com>
parents:
57
diff
changeset
|
55 | RCONSession::~RCONSession() {} |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | // |
186
9330b93d9946
cleanup ip address code
Teemu Piippo <teemu@hecknology.net>
parents:
185
diff
changeset
|
59 | void RCONSession::connect(net::ip_address address) |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | { |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | m_address = address; |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | m_state = RCON_CONNECTING; |
138
c909c38ca886
Restyled Interface's public method names
Teemu Piippo <teemu@compsta2.com>
parents:
137
diff
changeset
|
63 | m_interface->updateStatusBar(); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
64 | sendHello(); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | // |
72 | 69 | void RCONSession::disconnect() |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | { |
27
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
71 | if (m_state > RCON_CONNECTING) |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | { |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | // Say goodbye to remote |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
74 | send({CLRC_DISCONNECT}); |
111
51c93a0cc317
Now disconnects properly without instantly quitting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
109
diff
changeset
|
75 | m_interface->disconnected(); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | m_state = RCON_DISCONNECTED; |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | // |
191
2e6cbacafdc7
various little touchups
Teemu Piippo <teemu@hecknology.net>
parents:
190
diff
changeset
|
83 | bool RCONSession::send(const std::vector<unsigned char>& packet) |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | { |
189
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
85 | std::stringstream errors; |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
86 | const bool result = m_socket.send(m_address, packet, errors); |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
87 | if (not result) |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
88 | { |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
89 | this->m_interface->printError("Network error: %s\n", errors.str().data()); |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
90 | } |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
91 | return result; |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | // |
72 | 96 | void RCONSession::tick() |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | { |
31
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
98 | if (m_state == RCON_DISCONNECTED) |
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
99 | return; |
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
100 | |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | time_t now; |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
102 | time(&now); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | if (m_lastPing < now) |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | { |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | if (m_state == RCON_CONNECTING) |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | { |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
108 | sendHello(); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | else if (m_state == RCON_AUTHENTICATING) |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | { |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
112 | sendPassword(); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | else if (m_state == RCON_CONNECTED and m_lastPing + 5 < now) |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | { |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
116 | send({CLRC_PONG}); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
117 | bumpLastPing(); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | |
198
54d64e5a4204
reduce delta with protocol5
Teemu Piippo <teemu@hecknology.net>
parents:
191
diff
changeset
|
121 | // Check for new packets in our socket |
189
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
122 | std::stringstream errors; |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
123 | for (net::Datagram datagram; m_socket.read(datagram, errors);) |
168
96ffd13c08a2
Reduce delta to protocol5 branch by importing the change to RCONSessoin::handlePacket's signature
Teemu Piippo <teemu@compsta2.com>
parents:
163
diff
changeset
|
124 | { |
189
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
125 | if (errors.tellp() > 0) |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
126 | { |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
127 | m_interface->printError("Network error: %s\n", errors.str().data()); |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
128 | errors = {}; |
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
129 | } |
168
96ffd13c08a2
Reduce delta to protocol5 branch by importing the change to RCONSessoin::handlePacket's signature
Teemu Piippo <teemu@compsta2.com>
parents:
163
diff
changeset
|
130 | // Only process packets that originate from the game server. |
96ffd13c08a2
Reduce delta to protocol5 branch by importing the change to RCONSessoin::handlePacket's signature
Teemu Piippo <teemu@compsta2.com>
parents:
163
diff
changeset
|
131 | if (datagram.address == m_address) |
96ffd13c08a2
Reduce delta to protocol5 branch by importing the change to RCONSessoin::handlePacket's signature
Teemu Piippo <teemu@compsta2.com>
parents:
163
diff
changeset
|
132 | handlePacket(datagram.message); |
96ffd13c08a2
Reduce delta to protocol5 branch by importing the change to RCONSessoin::handlePacket's signature
Teemu Piippo <teemu@compsta2.com>
parents:
163
diff
changeset
|
133 | } |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | // |
191
2e6cbacafdc7
various little touchups
Teemu Piippo <teemu@hecknology.net>
parents:
190
diff
changeset
|
138 | void RCONSession::handlePacket(std::vector<unsigned char>& message) |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | { |
168
96ffd13c08a2
Reduce delta to protocol5 branch by importing the change to RCONSessoin::handlePacket's signature
Teemu Piippo <teemu@compsta2.com>
parents:
163
diff
changeset
|
140 | Bytestream stream(message); |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
141 | |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
142 | try |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
143 | { |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
144 | while (stream.bytesLeft() > 0) |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | { |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
146 | int header = stream.readByte(); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
147 | |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
148 | switch (ServerResponse(header)) |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
149 | { |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
150 | case SVRC_OLDPROTOCOL: |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
151 | m_interface->printError("Your RCON client is using outdated protocol.\n"); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
152 | m_state = RCON_DISCONNECTED; |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
153 | break; |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
155 | case SVRC_BANNED: |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
156 | m_interface->printError("You have been banned from the server.\n"); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
157 | m_state = RCON_DISCONNECTED; |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
158 | break; |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
160 | case SVRC_SALT: |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
161 | m_salt = stream.readString(); |
32
ee770597a281
- added support for in-game colors
Teemu Piippo <crimsondusk64@gmail.com>
parents:
31
diff
changeset
|
162 | m_state = RCON_AUTHENTICATING; |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
163 | sendPassword(); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
164 | break; |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
166 | case SVRC_INVALIDPASSWORD: |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
167 | m_interface->printError("Login failed.\n"); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
168 | m_state = RCON_DISCONNECTED; |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
169 | break; |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
171 | case SVRC_MESSAGE: |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
172 | { |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
173 | std::string message = stream.readString(); |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
174 | normalize(message); |
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
175 | m_interface->printText("%s\n", message.data()); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
176 | } |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
177 | break; |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
179 | case SVRC_LOGGEDIN: |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
180 | m_interface->print("Login successful!\n"); |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
181 | m_serverProtocol = stream.readByte(); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
182 | m_hostname = stream.readString(); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
183 | m_interface->setTitle(m_hostname); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
184 | m_state = RCON_CONNECTED; |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
185 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
186 | for (int i = stream.readByte(); i > 0; --i) |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
187 | processServerUpdates(stream); |
12
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
188 | |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
189 | m_interface->print("Previous messages:\n"); |
31
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
190 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
191 | for (int i = stream.readByte(); i > 0; --i) |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
192 | { |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
193 | std::string message = stream.readString(); |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
194 | normalize(message); |
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
195 | m_interface->printText("--- %s\n", message.data()); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
196 | } |
31
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
197 | |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
198 | m_interface->print("End of previous messages.\n"); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
199 | break; |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
200 | |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
201 | case SVRC_UPDATE: |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
202 | processServerUpdates(stream); |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
203 | break; |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
204 | |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
205 | case SVRC_TOOMANYTABCOMPLETES: |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
206 | { |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
207 | unsigned int numCompletions = stream.readShort(); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
208 | m_interface->print("%d completions for '%s'.\n", |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
209 | int(numCompletions), m_lastTabComplete.data()); |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
210 | } |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
211 | break; |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
212 | |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
213 | case SVRC_TABCOMPLETE: |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
214 | { |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
215 | std::vector<std::string> completes; |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
216 | completes.resize(stream.readByte()); |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
217 | |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
218 | for (std::string& completion : completes) |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
219 | completion = stream.readString(); |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
220 | |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
221 | if (completes.size() == 1) |
72 | 222 | { |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
223 | m_interface->tabComplete(m_lastTabComplete, completes[0]); |
72 | 224 | } |
179
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
168
diff
changeset
|
225 | else if (completes.size() > 0) |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
226 | { |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
227 | m_interface->print("Completions for '%s':\n", m_lastTabComplete.data()); |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
228 | |
185
e83ec58cc458
removed the Range class too
Teemu Piippo <teemu@hecknology.net>
parents:
183
diff
changeset
|
229 | for (std::size_t i = 0; i < completes.size(); i += 8) |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
230 | { |
185
e83ec58cc458
removed the Range class too
Teemu Piippo <teemu@hecknology.net>
parents:
183
diff
changeset
|
231 | const int end = min(i + 8, completes.size()); |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
232 | std::vector<std::string> splices = splice(completes, i, end); |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
233 | m_interface->print("- %s\n", join_string_list(splices, ", ").data()); |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
234 | } |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
235 | } |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
236 | } |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
237 | break; |
12
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
238 | } |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | } |
13
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
240 | } |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
241 | catch (std::exception& e) |
09dcaeaa216b
- to hell with that 'ok' field. now throws an exception if attempts to read past the end
Teemu Piippo <crimsondusk64@gmail.com>
parents:
12
diff
changeset
|
242 | { |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
243 | m_interface->printWarning("Couldn't process packet: %s\n", e.what()); |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
244 | m_interface->printWarning("Packet contents was: %s\n", quote(message).data()); |
163
5948441a1951
Added the ByteArray::quote() method to return a string representation of the byte array, and used it to print out the contents of unparseable packets.
Teemu Piippo <teemu@compsta2.com>
parents:
158
diff
changeset
|
245 | m_interface->printWarning("Stream position in payload was: %d\n", stream.position()); |
12
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
246 | } |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
247 | } |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
248 | |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
249 | void RCONSession::processServerUpdates(Bytestream& packet) |
12
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
250 | { |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
251 | int header = packet.readByte(); |
70 | 252 | |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
253 | switch (RCONUpdateType(header)) |
12
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
254 | { |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
255 | case SVRCU_PLAYERDATA: |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
256 | { |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
257 | std::vector<std::string> players; |
47 | 258 | |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
259 | for (int i = packet.readByte(); i > 0; --i) |
179
7fc34735178e
start cleaning up unused code
Teemu Piippo <teemu@hecknology.net>
parents:
168
diff
changeset
|
260 | players.push_back(packet.readString()); |
47 | 261 | |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
262 | m_interface->setPlayerNames(players); |
12
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
263 | } |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
264 | break; |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
265 | |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
266 | case SVRCU_ADMINCOUNT: |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
267 | m_adminCount = packet.readByte(); |
138
c909c38ca886
Restyled Interface's public method names
Teemu Piippo <teemu@compsta2.com>
parents:
137
diff
changeset
|
268 | m_interface->updateStatusBar(); |
12
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
269 | break; |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
270 | |
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
271 | case SVRCU_MAP: |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
272 | m_level = packet.readString(); |
138
c909c38ca886
Restyled Interface's public method names
Teemu Piippo <teemu@compsta2.com>
parents:
137
diff
changeset
|
273 | m_interface->updateStatusBar(); |
12
8d0d1b368de0
- rcon session now works! woo!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
274 | break; |
70 | 275 | |
276 | default: | |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
277 | m_interface->printWarning("Unknown server update type: %d\n", header); |
70 | 278 | break; |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
279 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
280 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
281 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
282 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
283 | // |
189
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
284 | net::UDPSocket* RCONSession::getSocket() |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
285 | { |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | return &m_socket; |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
287 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
288 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
289 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
290 | // |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
291 | void RCONSession::sendHello() |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | { |
186
9330b93d9946
cleanup ip address code
Teemu Piippo <teemu@hecknology.net>
parents:
185
diff
changeset
|
293 | m_interface->print("Connecting to %s...\n", net::ip_address_to_string(m_address).data()); |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
294 | send({CLRC_BEGINCONNECTION, RCON_PROTOCOL_VERSION}); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
295 | bumpLastPing(); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
296 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
297 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
298 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
299 | // |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
300 | void RCONSession::sendPassword() |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | { |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
302 | m_interface->print("Authenticating...\n"); |
191
2e6cbacafdc7
various little touchups
Teemu Piippo <teemu@hecknology.net>
parents:
190
diff
changeset
|
303 | std::vector<unsigned char> message; |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
304 | Bytestream stream(message); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
305 | stream.writeByte(CLRC_PASSWORD); |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
306 | stream.writeString(md5((m_salt + m_password).data())); |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
307 | send(message); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
308 | bumpLastPing(); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
309 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
310 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
311 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
312 | // |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
313 | void RCONSession::setPassword(const std::string& password) |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
314 | { |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
315 | m_password = password; |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
316 | } |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
317 | |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | // ------------------------------------------------------------------------------------------------- |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
319 | // |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
320 | void RCONSession::bumpLastPing() |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
321 | { |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
322 | time_t now; |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
323 | time(&now); |
10
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
324 | m_lastPing = now; |
3874575d924d
- begin work on rcon sessions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
325 | } |
14
33b8f428bacb
- begin work on interface - input line works for the most part :)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
13
diff
changeset
|
326 | |
33b8f428bacb
- begin work on interface - input line works for the most part :)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
13
diff
changeset
|
327 | // ------------------------------------------------------------------------------------------------- |
33b8f428bacb
- begin work on interface - input line works for the most part :)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
13
diff
changeset
|
328 | // |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
329 | bool RCONSession::isActive() const |
31
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
330 | { |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
331 | return getState() != RCON_DISCONNECTED; |
31
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
332 | } |
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
333 | |
b5b5a6a96d91
- added input history (use up/down to navigate)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
334 | // ------------------------------------------------------------------------------------------------- |
17
50341dec533e
- added command sending
Teemu Piippo <crimsondusk64@gmail.com>
parents:
15
diff
changeset
|
335 | // Returns true if the message was successfully sent. |
50341dec533e
- added command sending
Teemu Piippo <crimsondusk64@gmail.com>
parents:
15
diff
changeset
|
336 | // |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
337 | bool RCONSession::sendCommand(const std::string& commandString) |
17
50341dec533e
- added command sending
Teemu Piippo <crimsondusk64@gmail.com>
parents:
15
diff
changeset
|
338 | { |
182
20ca0a6be175
removed the String class in favor of std::string
Teemu Piippo <teemu@hecknology.net>
parents:
180
diff
changeset
|
339 | if (m_state != RCON_CONNECTED or commandString.empty()) |
17
50341dec533e
- added command sending
Teemu Piippo <crimsondusk64@gmail.com>
parents:
15
diff
changeset
|
340 | return false; |
50341dec533e
- added command sending
Teemu Piippo <crimsondusk64@gmail.com>
parents:
15
diff
changeset
|
341 | |
191
2e6cbacafdc7
various little touchups
Teemu Piippo <teemu@hecknology.net>
parents:
190
diff
changeset
|
342 | std::vector<unsigned char> message; |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
343 | Bytestream stream(message); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
344 | stream.writeByte(CLRC_COMMAND); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
345 | stream.writeString(commandString); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
346 | send(message); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
347 | bumpLastPing(); |
17
50341dec533e
- added command sending
Teemu Piippo <crimsondusk64@gmail.com>
parents:
15
diff
changeset
|
348 | return true; |
50341dec533e
- added command sending
Teemu Piippo <crimsondusk64@gmail.com>
parents:
15
diff
changeset
|
349 | } |
24
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
350 | |
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
351 | // ------------------------------------------------------------------------------------------------- |
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
352 | // |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
353 | RCONSessionState RCONSession::getState() const |
24
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
354 | { |
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
355 | return m_state; |
e651d02802c0
- the interface is now able to connect to arbitrary hosts (uses ^N to start the prompt) instead of the hardcoded localhost:10666
Teemu Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
356 | } |
27
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
357 | |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
358 | // ------------------------------------------------------------------------------------------------- |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
359 | // |
186
9330b93d9946
cleanup ip address code
Teemu Piippo <teemu@hecknology.net>
parents:
185
diff
changeset
|
360 | const net::ip_address& RCONSession::address() const |
27
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
361 | { |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
362 | return m_address; |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
363 | } |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
364 | |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
365 | // ------------------------------------------------------------------------------------------------- |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
366 | // |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
367 | int RCONSession::getAdminCount() const |
27
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
368 | { |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
369 | return m_adminCount; |
27
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
370 | } |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
371 | |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
372 | // ------------------------------------------------------------------------------------------------- |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
373 | // |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
374 | const std::string& RCONSession::getLevel() const |
27
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
375 | { |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
376 | return m_level; |
089e37c0887e
- now exits cleanly with ^Q!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
377 | } |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
378 | |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
379 | // ------------------------------------------------------------------------------------------------- |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
380 | // |
183
9b6a0daedfc0
renamed String and StringList uses
Teemu Piippo <teemu@hecknology.net>
parents:
182
diff
changeset
|
381 | void RCONSession::requestTabCompletion(const std::string& part) |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
382 | { |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
383 | if (m_serverProtocol >= 4) |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
384 | { |
191
2e6cbacafdc7
various little touchups
Teemu Piippo <teemu@hecknology.net>
parents:
190
diff
changeset
|
385 | std::vector<unsigned char> message; |
157
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
386 | Bytestream stream(message); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
387 | stream.writeByte(CLRC_TABCOMPLETE); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
388 | stream.writeString(part); |
42bb29924218
Bytestream now behaves more like a cursor. It does not store the data anymore, rather it leaves the user to specify a vector to use for storage.
Teemu Piippo <teemu@compsta2.com>
parents:
156
diff
changeset
|
389 | send(message); |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
390 | bumpLastPing(); |
41
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
391 | m_lastTabComplete = part; |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
392 | } |
9ab869656b9e
- re-commit tab-complete
Teemu Piippo <crimsondusk64@gmail.com>
parents:
40
diff
changeset
|
393 | else |
83
08bfc3d9d2ae
Removed format.cpp and format.h, use built-in formatting instead
Teemu Piippo <crimsondusk64@gmail.com>
parents:
81
diff
changeset
|
394 | { |
189
248d0b85cbda
various changes, better network error handling
Teemu Piippo <teemu@hecknology.net>
parents:
186
diff
changeset
|
395 | m_interface->print("This server does not support tab-completion\n"); |
83
08bfc3d9d2ae
Removed format.cpp and format.h, use built-in formatting instead
Teemu Piippo <crimsondusk64@gmail.com>
parents:
81
diff
changeset
|
396 | } |
88
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
83
diff
changeset
|
397 | } |
08ccaf26cffd
Now works with MSVC 2010/pdcurses-win32a
Teemu Piippo <tsapii@utu.fi>
parents:
83
diff
changeset
|
398 | |
92 | 399 | // ------------------------------------------------------------------------------------------------- |
400 | // | |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
401 | void RCONSession::setInterface(Interface* interface) |
92 | 402 | { |
156
ce66d7e374bf
Restyled RCONSession method names and paren style
Teemu Piippo <teemu@compsta2.com>
parents:
152
diff
changeset
|
403 | m_interface = interface; |
92 | 404 | } |
405 | ||
105
b4466472aecd
Added some basic IRC-like commands that can be used to do what keystrokes can do without actually using keystrokes
Teemu Piippo <crimsondusk64@gmail.com>
parents:
96
diff
changeset
|
406 | END_ZFC_NAMESPACE |