summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/irc/libkirc/kircengine_ctcp.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/irc/libkirc/kircengine_ctcp.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz
tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/irc/libkirc/kircengine_ctcp.cpp')
-rw-r--r--kopete/protocols/irc/libkirc/kircengine_ctcp.cpp134
1 files changed, 67 insertions, 67 deletions
diff --git a/kopete/protocols/irc/libkirc/kircengine_ctcp.cpp b/kopete/protocols/irc/libkirc/kircengine_ctcp.cpp
index db1903f3..7216dea7 100644
--- a/kopete/protocols/irc/libkirc/kircengine_ctcp.cpp
+++ b/kopete/protocols/irc/libkirc/kircengine_ctcp.cpp
@@ -28,37 +28,37 @@
#include <arpa/inet.h>
#include <kextsock.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
using namespace KIRC;
void Engine::bindCtcp()
{
- bindCtcpQuery("ACTION", this, SLOT(CtcpQuery_action(KIRC::Message &)),
+ bindCtcpQuery("ACTION", this, TQT_SLOT(CtcpQuery_action(KIRC::Message &)),
-1, -1);
- bindCtcpQuery("CLIENTINFO", this, SLOT(CtcpQuery_clientinfo(KIRC::Message &)),
+ bindCtcpQuery("CLIENTINFO", this, TQT_SLOT(CtcpQuery_clientinfo(KIRC::Message &)),
-1, 1);
- bindCtcpQuery("DCC", this, SLOT(CtcpQuery_dcc(KIRC::Message &)),
+ bindCtcpQuery("DCC", this, TQT_SLOT(CtcpQuery_dcc(KIRC::Message &)),
4, 5);
- bindCtcpQuery("FINGER", this, SLOT(CtcpQuery_finger(KIRC::Message &)),
+ bindCtcpQuery("FINGER", this, TQT_SLOT(CtcpQuery_finger(KIRC::Message &)),
-1, 0);
- bindCtcpQuery("PING", this, SLOT(CtcpQuery_ping(KIRC::Message &)),
+ bindCtcpQuery("PING", this, TQT_SLOT(CtcpQuery_ping(KIRC::Message &)),
1, 1);
- bindCtcpQuery("SOURCE", this, SLOT(CtcpQuery_source(KIRC::Message &)),
+ bindCtcpQuery("SOURCE", this, TQT_SLOT(CtcpQuery_source(KIRC::Message &)),
-1, 0);
- bindCtcpQuery("TIME", this, SLOT(CtcpQuery_time(KIRC::Message &)),
+ bindCtcpQuery("TIME", this, TQT_SLOT(CtcpQuery_time(KIRC::Message &)),
-1, 0);
- bindCtcpQuery("USERINFO", this, SLOT(CtcpQuery_userinfo(KIRC::Message &)),
+ bindCtcpQuery("USERINFO", this, TQT_SLOT(CtcpQuery_userinfo(KIRC::Message &)),
-1, 0);
- bindCtcpQuery("VERSION", this, SLOT(CtcpQuery_version(KIRC::Message &)),
+ bindCtcpQuery("VERSION", this, TQT_SLOT(CtcpQuery_version(KIRC::Message &)),
-1, 0);
- bindCtcpReply("ERRMSG", this, SLOT(CtcpReply_errmsg(KIRC::Message &)),
+ bindCtcpReply("ERRMSG", this, TQT_SLOT(CtcpReply_errmsg(KIRC::Message &)),
1, -1);
- bindCtcpReply("PING", this, SLOT(CtcpReply_ping(KIRC::Message &)),
+ bindCtcpReply("PING", this, TQT_SLOT(CtcpReply_ping(KIRC::Message &)),
1, 1, "");
- bindCtcpReply("VERSION", this, SLOT(CtcpReply_version(KIRC::Message &)),
+ bindCtcpReply("VERSION", this, TQT_SLOT(CtcpReply_version(KIRC::Message &)),
-1, -1, "");
}
@@ -68,20 +68,20 @@ void Engine::bindCtcp()
// CtcpReply_* (if any)
/* Generic ctcp commnd for the /ctcp trigger */
-void Engine::CtcpRequestCommand(const QString &contact, const QString &command)
+void Engine::CtcpRequestCommand(const TQString &contact, const TQString &command)
{
if(m_status == Connected)
{
- writeCtcpQueryMessage(contact, QString::null, command);
+ writeCtcpQueryMessage(contact, TQString::null, command);
// emit ctcpCommandMessage( contact, command );
}
}
-void Engine::CtcpRequest_action(const QString &contact, const QString &message)
+void Engine::CtcpRequest_action(const TQString &contact, const TQString &message)
{
if(m_status == Connected)
{
- writeCtcpQueryMessage(contact, QString::null, "ACTION", message);
+ writeCtcpQueryMessage(contact, TQString::null, "ACTION", message);
if( Entity::isChannel(contact) )
emit incomingAction(Kopete::Message::unescape(contact), Kopete::Message::unescape(m_Nickname), message);
@@ -92,7 +92,7 @@ void Engine::CtcpRequest_action(const QString &contact, const QString &message)
void Engine::CtcpQuery_action(Message &msg)
{
- QString target = msg.arg(0);
+ TQString target = msg.arg(0);
if (target[0] == '#' || target[0] == '!' || target[0] == '&')
emit incomingAction(target, msg.nickFromPrefix(), msg.ctcpMessage().ctcpRaw());
else
@@ -109,18 +109,18 @@ bool Engine::CtcpReply_action(Message &msg)
// FIXME: the API can now answer to help commands.
void Engine::CtcpQuery_clientinfo(Message &msg)
{
- QString clientinfo = customCtcpMap[ QString::fromLatin1("clientinfo") ];
+ TQString clientinfo = customCtcpMap[ TQString::fromLatin1("clientinfo") ];
if (clientinfo.isNull())
- clientinfo = QString::fromLatin1("The following commands are supported, but "
+ clientinfo = TQString::fromLatin1("The following commands are supported, but "
"without sub-command help: VERSION, CLIENTINFO, USERINFO, TIME, SOURCE, PING,"
"ACTION.");
- writeCtcpReplyMessage( msg.nickFromPrefix(), QString::null,
- msg.ctcpMessage().command(), QString::null, clientinfo);
+ writeCtcpReplyMessage( msg.nickFromPrefix(), TQString::null,
+ msg.ctcpMessage().command(), TQString::null, clientinfo);
}
-void Engine::CtcpRequest_dcc(const QString &nickname, const QString &fileName, uint port, Transfer::Type type)
+void Engine::CtcpRequest_dcc(const TQString &nickname, const TQString &fileName, uint port, Transfer::Type type)
{
if( m_status != Connected ||
m_sock->localAddress() == 0 ||
@@ -131,32 +131,32 @@ void Engine::CtcpRequest_dcc(const QString &nickname, const QString &fileName, u
{
case Transfer::Chat:
{
- writeCtcpQueryMessage(nickname, QString::null,
- QString::fromLatin1("DCC"),
- QStringList(QString::fromLatin1("CHAT")) << QString::fromLatin1("chat") <<
- m_sock->localAddress()->nodeName() << QString::number(port)
+ writeCtcpQueryMessage(nickname, TQString::null,
+ TQString::fromLatin1("DCC"),
+ TQStringList(TQString::fromLatin1("CHAT")) << TQString::fromLatin1("chat") <<
+ m_sock->localAddress()->nodeName() << TQString::number(port)
);
break;
}
case Transfer::FileOutgoing:
{
- QFileInfo file(fileName);
- QString noWhiteSpace = file.fileName();
+ TQFileInfo file(fileName);
+ TQString noWhiteSpace = file.fileName();
if (noWhiteSpace.contains(' ') > 0)
- noWhiteSpace.replace(QRegExp("\\s+"), "_");
+ noWhiteSpace.replace(TQRegExp("\\s+"), "_");
TransferServer *server = TransferHandler::self()->createServer(this, nickname, type, fileName, file.size());
- QString ip = m_sock->localAddress()->nodeName();
- QString ipNumber = QString::number( ntohl( inet_addr( ip.latin1() ) ) );
+ TQString ip = m_sock->localAddress()->nodeName();
+ TQString ipNumber = TQString::number( ntohl( inet_addr( ip.latin1() ) ) );
kdDebug(14120) << "Starting DCC file outgoing transfer." << endl;
- writeCtcpQueryMessage(nickname, QString::null,
- QString::fromLatin1("DCC"),
- QStringList(QString::fromLatin1("SEND")) << noWhiteSpace << ipNumber <<
- QString::number(server->port()) << QString::number(file.size())
+ writeCtcpQueryMessage(nickname, TQString::null,
+ TQString::fromLatin1("DCC"),
+ TQStringList(TQString::fromLatin1("SEND")) << noWhiteSpace << ipNumber <<
+ TQString::number(server->port()) << TQString::number(file.size())
);
break;
}
@@ -171,9 +171,9 @@ void Engine::CtcpRequest_dcc(const QString &nickname, const QString &fileName, u
void Engine::CtcpQuery_dcc(Message &msg)
{
Message &ctcpMsg = msg.ctcpMessage();
- QString dccCommand = ctcpMsg.arg(0).upper();
+ TQString dccCommand = ctcpMsg.arg(0).upper();
- if (dccCommand == QString::fromLatin1("CHAT"))
+ if (dccCommand == TQString::fromLatin1("CHAT"))
{
// if(ctcpMsg.argsSize()!=4) return false;
@@ -185,7 +185,7 @@ void Engine::CtcpQuery_dcc(Message &msg)
*/
bool okayHost, okayPort;
// should ctctMsg.arg(1) be tested?
- QHostAddress address(ctcpMsg.arg(2).toUInt(&okayHost));
+ TQHostAddress address(ctcpMsg.arg(2).toUInt(&okayHost));
unsigned int port = ctcpMsg.arg(3).toUInt(&okayPort);
if (okayHost && okayPort)
{
@@ -196,7 +196,7 @@ void Engine::CtcpQuery_dcc(Message &msg)
Transfer::Chat );
}
}
- else if (dccCommand == QString::fromLatin1("SEND"))
+ else if (dccCommand == TQString::fromLatin1("SEND"))
{
// if(ctcpMsg.argsSize()!=5) return false;
@@ -208,8 +208,8 @@ void Engine::CtcpQuery_dcc(Message &msg)
* filesize = Size of file being sent
*/
bool okayHost, okayPort, okaySize;
-// QFileInfo realfile(msg.arg(1));
- QHostAddress address(ctcpMsg.arg(2).toUInt(&okayHost));
+// TQFileInfo realfile(msg.arg(1));
+ TQHostAddress address(ctcpMsg.arg(2).toUInt(&okayHost));
unsigned int port = ctcpMsg.arg(3).toUInt(&okayPort);
unsigned int size = ctcpMsg.arg(4).toUInt(&okaySize);
if (okayHost && okayPort && okaySize)
@@ -243,21 +243,21 @@ void Engine::CtcpQuery_finger( Message &)
// To be implemented
}
-void Engine::CtcpRequest_ping(const QString &target)
+void Engine::CtcpRequest_ping(const TQString &target)
{
kdDebug(14120) << k_funcinfo << endl;
timeval time;
if (gettimeofday(&time, 0) == 0)
{
- QString timeReply;
+ TQString timeReply;
if( Entity::isChannel(target) )
- timeReply = QString::fromLatin1("%1.%2").arg(time.tv_sec).arg(time.tv_usec);
+ timeReply = TQString::fromLatin1("%1.%2").arg(time.tv_sec).arg(time.tv_usec);
else
- timeReply = QString::number( time.tv_sec );
+ timeReply = TQString::number( time.tv_sec );
- writeCtcpQueryMessage( target, QString::null, "PING", timeReply);
+ writeCtcpQueryMessage( target, TQString::null, "PING", timeReply);
}
// else
// ((MessageRedirector *)sender())->error("failed to get current time");
@@ -265,7 +265,7 @@ void Engine::CtcpRequest_ping(const QString &target)
void Engine::CtcpQuery_ping(Message &msg)
{
- writeCtcpReplyMessage( msg.nickFromPrefix(), QString::null,
+ writeCtcpReplyMessage( msg.nickFromPrefix(), TQString::null,
msg.ctcpMessage().command(), msg.ctcpMessage().arg(0));
}
@@ -275,30 +275,30 @@ void Engine::CtcpReply_ping(Message &msg)
if (gettimeofday(&time, 0) == 0)
{
// FIXME: the time code is wrong for usec
- QString timeReply = QString::fromLatin1("%1.%2").arg(time.tv_sec).arg(time.tv_usec);
+ TQString timeReply = TQString::fromLatin1("%1.%2").arg(time.tv_sec).arg(time.tv_usec);
double newTime = timeReply.toDouble();
double oldTime = msg.suffix().section(' ',0, 0).toDouble();
double difference = newTime - oldTime;
- QString diffString;
+ TQString diffString;
if (difference < 1)
{
- diffString = QString::number(difference);
+ diffString = TQString::number(difference);
diffString.remove((diffString.find('.') -1), 2);
diffString.truncate(3);
diffString.append("milliseconds");
}
else
{
- diffString = QString::number(difference);
- QString seconds = diffString.section('.', 0, 0);
- QString millSec = diffString.section('.', 1, 1);
+ diffString = TQString::number(difference);
+ TQString seconds = diffString.section('.', 0, 0);
+ TQString millSec = diffString.section('.', 1, 1);
millSec.remove(millSec.find('.'), 1);
millSec.truncate(3);
- diffString = QString::fromLatin1("%1 seconds, %2 milliseconds").arg(seconds).arg(millSec);
+ diffString = TQString::fromLatin1("%1 seconds, %2 milliseconds").arg(seconds).arg(millSec);
}
- emit incomingCtcpReply(QString::fromLatin1("PING"), msg.nickFromPrefix(), diffString);
+ emit incomingCtcpReply(TQString::fromLatin1("PING"), msg.nickFromPrefix(), diffString);
}
// else
// ((MessageRedirector *)sender())->error("failed to get current time");
@@ -306,36 +306,36 @@ void Engine::CtcpReply_ping(Message &msg)
void Engine::CtcpQuery_source(Message &msg)
{
- writeCtcpReplyMessage(msg.nickFromPrefix(), QString::null,
+ writeCtcpReplyMessage(msg.nickFromPrefix(), TQString::null,
msg.ctcpMessage().command(), m_SourceString);
}
void Engine::CtcpQuery_time(Message &msg)
{
- writeCtcpReplyMessage(msg.nickFromPrefix(), QString::null,
- msg.ctcpMessage().command(), QDateTime::currentDateTime().toString(),
- QString::null, false);
+ writeCtcpReplyMessage(msg.nickFromPrefix(), TQString::null,
+ msg.ctcpMessage().command(), TQDateTime::currentDateTime().toString(),
+ TQString::null, false);
}
void Engine::CtcpQuery_userinfo(Message &msg)
{
- QString userinfo = customCtcpMap[ QString::fromLatin1("userinfo") ];
+ TQString userinfo = customCtcpMap[ TQString::fromLatin1("userinfo") ];
if (userinfo.isNull())
userinfo = m_UserString;
- writeCtcpReplyMessage(msg.nickFromPrefix(), QString::null,
- msg.ctcpMessage().command(), QString::null, userinfo);
+ writeCtcpReplyMessage(msg.nickFromPrefix(), TQString::null,
+ msg.ctcpMessage().command(), TQString::null, userinfo);
}
-void Engine::CtcpRequest_version(const QString &target)
+void Engine::CtcpRequest_version(const TQString &target)
{
- writeCtcpQueryMessage(target, QString::null, "VERSION");
+ writeCtcpQueryMessage(target, TQString::null, "VERSION");
}
void Engine::CtcpQuery_version(Message &msg)
{
- QString response = customCtcpMap[ QString::fromLatin1("version") ];
+ TQString response = customCtcpMap[ TQString::fromLatin1("version") ];
kdDebug(14120) << "Version check: " << response << endl;
if (response.isNull())