------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=133950         
kedgedev centrum cz changed:

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



------- Additional Comments From kedgedev centrum cz  2007-03-22 01:10 -------
SVN commit 645234 by rjarosz:

Update our local Server Side Info correctly.
Fix authorization status in ICQ.

Fix bug 133950: adding users to visible/invisible list does not work
Please test it because I can't reproduce it.

BUG: 133950



 M  +23 -1     liboscar/client.cpp  
 M  +0 -9      liboscar/ssiauthtask.cpp  
 M  +62 -27    liboscar/ssimanager.cpp  
 M  +3 -2      liboscar/ssimanager.h  
 M  +116 -12   liboscar/ssimodifytask.cpp  
 M  +12 -1     liboscar/ssimodifytask.h  
 M  +1 -1      oscarcontact.cpp  


--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/liboscar/client.cpp 
#645233:645234
 @ -111,6 +111,7  @
        ICQUserInfoRequestTask* icqInfoTask;
        UserInfoTask* userInfoTask;
        TypingNotifyTask * typingNotifyTask;
+       SSIModifyTask* ssiModifyTask;
        //Managers
        SSIManager* ssiManager;
        ConnectionHandler connections;
 @ -160,6 +161,7  @
        d->userInfoTask = 0L;
        d->stage = ClientPrivate::StageOne;
        d->typingNotifyTask = 0L;
+       d->ssiModifyTask = 0L;
        d->awayMsgRequestTimer = new QTimer();
        d->codecProvider = &defaultCodecProvider;
 
 @ -619,6 +621,7  @
        d->icqInfoTask = new ICQUserInfoRequestTask( c->rootTask() );
        d->userInfoTask = new UserInfoTask( c->rootTask() );
        d->typingNotifyTask = new TypingNotifyTask( c->rootTask() );
+       d->ssiModifyTask = new SSIModifyTask( c->rootTask(), true );
 
        connect( d->onlineNotifier, SIGNAL( userIsOnline( const QString&, const 
UserDetails& ) ),
                 this, SIGNAL( receivedUserInfo( const QString&, const 
UserDetails& ) ) );
 @ -660,6 +663,8  @
        SSIModifyTask* ssimt = new SSIModifyTask( c->rootTask() );
        if ( ssimt->removeGroup( groupName ) )
                ssimt->go( true );
+       else
+               delete ssimt;
 }
 
 void Client::addGroup( const QString& groupName )
 @ -672,6 +677,8  @
        SSIModifyTask* ssimt = new SSIModifyTask( c->rootTask() );
        if ( ssimt->addGroup( groupName ) )
                ssimt->go( true );
+       else
+               delete ssimt;
 }
 
 void Client::addContact( const QString& contactName, const QString& groupName )
 @ -684,7 +691,8  @
        SSIModifyTask* ssimt = new SSIModifyTask( c->rootTask() );
        if ( ssimt->addContact( contactName, groupName )  )
                ssimt->go( true );
-
+       else
+               delete ssimt;
 }
 
 void Client::removeContact( const QString& contactName )
 @ -697,6 +705,8  @
        SSIModifyTask* ssimt = new SSIModifyTask( c->rootTask() );
        if ( ssimt->removeContact( contactName ) )
                ssimt->go( true );
+       else
+               delete ssimt;
 }
 
 void Client::renameGroup( const QString & oldGroupName, const QString & 
newGroupName )
 @ -709,6 +719,8  @
        SSIModifyTask* ssimt = new SSIModifyTask( c->rootTask() );
        if ( ssimt->renameGroup( oldGroupName, newGroupName ) )
                ssimt->go( true );
+       else
+               delete ssimt;
 }
 
 void Client::modifySSIItem( const Oscar::SSI& oldItem, const Oscar::SSI& 
newItem )
 @ -730,14 +742,20  @
        case 0:
                if ( ssimt->modifyItem( oldItem, newItem ) )
                        ssimt->go( true );
+               else
+                       delete ssimt;
                break;
        case 1:
                if ( ssimt->addItem( newItem ) )
                        ssimt->go( true );
+               else
+                       delete ssimt;
                break;
        case 2:
                if ( ssimt->removeItem( oldItem ) )
                        ssimt->go( true );
+               else
+                       delete ssimt;
                break;
        }
 }
 @ -753,6 +771,8  @
        SSIModifyTask* ssimt = new SSIModifyTask( c->rootTask() );
        if ( ssimt->changeGroup( contact, newGroupName ) )
                ssimt->go( true );
+       else
+               delete ssimt;
 }
 
 void Client::requestFullInfo( const QString& contactId )
 @ -1306,6 +1326,7  @
        delete d->icqInfoTask;
        delete d->userInfoTask;
        delete d->typingNotifyTask;
