Mercurial > cabal
diff sources/connection.cpp @ 2:19227b0b7cc1
.h => .hpp for the headers
added year 2008 to copyright notes
renamed some functions for better meaning
prepared parser module for rewriting
added showHelp() function
some code clean up
| author | Vlad Glagolev <enqlave@gmail.com> |
|---|---|
| date | Mon, 21 Jan 2008 01:14:10 +0300 |
| parents | bafff9de2a76 |
| children | a7051ac7118b |
line wrap: on
line diff
--- a/sources/connection.cpp Sun Jan 20 19:32:59 2008 +0300 +++ b/sources/connection.cpp Mon Jan 21 01:14:10 2008 +0300 @@ -3,7 +3,7 @@ * * -- CABAL -- connection base (servers usage) * - * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com> + * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com> * All rights reserved. * * Permission to use, copy, modify, and distribute this software for any @@ -19,10 +19,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "cabal.h" // required: core.h +#include "cabal.hpp" // required: core.h -Connection::Connection() - : +Connection::Connection(): nick(NICK), user(USER), name(NAME), @@ -86,10 +85,10 @@ return; } - string buffer = msgReceive(); + string buffer = receiveMsg(); if (buffer != "") { - Parser *DATA = new Parser (this, buffer); + Parser *DATA = new Parser(this, buffer); DATA->Parse (this); @@ -97,52 +96,52 @@ } } -void Connection::ircPass (string pass) +void Connection::ircPass(string pass) { - msgSend ("PASS " + pass); + sendMsg("PASS " + pass); } -void Connection::ircNick (string nnick) +void Connection::ircNick(string nnick) { - msgSend ("NICK " + (nnick != "" ? nnick : NICK)); + sendMsg("NICK " + (nnick != "" ? nnick : NICK)); } -void Connection::ircUser (string nuser, string nname) +void Connection::ircUser(string nuser, string nname) { - msgSend ("USER " + nuser + (virtualhost != 0 ? " " + (string)virtualhost + \ + sendMsg("USER " + nuser + (virtualhost != 0 ? " " + (string)virtualhost + \ " " : " 0 ") + (string)current->host + " :" + nname); } -void Connection::ircAway (string away) +void Connection::ircAway(string away) { - msgSend ("AWAY :" + away); + sendMsg("AWAY :" + away); } -void Connection::ircJoin (string nchan, string nckey) +void Connection::ircJoin(string nchan, string nckey) { - msgSend ("JOIN " + nchan + (nckey != "" ? " " + nckey : "")); + sendMsg("JOIN " + nchan + (nckey != "" ? " " + nckey : "")); } -void Connection::ircPart (string nchan) +void Connection::ircPart(string nchan) { - msgSend ("PART " + nchan); + sendMsg("PART " + nchan); } -void Connection::ircCycle (string nchan) +void Connection::ircCycle(string nchan) { - msgSend ("PART " + nchan); - msgSend ("JOIN " + nchan); + sendMsg("PART " + nchan); + sendMsg("JOIN " + nchan); } Connection::host_type * -Connection::hostAdd (host_type *list, pchar host, int port, pchar password) + Connection::addHost(host_type *list, pchar host, int port, pchar password) { - if (list == 0) - current = list = new host_type (host, port, password); + if (!list) + current = list = new host_type(host, port, password); else if (list->next == current) - list->next = new host_type (host, port, password, current); + list->next = new host_type(host, port, password, current); else - return hostAdd (list->next, host, port, password); + return addHost(list->next, host, port, password); return list; }
