Asnwer to VCards without to attribute

This commit is contained in:
HanzZ 2011-06-19 10:09:49 +02:00
parent 828ae9d2cb
commit 96425ce8db
2 changed files with 12 additions and 4 deletions

View file

@ -11,8 +11,8 @@ backend_port=10001
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]

View file

@ -27,6 +27,7 @@
#include "transport/user.h"
#include "transport/usermanager.h"
#include "transport/rostermanager.h"
#include "transport/transport.h"
using namespace Swift;
using namespace boost;
@ -60,13 +61,20 @@ bool VCardResponder::handleGetRequest(const Swift::JID& from, const Swift::JID&
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;