diff options
Diffstat (limited to 'kopete/protocols/msn/msnsocket.cpp')
-rw-r--r-- | kopete/protocols/msn/msnsocket.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/kopete/protocols/msn/msnsocket.cpp b/kopete/protocols/msn/msnsocket.cpp index 0aaad25c..3e5d84fd 100644 --- a/kopete/protocols/msn/msnsocket.cpp +++ b/kopete/protocols/msn/msnsocket.cpp @@ -54,9 +54,9 @@ class MimeMessage TQString message; }; -MSNSocket::MSNSocket(TQObject* parent) : TQObject (parent) +MSNSocket::MSNSocket(TQObject* tqparent) : TQObject (tqparent) { - m_onlineStatus = Disconnected; + m_onlinetqStatus = Disconnected; m_socket = 0L; m_useHttp = false; m_timer = 0L; @@ -64,7 +64,7 @@ MSNSocket::MSNSocket(TQObject* parent) : TQObject (parent) MSNSocket::~MSNSocket() { - //if ( m_onlineStatus != Disconnected ) + //if ( m_onlinetqStatus != Disconnected ) // disconnect(); delete m_timer; m_timer = 0L; @@ -75,13 +75,13 @@ MSNSocket::~MSNSocket() void MSNSocket::connect( const TQString &server, uint port ) { - if ( m_onlineStatus == Connected || m_onlineStatus == Connecting ) + if ( m_onlinetqStatus == Connected || m_onlinetqStatus == Connecting ) { kdWarning( 14140 ) << k_funcinfo << "Already connected or connecting! Not connecting again." << endl; return; } - if( m_onlineStatus == Disconnecting ) + if( m_onlinetqStatus == Disconnecting ) { // Cleanup first. // FIXME: More generic!!! @@ -166,16 +166,16 @@ void MSNSocket::doneDisconnect() void MSNSocket::setOnlineStatus( MSNSocket::OnlineStatus status ) { - if ( m_onlineStatus == status ) + if ( m_onlinetqStatus == status ) return; - m_onlineStatus = status; + m_onlinetqStatus = status; emit onlineStatusChanged( status ); } void MSNSocket::slotSocketError( int error ) { - kdWarning( 14140 ) << k_funcinfo << "Error: " << error << " (" << m_socket->errorString() << ")" << endl; + kdWarning( 14140 ) << k_funcinfo << "Error: " << error << " (" << m_socket->KSocketBase::errorString() << ")" << endl; if(!KSocketBase::isFatalError(error)) return; @@ -183,9 +183,9 @@ void MSNSocket::slotSocketError( int error ) TQString errormsg = i18n( "There was an error while connecting to the MSN server.\nError message:\n" ); if ( error == KSocketBase::LookupFailure ) - errormsg += i18n( "Unable to lookup %1" ).arg( m_socket->peerResolver().nodeName() ); + errormsg += i18n( "Unable to lookup %1" ).tqarg( m_socket->peerResolver().nodeName() ); else - errormsg += m_socket->errorString() ; + errormsg += m_socket->KSocketBase::errorString() ; //delete m_socket; m_socket->deleteLater(); @@ -249,12 +249,12 @@ void MSNSocket::slotDataReceived() // Check if all data has arrived. rawData = TQString(TQCString(buffer, avail + 1)); - bool headers = (rawData.find(TQRegExp("HTTP/\\d\\.\\d (\\d+) ([^\r\n]+)")) != -1); + bool headers = (rawData.tqfind(TQRegExp("HTTP/\\d\\.\\d (\\d+) ([^\r\n]+)")) != -1); if(headers) { // The http header packet arrived. - int endOfHeaders = rawData.find("\r\n\r\n"); + int endOfHeaders = rawData.tqfind("\r\n\r\n"); if((endOfHeaders + 4) == avail) { // Only the response headers data is included. @@ -314,17 +314,17 @@ void MSNSocket::slotDataReceived() // Retrieve the X-MSN-Messenger header. TQString header = response.getHeaders()->getValue("X-MSN-Messenger"); - TQStringList parts = TQStringList::split(";", header.replace(" ", "")); + TQStringList parts = TQStringList::split(";", header.tqreplace(" ", "")); if(!header.isNull() && (parts.count() >= 2)) { - if(parts[0].find("SessionID", 0) != -1) + if(parts[0].tqfind("SessionID", 0) != -1) { // Assign the session id. m_sessionId = parts[0].section("=", 1, 1); }else error = true; - if(parts[1].find("GW-IP", 0) != -1) + if(parts[1].tqfind("GW-IP", 0) != -1) { // Assign the gateway IP address. m_gwip = parts[1].section("=", 1, 1); @@ -333,7 +333,7 @@ void MSNSocket::slotDataReceived() if(parts.count() > 2) - if((parts[2].find("Session", 0) != -1) && (parts[2].section("=", 1, 1) == "close")) + if((parts[2].tqfind("Session", 0) != -1) && (parts[2].section("=", 1, 1) == "close")) { // The http session has been closed by the server, disconnect. kdDebug(14140) << k_funcinfo << "Session closed." << endl; @@ -390,7 +390,7 @@ void MSNSocket::slotDataReceived() // all MSN commands start with one or more uppercase characters. // For now just check the first three chars, let's see how accurate it is. // Additionally, if we receive an MSN-P2P packet, strip off anything after the P2P header. - rawData = TQString( TQCString( buffer, ((!m_useHttp)? avail : ret) + 1 ) ).stripWhiteSpace().replace( + rawData = TQString( TQCString( buffer, ((!m_useHttp)? avail : ret) + 1 ) ).stripWhiteSpace().tqreplace( TQRegExp( "(P2P-Dest:.[a-zA-Z@.]*).*" ), "\\1\n\n(Stripped binary data)" ); bool isBinary = false; @@ -446,7 +446,7 @@ void MSNSocket::slotReadLine() if ( index != -1 ) { TQString command = TQString::fromUtf8( m_buffer.take( index + 2 ), index ); - command.replace( "\r\n", "" ); + command.tqreplace( "\r\n", "" ); //kdDebug( 14141 ) << k_funcinfo << command << endl; // Don't block the GUI while parsing data, only do a single line! @@ -502,7 +502,7 @@ bool MSNSocket::pollReadBlock() void MSNSocket::parseLine( const TQString &str ) { TQString cmd = str.section( ' ', 0, 0 ); - TQString data = str.section( ' ', 2 ).replace( "\r\n" , "" ); + TQString data = str.section( ' ', 2 ).tqreplace( "\r\n" , "" ); bool isNum; uint id = str.section( ' ', 1, 1 ).toUInt( &isNum ); @@ -517,7 +517,7 @@ void MSNSocket::parseLine( const TQString &str ) //kdDebug( 14140 ) << k_funcinfo << "Parsing command " << cmd << " (ID " << id << "): '" << data << "'" << endl; - data.replace( "\r\n", "" ); + data.tqreplace( "\r\n", "" ); bool isError; uint errorCode = cmd.toUInt( &isError ); if ( isError ) @@ -594,7 +594,7 @@ void MSNSocket::handleError( uint code, uint /* id */ ) default: // FIXME: if the error causes a disconnect, it will crash, but we can't disconnect every time msg = i18n( "Unhandled MSN error code %1 \n" - "Please fill a bug report with a detailed description and if possible the last console debug output." ).arg( code ); + "Please fill a bug report with a detailed description and if possible the last console debug output." ).tqarg( code ); // "See http://www.hypothetic.org/docs/msn/basics.php for a description of all error codes." break; } @@ -725,7 +725,7 @@ void MSNSocket::slotReadyWrite() // Simple check to avoid dumping the binary data from the icons and emoticons to kdDebug: // When sending an MSN-P2P packet, strip off anything after the P2P header. - TQString debugData = TQString( *it ).stripWhiteSpace().replace( + TQString debugData = TQString( *it ).stripWhiteSpace().tqreplace( TQRegExp( "(P2P-Dest:.[a-zA-Z@.]*).*" ), "\\1\n\n(Stripped binary data)" ); kdDebug( 14141 ) << k_funcinfo << "Sending command: " << debugData << endl; @@ -757,12 +757,12 @@ TQString MSNSocket::escape( const TQString &str ) //If we encode more, the size can be longer than excepted. int old_length= str.length(); - TQChar *new_segment = new QChar[ old_length * 3 + 1 ]; + TQChar *new_segment = new TQChar[ old_length * 3 + 1 ]; int new_length = 0; for ( int i = 0; i < old_length; i++ ) { - unsigned short character = str[i].unicode(); + unsigned short character = str[i].tqunicode(); if( character <= 32 || character == '%' ) { @@ -790,10 +790,10 @@ TQString MSNSocket::unescape( const TQString &str ) { TQString str2 = KURL::decode_string( str, 106 ); //remove msn+ colors code - str2 = str2.replace( TQRegExp("[\\x1-\\x8]"), "" ); // old msn+ colors + str2 = str2.tqreplace( TQRegExp("[\\x1-\\x8]"), "" ); // old msn+ colors // added by kaoul <erwin.kwolek at gmail.com> - str2 = str2.replace( TQRegExp("\\xB7[&@\'#0]"),""); // dot ... - str2 = str2.replace( TQRegExp("\\xB7\\$,?\\d{1,2}"),""); // dot dollar (comma)? 0-99 + str2 = str2.tqreplace( TQRegExp("\\xB7[&@\'#0]"),""); // dot ... + str2 = str2.tqreplace( TQRegExp("\\xB7\\$,?\\d{1,2}"),""); // dot dollar (comma)? 0-99 return str2; } @@ -823,7 +823,7 @@ void MSNSocket::slotSocketClosed() { kdDebug( 14140 ) << k_funcinfo << "Socket closed. " << endl; - if ( !m_socket || m_onlineStatus == Disconnected ) + if ( !m_socket || m_onlinetqStatus == Disconnected ) { kdDebug( 14140 ) << k_funcinfo << "Socket already deleted or already disconnected" << endl; return; @@ -885,7 +885,7 @@ bool MSNSocket::setUseHttpMethod( bool useHttp ) else if( s == "msnswitchboardsocket" ) m_type = "SB"; else - m_type = TQString::null; + m_type = TQString(); if( m_type.isNull() ) return false; @@ -897,7 +897,7 @@ bool MSNSocket::setUseHttpMethod( bool useHttp ) m_gateway = "gateway.messenger.hotmail.com"; } - if ( m_onlineStatus != Disconnected ) + if ( m_onlinetqStatus != Disconnected ) disconnect(); m_useHttp = useHttp; @@ -950,7 +950,7 @@ bool MSNSocket::accept( KServerSocket *server ) TQString MSNSocket::getLocalIP() { if ( !m_socket ) - return TQString::null; + return TQString(); const KSocketAddress address = m_socket->localAddress(); @@ -1031,7 +1031,7 @@ MSNSocket::WebResponse::WebResponse(const TQByteArray& bytes) // Parse the HTTP status header TQRegExp re("HTTP/\\d\\.\\d (\\d+) ([^\r\n]+)"); - headerEnd = data.find("\r\n"); + headerEnd = data.tqfind("\r\n"); header = data.left( (headerEnd == -1) ? 20 : headerEnd ); re.search(header); @@ -1039,7 +1039,7 @@ MSNSocket::WebResponse::WebResponse(const TQByteArray& bytes) m_statusDescription = re.cap(2); // Remove the web response status header. - data = data.mid(headerEnd + 2, (data.find("\r\n\r\n") + 2) - (headerEnd + 2)); + data = data.mid(headerEnd + 2, (data.tqfind("\r\n\r\n") + 2) - (headerEnd + 2)); // Create a MimeMessage, removing the HTTP status header m_headers = new MimeMessage(data); |