From kde-commits Tue Feb 03 19:53:25 2009 From: Michael Zanetti Date: Tue, 03 Feb 2009 19:53:25 +0000 To: kde-commits Subject: KDE/kdenetwork/kopete/plugins/otr Message-Id: <1233690805.393021.6343.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=123369092607521 SVN commit 920794 by mzanetti: get the correct remote fingerprint if stored locally for multiple accounts BUG: 177416 M +8 -5 otrlchatinterface.cpp M +1 -1 otrlchatinterface.h --- trunk/KDE/kdenetwork/kopete/plugins/otr/otrlchatinterface.cpp #920793:920794 @@ -657,11 +657,12 @@ new AuthenticationWizard( session->view()->mainWidget(), context, session, true ); } -Fingerprint *OtrlChatInterface::findFingerprint( const QString &account ){ +Fingerprint *OtrlChatInterface::findFingerprint( Kopete::ChatSession *session ){ ConnContext *context; for( context = userstate->context_root; context != NULL; context = context->next ){ - if( strcmp( context->username, account.toLocal8Bit() ) == 0 ){ + if( ( session->members().first()->contactId().toLocal8Bit() == context->username ) && + (session->account()->accountId().toLocal8Bit() == context->accountname ) ){ return context->active_fingerprint ? context->active_fingerprint : NULL; } } @@ -673,7 +674,8 @@ char hash[45]; for( context = userstate->context_root; context != NULL; context = context->next ){ - if( strcmp( context->username, session->members().first()->contactId().toLocal8Bit() ) == 0 ){ + if( ( session->members().first()->contactId().toLocal8Bit() == context->username ) && + (session->account()->accountId().toLocal8Bit() == context->accountname ) ){ otrl_privkey_hash_to_human( hash, context->active_fingerprint->fingerprint ); return hash; } @@ -682,8 +684,9 @@ } bool OtrlChatInterface::isVerified( Kopete::ChatSession *session ){ - Fingerprint *fingerprint = findFingerprint( session->members().first()->contactId() ); + Fingerprint *fingerprint = findFingerprint( session ); + kDebug() << "fingerprint" << fingerprint; if( fingerprint->trust && fingerprint->trust[0] != '\0' ){ return true; } else { @@ -715,7 +718,7 @@ void OtrlChatInterface::setTrust( Kopete::ChatSession *session, bool trust ){ Fingerprint *fingerprint; - fingerprint = findFingerprint( session->members().first()->contactId() ); + fingerprint = findFingerprint( session ); if( fingerprint != 0 ){ if( trust ){ otrl_context_set_trust( fingerprint, "verified" ); --- trunk/KDE/kdenetwork/kopete/plugins/otr/otrlchatinterface.h #920793:920794 @@ -74,7 +74,7 @@ private: OtrlChatInterface(); static OtrlChatInterface *mSelf; - Fingerprint *findFingerprint( const QString &username ); + Fingerprint *findFingerprint( Kopete::ChatSession *session ); signals: void goneSecure(Kopete::ChatSession* session, int state);