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

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/plugins/otr
From:       Michael Zanetti <michael_zanetti () gmx ! net>
Date:       2009-02-03 19:53:25
Message-ID: 1233690805.393021.6343.nullmailer () svn ! kde ! org
[Download RAW message or body]

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);
[prev in list] [next in list] [prev in thread] [next in thread] 

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