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

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/protocols/jabber
From:       Pali Rohár <pali.rohar () gmail ! com>
Date:       2013-06-02 10:05:16
Message-ID: 20130602100516.0BE33AC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1356784 by pali:

Update capabilities and feature list also for our jabber account and myself contact


 M  +22 -0     jabberaccount.cpp  
 M  +7 -0      jabberaccount.h  
 M  +0 -6      jabbercapabilitiesmanager.cpp  


--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabberaccount.cpp #1356783:1356784
@@ -73,6 +73,7 @@
 #include "jabbergroupcontact.h"
 #include "jabbercapabilitiesmanager.h"
 #include "jabbertransport.h"
+#include "jabberresource.h"
 #include "dlgxmppconsole.h"
 #include "dlgjabberservices.h"
 #include "dlgjabberchatjoin.h"
@@ -1149,7 +1150,16 @@
 
 			task->pres ( newStatus );
 			task->go ( true );
+
+			// update our capabilities (for this we need capabilities manager)
+			if (protocol() && protocol()->capabilitiesManager())
+			{
+				m_lastStatus = newStatus;
+				m_lastXMPPResource = newResource;
+				protocol()->capabilitiesManager()->updateCapabilities( this, jid, m_lastStatus \
); +				QTimer::singleShot ( client()->getPenaltyTime () * 1000 + 2000, this, SLOT \
(slotUpdateOurCapabilities()) );  }
+		}
 		else
 		{
 			kDebug(JABBER_DEBUG_GLOBAL) << "We were not connected, presence update aborted.";
@@ -1158,6 +1168,18 @@
 
 }
 
+void JabberAccount::slotUpdateOurCapabilities ()
+{
+	if ( ! myself() )
+		return;
+	XMPP::Jid jid ( myself()->contactId () );
+	JabberResource * resource = resourcePool()->getJabberResource( jid, m_lastResource \
); +	if ( resource )
+		resource->setResource ( m_lastXMPPResource );
+	protocol()->capabilitiesManager()->updateCapabilities( this, jid, m_lastStatus );
+	dynamic_cast<JabberContact *>(myself())->updateResourceList ();
+}
+
 void JabberAccount::slotXMPPConsole ()
 {
 	dlgXMPPConsole *w = new dlgXMPPConsole( client (), \
                Kopete::UI::Global::mainWidget());
--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabberaccount.h #1356783:1356784
@@ -255,7 +255,11 @@
 
 	/* last resource for this account */
 	QString m_lastResource;
+	XMPP::Resource m_lastXMPPResource;
 
+	/* last status for this account */
+	XMPP::Status m_lastStatus;
+
 #ifdef GOOGLETALK_SUPPORT
 	GoogleTalk * m_googleTalk;
 #endif
@@ -347,6 +351,9 @@
 	/* the unregister task finished */
 	void slotUnregisterFinished();
 
+	/* update our capabilities for myself contact */
+	void slotUpdateOurCapabilities();
+
 	//void slotIncomingJingleSession(const QString &sessionType, JingleSession \
*session);  };
 
--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabbercapabilitiesmanager.cpp \
#1356783:1356784 @@ -357,12 +357,6 @@
 	if( !account->client() || !account->client()->rootTask() )
 		return;
 	
-	
-	// Do don't anything if the jid correspond to the account's JabberClient jid.
-	// false means that we don't check for resources.
-	if( jid.compare(account->client()->jid(), false) )
-		return;
-
 	QString node = status.capsNode(), version = status.capsVersion(), extensions = \
status.capsExt();  QString hash;
 


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

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