From kde-commits Tue Dec 31 20:51:03 2002 From: =?utf-8?q?Tom=20Linsky?= Date: Tue, 31 Dec 2002 20:51:03 +0000 To: kde-commits Subject: kdenonbeta/kopete/protocols/oscar X-MARC-Message: https://marc.info/?l=kde-commits&m=104136793720791 CVS commit by linsky: Fixed bug 51213 (Metacontacts only remember one Oscar contact) M +3 -1 oscarcontact.cpp 1.36 M +21 -10 oscarprotocol.cpp 1.39 --- kdenonbeta/kopete/protocols/oscar/oscarcontact.cpp #1.35:1.36 @@ -562,6 +562,8 @@ QStringList OscarContact::removeTag ( QS } */ -void OscarContact::slotMoved(KopeteMetaContact * /*old */) +void OscarContact::slotMoved(KopeteMetaContact * old ) { + disconnect(old, SIGNAL(aboutToSave(KopeteMetaContact*)), 0, 0); + connect (metaContact() , SIGNAL( aboutToSave(KopeteMetaContact*) ), protocol(), SLOT (serialize(KopeteMetaContact*) )); --- kdenonbeta/kopete/protocols/oscar/oscarprotocol.cpp #1.38:1.39 @@ -524,13 +524,19 @@ void OscarProtocol::serialize( KopeteMet { QStringList strList; - KopeteContact *c; - for( c = metaContact->contacts().first(); c ; c = metaContact->contacts().next() ) + QStringList stream; + QPtrList contacts = metaContact->contacts(); + for( KopeteContact *c = contacts.first(); c ; c = contacts.next() ) { - if( c->protocol()->pluginId() == this->pluginId() ){ - OscarContact *g = static_cast(c); - strList << g->contactId() << g->data(); + if ( c->protocol()->pluginId() != this->pluginId() ) // not our contact, next one please + continue; + + OscarContact *m = dynamic_cast(c); + + if( m ) + { + stream << m->contactId() << m->displayName(); } } - metaContact->setPluginData(this , strList); + metaContact->setPluginData(this , stream); } @@ -544,8 +550,13 @@ void OscarProtocol::deserialize( KopeteM kdDebug() << "[OscarProtocol] in deserialize, strList[0]: " << strList[0] << endl; + for ( QStringList::ConstIterator it = strList.begin(); it != strList.end(); ++it ) + { QString group= "Unknow"; if(!metaContact->groups().isEmpty()) group=metaContact->groups().first()->displayName(); - addNewContact(strList[0], strList[1], strList[1].isEmpty() ? false : true, group, metaContact); + QString tmpstr = *it; + it++; + addNewContact(tmpstr, *it, ( *it ).isEmpty() ? false : true, group, metaContact); + } }