More logging and don't use DB on every presence
This commit is contained in:
parent
95a4924622
commit
6efc5e055b
2 changed files with 8 additions and 1 deletions
|
@ -1300,7 +1300,6 @@ void NetworkPluginServer::handleBuddyUpdated(Buddy *b, const Swift::RosterItemPa
|
|||
|
||||
dynamic_cast<LocalBuddy *>(b)->setAlias(item.getName());
|
||||
dynamic_cast<LocalBuddy *>(b)->setGroups(item.getGroups());
|
||||
user->getRosterManager()->storeBuddy(b);
|
||||
|
||||
pbnetwork::Buddy buddy;
|
||||
buddy.set_username(user->getJID().toBare());
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "transport/buddy.h"
|
||||
#include "transport/user.h"
|
||||
#include "transport/storagebackend.h"
|
||||
#include "transport/logging.h"
|
||||
|
||||
DEFINE_LOGGER(logger, "RosterStorage");
|
||||
|
||||
namespace Transport {
|
||||
|
||||
|
@ -111,16 +114,20 @@ bool RosterStorage::storeBuddies() {
|
|||
m_storageBackend->beginTransaction();
|
||||
|
||||
for (std::map<std::string, Buddy *>::const_iterator it = m_buddies.begin(); it != m_buddies.end(); it++) {
|
||||
LOG4CXX_INFO(logger, "storing 1");
|
||||
Buddy *buddy = (*it).second;
|
||||
BuddyInfo buddyInfo;
|
||||
buddyInfo.alias = buddy->getAlias();
|
||||
LOG4CXX_INFO(logger, "storing 1.5");
|
||||
buddyInfo.legacyName = buddy->getName();
|
||||
buddyInfo.groups = buddy->getGroups();
|
||||
LOG4CXX_INFO(logger, "storing 2");
|
||||
buddyInfo.subscription = buddy->getSubscription() == Buddy::Ask ? "ask" : "both";
|
||||
buddyInfo.id = buddy->getID();
|
||||
buddyInfo.flags = buddy->getFlags();
|
||||
buddyInfo.settings["icon_hash"].s = buddy->getIconHash();
|
||||
buddyInfo.settings["icon_hash"].type = TYPE_STRING;
|
||||
LOG4CXX_INFO(logger, "storing 3");
|
||||
|
||||
// Buddy is in DB
|
||||
if (buddyInfo.id != -1) {
|
||||
|
@ -130,6 +137,7 @@ bool RosterStorage::storeBuddies() {
|
|||
buddyInfo.id = m_storageBackend->addBuddy(m_user->getUserInfo().id, buddyInfo);
|
||||
buddy->setID(buddyInfo.id);
|
||||
}
|
||||
LOG4CXX_INFO(logger, "storing 4");
|
||||
|
||||
// Log("buddyListSaveNode", id << " " << name << " " << alias << " " << s_buddy->getSubscription());
|
||||
// if (s_buddy->getBuddy() && id != -1) {
|
||||
|
|
Loading…
Add table
Reference in a new issue