[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-27 18:02:50
Message-ID: 20050127180250.E824E1CFBB () office ! kde ! org
[Download RAW message or body]

CVS commit by ogoffart: 

Make sure to remove the group when no contact are still in.


  M +32 -6     msnaccount.cpp   1.105


--- kdenetwork/kopete/protocols/msn/msnaccount.cpp  #1.104:1.105
@@ -707,13 +707,20 @@ void MSNAccount::slotKopeteGroupRemoved(
                 if ( m_notifySocket )
                 {
-                        /*  -not needed anymore  remember that contact are supposed \
                to be deleted when a group is deleted.
-                        // if contact are contains only in the group we are \
removing, move it from the group 0 +                        bool \
still_have_contact=false; +                        // if contact are contains only in \
the group we are removing, abort the   QDictIterator<Kopete::Contact> it( contacts() \
);  for ( ; it.current(); ++it )
                         {
                                 MSNContact *c = static_cast<MSNContact *>( \
                it.current() );
-                                if ( c->serverGroups().contains( groupNumber ) && \
                c->serverGroups().count() == 1 )
-                                        m_notifySocket->addContact( c->contactId(), \
                c->displayName(), 0, MSNProtocol::FL );
-                        }*/
+                                if ( c->serverGroups().contains( groupNumber )  )
+                                {
+                                        /** don't do that becasue theses may already \
have been sent +                                        \
m_notifySocket->removeContact( c->contactId(), groupNumber, MSNProtocol::FL ); +      \
*/ +                                        still_have_contact=true;
+                                        break;
+                                }
+                        }
+                        if(!still_have_contact)
                         m_notifySocket->removeGroup( groupNumber );
                 }
@@ -1008,4 +1015,23 @@ void MSNAccount::slotContactRemoved( con
                         // Contact is removed from the FL list, remove it from the \
group  c->contactRemovedFromGroup( group );
+
+                        //check if the group is now empty to remove it
+                        if ( m_notifySocket )
+                        {
+                                bool still_have_contact=false;
+                                // if contact are contains only in the group we are \
removing, abort the  +                                QDictIterator<Kopete::Contact> \
it( contacts() ); +                                for ( ; it.current(); ++it )
+                                {
+                                        MSNContact *c = static_cast<MSNContact *>( \
it.current() ); +                                        if ( \
c->serverGroups().contains( group )  ) +                                        {
+                                                still_have_contact=true;
+                                                break;
+                                        }
+                                }
+                                if(!still_have_contact)
+                                        m_notifySocket->removeGroup( group );
+                        }
                 }
                 else if ( list == "BL" )


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

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