------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=113425         
ogoffart kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From ogoffart kde org  2006-03-05 17:34 -------
SVN commit 515993 by ogoffart:

workaround Bug 113425: Webcam stops unexpected ($contact has left the chat)

send a keep-alive message
please test.

BUG: 113425




 M  +38 -1     msnswitchboardsocket.cpp  
 M  +9 -1      msnswitchboardsocket.h  


--- branches/kopete/0.12/kopete/protocols/msn/msnswitchboardsocket.cpp 
#515992:515993
 @ -2,7 +2,7  @
     msnswitchboardsocket.cpp - switch board connection socket
 
     Copyright (c) 2002      by Martijn Klingens       <klingens kde org>
-    Copyright (c) 2002-2005 by Olivier Goffart        <ogoffart@ kde.org>
+    Copyright (c) 2002-2006 by Olivier Goffart        <ogoffart@ kde.org>
     Kopete    (c) 2002-2005 by the Kopete developers  <kopete-devel kde org>
 
     Portions of this code are taken from KMerlin,
 @ -72,6 +72,7  @
        m_chunks=0;
        m_clientcapsSent=false;
        m_dispatcher = 0l;
+       m_keepAlive = 0l;
 }
 
 MSNSwitchBoardSocket::~MSNSwitchBoardSocket()
 @ -846,6 +847,13  @
                        args = m_myHandle + " " + m_auth + " " + m_ID;
                }
                sendCommand( command, args );
+               
+               if(!m_keepAlive)
+               {
+                       m_keepAlive=new QTimer(this);
+                       QObject::connect(m_keepAlive, SIGNAL(timeout()) , this 
, SLOT(slotKeepAliveTimer()));
+                       m_keepAlive->start(50*1000);
+               }
        }
 }
 
 @ -1065,6 +1073,35  @
        return m_dispatcher;
 }
 
+void MSNSwitchBoardSocket::slotKeepAliveTimer( )
+{
+       /*
+       This is a workaround against the bug 113425
+       The problem:  the P2P::Webcam class is parent of us, and when we get 
deleted, it get deleted.
+                       the correct solution would be to change that.
+       The second problem: after one minute of inactivity, the official client 
close the chat socket.
+       the workaround: we simulate the activity by sending small packet each 
50 seconds
+       the nice side effect:  the "xxx has closed the chat" is now meaningfull
+       the bad side effect:  some switchboard connection may be maintained for 
really long time!
+        */
+       
+       if ( onlineStatus() != Connected || m_chatMembers.empty())
+       {
+               //we are not yet in a chat.
+               //if we send that command now, we may get disconnected.
+               return;
+       }
+
+
+       QCString message = QString( "MIME-Version: 1.0\r\n"
+                       "Content-Type: text/x-keepalive\r\n"
+                       "\r\n" ).utf8();
+
+       // Length is appended by sendCommand()
+       QString args = "U";
+       sendCommand( "MSG", args, true, message );
+}
+
 #include "msnswitchboardsocket.moc"
 
 // vim: set noet ts=4 sts=4 sw=4:
--- branches/kopete/0.12/kopete/protocols/msn/msnswitchboardsocket.h 
#515992:515993
 @ -2,7 +2,7  @
     msnswitchboardsocket.h - switch board connection socket
 
     Copyright (c) 2002      by Martijn Klingens       <klingens kde org>
-    Copyright (c) 2002-2005 by Olivier Goffart        <ogoffart@ kde.org>
+    Copyright (c) 2002-2006 by Olivier Goffart        <ogoffart@ kde.org>
     Kopete    (c) 2002-2005 by the Kopete developers  <kopete-devel kde org>
 
     Portions of this code are taken from KMerlin,
 @ -129,7 +129,12  @
        void sendTypingMsg( bool isTyping );
 
        void requestDisplayPicture();
+       
+       /** workaround Bug 113425 . see slotKeepAliveTimer() **/
+       QTimer *m_keepAlive;
+       
 
+
 private slots:
        void slotOnlineStatusChanged( MSNSocket::OnlineStatus status );
        void slotSocketClosed(  );
 @ -137,6 +142,9  @
        void slotEmoticonReceived( KTempFile *, const QString& );
        void slotIncomingFileTransfer(const QString& from, const QString& 
fileName, Q_INT64 fileSize);
        void cleanQueue();
+       
+       /** workaround Bug 113425 . see comment inside the function **/
+       void slotKeepAliveTimer();
 
 signals:
        void msgReceived( Kopete::Message &msg );
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to