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/msn/webcam.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/msn/webcam.cpp')
-rw-r--r-- | kopete/protocols/msn/webcam.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/kopete/protocols/msn/webcam.cpp b/kopete/protocols/msn/webcam.cpp index 60ce0e82..2c2023c2 100644 --- a/kopete/protocols/msn/webcam.cpp +++ b/kopete/protocols/msn/webcam.cpp @@ -42,8 +42,8 @@ using namespace KNetwork; namespace P2P { -Webcam::Webcam(Who who, const TQString& to, Dispatcher *parent, Q_UINT32 sessionId) - : TransferContext(to,parent,sessionId) , m_who(who) , m_timerId(0) +Webcam::Webcam(Who who, const TQString& to, Dispatcher *tqparent, TQ_UINT32 sessionId) + : TransferContext(to,tqparent,sessionId) , m_who(who) , m_timerId(0) { setType(P2P::WebcamType); m_direction = Incoming; @@ -87,12 +87,12 @@ void Webcam::askIncommingInvitation() TQString message= (m_who==wProducer) ? i18n("<qt>The contact %1 wants to see <b>your</b> webcam, do you want them to see it?</qt>") : i18n("The contact %1 wants to show you his/her webcam, do you want to see it?") ; - int result=KMessageBox::questionYesNo( 0L , message.arg(m_recipient), + int result=KMessageBox::questionYesNo( 0L , message.tqarg(m_recipient), i18n("Webcam invitation - Kopete MSN Plugin") , i18n("Accept") , i18n("Decline")); if(!_this) return; - TQString content = TQString("SessionID: %1\r\n\r\n").arg(m_sessionId); + TQString content = TQString("SessionID: %1\r\n\r\n").tqarg(m_sessionId); if(result==KMessageBox::Yes) { //Send two message, an OK, and an invite. @@ -268,7 +268,7 @@ void Webcam::processMessage(const Message& message) { unsigned char X=dataMessage[q+f]; char C=((char)(( X<128 && X>31 ) ? X : '.')); - echoS+=TQString::fromLatin1(&C,1); + echoS+=TQString::tqfromLatin1(&C,1); } f+=16; } @@ -305,31 +305,31 @@ void Webcam::processMessage(const Message& message) { uint sess=rand()%1000+5000; uint rid=rand()%100+50; - m_myAuth=TQString("recipientid=%1&sessionid=%2\r\n\r\n").arg(rid).arg(sess); + m_myAuth=TQString("recipientid=%1&sessionid=%2\r\n\r\n").tqarg(rid).tqarg(sess); kdDebug(14140) << k_funcinfo << "m_myAuth= " << m_myAuth << endl; TQString producerxml=xml(sess , rid); kdDebug(14140) << k_funcinfo << "producerxml= " << producerxml << endl; makeSIPMessage(producerxml); } } - else if(m_content.contains("<producer>") || m_content.contains("<viewer>")) + else if(m_content.tqcontains("<producer>") || m_content.tqcontains("<viewer>")) { TQRegExp rx("<rid>([0-9]*)</rid>.*<session>([0-9]*)</session>"); rx.search(m_content); TQString rid=rx.cap(1); TQString sess=rx.cap(2); - if(m_content.contains("<producer>")) + if(m_content.tqcontains("<producer>")) { TQString viewerxml=xml(sess.toUInt() , rid.toUInt()); kdDebug(14140) << k_funcinfo << "vewerxml= " << viewerxml << endl; makeSIPMessage( viewerxml ,0x00,0x09,0x00 ); - m_peerAuth=m_myAuth=TQString("recipientid=%1&sessionid=%2\r\n\r\n").arg(rid,sess); + m_peerAuth=m_myAuth=TQString("recipientid=%1&sessionid=%2\r\n\r\n").tqarg(rid,sess); kdDebug(14140) << k_funcinfo << "m_auth= " << m_myAuth << endl; } else { - m_peerAuth=TQString("recipientid=%1&sessionid=%2\r\n\r\n").arg(rid,sess); + m_peerAuth=TQString("recipientid=%1&sessionid=%2\r\n\r\n").tqarg(rid,sess); makeSIPMessage("receivedViewerData", 0xec , 0xda , 0x03); } @@ -346,33 +346,33 @@ void Webcam::processMessage(const Message& message) TQObject::connect(m_listener, TQT_SIGNAL(gotError(int)), this, TQT_SLOT(slotListenError(int))); // Listen for incoming connections. bool isListening = m_listener->listen(); - kdDebug(14140) << k_funcinfo << (isListening ? TQString("listening %1").arg(m_listener->localAddress().toString()) : TQString("not listening")) << endl; + kdDebug(14140) << k_funcinfo << (isListening ? TQString("listening %1").tqarg(m_listener->localAddress().toString()) : TQString("not listening")) << endl; rx=TQRegExp("<tcpport>([^<]*)</tcpport>"); rx.search(m_content); TQString port1=rx.cap(1); if(port1=="0") - port1=TQString::null; + port1=TQString(); rx=TQRegExp("<tcplocalport>([^<]*)</tcplocalport>"); rx.search(m_content); TQString port2=rx.cap(1); if(port2==port1 || port2=="0") - port2=TQString::null; + port2=TQString(); rx=TQRegExp("<tcpexternalport>([^<]*)</tcpexternalport>"); rx.search(m_content); TQString port3=rx.cap(1); if(port3==port1 || port3==port2 || port3=="0") - port3=TQString::null; + port3=TQString(); int an=0; while(true) { an++; - if(!m_content.contains( TQString("<tcpipaddress%1>").arg(an) )) + if(!m_content.tqcontains( TQString("<tcpipaddress%1>").tqarg(an) )) break; - rx=TQRegExp(TQString("<tcpipaddress%1>([^<]*)</tcpipaddress%2>").arg(an).arg(an)); + rx=TQRegExp(TQString("<tcpipaddress%1>([^<]*)</tcpipaddress%2>").tqarg(an).tqarg(an)); rx.search(m_content); TQString ip=rx.cap(1); if(ip.isNull()) @@ -416,28 +416,28 @@ void Webcam::processMessage(const Message& message) kdDebug(14140) << k_funcinfo << "connect to " << sock << " - "<< sock->peerAddress().toString() << " ; " << sock->localAddress().toString() << endl; } } - else if(m_content.contains("receivedViewerData")) + else if(m_content.tqcontains("receivedViewerData")) { //I'm happy you received the xml i sent, really. } else error(); - m_content=TQString::null; + m_content=TQString(); } -void Webcam::makeSIPMessage(const TQString &message, Q_UINT8 XX, Q_UINT8 YY , Q_UINT8 ZZ) +void Webcam::makeSIPMessage(const TQString &message, TQ_UINT8 XX, TQ_UINT8 YY , TQ_UINT8 ZZ) { TQByteArray dataMessage; //(12+message.length()*2); TQDataStream writer(dataMessage, IO_WriteOnly); writer.setByteOrder(TQDataStream::LittleEndian); - writer << (Q_UINT8)0x80; - writer << (Q_UINT8)XX; - writer << (Q_UINT8)YY; - writer << (Q_UINT8)ZZ; - writer << (Q_UINT8)0x08; - writer << (Q_UINT8)0x00; + writer << (TQ_UINT8)0x80; + writer << (TQ_UINT8)XX; + writer << (TQ_UINT8)YY; + writer << (TQ_UINT8)ZZ; + writer << (TQ_UINT8)0x08; + writer << (TQ_UINT8)0x00; writer << message+'\0'; - //writer << (Q_UINT16)0x0000; + //writer << (TQ_UINT16)0x0000; /*TQString echoS=""; unsigned int f=0; @@ -462,7 +462,7 @@ void Webcam::makeSIPMessage(const TQString &message, Q_UINT8 XX, Q_UINT8 YY , Q_ { unsigned char X=dataMessage[q+f]; char C=((char)(( X<128 && X>31 ) ? X : '.')); - echoS+=TQString::fromLatin1(&C,1); + echoS+=TQString::tqfromLatin1(&C,1); } f+=16; } @@ -482,7 +482,7 @@ void Webcam::sendBigP2PMessage( const TQByteArray & dataMessage) { m_offset=f; TQByteArray dm2; - dm2.duplicate(dataMessage.data()+m_offset, QMIN(1200,m_totalDataSize-m_offset)); + dm2.duplicate(dataMessage.data()+m_offset, TQMIN(1200,m_totalDataSize-m_offset)); sendData( dm2 ); m_offset+=dm2.size(); } @@ -503,7 +503,7 @@ TQString Webcam::xml(uint session , uint rid) TQStringList ips=m_dispatcher->localIp(); for ( it = ips.begin(); it != ips.end(); ++it ) { - ip+=TQString("<tcpipaddress%1>%2</tcpipaddress%3>").arg(ip_number).arg(*it).arg(ip_number); + ip+=TQString("<tcpipaddress%1>%2</tcpipaddress%3>").tqarg(ip_number).tqarg(*it).tqarg(ip_number); ++ip_number; } @@ -749,7 +749,7 @@ void Webcam::slotSocketRead() TQByteArray buffer(24); m_webcamSocket->peekBlock(buffer.data(), buffer.size()); - Q_UINT32 paysize=(uchar)buffer[8] + ((uchar)buffer[9]<<8) + ((uchar)buffer[10]<<16) + ((uchar)buffer[11]<<24); + TQ_UINT32 paysize=(uchar)buffer[8] + ((uchar)buffer[9]<<8) + ((uchar)buffer[10]<<16) + ((uchar)buffer[11]<<24); if(available < (paysize+24)) { @@ -805,7 +805,7 @@ void Webcam::slotSocketClosed() void Webcam::slotSocketError(int errorCode) { KBufferedSocket *socket=const_cast<KBufferedSocket*>(static_cast<const KBufferedSocket*>(sender())); - kdDebug(14140) << k_funcinfo << socket << " - " << errorCode << " : " << socket->errorString() << endl; + kdDebug(14140) << k_funcinfo << socket << " - " << errorCode << " : " << socket->KSocketBase::errorString() << endl; //sendBYEMessage(); } @@ -868,13 +868,13 @@ void Webcam::timerEvent( TQTimerEvent *e ) TQDataStream writer(header, IO_WriteOnly); writer.setByteOrder(TQDataStream::LittleEndian); - writer << (Q_UINT16)24; // header size - writer << (Q_UINT16)img.width(); - writer << (Q_UINT16)img.height(); - writer << (Q_UINT16)0x0000; //wtf .? - writer << (Q_UINT32)frame.size(); - writer << (Q_UINT8)('M') << (Q_UINT8)('L') << (Q_UINT8)('2') << (Q_UINT8)('0'); - writer << (Q_UINT32)0x00000000; //wtf .? + writer << (TQ_UINT16)24; // header size + writer << (TQ_UINT16)img.width(); + writer << (TQ_UINT16)img.height(); + writer << (TQ_UINT16)0x0000; //wtf .? + writer << (TQ_UINT32)frame.size(); + writer << (TQ_UINT8)('M') << (TQ_UINT8)('L') << (TQ_UINT8)('2') << (TQ_UINT8)('0'); + writer << (TQ_UINT32)0x00000000; //wtf .? writer << TQTime::currentTime(); //FIXME: possible midnight bug ? m_webcamSocket->writeBlock(header.data(), header.size()); |