Mercurial > cabal
comparison sources/connection.cpp @ 6:9be05a31b7f9
Enqlave IRC Network => Vaygr IRC Network
-Os optimizations by default
temporary functions' arguments rename
*char => NULL
bool => true|false
renamed some global vars, removed debug info
| author | Vlad Glagolev <enqlave@gmail.com> |
|---|---|
| date | Sun, 27 Jan 2008 17:23:14 +0300 |
| parents | 0faceb076254 |
| children | 8d54d9fdeca3 |
comparison
equal
deleted
inserted
replaced
| 5:0faceb076254 | 6:9be05a31b7f9 |
|---|---|
| 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.hpp |
| 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), |
| 28 chan(CHANNEL), | 28 chan(CHANNEL), |
| 29 key(CHANNEL_KEY) | 29 key(CHANNEL_KEY) |
| 30 { | 30 { |
| 31 hosts = current = 0; | 31 hosts = current = NULL; |
| 32 | 32 |
| 33 now = CABAL->now; | 33 now = CABAL->now; |
| 34 | 34 |
| 35 uptime = 0; | 35 uptime = 0; |
| 36 | 36 |
| 94 | 94 |
| 95 delete DATA; | 95 delete DATA; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 void Connection::ircPass(string pass) | 99 void Connection::ircPass(string p) |
| 100 { | 100 { |
| 101 sendMsg("PASS " + pass); | 101 sendMsg("PASS " + p); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void Connection::ircNick(string nnick) | 104 void Connection::ircNick(string n) |
| 105 { | 105 { |
| 106 sendMsg("NICK " + (nnick != "" ? nnick : NICK)); | 106 sendMsg("NICK " + (n != "" ? n: NICK)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void Connection::ircUser(string nuser, string nname) | 109 void Connection::ircUser(string u, string n) |
| 110 { | 110 { |
| 111 sendMsg("USER " + nuser + (virtualhost != 0 ? " " + (string)virtualhost + \ | 111 sendMsg("USER " + u + (virtualhost ? " " + (string)virtualhost + " ": \ |
| 112 " " : " 0 ") + (string)current->host + " :" + nname); | 112 " 0 ") + (string)current->host + " :" + n); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void Connection::ircAway(string away) | 115 void Connection::ircAway(string m) |
| 116 { | 116 { |
| 117 sendMsg("AWAY :" + away); | 117 sendMsg("AWAY :" + m); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void Connection::ircJoin(string chan, string key) | 120 void Connection::ircJoin(string c, string k) |
| 121 { | 121 { |
| 122 sendMsg("JOIN " + chan + (key != "" ? " " + key : "")); | 122 sendMsg("JOIN " + c + (k != "" ? " " + k: "")); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void Connection::ircPart(string chan) | 125 void Connection::ircPart(string c) |
| 126 { | 126 { |
| 127 sendMsg("PART " + chan); | 127 sendMsg("PART " + c); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void Connection::ircCycle(string chan) | 130 void Connection::ircCycle(string c) |
| 131 { | 131 { |
| 132 sendMsg("PART " + chan); | 132 sendMsg("PART " + c); |
| 133 sendMsg("JOIN " + chan); | 133 sendMsg("JOIN " + c); |
| 134 } | 134 } |
| 135 | 135 |
| 136 Connection::host_type *Connection::addHost(host_type *list, pchar host, \ | 136 Connection::host_type *Connection::addHost(host_type *list, pchar host, \ |
| 137 int port, pchar password) | 137 int port, pchar password) |
| 138 { | 138 { |
