diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-22 00:30:31 +0000 |
commit | 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 (patch) | |
tree | 073fde0496ea90eb5bf5cffe66a8da43a9f55fbc /kopete/protocols/irc/libkirc/kircmessage.cpp | |
parent | 3467e6464beac3a162839bf7078e22e3a74d73e7 (diff) | |
download | tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.tar.gz tdenetwork-69cac65817d949cda2672ec4f0aa73d5e66a0ba1.zip |
TQt4 port kdenetwork
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/irc/libkirc/kircmessage.cpp')
-rw-r--r-- | kopete/protocols/irc/libkirc/kircmessage.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/kopete/protocols/irc/libkirc/kircmessage.cpp b/kopete/protocols/irc/libkirc/kircmessage.cpp index 73a1e53f..0c1d3ef0 100644 --- a/kopete/protocols/irc/libkirc/kircmessage.cpp +++ b/kopete/protocols/irc/libkirc/kircmessage.cpp @@ -34,7 +34,7 @@ TQRegExp Message::m_IRCNumericCommand("^\\d{1,3}$"); // TODO: This regexp parsing is no good. It's slower than it needs to be, and // is not codec-safe since TQString requires a codec. NEed to parse this with -// our own parsing class that operates on the raw QCStrings +// our own parsing class that operates on the raw TQCStrings TQRegExp Message::m_IRCCommandType1( "^(?::([^ ]+) )?([A-Za-z]+|\\d{1,3})((?: [^ :][^ ]*)*) ?(?: :(.*))?$"); // Extra end arg space check -------------------------^ @@ -99,14 +99,14 @@ void Message::writeRawMessage(Engine *engine, const TQTextCodec *codec, const TQ return; } - TQString txt = str + TQString::fromLatin1("\r\n"); + TQString txt = str + TQString::tqfromLatin1("\r\n"); TQCString s(codec->fromUnicode(txt)); kdDebug(14120) << "Message is " << s.length() << " chars" << endl; // FIXME: Should check the amount of data really writen. int wrote = engine->socket()->writeBlock(s.data(), s.length()); - kdDebug(14121) << TQString::fromLatin1("(%1 bytes) >> %2").arg(wrote).arg(str) << endl; + kdDebug(14121) << TQString::tqfromLatin1("(%1 bytes) >> %2").tqarg(wrote).tqarg(str) << endl; } void Message::writeMessage(Engine *engine, const TQTextCodec *codec, const TQString &message) @@ -123,7 +123,7 @@ void Message::writeMessage(Engine *engine, const TQTextCodec *codec, msg += TQChar(' ') + args.join(TQChar(' ')).stripWhiteSpace(); // some extra check should be done here if (!suffix.isNull()) - msg = msg.stripWhiteSpace() + TQString::fromLatin1(" :") + suffix; + msg = msg.stripWhiteSpace() + TQString::tqfromLatin1(" :") + suffix; writeMessage(engine, codec, msg); } @@ -145,7 +145,7 @@ void Message::writeCtcpMessage(Engine *engine, const TQTextCodec *codec, ctcpMsg += TQChar(' ') + ctcpArgs.join(TQChar(' ')).stripWhiteSpace(); // some extra check should be done here if (!ctcpSuffix.isNull()) - ctcpMsg += TQString::fromLatin1(" :") + ctcpSuffix; + ctcpMsg += TQString::tqfromLatin1(" :") + ctcpSuffix; writeMessage(engine, codec, command, to, suffix + TQChar(0x01) + ctcpQuote(ctcpMsg) + TQChar(0x01)); } @@ -158,7 +158,7 @@ Message Message::parse(Engine *engine, const TQTextCodec *codec, bool *parseSucc if (engine->socket()->canReadLine()) { TQCString raw(engine->socket()->bytesAvailable()+1); - Q_LONG length = engine->socket()->readLine(raw.data(), raw.count()); + TQ_LONG length = engine->socket()->readLine(raw.data(), raw.count()); if( length > -1 ) { @@ -169,10 +169,10 @@ Message Message::parse(Engine *engine, const TQTextCodec *codec, bool *parseSucc // Some servers send '\n' instead of '\r\n' that the RFCs say they should be sending. if (length > 1 && raw.at(length-2) == '\n') { - raw.at(length-2) = '\0'; + raw.tqat(length-2) = '\0'; } if (length > 2 && raw.at(length-3) == '\r') { - raw.at(length-3) = '\0'; + raw.tqat(length-3) = '\0'; } kdDebug(14121) << "<< " << raw << endl; @@ -201,10 +201,10 @@ TQString Message::quote(const TQString &str) { TQString tmp = str; TQChar q('\020'); - tmp.replace(q, q+TQString(q)); - tmp.replace(TQChar('\r'), q+TQString::fromLatin1("r")); - tmp.replace(TQChar('\n'), q+TQString::fromLatin1("n")); - tmp.replace(TQChar('\0'), q+TQString::fromLatin1("0")); + tmp.tqreplace(q, q+TQString(q)); + tmp.tqreplace(TQChar('\r'), q+TQString::tqfromLatin1("r")); + tmp.tqreplace(TQChar('\n'), q+TQString::tqfromLatin1("n")); + tmp.tqreplace(TQChar('\0'), q+TQString::tqfromLatin1("0")); return tmp; } @@ -216,13 +216,13 @@ TQString Message::unquote(const TQString &str) char b[3] = { 020, 020, '\0' }; const char b2[2] = { 020, '\0' }; - tmp.replace( b, b2 ); + tmp.tqreplace( b, b2 ); b[1] = 'r'; - tmp.replace( b, "\r"); + tmp.tqreplace( b, "\r"); b[1] = 'n'; - tmp.replace( b, "\n"); + tmp.tqreplace( b, "\n"); b[1] = '0'; - tmp.replace( b, "\0"); + tmp.tqreplace( b, "\0"); return tmp; } @@ -230,16 +230,16 @@ TQString Message::unquote(const TQString &str) TQString Message::ctcpQuote(const TQString &str) { TQString tmp = str; - tmp.replace( TQChar('\\'), TQString::fromLatin1("\\\\")); - tmp.replace( (char)1, TQString::fromLatin1("\\1")); + tmp.tqreplace( TQChar('\\'), TQString::tqfromLatin1("\\\\")); + tmp.tqreplace( (char)1, TQString::tqfromLatin1("\\1")); return tmp; } TQString Message::ctcpUnquote(const TQString &str) { TQString tmp = str; - tmp.replace("\\\\", "\\"); - tmp.replace("\\1", "\1" ); + tmp.tqreplace("\\\\", "\\"); + tmp.tqreplace("\\1", "\1" ); return tmp; } @@ -276,7 +276,7 @@ bool Message::matchForIRCRegExp(TQRegExp ®exp, const TQTextCodec *codec, cons msg.m_ctcpMessage = new Message(); msg.m_ctcpMessage->m_raw = codec->fromUnicode(ctcpUnquote(msg.m_ctcpRaw)); - int space = ctcpRaw.find(' '); + int space = ctcpRaw.tqfind(' '); if (!matchForIRCRegExp(msg.m_ctcpMessage->m_raw, codec, *msg.m_ctcpMessage)) { TQCString command; @@ -296,7 +296,7 @@ bool Message::matchForIRCRegExp(TQRegExp ®exp, const TQTextCodec *codec, cons msg.m_suffix = Kopete::Message::decodeString( KSParser::parse(suffix), codec ); } else - msg.m_suffix = TQString::null; + msg.m_suffix = TQString(); return true; } return false; @@ -311,13 +311,13 @@ void Message::decodeAgain( const TQTextCodec *codec ) TQString Message::toString() const { if( !isValid() ) - return TQString::null; + return TQString(); TQString msg = m_command; for (TQStringList::ConstIterator it = m_args.begin(); it != m_args.end(); ++it) msg += TQChar(' ') + *it; if (!m_suffix.isNull()) - msg += TQString::fromLatin1(" :") + m_suffix; + msg += TQString::tqfromLatin1(" :") + m_suffix; return msg; } |