Diffstat (limited to 'noncore/net/opieirc/ircconnection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircconnection.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/noncore/net/opieirc/ircconnection.cpp b/noncore/net/opieirc/ircconnection.cpp index 2325cca..88e63f7 100644 --- a/noncore/net/opieirc/ircconnection.cpp +++ b/noncore/net/opieirc/ircconnection.cpp | |||
@@ -1,6 +1,10 @@ | |||
1 | #include <unistd.h> | 1 | #include <unistd.h> |
2 | #include <string.h> | 2 | #include <string.h> |
3 | |||
4 | #include <qstringlist.h> | ||
5 | #include <qdatetime.h> | ||
6 | |||
3 | #include "ircconnection.h" | 7 | #include "ircconnection.h" |
4 | 8 | ||
5 | IRCConnection::IRCConnection(IRCServer *server) { | 9 | IRCConnection::IRCConnection(IRCServer *server) { |
6 | m_server = server; | 10 | m_server = server; |
@@ -27,10 +31,25 @@ void IRCConnection::sendLine(QString line) { | |||
27 | line.append("\r\n"); | 31 | line.append("\r\n"); |
28 | m_socket->writeBlock(line, line.length()); | 32 | m_socket->writeBlock(line, line.length()); |
29 | } | 33 | } |
30 | 34 | ||
31 | void IRCConnection::sendCTCP(QString nick, QString line) { | 35 | void IRCConnection::sendCTCPReply(const QString &nickname, const QString &type, const QString &args) { |
32 | sendLine("NOTICE " + nick + " :\001"+line+"\001"); | 36 | sendLine("NOTICE " + nickname + " :\001" + type + " " + args + "\001"); |
37 | } | ||
38 | |||
39 | void IRCConnection::sendCTCPRequest(const QString &nickname, const QString &type, const QString &args) { | ||
40 | sendLine("PRIVMSG " + nickname + " :\001" + type + " " + args + "\001"); | ||
41 | } | ||
42 | |||
43 | void IRCConnection::sendCTCPPing(const QString &nickname) { | ||
44 | QDateTime tm; | ||
45 | tm.setTime_t(0); | ||
46 | QString strtime = QString::number(tm.secsTo(QDateTime::currentDateTime())); | ||
47 | sendCTCPRequest(nickname, "PING", strtime); | ||
48 | } | ||
49 | |||
50 | void IRCConnection::whois(const QString &nickname) { | ||
51 | sendLine("WHOIS " + nickname); | ||
33 | } | 52 | } |
34 | 53 | ||
35 | /* | 54 | /* |
36 | * login() is called right after the connection | 55 | * login() is called right after the connection |
@@ -99,4 +118,5 @@ void IRCConnection::close() { | |||
99 | if (m_socket->state()==QSocket::Idle) { | 118 | if (m_socket->state()==QSocket::Idle) { |
100 | disconnect(); | 119 | disconnect(); |
101 | } | 120 | } |
102 | } | 121 | } |
122 | |||