diff options
Diffstat (limited to 'kopete/protocols/msn/msnswitchboardsocket.cpp')
-rw-r--r-- | kopete/protocols/msn/msnswitchboardsocket.cpp | 298 |
1 files changed, 149 insertions, 149 deletions
diff --git a/kopete/protocols/msn/msnswitchboardsocket.cpp b/kopete/protocols/msn/msnswitchboardsocket.cpp index ae09a93c..7754c448 100644 --- a/kopete/protocols/msn/msnswitchboardsocket.cpp +++ b/kopete/protocols/msn/msnswitchboardsocket.cpp @@ -26,12 +26,12 @@ #include <cmath> // qt -#include <qstylesheet.h> -#include <qregexp.h> -#include <qimage.h> -#include <qtimer.h> -#include <qfile.h> -#include <qfileinfo.h> +#include <tqstylesheet.h> +#include <tqregexp.h> +#include <tqimage.h> +#include <tqtimer.h> +#include <tqfile.h> +#include <tqfileinfo.h> // kde #include <kdebug.h> @@ -63,7 +63,7 @@ #include "dispatcher.h" using P2P::Dispatcher; -MSNSwitchBoardSocket::MSNSwitchBoardSocket( MSNAccount *account , QObject *parent ) +MSNSwitchBoardSocket::MSNSwitchBoardSocket( MSNAccount *account , TQObject *parent ) : MSNSocket( parent ) { m_account = account; @@ -80,30 +80,30 @@ MSNSwitchBoardSocket::~MSNSwitchBoardSocket() { kdDebug(14140) << k_funcinfo << endl; - QMap<QString , QPair<QString , KTempFile*> >::Iterator it; + TQMap<TQString , QPair<TQString , KTempFile*> >::Iterator it; for ( it = m_emoticons.begin(); it != m_emoticons.end(); ++it ) { delete it.data().second; } } -void MSNSwitchBoardSocket::connectToSwitchBoard(QString ID, QString address, QString auth) +void MSNSwitchBoardSocket::connectToSwitchBoard(TQString ID, TQString address, TQString auth) { // we need these for the handshake later on (when we're connected) m_ID = ID; m_auth = auth; - QString server = address.left( address.find( ":" ) ); + TQString server = address.left( address.find( ":" ) ); uint port = address.right( address.length() - address.findRev( ":" ) - 1 ).toUInt(); - QObject::connect( this, SIGNAL( blockRead( const QByteArray & ) ), - this, SLOT(slotReadMessage( const QByteArray & ) ) ); + TQObject::connect( this, TQT_SIGNAL( blockRead( const TQByteArray & ) ), + this, TQT_SLOT(slotReadMessage( const TQByteArray & ) ) ); - QObject::connect( this, SIGNAL( onlineStatusChanged( MSNSocket::OnlineStatus ) ), - this, SLOT( slotOnlineStatusChanged( MSNSocket::OnlineStatus ) ) ); + TQObject::connect( this, TQT_SIGNAL( onlineStatusChanged( MSNSocket::OnlineStatus ) ), + this, TQT_SLOT( slotOnlineStatusChanged( MSNSocket::OnlineStatus ) ) ); - QObject::connect( this, SIGNAL( socketClosed( ) ), - this, SLOT( slotSocketClosed( ) ) ); + TQObject::connect( this, TQT_SIGNAL( socketClosed( ) ), + this, TQT_SLOT( slotSocketClosed( ) ) ); connect( server, port ); } @@ -112,7 +112,7 @@ void MSNSwitchBoardSocket::handleError( uint code, uint id ) { kdDebug(14140) << k_funcinfo << endl; - QString msg; + TQString msg; MSNSocket::ErrorType type; switch( code ) @@ -153,7 +153,7 @@ void MSNSwitchBoardSocket::handleError( uint code, uint id ) } case 713: { - QString msg = i18n( "You are trying to invite too many contacts to this chat at the same time" ).arg( m_msgHandle ); + TQString msg = i18n( "You are trying to invite too many contacts to this chat at the same time" ).arg( m_msgHandle ); type = MSNSocket::ErrorInformation; userLeftChat(m_msgHandle, i18n("user blocked you")); @@ -175,8 +175,8 @@ void MSNSwitchBoardSocket::handleError( uint code, uint id ) emit errorMessage( type, msg ); } -void MSNSwitchBoardSocket::parseCommand( const QString &cmd, uint id , - const QString &data ) +void MSNSwitchBoardSocket::parseCommand( const TQString &cmd, uint id , + const TQString &data ) { if( cmd == "NAK" ) { @@ -189,8 +189,8 @@ void MSNSwitchBoardSocket::parseCommand( const QString &cmd, uint id , else if( cmd == "JOI" ) { // new user joins the chat, update user in chat list - QString handle = data.section( ' ', 0, 0 ); - QString screenname = unescape(data.section( ' ', 1, 1 )); + TQString handle = data.section( ' ', 0, 0 ); + TQString screenname = unescape(data.section( ' ', 1, 1 )); if( !m_chatMembers.contains( handle ) ) m_chatMembers.append( handle ); emit userJoined( handle, screenname, false ); @@ -198,11 +198,11 @@ void MSNSwitchBoardSocket::parseCommand( const QString &cmd, uint id , else if( cmd == "IRO" ) { // we have joined a multi chat session- this are the users in this chat - QString handle = data.section( ' ', 2, 2 ); + TQString handle = data.section( ' ', 2, 2 ); if( !m_chatMembers.contains( handle ) ) m_chatMembers.append( handle ); - QString screenname = unescape(data.section( ' ', 3, 3)); + TQString screenname = unescape(data.section( ' ', 3, 3)); emit userJoined( handle, screenname, true ); } else if( cmd == "USR" ) @@ -214,12 +214,12 @@ void MSNSwitchBoardSocket::parseCommand( const QString &cmd, uint id , // some has disconnect from chat, update user in chat list cleanQueue(); //in case some message are waiting their emoticons, never mind, send them - QString handle = data.section( ' ', 0, 0 ).replace( "\r\n" , "" ); - userLeftChat( handle, (data.section( ' ', 1, 1 ) == "1" ) ? i18n("timeout") : QString::null ); + TQString handle = data.section( ' ', 0, 0 ).replace( "\r\n" , "" ); + userLeftChat( handle, (data.section( ' ', 1, 1 ) == "1" ) ? i18n("timeout") : TQString::null ); } else if( cmd == "MSG" ) { - QString len = data.section( ' ', 2, 2 ); + TQString len = data.section( ' ', 2, 2 ); // we need to know who's sending is the block... m_msgHandle = data.section( ' ', 0, 0 ); @@ -229,7 +229,7 @@ void MSNSwitchBoardSocket::parseCommand( const QString &cmd, uint id , //that's why the official client does not uptade alaws the nickname immediately. if(m_account->contacts()[ m_msgHandle ]) { - QString displayName=data.section( ' ', 1, 1 ); + TQString displayName=data.section( ' ', 1, 1 ); if(m_account->contacts()[ m_msgHandle ]->displayName() != displayName) m_account->contacts()[ m_msgHandle ]->rename(displayName); }*/ @@ -238,17 +238,17 @@ void MSNSwitchBoardSocket::parseCommand( const QString &cmd, uint id , } } -void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) +void MSNSwitchBoardSocket::slotReadMessage( const TQByteArray &bytes ) { - QString msg = QString::fromUtf8(bytes, bytes.size()); + TQString msg = TQString::fromUtf8(bytes, bytes.size()); - QRegExp rx("Content-Type: ([A-Za-z0-9/\\-]*)"); + TQRegExp rx("Content-Type: ([A-Za-z0-9/\\-]*)"); rx.search(msg); - QString type=rx.cap(1); + TQString type=rx.cap(1); - rx=QRegExp("User-Agent: ([A-Za-z0-9./\\-]*)"); + rx=TQRegExp("User-Agent: ([A-Za-z0-9./\\-]*)"); rx.search(msg); - QString clientStr=rx.cap(1); + TQString clientStr=rx.cap(1); if( !clientStr.isNull() && !m_msgHandle.isNull()) { @@ -264,7 +264,7 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) } else if( type== "text/x-msmsgscontrol" ) { - QString message; + TQString message; message = msg.right( msg.length() - msg.findRev( " " ) - 1 ); message = message.replace( "\r\n" ,"" ); emit receivedTypingMsg( message.lower(), true ); @@ -273,7 +273,7 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) { if(msg.contains("ID:")) { - QRegExp rx("ID: ([0-9]*)"); + TQRegExp rx("ID: ([0-9]*)"); rx.search(msg); uint dataCastId = rx.cap(1).toUInt(); if( dataCastId == 1 ) @@ -290,16 +290,16 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) // sending a text message. So if it's not supplied, we'll just // assume its that. - QColor fontColor; - QFont font; + TQColor fontColor; + TQFont font; if ( msg.contains( "X-MMS-IM-Format" ) ) { - QString fontName; - QString fontInfo; - QString color; + TQString fontName; + TQString fontInfo; + TQString color; - rx=QRegExp("X-MMS-IM-Format: ([^\r\n]*)"); + rx=TQRegExp("X-MMS-IM-Format: ([^\r\n]*)"); rx.search(msg); fontInfo =rx.cap(1); @@ -339,27 +339,27 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) // Handle 'MS Serif' and 'MS Sans Serif' as an empty font name if( !fontName.isEmpty() && fontName != "MS Serif" && fontName != "MS Sans Serif" ) { - QString ef=parseFontAttr( fontInfo, "EF" ); + TQString ef=parseFontAttr( fontInfo, "EF" ); - font = QFont( fontName, + font = TQFont( fontName, parseFontAttr( fontInfo, "PF" ).toInt(), // font size - ef.contains( 'B' ) ? QFont::Bold : QFont::Normal, + ef.contains( 'B' ) ? TQFont::Bold : TQFont::Normal, ef.contains( 'I' ) ); font.setUnderline(ef.contains( 'U' )); font.setStrikeOut(ef.contains( 'S' )); } } - QPtrList<Kopete::Contact> others; + TQPtrList<Kopete::Contact> others; others.append( m_account->myself() ); - QStringList::iterator it2; + TQStringList::iterator it2; for( it2 = m_chatMembers.begin(); it2 != m_chatMembers.end(); ++it2 ) { if( *it2 != m_msgHandle ) others.append( m_account->contacts()[ *it2 ] ); } - QString message=msg.right( msg.length() - msg.find("\r\n\r\n") - 4 ); + TQString message=msg.right( msg.length() - msg.find("\r\n\r\n") - 4 ); //Stupid MSN PLUS colors code. message with incorrect charactere are not showed correctly in the chatwindow. //TODO: parse theses one to show the color too in Kopete @@ -381,16 +381,16 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) kmsg.setFg( fontColor ); kmsg.setFont( font ); - rx=QRegExp("Chunks: ([0-9]*)"); + rx=TQRegExp("Chunks: ([0-9]*)"); rx.search(msg); unsigned int chunks=rx.cap(1).toUInt(); - rx=QRegExp("Chunk: ([0-9]*)"); + rx=TQRegExp("Chunk: ([0-9]*)"); rx.search(msg); unsigned int chunk=rx.cap(1).toUInt(); if(chunk != 0 && !m_msgQueue.isEmpty()) { - QString msg=m_msgQueue.last().plainBody(); + TQString msg=m_msgQueue.last().plainBody(); m_msgQueue.pop_back(); //removes the last item kmsg.setBody( msg+ message, Kopete::Message::PlainText ); } @@ -407,8 +407,8 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) m_msgQueue.append( kmsg ); if(!m_emoticonTimer) //to be sure no message will be lost, we will appends message to { // the queue in 15 secondes even if we have not received emoticons - m_emoticonTimer=new QTimer(this); - QObject::connect(m_emoticonTimer , SIGNAL(timeout()) , this, SLOT(cleanQueue())); + m_emoticonTimer=new TQTimer(this); + TQObject::connect(m_emoticonTimer , TQT_SIGNAL(timeout()) , this, TQT_SLOT(cleanQueue())); m_emoticonTimer->start( 15000 , true ); } } @@ -423,13 +423,13 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) config->setGroup( "MSN" ); if ( config->readBoolEntry( "useCustomEmoticons", true ) ) { - QRegExp rx("([^\\s]*)[\\s]*(<msnobj [^>]*>)"); + TQRegExp rx("([^\\s]*)[\\s]*(<msnobj [^>]*>)"); rx.setMinimal(true); int pos = rx.search(msg); while( pos != -1) { - QString msnobj=rx.cap(2); - QString txt=rx.cap(1); + TQString msnobj=rx.cap(2); + TQString txt=rx.cap(1); kdDebug(14140) << k_funcinfo << "emoticon: " << txt << " msnobj: " << msnobj<< endl; if( !m_emoticons.contains(msnobj) || !m_emoticons[msnobj].second ) @@ -453,7 +453,7 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) } else if( type == "text/x-clientcaps" ) { - rx=QRegExp("Client-Name: ([A-Za-z0-9.$!*/% \\-]*)"); + rx=TQRegExp("Client-Name: ([A-Za-z0-9.$!*/% \\-]*)"); rx.search(msg); clientStr=unescape( rx.cap(1) ); @@ -469,7 +469,7 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) KConfig *config = KGlobal::config(); config->setGroup( "MSN" ); - QString JabberID; + TQString JabberID; if(config->readBoolEntry("SendJabber", true)) JabberID=config->readEntry("JabberAccount"); @@ -479,13 +479,13 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) if( config->readBoolEntry("SendClientInfo", true) || !JabberID.isEmpty()) { - QCString message = QString( "MIME-Version: 1.0\r\n" + TQCString message = TQString( "MIME-Version: 1.0\r\n" "Content-Type: text/x-clientcaps\r\n" "Client-Name: Kopete/"+escape(kapp->aboutData()->version())+"\r\n" +JabberID+ "\r\n" ).utf8(); - QString args = "U"; + TQString args = "U"; sendCommand( "MSG", args, true, message ); } m_clientcapsSent=true; @@ -496,15 +496,15 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) else if(type == "image/gif" || msg.contains("Message-ID:")) { // Incoming inkformatgif. - QRegExp regex("Message-ID: \\{([0-9A-F\\-]*)\\}"); + TQRegExp regex("Message-ID: \\{([0-9A-F\\-]*)\\}"); regex.search(msg); - QString messageId = regex.cap(1); - regex = QRegExp("Chunks: (\\d+)"); + TQString messageId = regex.cap(1); + regex = TQRegExp("Chunks: (\\d+)"); regex.search(msg); - QString chunks = regex.cap(1); - regex = QRegExp("Chunk: (\\d+)"); + TQString chunks = regex.cap(1); + regex = TQRegExp("Chunk: (\\d+)"); regex.search(msg); - QString chunk = regex.cap(1); + TQString chunk = regex.cap(1); if(!messageId.isNull()) { @@ -513,10 +513,10 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) Q_UINT32 numberOfChunks = chunks.toUInt(&valid); if(valid && (numberOfChunks > 1)) { - regex = QRegExp("base64:([0-9a-zA-Z+/=]+)"); + regex = TQRegExp("base64:([0-9a-zA-Z+/=]+)"); regex.search(msg); // Retrieve the first chunk of the ink format gif. - QString base64 = regex.cap(1); + TQString base64 = regex.cap(1); // More chunks are expected, buffer the chunk received. InkMessage inkMessage; inkMessage.chunks = numberOfChunks; @@ -527,10 +527,10 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) else { // There is only one chunk of data. - regex = QRegExp("base64:([0-9a-zA-Z+/=]*)"); + regex = TQRegExp("base64:([0-9a-zA-Z+/=]*)"); regex.search(msg); // Retrieve the base64 encoded ink data. - QString data = regex.cap(1); + TQString data = regex.cap(1); DispatchInkMessage(data); } @@ -558,9 +558,9 @@ void MSNSwitchBoardSocket::slotReadMessage( const QByteArray &bytes ) } } -void MSNSwitchBoardSocket::DispatchInkMessage(const QString& base64String) +void MSNSwitchBoardSocket::DispatchInkMessage(const TQString& base64String) { - QByteArray image; + TQByteArray image; // Convert from base64 encoded string to byte array. KCodecs::base64Decode(base64String.utf8() , image); KTempFile *inkImage = new KTempFile(locateLocal( "tmp", "inkformatgif-" ), ".gif"); @@ -585,18 +585,18 @@ void MSNSwitchBoardSocket::sendTypingMsg( bool isTyping ) } - QCString message = QString( "MIME-Version: 1.0\r\n" + TQCString message = TQString( "MIME-Version: 1.0\r\n" "Content-Type: text/x-msmsgscontrol\r\n" "TypingUser: " + m_myHandle + "\r\n" "\r\n" ).utf8(); // Length is appended by sendCommand() - QString args = "U"; + TQString args = "U"; sendCommand( "MSG", args, true, message ); } // this Invites an Contact -void MSNSwitchBoardSocket::slotInviteContact(const QString &handle) +void MSNSwitchBoardSocket::slotInviteContact(const TQString &handle) { m_msgHandle=handle; sendCommand( "CAL", handle ); @@ -604,13 +604,13 @@ void MSNSwitchBoardSocket::slotInviteContact(const QString &handle) // // Send a custum emoticon // -int MSNSwitchBoardSocket::sendCustomEmoticon(const QString &name, const QString &filename) +int MSNSwitchBoardSocket::sendCustomEmoticon(const TQString &name, const TQString &filename) { - QString picObj; + TQString picObj; //try to find it in the cache. - const QMap<QString, QString> objectList = PeerDispatcher()->objectList; - for (QMap<QString,QString>::ConstIterator it = objectList.begin(); it != objectList.end(); ++it ) + const TQMap<TQString, TQString> objectList = PeerDispatcher()->objectList; + for (TQMap<TQString,TQString>::ConstIterator it = objectList.begin(); it != objectList.end(); ++it ) { if(it.data() == filename) { @@ -621,18 +621,18 @@ int MSNSwitchBoardSocket::sendCustomEmoticon(const QString &name, const QString if(picObj.isNull()) { //if not found in the cache, generate the picture object - QFileInfo fi(filename); + TQFileInfo fi(filename); // open the icon file - QFile pictFile(fi.filePath()); + TQFile pictFile(fi.filePath()); if (pictFile.open(IO_ReadOnly)) { - QByteArray ar = pictFile.readAll(); + TQByteArray ar = pictFile.readAll(); pictFile.close(); - QString sha1d = QString(KCodecs::base64Encode(SHA1::hash(ar))); - QString size = QString::number( pictFile.size() ); - QString all = "Creator" + m_account->accountId() + "Size" + size + "Type2Location" + fi.fileName() + "FriendlyAAA=SHA1D" + sha1d; - QString sha1c = QString(KCodecs::base64Encode(SHA1::hashString(all.utf8()))); + TQString sha1d = TQString(KCodecs::base64Encode(SHA1::hash(ar))); + TQString size = TQString::number( pictFile.size() ); + TQString all = "Creator" + m_account->accountId() + "Size" + size + "Type2Location" + fi.fileName() + "FriendlyAAA=SHA1D" + sha1d; + TQString sha1c = TQString(KCodecs::base64Encode(SHA1::hashString(all.utf8()))); picObj = "<msnobj Creator=\"" + m_account->accountId() + "\" Size=\"" + size + "\" Type=\"2\" Location=\""+ fi.fileName() + "\" Friendly=\"AAA=\" SHA1D=\""+sha1d+ "\" SHA1C=\""+sha1c+"\"/>"; PeerDispatcher()->objectList.insert(picObj, filename); @@ -641,7 +641,7 @@ int MSNSwitchBoardSocket::sendCustomEmoticon(const QString &name, const QString return 0; } - QString msg = "MIME-Version: 1.0\r\n" + TQString msg = "MIME-Version: 1.0\r\n" "Content-Type: text/x-mms-emoticon\r\n" "\r\n" + name + "\t" + picObj + "\t\r\n"; @@ -671,12 +671,12 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) config->setGroup( "MSN" ); if ( config->readBoolEntry( "exportEmoticons", false ) ) { - QMap<QString, QStringList> emap = Kopete::Emoticons::self()->emoticonAndPicList(); + TQMap<TQString, TQStringList> emap = Kopete::Emoticons::self()->emoticonAndPicList(); // Check the list for any custom emoticons - for (QMap<QString, QStringList>::const_iterator itr = emap.begin(); itr != emap.end(); itr++) + for (TQMap<TQString, TQStringList>::const_iterator itr = emap.begin(); itr != emap.end(); itr++) { - for ( QStringList::const_iterator itr2 = itr.data().constBegin(); itr2 != itr.data().constEnd(); ++itr2 ) + for ( TQStringList::const_iterator itr2 = itr.data().constBegin(); itr2 != itr.data().constEnd(); ++itr2 ) { if ( msg.plainBody().contains( *itr2 ) ) sendCustomEmoticon( *itr2, itr.key() ); @@ -686,7 +686,7 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) if( msg.format() & Kopete::Message::RichText ) { - QRegExp regex("^\\s*<img src=\"([^>\"]+)\"[^>]*>\\s*$"); + TQRegExp regex("^\\s*<img src=\"([^>\"]+)\"[^>]*>\\s*$"); if(regex.search(msg.escapedBody()) != -1) { // FIXME why are we sending the images.. the contact should request them. @@ -696,19 +696,19 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) } // User-Agent is not a official flag, but GAIM has it - QString UA; + TQString UA; if( config->readBoolEntry("SendClientInfo", true) ) { UA="User-Agent: Kopete/"+escape(kapp->aboutData()->version())+"\r\n"; } - QString head = + TQString head = "MIME-Version: 1.0\r\n" "Content-Type: text/plain; charset=UTF-8\r\n" +UA+ "X-MMS-IM-Format: "; - if(msg.font() != QFont() ) + if(msg.font() != TQFont() ) { //It's verry strange that if the font name is bigger than 31 char, the _server_ close the socket and don't deliver the message. // the real question is why ? my guess is that MS patched the server because a bug in their client, but that's just a guess. @@ -735,7 +735,7 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) // Color support if (msg.fg().isValid()) { - QString colorCode = QColor(msg.fg().blue(),msg.fg().green(),msg.fg().red()).name().remove(0,1); //colors aren't sent in RGB but in BGR (O.G.) + TQString colorCode = TQColor(msg.fg().blue(),msg.fg().green(),msg.fg().red()).name().remove(0,1); //colors aren't sent in RGB but in BGR (O.G.) head += "CO=" + colorCode; } else @@ -748,7 +748,7 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) head += "; RL=1"; head += "\r\n"; - QString message= msg.plainBody().replace( "\n" , "\r\n" ); + TQString message= msg.plainBody().replace( "\n" , "\r\n" ); //-- Check if the message isn't too big, TODO: do that at the libkopete level. int len_H=head.utf8().length(); // != head.length() because i need the size in butes and @@ -759,7 +759,7 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) //It's possible to made the opposite client join them, as explained in this MS Word document //http://www.bot-depot.com/forums/index.php?act=Attach&type=post&id=35110 - head+="Message-ID: {7B7B34E6-7A8D-44FF-926C-1799156B58"+QString::number( rand()%10)+QString::number( rand()%10)+"}\r\n"; + head+="Message-ID: {7B7B34E6-7A8D-44FF-926C-1799156B58"+TQString::number( rand()%10)+TQString::number( rand()%10)+"}\r\n"; int len_H=head.utf8().length()+ 14; //14 is the size of "Chunks: x" //this is the size of each part of the message (excluding the header) int futurmessages_size=1400; //1400 is a common good size @@ -777,7 +777,7 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) int chunk=0; do { - QString m=message.mid(place, futurmessages_size); + TQString m=message.mid(place, futurmessages_size); place += futurmessages_size; //make sure the size is not too big because of utf8 @@ -798,11 +798,11 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) m=m.left(len-d); place -= d; } - QString chunk_str; + TQString chunk_str; if(chunk==0) - chunk_str="Chunks: "+QString::number(nb)+"\r\n"; + chunk_str="Chunks: "+TQString::number(nb)+"\r\n"; else if(chunk<nb) - chunk_str="Chunk: "+QString::number(chunk)+"\r\n"; + chunk_str="Chunk: "+TQString::number(chunk)+"\r\n"; else { kdDebug(14140) << k_funcinfo <<"The message is slit in more than initially estimated" <<endl; @@ -815,7 +815,7 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) while(chunk<nb) { kdDebug(14140) << k_funcinfo <<"The message is plit in less than initially estimated. Sending empty message to complete" <<endl; - QString chunk_str="Chunk: "+QString::number(chunk); + TQString chunk_str="Chunk: "+TQString::number(chunk); sendCommand( "MSG", "A", true, (head+chunk_str+"\r\n").utf8() ); chunk++; } @@ -827,8 +827,8 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) if(!m_keepAlive) { m_keepAliveNb=20; - m_keepAlive=new QTimer(this); - QObject::connect(m_keepAlive, SIGNAL(timeout()) , this , SLOT(slotKeepAliveTimer())); + m_keepAlive=new TQTimer(this); + TQObject::connect(m_keepAlive, TQT_SIGNAL(timeout()) , this , TQT_SLOT(slotKeepAliveTimer())); m_keepAlive->start(50*1000); } @@ -838,7 +838,7 @@ int MSNSwitchBoardSocket::sendMsg( const Kopete::Message &msg ) void MSNSwitchBoardSocket::slotSocketClosed( ) { - for( QStringList::Iterator it = m_chatMembers.begin(); it != m_chatMembers.end(); ++it ) + for( TQStringList::Iterator it = m_chatMembers.begin(); it != m_chatMembers.end(); ++it ) { emit userLeft( (*it), i18n("connection closed")); } @@ -850,7 +850,7 @@ void MSNSwitchBoardSocket::slotSocketClosed( ) void MSNSwitchBoardSocket::slotCloseSession() { - sendCommand( "OUT", QString::null, false ); + sendCommand( "OUT", TQString::null, false ); disconnect(); } @@ -859,8 +859,8 @@ void MSNSwitchBoardSocket::slotOnlineStatusChanged( MSNSocket::OnlineStatus stat { if (status == Connected) { - QCString command; - QString args; + TQCString command; + TQString args; if( !m_ID ) // we're inviting { @@ -877,14 +877,14 @@ void MSNSwitchBoardSocket::slotOnlineStatusChanged( MSNSocket::OnlineStatus stat if(!m_keepAlive) { m_keepAliveNb=20; - m_keepAlive=new QTimer(this); - QObject::connect(m_keepAlive, SIGNAL(timeout()) , this , SLOT(slotKeepAliveTimer())); + m_keepAlive=new TQTimer(this); + TQObject::connect(m_keepAlive, TQT_SIGNAL(timeout()) , this , TQT_SLOT(slotKeepAliveTimer())); m_keepAlive->start(50*1000); } } } -void MSNSwitchBoardSocket::userLeftChat(const QString& handle , const QString &reason) +void MSNSwitchBoardSocket::userLeftChat(const TQString& handle , const TQString &reason) { emit userLeft( handle, reason ); @@ -903,7 +903,7 @@ void MSNSwitchBoardSocket::requestDisplayPicture() PeerDispatcher()->requestDisplayIcon(m_msgHandle, contact->object()); } -void MSNSwitchBoardSocket::slotEmoticonReceived( KTempFile *file, const QString &msnObj ) +void MSNSwitchBoardSocket::slotEmoticonReceived( KTempFile *file, const TQString &msnObj ) { kdDebug(14141) << k_funcinfo << msnObj << endl; @@ -920,17 +920,17 @@ void MSNSwitchBoardSocket::slotEmoticonReceived( KTempFile *file, const QString } else if(msnObj == "inkformatgif") { - QString msg=i18n("<img src=\"%1\" alt=\"Typewrited message\" />" ).arg( file->name() ); + TQString msg=i18n("<img src=\"%1\" alt=\"Typewrited message\" />" ).arg( file->name() ); kdDebug(14140) << k_funcinfo << file->name() <<endl; m_typewrited.append(file); m_typewrited.setAutoDelete(true); - QPtrList<Kopete::Contact> others; + TQPtrList<Kopete::Contact> others; others.append( m_account->myself() ); - QStringList::iterator it2; + TQStringList::iterator it2; for( it2 = m_chatMembers.begin(); it2 != m_chatMembers.end(); ++it2 ) { if( *it2 != m_msgHandle ) @@ -961,11 +961,11 @@ void MSNSwitchBoardSocket::slotEmoticonReceived( KTempFile *file, const QString } } -void MSNSwitchBoardSocket::slotIncomingFileTransfer(const QString& from, const QString& /*fileName*/, Q_INT64 /*fileSize*/) +void MSNSwitchBoardSocket::slotIncomingFileTransfer(const TQString& from, const TQString& /*fileName*/, Q_INT64 /*fileSize*/) { - QPtrList<Kopete::Contact> others; + TQPtrList<Kopete::Contact> others; others.append( m_account->myself() ); - QStringList::iterator it2; + TQStringList::iterator it2; for( it2 = m_chatMembers.begin(); it2 != m_chatMembers.end(); ++it2 ) { if( *it2 != m_msgHandle ) @@ -980,7 +980,7 @@ void MSNSwitchBoardSocket::slotIncomingFileTransfer(const QString& from, const Q m_chatMembers.append( m_msgHandle ); emit userJoined( m_msgHandle , m_msgHandle , false); } - QString invite = "Incoming file transfer."; + TQString invite = "Incoming file transfer."; Kopete::Message msg = Kopete::Message(m_account->contacts()[from], others, invite, Kopete::Message::Internal, Kopete::Message::PlainText); emit msgReceived(msg); @@ -996,7 +996,7 @@ void MSNSwitchBoardSocket::cleanQueue() } kdDebug(14141) << k_funcinfo << m_msgQueue.count() << endl; - QValueList<const Kopete::Message>::Iterator it_msg; + TQValueList<const Kopete::Message>::Iterator it_msg; for ( it_msg = m_msgQueue.begin(); it_msg != m_msgQueue.end(); ++it_msg ) { Kopete::Message kmsg = (*it_msg); @@ -1007,33 +1007,33 @@ void MSNSwitchBoardSocket::cleanQueue() Kopete::Message &MSNSwitchBoardSocket::parseCustomEmoticons(Kopete::Message &kmsg) { - QString message=kmsg.escapedBody(); - QMap<QString , QPair<QString , KTempFile*> >::Iterator it; + TQString message=kmsg.escapedBody(); + TQMap<TQString , QPair<TQString , KTempFile*> >::Iterator it; for ( it = m_emoticons.begin(); it != m_emoticons.end(); ++it ) { - QString es=QStyleSheet::escape(it.data().first); + TQString es=TQStyleSheet::escape(it.data().first); KTempFile *f=it.data().second; if(message.contains(es) && f) { - QString imgPath = f->name(); - QImage iconImage(imgPath); + TQString imgPath = f->name(); + TQImage iconImage(imgPath); /* We don't use a comple algoritm (like the one in the #if) because the msn client shows * emoticons like that. So, in that case, we show like the MSN client */ #if 0 - QString em = QRegExp::escape( es ); - message.replace( QRegExp(QString::fromLatin1( "(^|[\\W\\s]|%1)(%2)(?!\\w)" ).arg(em).arg(em)), - QString::fromLatin1("\\1<img align=\"center\" width=\"") + + TQString em = TQRegExp::escape( es ); + message.replace( TQRegExp(TQString::fromLatin1( "(^|[\\W\\s]|%1)(%2)(?!\\w)" ).arg(em).arg(em)), + TQString::fromLatin1("\\1<img align=\"center\" width=\"") + #endif //match any occurence which is not in a html tag. - message.replace( QRegExp(QString::fromLatin1("%1(?![^><]*>)").arg(QRegExp::escape(es))), - QString::fromLatin1("<img align=\"center\" width=\"") + - QString::number(iconImage.width()) + - QString::fromLatin1("\" height=\"") + - QString::number(iconImage.height()) + - QString::fromLatin1("\" src=\"") + imgPath + - QString::fromLatin1("\" title=\"") + es + - QString::fromLatin1("\" alt=\"") + es + - QString::fromLatin1( "\"/>" ) ); + message.replace( TQRegExp(TQString::fromLatin1("%1(?![^><]*>)").arg(TQRegExp::escape(es))), + TQString::fromLatin1("<img align=\"center\" width=\"") + + TQString::number(iconImage.width()) + + TQString::fromLatin1("\" height=\"") + + TQString::number(iconImage.height()) + + TQString::fromLatin1("\" src=\"") + imgPath + + TQString::fromLatin1("\" title=\"") + es + + TQString::fromLatin1("\" alt=\"") + es + + TQString::fromLatin1( "\"/>" ) ); kmsg.setBody(message, Kopete::Message::RichText); } } @@ -1042,22 +1042,22 @@ Kopete::Message &MSNSwitchBoardSocket::parseCustomEmoticons(Kopete::Message &kms int MSNSwitchBoardSocket::sendNudge() { - QCString message = QString( "MIME-Version: 1.0\r\n" + TQCString message = TQString( "MIME-Version: 1.0\r\n" "Content-Type: text/x-msnmsgr-datacast\r\n" "\r\n" "ID: 1\r\n" "\r\n\r\n" ).utf8(); - QString args = "U"; + TQString args = "U"; return sendCommand( "MSG", args, true, message ); } // FIXME: This is nasty... replace with a regexp or so. -QString MSNSwitchBoardSocket::parseFontAttr(QString str, QString attr) +TQString MSNSwitchBoardSocket::parseFontAttr(TQString str, TQString attr) { - QString tmp; + TQString tmp; int pos1=0, pos2=0; pos1 = str.find(attr + "="); @@ -1081,7 +1081,7 @@ Dispatcher* MSNSwitchBoardSocket::PeerDispatcher() { // Create a new msnslp dispatcher to handle // all peer to peer requests. - QStringList ip; + TQStringList ip; if(m_account->notifySocket()) { ip << m_account->notifySocket()->localIP(); @@ -1090,11 +1090,11 @@ Dispatcher* MSNSwitchBoardSocket::PeerDispatcher() } m_dispatcher = new Dispatcher(this, m_account->accountId(),ip ); -// QObject::connect(this, SIGNAL(blockRead(const QByteArray&)), m_dispatcher, SLOT(slotReadMessage(const QByteArray&))); -// QObject::connect(m_dispatcher, SIGNAL(sendCommand(const QString&, const QString&, bool, const QByteArray&, bool)), this, SLOT(sendCommand(const QString&, const QString&, bool, const QByteArray&, bool))); - QObject::connect(m_dispatcher, SIGNAL(incomingTransfer(const QString&, const QString&, Q_INT64)), this, SLOT(slotIncomingFileTransfer(const QString&, const QString&, Q_INT64))); - QObject::connect(m_dispatcher, SIGNAL(displayIconReceived(KTempFile *, const QString&)), this, SLOT(slotEmoticonReceived( KTempFile *, const QString&))); - QObject::connect(this, SIGNAL(msgAcknowledgement(unsigned int, bool)), m_dispatcher, SLOT(messageAcknowledged(unsigned int, bool))); +// TQObject::connect(this, TQT_SIGNAL(blockRead(const TQByteArray&)), m_dispatcher, TQT_SLOT(slotReadMessage(const TQByteArray&))); +// TQObject::connect(m_dispatcher, TQT_SIGNAL(sendCommand(const TQString&, const TQString&, bool, const TQByteArray&, bool)), this, TQT_SLOT(sendCommand(const TQString&, const TQString&, bool, const TQByteArray&, bool))); + TQObject::connect(m_dispatcher, TQT_SIGNAL(incomingTransfer(const TQString&, const TQString&, Q_INT64)), this, TQT_SLOT(slotIncomingFileTransfer(const TQString&, const TQString&, Q_INT64))); + TQObject::connect(m_dispatcher, TQT_SIGNAL(displayIconReceived(KTempFile *, const TQString&)), this, TQT_SLOT(slotEmoticonReceived( KTempFile *, const TQString&))); + TQObject::connect(this, TQT_SIGNAL(msgAcknowledgement(unsigned int, bool)), m_dispatcher, TQT_SLOT(messageAcknowledged(unsigned int, bool))); m_dispatcher->m_pictureUrl = m_account->pictureUrl(); } return m_dispatcher; @@ -1120,12 +1120,12 @@ void MSNSwitchBoardSocket::slotKeepAliveTimer( ) } - QCString message = QString( "MIME-Version: 1.0\r\n" + TQCString message = TQString( "MIME-Version: 1.0\r\n" "Content-Type: text/x-keepalive\r\n" "\r\n" ).utf8(); // Length is appended by sendCommand() - QString args = "U"; + TQString args = "U"; sendCommand( "MSG", args, true, message ); m_keepAliveNb--; |