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

List:       kde-bugs-dist
Subject:    [Bug 102399] [liboscar/icq] all contacts shown offline
From:       Matt Rogers <mattr () kde ! org>
Date:       2005-09-05 20:56:01
Message-ID: 20050905205601.24322.qmail () ktown ! kde ! org
[Download RAW message or body]

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

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



------- Additional Comments From mattr kde org  2005-09-05 22:55 -------
SVN commit 457416 by mattr:

Tell users that they don't have certain contacts on their server side
contact list and give them the option to add them. Fixes bug 102399. Please
make sure it works for you.

BUG: 102399.


 M  +3 -1      Makefile.am  
 M  +9 -0      icq/icqprotocol.cpp  
 M  +89 -1     oscaraccount.cpp  
 M  +2 -0      oscaraccount.h  
 M  +4 -1      oscarcontact.cpp  
 M  +14 -1     oscarlistnonservercontacts.cpp  
 M  +7 -0      oscarlistnonservercontacts.h  


--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/Makefile.am #457415:457416
 @ -6,6 +6,8  @
 
 lib_LTLIBRARIES = libkopete_oscar.la
 
-libkopete_oscar_la_SOURCES = oscaraccount.cpp oscarcontact.cpp \
oscarmyselfcontact.cpp oscarencodingselectionbase.ui oscarencodingselectiondialog.cpp \
+libkopete_oscar_la_SOURCES = oscaraccount.cpp oscarcontact.cpp \
oscarmyselfcontact.cpp \ +	oscarencodingselectionbase.ui \
oscarencodingselectiondialog.cpp \ +	oscarlistcontactsbase.ui \
oscarlistnonservercontacts.cpp  libkopete_oscar_la_LDFLAGS = -no-undefined \
-version-info 2:0:0 $(all_libraries)  libkopete_oscar_la_LIBADD  = $(LIB_KIO) \
                $(top_builddir)/kopete/libkopete/libkopete.la ./liboscar/liboscar.la
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/icq/icqprotocol.cpp \
#457415:457416  @ -760,12 +760,21  @
 	uint ssiGid = 0, ssiBid = 0, ssiType = 0xFFFF;
 	QString ssiName;
 	bool ssiWaitingAuth = false;
+    if ( serializedData.contains( "ssi_name" ) )
 	ssiName = serializedData["ssi_name"];
+
+    if ( serializedData.contains( "ssi_waitingAuth" ) )
+    {
 	QString authStatus = serializedData["ssi_waitingAuth"];
 	if ( authStatus == "true" )
 		ssiWaitingAuth = true;
+    }
+
+    if ( serializedData.contains( "ssi_gid" ) )
 	ssiGid = serializedData["ssi_gid"].toUInt();
+    if ( serializedData.contains( "ssi_bid" ) )
 	ssiBid = serializedData["ssi_bid"].toUInt();
+    if ( serializedData.contains( "ssi_type" ) )
 	ssiType = serializedData["ssi_type"].toUInt();
 
 	Oscar::SSI item( ssiName, ssiGid, ssiBid, ssiType, QValueList<TLV>(), 0 );
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/oscaraccount.cpp \
#457415:457416  @ -51,6 +51,7  @
 #include "oscarclientstream.h"
 #include "oscarconnector.h"
 #include "ssimanager.h"
+#include "oscarlistnonservercontacts.h"
 #include <qtextcodec.h>
 
 class OscarAccountPrivate
 @ -68,6 +69,7  @
 	//contacts waiting on their group to be added
 	QMap<QString, QString> contactAddQueue;
 
+    OscarListNonServerContacts* olnscDialog;
 
 };
 
 @ -79,7 +81,7  @
 
 	d = new OscarAccountPrivate;
 	d->engine = new Client( this );
-
+    d->olnscDialog = 0L;
     QObject::connect( d->engine, SIGNAL( loggedIn() ), this, SLOT( loginActions() ) \
);  QObject::connect( d->engine, SIGNAL( messageReceived( const Oscar::Message& ) ),
 	                  this, SLOT( messageReceived(const Oscar::Message& ) ) );
 @ -238,9 +240,95  @
 	                  this, SLOT( ssiGroupAdded( const Oscar::SSI& ) ) );
 
     //TODO: check the kopete contact list and handle non server side contacts \
appropriately. +    QDict<Kopete::Contact> nonServerContacts = contacts();
+    QDictIterator<Kopete::Contact> it( nonServerContacts );
+    QStringList nonServerContactList;
+    for ( ; it.current(); ++it )
+    {
+        OscarContact* oc = dynamic_cast<OscarContact*>( ( *it ) );
+        if ( !oc )
+            continue;
+        kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << oc->contactId() << " contact ssi \
type: " << oc->ssiItem().type() << endl; +        if ( !oc->isOnServer() )
+            nonServerContactList.append( ( *it )->contactId() );
+    }
+    kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "the following contacts are not on the \
server side list" +                             << nonServerContactList << endl;
+    if ( !nonServerContactList.isEmpty() )
+    {
+        d->olnscDialog = new OscarListNonServerContacts( \
Kopete::UI::Global::mainWidget() ); +        QObject::connect( d->olnscDialog, \
SIGNAL( closing() ), +                          this, SLOT( \
nonServerAddContactDialogClosed() ) ); +        d->olnscDialog->addContacts( \
nonServerContactList ); +        d->olnscDialog->show();
+    }
 }
 
