Changeset - 96425ce8dba1
[Not reviewed]
0 2 0
HanzZ - 14 years ago 2011-06-19 10:09:49
hanzz.k@gmail.com
Asnwer to VCards without to attribute
2 files changed with 12 insertions and 4 deletions:
0 comments (0 inline, 0 general)
spectrum/src/sample.cfg
Show inline comments
 
@@ -8,14 +8,14 @@ backend_host=localhost # < this option doesn't work yet
 
backend_port=10001
 
#cert= #patch to PKCS#12 certificate
 
#cert_password= #password to that certificate if any
 
users_per_backend=2
 
backend=../../backends/libpurple/spectrum_libpurple_backend
 
#backend=../../backends/libircclient-qt/spectrum_libircclient-qt_backend
 
protocol=prpl-jabber
 
#protocol=prpl-msn
 
#protocol=prpl-jabber
 
protocol=prpl-msn
 
#protocol=prpl-icq
 

	
 
[database]
 
type = sqlite3 # or "none" without database backend
 
database = test.sql
 
prefix=icq
src/vcardresponder.cpp
Show inline comments
 
@@ -24,12 +24,13 @@
 
#include <boost/bind.hpp>
 
#include "Swiften/Queries/IQRouter.h"
 
#include "Swiften/Swiften.h"
 
#include "transport/user.h"
 
#include "transport/usermanager.h"
 
#include "transport/rostermanager.h"
 
#include "transport/transport.h"
 

	
 
using namespace Swift;
 
using namespace boost;
 

	
 
namespace Transport {
 

	
 
@@ -57,19 +58,26 @@ bool VCardResponder::handleGetRequest(const Swift::JID& from, const Swift::JID&
 
	// For now we send empty reponse, but TODO: Get buddies from database and send proper stored roster.
 
	User *user = m_userManager->getUser(from.toBare().toString());
 
	if (!user) {
 
		return false;
 
	}
 

	
 
	std::string name = to.getUnescapedNode();
 
	Swift::JID to_ = to;
 

	
 
	std::string name = to_.getUnescapedNode();
 
	if (name.empty()) {
 
		to_ = user->getComponent()->getJID();
 
		std::string name = to_.getUnescapedNode();
 
	}
 

	
 
	if (name.find_last_of("%") != std::string::npos) {
 
		name.replace(name.find_last_of("%"), 1, "@");
 
	}
 

	
 
	m_queries[m_id].from = from;
 
	m_queries[m_id].to = to;
 
	m_queries[m_id].to = to_;
 
	m_queries[m_id].id = id; 
 
	onVCardRequired(user, name, m_id++);
 
	return true;
 
}
 

	
 
bool VCardResponder::handleSetRequest(const Swift::JID& from, const Swift::JID& to, const std::string& id, boost::shared_ptr<Swift::VCard> payload) {
0 comments (0 inline, 0 general)