+       delete d->ssiModifyTask;
 
        d->errorTask = 0;
        d->onlineNotifier = 0;
 @ -1315,6 +1336,7  @
        d->icqInfoTask = 0;
        d->userInfoTask = 0;
        d->typingNotifyTask = 0;
+       d->ssiModifyTask = 0;
 }
 
 bool Client::hasIconConnection( ) const
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/liboscar/ssiauthtask.cpp 
#645233:645234
 @ -112,10 +112,6  @
        
        Transfer* t = createTransfer( f, s, buf );
        send( t );
-       
-       Oscar::SSI contact = m_manager->findContact( uin );
-       if ( contact )
-               contact.setWaitingAuth( true );
 }
 
 void SSIAuthTask::sendAuthReply( const QString& uin, const QString& reason, 
bool auth )
 @ -175,11 +171,6  @
                kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Authorization 
request declined by " << uin << endl;
                
        kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Reason: " << reason << 
endl;
-       
-       Oscar::SSI sender = m_manager->findContact( uin );
-       if ( sender )
-               sender.setWaitingAuth( false );
-               
        emit authReplied( uin, reason, accepted );
 }
 
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/liboscar/ssimanager.cpp 
#645233:645234
 @ -439,26 +439,27  @
        return false;
 }
 
-bool SSIManager::updateGroup( const Oscar::SSI& oldGroup, const Oscar::SSI& 
newGroup )
+bool SSIManager::updateGroup( const Oscar::SSI& group )
 {
-       removeID( oldGroup );
-       if ( d->SSIList.remove( oldGroup ) == 0 )
+       Oscar::SSI oldGroup = findGroup( group.name() );
+
+       if ( oldGroup.isValid() )
        {
-               kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "No group were 
removed." << endl;
-               return false;
+               removeID( oldGroup );
+               d->SSIList.remove( oldGroup );
        }
-       
-       if ( d->SSIList.findIndex( newGroup ) != -1 )
+
+       if ( d->SSIList.findIndex( group ) != -1 )
        {
                kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "New group is already 
in list." << endl;
                return false;
        }
-       
-       kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Updating group '" << 
newGroup.name() << "' in SSI list" << endl;
-       d->SSIList.append( newGroup );
-       addID( newGroup );
-       emit groupUpdated( newGroup );
-       
+
+       kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Updating group '" << 
group.name() << "' in SSI list" << endl;
+       d->SSIList.append( group );
+       addID( group );
+       emit groupUpdated( group );
+
        return true;
 }
 
 @ -507,26 +508,27  @
        return true;
 }
 
-bool SSIManager::updateContact( const Oscar::SSI& oldContact, const 
Oscar::SSI& newContact )
+bool SSIManager::updateContact( const Oscar::SSI& contact )
 {
-       removeID( oldContact );
-       if ( d->SSIList.remove( oldContact ) == 0 )
+       Oscar::SSI oldContact = findContact( contact.name() );
+
+       if ( oldContact.isValid() )
        {
-               kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "No contacts were 
removed." << endl;
-               return false;
+               removeID( oldContact );
+               d->SSIList.remove( oldContact );
        }
-       
-       if ( d->SSIList.findIndex( newContact ) != -1 )
+
+       if ( d->SSIList.findIndex( contact ) != -1 )
        {
                kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "New contact is 
already in list." << endl;
                return false;
        }
+
+       kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Updating contact '" << 
contact.name() << "' in SSI list" << endl;
+       addID( contact );
+       d->SSIList.append( contact );
+       emit contactUpdated( contact );
        
-       kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Updating contact '" << 
newContact.name() << "' in SSI list" << endl;
-       addID( newContact );
-       d->SSIList.append( newContact );
-       emit contactUpdated( newContact );
-       
        return true;
 }
 
 @ -560,17 +562,50  @
 
 bool SSIManager::newItem( const Oscar::SSI& item )
 {
-       //no error checking for now
+       if ( d->SSIList.findIndex( item ) != -1 )
+       {
+               kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Item is already in 
list." << endl;
+               return false;
+       }
+
        kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Adding item " << 
item.toString() << endl;
        d->SSIList.append( item );
        addID( item );
        return true;
 }
 