+void OscarAccount::nonServerAddContactDialogClosed()
+{
+    //use sender() because i'm lazy
+    if ( !d->olnscDialog )
+        return;
 
+    kdDebug(OSCAR_GEN_DEBUG) << "non server contacts notification dialog closed" << \
endl; +    if ( d->olnscDialog->result() == QDialog::Accepted )
+    {
+        //start adding contacts
+        kdDebug(OSCAR_GEN_DEBUG) << "adding non server contacts to the contact list" \
<< endl; +        //get the contact list. get the OscarContact object, then the group
+        //check if the group is on ssi, if not, add it
+        //if so, add the contact.
+        QStringList offliners = d->olnscDialog->nonServerContactList();
+        QStringList::iterator it, itEnd = offliners.end();
+        for ( it = offliners.begin(); it != itEnd; ++it )
+        {
+            OscarContact* oc = dynamic_cast<OscarContact*>( contacts()[( *it )] );
+            if ( !oc )
+            {
+                kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "no OscarContact object \
available for" +                                         << ( *it ) << endl;
+                continue;
+            }
+
+            Kopete::MetaContact* mc = oc->metaContact();
+            if ( !mc )
+            {
+                kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "no metacontact object \
available for" +                                         << ( oc->contactId() ) << \
endl; +                continue;
+            }
+
+            Kopete::Group* group = mc->groups().first();
+            if ( !group )
+            {
+                kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "no metacontact object \
available for" +                                         << ( oc->contactId() ) << \
endl; +                continue;
+            }
+
+            SSIManager* listManager = d->engine->ssiManager();
+            if ( !listManager->findGroup( group->displayName() ) )
+            {
+                kdDebug(OSCAR_GEN_DEBUG) << k_funcinfo << "adding non-existant group \
" +                                         << group->displayName() << endl;
+                d->contactAddQueue[Oscar::normalize( ( *it ) )] = \
group->displayName(); +                d->engine->addGroup( group->displayName() );
+            }
+            else
+            {
+                d->engine->addContact( ( *it ), group->displayName() );
+            }
+        }
+
+
+    }
+    else
+        kdDebug(OSCAR_GEN_DEBUG) << "NOT adding non server contacts to the contact \
list" << endl; +
+    d->olnscDialog->delayedDestruct();
+    d->olnscDialog = 0L;
+}
+
 void OscarAccount::slotGoOffline()
 {
 	OscarAccount::disconnect();
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/oscaraccount.h #457415:457416
 @ -131,6 +131,8  @
 	void userStartedTyping( const QString & contact );
 	void userStoppedTyping( const QString & contact );
 
+    void nonServerAddContactDialogClosed();
+
 signals:
 
 	void accountDisconnected( Kopete::Account::DisconnectReason reason );
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/oscarcontact.cpp \
#457415:457416  @ -70,7 +70,10  @
 
 bool OscarContact::isOnServer() const
 {
-	return ( m_ssiItem.type() != 0xFFFF );
+    SSIManager* serverList = mAccount->engine()->ssiManager();
+    SSI ssi = serverList->findContact( Oscar::normalize( contactId() ) );
+
+	return ( ssi && ssi.type() != 0xFFFF );
 }
 
 void OscarContact::setSSIItem( const Oscar::SSI& ssiItem )
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/oscarlistnonservercontacts.cpp \
#457415:457416  @ -31,7 +31,6  @
     setMainWidget( m_contactsList );
     setButtonText( Ok, i18n( "&Add" ) );
     setButtonText( Cancel, i18n( "Do &not add" ) );
-
 }
 
 OscarListNonServerContacts::~OscarListNonServerContacts()
 @ -50,4 +49,18  @
     return m_nonServerContacts;
 }
 
+
+
+void OscarListNonServerContacts::slotCancel()
+{
+    KDialogBase::slotCancel();
+    emit closing();
+}
+
+void OscarListNonServerContacts::slotOk()
+{
+    KDialogBase::slotOk();
+    emit closing();
+}
+
 #include "oscarlistnonservercontacts.moc"
--- branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/oscarlistnonservercontacts.h \
#457415:457416  @ -34,6 +34,13  @
     void addContacts( const QStringList& contactList );
     QStringList nonServerContactList() const;
 
+protected:
+    virtual void slotOk();
+    virtual void slotCancel();
+
+signals:
+    void closing();
+
 private:
     OscarListContactsBase* m_contactsList;
     QStringList m_nonServerContacts;


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

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