From f85af28663814f3262f5ecfcd20a4b4f67c23067 Mon Sep 17 00:00:00 2001 From: skyhusker Date: Wed, 26 Jan 2005 22:45:53 +0000 Subject: * Created new class for IRCChannelPerson. * Added whois, ping and version entries to channel popup menu. * Fixed action on CTCP PING reply (was interpreted as a request). --- (limited to 'noncore/net/opieirc/ircconnection.cpp') 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,5 +1,9 @@ #include #include + +#include +#include + #include "ircconnection.h" IRCConnection::IRCConnection(IRCServer *server) { @@ -28,8 +32,23 @@ void IRCConnection::sendLine(QString line) { m_socket->writeBlock(line, line.length()); } -void IRCConnection::sendCTCP(QString nick, QString line) { - sendLine("NOTICE " + nick + " :\001"+line+"\001"); +void IRCConnection::sendCTCPReply(const QString &nickname, const QString &type, const QString &args) { + sendLine("NOTICE " + nickname + " :\001" + type + " " + args + "\001"); +} + +void IRCConnection::sendCTCPRequest(const QString &nickname, const QString &type, const QString &args) { + sendLine("PRIVMSG " + nickname + " :\001" + type + " " + args + "\001"); +} + +void IRCConnection::sendCTCPPing(const QString &nickname) { + QDateTime tm; + tm.setTime_t(0); + QString strtime = QString::number(tm.secsTo(QDateTime::currentDateTime())); + sendCTCPRequest(nickname, "PING", strtime); +} + +void IRCConnection::whois(const QString &nickname) { + sendLine("WHOIS " + nickname); } /* @@ -100,3 +119,4 @@ void IRCConnection::close() { disconnect(); } } + -- cgit v0.9.0.2