[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenetwork/kopete/protocols/msn
From:       Olivier Goffart <ogoffart () kde ! org>
Date:       2005-01-26 16:36:07
Message-ID: 20050126163607.A0D301D1D5 () office ! kde ! org
[Download RAW message or body]

CVS commit by ogoffart: 

The MSN option "Open chatwindow chan the contact start a chat" behavior has changed.

Now, the window is only openend if the user start typing.
This is because many contact open the window just to get the display picture.
Or Gaim, which open socket everytime for no known reason.


  M +9 -0      msnaccount.cpp   1.104
  M +29 -0     msnmessagemanager.cpp   1.114
  M +11 -0     msnmessagemanager.h   1.36


--- kdenetwork/kopete/protocols/msn/msnaccount.cpp  #1.103:1.104
@@ -1059,4 +1059,12 @@ void MSNAccount::slotCreateChat( const Q
                 manager->createChat( handle, address, auth, ID );
 
+                /**
+                 *  This code should open a chatwindow when a socket is open
+                 * It has been disabled because gaim open switchboeard too often
+                 *
+                 * the solution is to open the window only when the contact start \
typing +                 * see MSNChatSession::receivedTypingMsg
+                 *
+
                 KGlobal::config()->setGroup( "MSN" );
                 bool notifyNewChat = KGlobal::config()->readBoolEntry( \
"NotifyNewChat", false ); @@ -1068,4 +1076,5 @@ void MSNAccount::slotCreateChat( \
const Q  manager->appendMessage( tmpMsg );
                 }
+                 */
         }
 

--- kdenetwork/kopete/protocols/msn/msnmessagemanager.cpp  #1.113:1.114
@@ -35,4 +35,5 @@
 
 #include "kopetecontactaction.h"
+#include "kopetemetacontact.h"
 #include "kopetecontactlist.h"
 #include "kopetemessagemanagerfactory.h"
@@ -57,4 +58,5 @@ MSNChatSession::MSNChatSession( Kopete::
         m_chatService = 0l;
 //      m_msgQueued = 0L;
+        m_newSession = true;
 
         setInstance(protocol->instance());
@@ -125,4 +127,9 @@ void MSNChatSession::createChat( const Q
         const QString &address, const QString &auth, const QString &ID )
 {
+        /** disabled because i don't want to reopen a chatwindow if we just closed \
it +         * and the contact take much time to type his message
+         m_newSession= !(ID.isEmpty());
+        */
+        
         if( m_chatService )
         {
@@ -208,4 +215,5 @@ void MSNChatSession::slotSwitchBoardClos
 void MSNChatSession::slotMessageSent(Kopete::Message &message,Kopete::ChatSession *)
 {
+        m_newSession=false;
         if(m_chatService)
         {
@@ -245,4 +253,5 @@ void MSNChatSession::slotMessageSent(Kop
 void MSNChatSession::slotMessageReceived( Kopete::Message &msg )
 {
+        m_newSession=false;
         if( msg.plainBody().startsWith( "AutoMessage: " ) )
         {
@@ -590,4 +599,24 @@ void MSNChatSession::slotDebugRawCommand
 
 
+void MSNChatSession::receivedTypingMsg( const QString &contactId, bool b )
+{
+        MSNContact *c = dynamic_cast<MSNContact *>( account()->contacts()[ contactId \
] ); +        if(c && m_newSession &&  !view(false))
+        {
+                //this was originaly in MSNAccount::slotCreateChat
+                KGlobal::config()->setGroup( "MSN" );
+                bool notifyNewChat = KGlobal::config()->readBoolEntry( \
"NotifyNewChat", false ); +                if (  notifyNewChat  )
+                {
+                        // this internal message should open the window if they not \
exist +                        QString body = i18n( "%1 has started a chat with you" \
).arg( c->metaContact()->displayName() ); +                        Kopete::Message \
tmpMsg = Kopete::Message( c, members(), body, Kopete::Message::Internal, \
Kopete::Message::PlainText ); +                        appendMessage( tmpMsg );
+                }
+        }
+        m_newSession=false;
+        Kopete::ChatSession::receivedTypingMsg(c,b);
+}
+
 #include "msnmessagemanager.moc"
 

--- kdenetwork/kopete/protocols/msn/msnmessagemanager.h  #1.35:1.36
@@ -62,4 +62,10 @@ public slots:
         void slotRequestPicture();
 
+        /**
+         * this is a reimplementation of ChatSesstion slot.
+         * the original slot is not virtual, but that's not a problem because it's a \
slot. +         */
+        virtual void receivedTypingMsg( const QString &, bool );
+
 private slots:
         void slotMessageSent( Kopete::Message &message, Kopete::ChatSession *kmm );
@@ -99,4 +105,9 @@ private:
         QTime m_awayMessageTime;
 
+        /**
+         * weither or not the "has opened a new chat" message need to be sent if the \
user is typing +         */
+        bool m_newSession;
+
         QLabel *m_image;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic