comparison sources/connection.cpp @ 4:a7051ac7118b

added primary parser implementation renamed some functions to well-formed format bool => false, pointers => NULL removed useless eTime()
author Vlad Glagolev <enqlave@gmail.com>
date Thu, 24 Jan 2008 19:38:34 +0300
parents 19227b0b7cc1
children 0faceb076254
comparison
equal deleted inserted replaced
3:cd60300cae0b 4:a7051ac7118b
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */ 20 */
21 21
22 #include "cabal.hpp" // required: core.h 22 #include "cabal.hpp" // required: core.h
23 23
24 Connection::Connection(): 24 Connection::Connection():
25 nick(NICK), 25 nick(NICK),
26 user(USER), 26 user(USER),
27 name(NAME), 27 name(NAME),
48 shut ("no hosts defined"); 48 shut ("no hosts defined");
49 49
50 if (!connected && !connecting) { 50 if (!connected && !connecting) {
51 cout << "CONNECTION: connecting to server: " << current->host << endl; 51 cout << "CONNECTION: connecting to server: " << current->host << endl;
52 52
53 if (!hostResolve (current->host, &address)) { 53 if (!resolveHost(current->host, &address)) {
54 cout << "Error: unable to resolve host " << current->host << endl; 54 cout << "Error: unable to resolve host " << current->host << endl;
55 55
56 current = current->next; 56 current = current->next;
57 } else if (!tcpActivate (current->port, virtualhost)) { 57 } else if (!activateTCP(current->port, virtualhost)) {
58 cout << "Error: unable to open socket\n"; 58 cout << "Error: unable to open socket\n";
59 59
60 return; 60 return;
61 } 61 }
62 } 62 }
63 63
64 if (!hostOpen()) 64 if (!openHost())
65 current = current->next; 65 current = current->next;
66 66
67 if (!connected) 67 if (!connected)
68 return; 68 return;
69 69
88 string buffer = receiveMsg(); 88 string buffer = receiveMsg();
89 89
90 if (buffer != "") { 90 if (buffer != "") {
91 Parser *DATA = new Parser(this, buffer); 91 Parser *DATA = new Parser(this, buffer);
92 92
93 DATA->Parse (this); 93 DATA->Parse(this);
94 94
95 delete DATA; 95 delete DATA;
96 } 96 }
97 } 97 }
98 98