+bool SSIManager::updateItem( const Oscar::SSI& item )
+{
+       Oscar::SSI oldItem = findItem( item.name(), item.type() );
+
+       if ( oldItem.isValid() )
+       {
+               removeID( oldItem );
+               d->SSIList.remove( oldItem );
+       }
+
+       if ( d->SSIList.findIndex( item ) != -1 )
+       {
+               kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "New item is already 
in list." << endl;
+               return false;
+       }
+
+       kdDebug( OSCAR_RAW_DEBUG ) << k_funcinfo << "Updating item in SSI list" 
<< endl;
+       addID( item );
+       d->SSIList.append( item );
+       return true;
+}
+
 bool SSIManager::removeItem( const Oscar::SSI& item )
 {
-       d->SSIList.remove( item );
+       int remcount = d->SSIList.remove( item );
        removeID( item );
+
+       if ( remcount == 0 )
+       {
+               kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "No items were 
removed." << endl;
+               return false;
+       }
        
        return true;
 }
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/liboscar/ssimanager.h 
#645233:645234
 @ -104,16 +104,17  @
 
 public slots:
        bool newGroup( const Oscar::SSI& group );
-       bool updateGroup( const Oscar::SSI& oldGroup, const Oscar::SSI& 
newGroup );
+       bool updateGroup( const Oscar::SSI& group );
        bool removeGroup( const Oscar::SSI& group );
        bool removeGroup( const QString& group );
 
        bool newContact( const Oscar::SSI& contact );
-       bool updateContact( const Oscar::SSI& oldContact, const Oscar::SSI& 
newContact );
+       bool updateContact( const Oscar::SSI& contact );
        bool removeContact( const Oscar::SSI& contact );
        bool removeContact( const QString& contact );
        
        bool newItem( const Oscar::SSI& item );
+       bool updateItem( const Oscar::SSI& item );
        bool removeItem( const Oscar::SSI& item );
 
        void addID( const Oscar::SSI& item );
--- 
branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/liboscar/ssimodifytask.cpp 
#645233:645234
 @ -28,9 +28,10  @
 #include "transfer.h"
 
 
-SSIModifyTask::SSIModifyTask( Task* parent ) : Task( parent )
+SSIModifyTask::SSIModifyTask( Task* parent, bool staticTask ) : Task( parent )
 {
        m_ssiManager = parent->client()->ssiManager();
+       m_static = staticTask;
        m_opType = NoType;
        m_opSubject = NoSubject;
        m_id = 0;
 @ -50,9 +51,22  @
 {
        if ( forMe( transfer ) )
        {
-               setTransfer( transfer );
-               handleSSIAck();
-               setTransfer( 0 );
+               SnacTransfer* st = dynamic_cast<SnacTransfer*>( transfer );
+               if ( st )
+               {
+                       setTransfer( transfer );
+                       
+                       if ( st->snacSubtype() == 0x0008 )
+                               handleSSIAdd();
+                       else if ( st->snacSubtype() == 0x0009 )
+                               handleSSIUpdate();
+                       else if ( st->snacSubtype() == 0x000A )
+                               handleSSIRemove();
+                       else if ( st->snacSubtype() == 0x000E )
+                               handleSSIAck();
+                       
+                       setTransfer( 0 );
+               }
                return true;
        }
        else
 @ -201,11 +215,23  @
        const SnacTransfer* st = dynamic_cast<const SnacTransfer*>( transfer );
        if ( !st )
                return false;
+
+       if ( st->snacService() == 0x0013 )
+       {
+               WORD subtype = st->snacSubtype();
+               if ( m_static )
+               {
+                       if ( subtype == 0x0008 || subtype == 0x0009 || subtype 
== 0x000A )
+                               return true;
+               }
+               else
+               {
+                       if ( subtype == 0x000E && m_id == st->snac().id )
+                               return true;
+               }
+       }
        
-       if ( st->snacService() == 0x0013 && st->snacSubtype() == 0x000E && m_id 
== st->snac().id )
-               return true;
-       else
-               return false;
+       return false;
 }
 
 void SSIModifyTask::handleSSIAck()
 @ -429,9 +455,9  @
                else if ( m_opSubject == Group )
                {
                        if ( m_opType == Rename )
-                               m_ssiManager->updateGroup( m_oldItem, m_newItem 
);
+                               m_ssiManager->updateGroup( m_newItem );
                        else if ( m_opType == Change )
-                               m_ssiManager->updateContact( m_oldItem, 
m_newItem );
+                               m_ssiManager->updateContact( m_newItem );
                }
                else if ( m_opSubject == NoSubject )
                {
 @ -443,7 +469,7  @
                setSuccess( 0, QString::null );
                return;
        }
-       
+
        if ( m_oldItem.isValid() && !m_newItem )
        {
                kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Removing " << 
m_oldItem.name() << " from SSI manager" << endl;
 @ -469,7 +495,7  @
                setSuccess( 0, QString::null );
                return;
        }
-       
+
        setSuccess( 0, QString::null );
 }
 
 @ -530,4 +556,82  @
                buffer->addTLV( ( *it ) );
 }
 
