Files
@ be3af42a21a7
Branch filter:
Location: libtransport.git/libtransport/LocalBuddy.cpp - annotation
be3af42a21a7
2.9 KiB
text/x-c++hdr
MySQLBackend: disable autoreconnect, control CR_SERVER_LOST manually
* correctly recreate prepared statements
* do not close connection while reconnecting
* signed/unsigned comparison fix
* correctly recreate prepared statements
* do not close connection while reconnecting
* signed/unsigned comparison fix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 78e71f9345c7 78e71f9345c7 78e71f9345c7 78e71f9345c7 17f3dabe1419 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a bb4ac38e5089 ac7bbb6cccf3 bb4ac38e5089 bb4ac38e5089 bb4ac38e5089 bb4ac38e5089 bb4ac38e5089 bb4ac38e5089 bb4ac38e5089 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a 1105d3f1e37a eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 eeda35442237 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 83f5f36c94a2 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 4ea0afca8c48 d6766b4f84e8 d6766b4f84e8 d6766b4f84e8 d6766b4f84e8 d6766b4f84e8 fe47e0979be9 d6766b4f84e8 d6766b4f84e8 d6766b4f84e8 d6766b4f84e8 ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc e63427c2da8a ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc fe47e0979be9 ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc ee4e5ecb71cc e5aab1415d9e 17f3dabe1419 e5aab1415d9e e5aab1415d9e e5aab1415d9e e5aab1415d9e e5aab1415d9e e5aab1415d9e e5aab1415d9e 1105d3f1e37a | /**
* XMPP - libpurple transport
*
* Copyright (C) 2009, Jan Kaluza <hanzz@soc.pidgin.im>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#include "transport/LocalBuddy.h"
#include "transport/User.h"
#include "transport/RosterManager.h"
#include "transport/Transport.h"
#include "transport/Frontend.h"
namespace Transport {
LocalBuddy::LocalBuddy(RosterManager *rosterManager, long id, const std::string &name, const std::string &alias, const std::vector<std::string> &groups, BuddyFlag flags) : Buddy(rosterManager, id, flags) {
m_status = Swift::StatusShow::None;
m_alias = alias;
m_name = name;
m_groups = groups;
try {
generateJID();
} catch (...) {
}
}
LocalBuddy::~LocalBuddy() {
}
void LocalBuddy::setStatus(const Swift::StatusShow &status, const std::string &statusMessage) {
bool changed = ((m_status.getType() != status.getType()) || (m_statusMessage != statusMessage));
if (changed) {
m_status = status;
m_statusMessage = statusMessage;
sendPresence();
}
}
void LocalBuddy::setIconHash(const std::string &iconHash) {
bool changed = m_iconHash != iconHash;
m_iconHash = iconHash;
if (changed) {
getRosterManager()->storeBuddy(this);
sendPresence();
}
}
bool LocalBuddy::setName(const std::string &name) {
if (name == m_name) {
return true;
}
std::string oldName = name;
m_name = name;
try {
generateJID();
return m_jid.isValid();
} catch (...) {
m_name = oldName;
return false;
}
}
void LocalBuddy::setAlias(const std::string &alias) {
bool changed = m_alias != alias;
m_alias = alias;
if (changed) {
getRosterManager()->doUpdateBuddy(this);
getRosterManager()->storeBuddy(this);
}
}
void LocalBuddy::setGroups(const std::vector<std::string> &groups) {
bool changed = m_groups.size() != groups.size();
if (!changed) {
for (unsigned i = 0; i != m_groups.size(); i++) {
if (m_groups[i] != groups[i]) {
changed = true;
break;
}
}
}
m_groups = groups;
if (changed) {
getRosterManager()->doUpdateBuddy(this);
getRosterManager()->storeBuddy(this);
}
}
bool LocalBuddy::getStatus(Swift::StatusShow &status, std::string &statusMessage) {
if (getRosterManager()->getUser()->getComponent()->getFrontend()->isRawXMLEnabled()) {
return false;
}
status = m_status;
statusMessage = m_statusMessage;
return true;
}
}
|