[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-05-21 22:49:02
Message-ID: 20130521224902.072AEAC85D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1355990 by pali:

For Jabber protocol add function JabberResourcePool::getJabberResource which return a \
JabberResource for a given JID and resource name


 M  +22 -0     jabberresourcepool.cpp  
 M  +6 -0      jabberresourcepool.h  


--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabberresourcepool.cpp \
#1355989:1355990 @@ -396,4 +396,26 @@
 	}
 }
 
+JabberResource *JabberResourcePool::getJabberResource ( const XMPP::Jid &jid, const \
QString &resource ) +{
+	if ( resource.isEmpty() )
+		return bestJabberResource(jid);
+
+	foreach(JabberResource *mResource, d->pool)
+	{
+		if ( mResource->jid().bare().toLower() == jid.bare().toLower() && \
jid.resource().toLower() == resource ) +		{
+			// we found a resource for the JID, let's see if the JID already contains a \
resource +			if ( !jid.resource().isEmpty() && ( jid.resource().toLower() != \
mResource->resource().name().toLower() ) ) +				// the JID contains a resource but \
it's not the one we have in the dictionary, +				// thus we have to ignore this \
resource +				continue;
+
+			return mResource;
+		}
+	}
+
+	return bestJabberResource(jid);
+}
+
 #include "jabberresourcepool.moc"
--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabberresourcepool.h \
#1355989:1355990 @@ -112,6 +112,12 @@
 	 */
 	const XMPP::Resource &bestResource ( const XMPP::Jid &jid, bool honourLock = true \
);  
+	/*
+	 * Return a JabberResource for a given JID and resource name
+	 * If resource name is empty or not exists, return bestJabberResource
+	 */
+	JabberResource *getJabberResource ( const XMPP::Jid &jid, const QString &resource \
); +
 	/**
 	 * Find all resources that exist for a given JID
 	 */


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

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