+Oscar::SSI SSIModifyTask::getItemFromBuffer( Buffer* buffer ) const
+{
+       QValueList<TLV> tlvList;
+       
+       WORD strlength = buffer->getWord();
+       QString itemName = QString::fromUtf8( buffer->getBlock( strlength ), 
strlength );
+       WORD groupId = buffer->getWord();
+       WORD itemId = buffer->getWord();
+       WORD itemType = buffer->getWord();
+       WORD tlvLength = buffer->getWord();
+       for ( int i = 0; i < tlvLength; )
+       {
+               TLV t = buffer->getTLV();
+               i += 4;
+               i += t.length;
+               tlvList.append( t );
+       }
+               
+       if ( itemType == ROSTER_CONTACT )
+               itemName = Oscar::normalize( itemName );
+               
+       return Oscar::SSI( itemName, groupId, itemId, itemType, tlvList );
+}
+
+void SSIModifyTask::handleSSIAdd()
+{
+       Buffer* b = transfer()->buffer();
+
+       while ( b->length() > 0 )
+       {
+               Oscar::SSI item = getItemFromBuffer( b );
+               kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Adding " << 
item.name() << " to SSI manager" << endl;
+
+               if ( item.type() == ROSTER_GROUP )
+                       m_ssiManager->newGroup( item );
+               else if ( item.type() == ROSTER_CONTACT )
+                       m_ssiManager->newContact( item );
+               else
+                       m_ssiManager->newItem( item );
+       }
+}
+
+void SSIModifyTask::handleSSIUpdate()
+{
+       Buffer* b = transfer()->buffer();
+
+       while ( b->length() > 0 )
+       {
+               Oscar::SSI item = getItemFromBuffer( b );
+               kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Updating " << 
item.name() << " in SSI manager" << endl;
+
+               if ( item.type() == ROSTER_GROUP )
+                       m_ssiManager->updateGroup( item );
+               else if ( item.type() == ROSTER_CONTACT )
+                       m_ssiManager->updateContact( item );
+               else
+                       m_ssiManager->updateItem( item );
+       }
+}
+
+void SSIModifyTask::handleSSIRemove()
+{
+       Buffer* b = transfer()->buffer();
+
+       while ( b->length() > 0 )
+       {
+               Oscar::SSI item = getItemFromBuffer( b );
+               kdDebug(OSCAR_RAW_DEBUG) << k_funcinfo << "Removing " << 
item.name() << " from SSI manager" << endl;
+
+               if ( item.type() == ROSTER_GROUP )
+                       m_ssiManager->removeGroup( item );
+               else if ( item.type() == ROSTER_CONTACT )
+                       m_ssiManager->removeContact( item );
+               else
+                       m_ssiManager->removeItem( item );
+       }
+}
+
 //kate: tab-width 4; indent-mode csands;
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/liboscar/ssimodifytask.h 
#645233:645234
 @ -51,7 +51,7  @
 class SSIModifyTask : public Task
 {
 public:
-    SSIModifyTask(Task* parent);
+    SSIModifyTask( Task* parent, bool staticTask = false );
     ~SSIModifyTask();
 
        virtual void onGo();
 @ -128,7 +128,17  @
        void sendEditEnd();
        
        void addItemToBuffer( Oscar::SSI item, Buffer* buffer );
+       Oscar::SSI getItemFromBuffer( Buffer* buffer ) const;
        
+       //! Handle server request to add item
+       void handleSSIAdd();
+       
+       //! Handle server request to update item
+       void handleSSIUpdate();
+       
+       //! Handle server request to remove item
+       void handleSSIRemove();
+
 private:
        SSI m_oldItem;
        SSI m_newItem;
 @ -137,6 +147,7  @
        OperationSubject m_opSubject;
        WORD m_id;
        SSIManager* m_ssiManager;
+       bool m_static;
        
 };
 
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/oscarcontact.cpp 
#645233:645234
 @ -142,7 +142,7  @
        if( !metaContact() || metaContact()->isTemporary() )
                return;
        
-       if ( flags & Kopete::Contact::MovedBetweenGroup == 
Kopete::Contact::MovedBetweenGroup )
+       if ( (flags & Kopete::Contact::MovedBetweenGroup) == 
Kopete::Contact::MovedBetweenGroup )
        {
                kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "Moving a contact 
between groups" << endl;
                SSIManager* ssiManager = mAccount->engine()->ssiManager();
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to