1
0
forked from blue/squawk

moving on with MUC, nothing final yet

This commit is contained in:
Blue 2019-08-21 12:35:07 +03:00
parent 0a6f612b60
commit 828d14c908
10 changed files with 314 additions and 145 deletions

View File

@ -14,6 +14,7 @@ set(squawkCORE_SRC
archive.cpp archive.cpp
rosteritem.cpp rosteritem.cpp
contact.cpp contact.cpp
conference.cpp
) )
# Tell CMake to create the helloworld executable # Tell CMake to create the helloworld executable

View File

@ -1,6 +1,6 @@
/* /*
* Squawk messenger. * Squawk messenger.
* Copyright (C) 2019 Yury Gubich <blue@macaw.me> * Copyright (C) 2019 Yury Gubich <blue@macaw.me>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -37,11 +37,11 @@ Account::Account(const QString& p_login, const QString& p_server, const QString&
mm(new QXmppMucManager()), mm(new QXmppMucManager()),
bm(new QXmppBookmarkManager()), bm(new QXmppBookmarkManager()),
contacts(), contacts(),
conferences(),
maxReconnectTimes(0), maxReconnectTimes(0),
reconnectTimes(0), reconnectTimes(0),
queuedContacts(), queuedContacts(),
outOfRosterContacts(), outOfRosterContacts()
mucInfo()
{ {
config.setUser(p_login); config.setUser(p_login);
config.setDomain(p_server); config.setDomain(p_server);
@ -87,6 +87,10 @@ Account::~Account()
delete itr->second; delete itr->second;
} }
for (std::map<QString, Conference*>::const_iterator itr = conferences.begin(), end = conferences.end(); itr != end; ++itr) {
delete itr->second;
}
delete bm; delete bm;
delete mm; delete mm;
delete am; delete am;
@ -288,15 +292,29 @@ void Core::Account::addedAccount(const QString& jid)
} }
} }
void Core::Account::handleNewContact(Core::Contact* contact) void Core::Account::handleNewRosterItem(Core::RosterItem* contact)
{ {
QObject::connect(contact, SIGNAL(groupAdded(const QString&)), this, SLOT(onContactGroupAdded(const QString&)));
QObject::connect(contact, SIGNAL(groupRemoved(const QString&)), this, SLOT(onContactGroupRemoved(const QString&)));
QObject::connect(contact, SIGNAL(nameChanged(const QString&)), this, SLOT(onContactNameChanged(const QString&)));
QObject::connect(contact, SIGNAL(subscriptionStateChanged(Shared::SubscriptionState)),
this, SLOT(onContactSubscriptionStateChanged(Shared::SubscriptionState)));
QObject::connect(contact, SIGNAL(needHistory(const QString&, const QString&, const QDateTime&)), this, SLOT(onContactNeedHistory(const QString&, const QString&, const QDateTime&))); QObject::connect(contact, SIGNAL(needHistory(const QString&, const QString&, const QDateTime&)), this, SLOT(onContactNeedHistory(const QString&, const QString&, const QDateTime&)));
QObject::connect(contact, SIGNAL(historyResponse(const std::list<Shared::Message>&)), this, SLOT(onContactHistoryResponse(const std::list<Shared::Message>&))); QObject::connect(contact, SIGNAL(historyResponse(const std::list<Shared::Message>&)), this, SLOT(onContactHistoryResponse(const std::list<Shared::Message>&)));
QObject::connect(contact, SIGNAL(nameChanged(const QString&)), this, SLOT(onContactNameChanged(const QString&)));
}
void Core::Account::handleNewContact(Core::Contact* contact)
{
handleNewRosterItem(contact);
QObject::connect(contact, SIGNAL(groupAdded(const QString&)), this, SLOT(onContactGroupAdded(const QString&)));
QObject::connect(contact, SIGNAL(groupRemoved(const QString&)), this, SLOT(onContactGroupRemoved(const QString&)));
QObject::connect(contact, SIGNAL(subscriptionStateChanged(Shared::SubscriptionState)),
this, SLOT(onContactSubscriptionStateChanged(Shared::SubscriptionState)));
}
void Core::Account::handleNewConference(Core::Conference* contact)
{
handleNewRosterItem(contact);
QObject::connect(contact, SIGNAL(nickChanged(const QString&)), this, SLOT(onMucNickNameChanged(const QString&)));
QObject::connect(contact, SIGNAL(joinedChanged(bool)), this, SLOT(onMucJoinedChanged(bool)));
QObject::connect(contact, SIGNAL(autoJoinChanged(bool)), this, SLOT(onMucAutoJoinChanged(bool)));
} }
@ -548,32 +566,48 @@ void Core::Account::initializeMessage(Shared::Message& target, const QXmppMessag
void Core::Account::onMamMessageReceived(const QString& queryId, const QXmppMessage& msg) void Core::Account::onMamMessageReceived(const QString& queryId, const QXmppMessage& msg)
{ {
std::map<QString, QString>::const_iterator itr = achiveQueries.find(queryId); if (msg.id().size() > 0 && msg.body().size() > 0) {
QString jid = itr->second; std::map<QString, QString>::const_iterator itr = achiveQueries.find(queryId);
std::map<QString, Contact*>::const_iterator citr = contacts.find(jid); QString jid = itr->second;
RosterItem* item = 0;
std::map<QString, Contact*>::const_iterator citr = contacts.find(jid);
if (citr != contacts.end()) { if (citr != contacts.end()) {
Contact* cnt = citr->second; item = citr->second;
if (msg.id().size() > 0 && msg.body().size() > 0) { } else {
Shared::Message sMsg(Shared::Message::chat); std::map<QString, Conference*>::const_iterator coitr = conferences.find(jid);
initializeMessage(sMsg, msg, false, true, true); if (coitr != conferences.end()) {
item = coitr->second;
cnt->addMessageToArchive(sMsg); }
} }
Shared::Message sMsg(Shared::Message::chat);
initializeMessage(sMsg, msg, false, true, true);
item->addMessageToArchive(sMsg);
} }
//handleChatMessage(msg, false, true, true); //handleChatMessage(msg, false, true, true);
} }
void Core::Account::requestArchive(const QString& jid, int count, const QString& before) void Core::Account::requestArchive(const QString& jid, int count, const QString& before)
{ {
qDebug() << "An archive request for " << jid << ", before " << before; qDebug() << "An archive request for " << jid << ", before " << before;
RosterItem* contact = 0;
std::map<QString, Contact*>::const_iterator itr = contacts.find(jid); std::map<QString, Contact*>::const_iterator itr = contacts.find(jid);
if (itr == contacts.end()) { if (itr != contacts.end()) {
contact = itr->second;
} else {
std::map<QString, Conference*>::const_iterator citr = conferences.find(jid);
if (citr != conferences.end()) {
contact = citr->second;
}
}
if (contact == 0) {
qDebug() << "An attempt to request archive for" << jid << "in account" << name << ", but the contact with such id wasn't found, skipping"; qDebug() << "An attempt to request archive for" << jid << "in account" << name << ", but the contact with such id wasn't found, skipping";
return; return;
} }
RosterItem* contact = itr->second;
if (contact->getArchiveState() == RosterItem::empty && before.size() == 0) { if (contact->getArchiveState() == RosterItem::empty && before.size() == 0) {
QXmppMessage msg(getFullJid(), jid, "", ""); QXmppMessage msg(getFullJid(), jid, "", "");
@ -623,14 +657,22 @@ void Core::Account::onMamResultsReceived(const QString& queryId, const QXmppResu
{ {
std::map<QString, QString>::const_iterator itr = achiveQueries.find(queryId); std::map<QString, QString>::const_iterator itr = achiveQueries.find(queryId);
QString jid = itr->second; QString jid = itr->second;
RosterItem* ri = 0;
achiveQueries.erase(itr); achiveQueries.erase(itr);
std::map<QString, Contact*>::const_iterator citr = contacts.find(jid); std::map<QString, Contact*>::const_iterator citr = contacts.find(jid);
if (citr != contacts.end()) { if (citr != contacts.end()) {
Contact* cnt = citr->second; ri = citr->second;
} else {
std::map<QString, Conference*>::const_iterator coitr = conferences.find(jid);
if (coitr != conferences.end()) {
ri = coitr->second;
}
}
if (ri != 0) {
qDebug() << "Flushing messages for" << jid; qDebug() << "Flushing messages for" << jid;
cnt->flushMessagesToArchive(complete, resultSetReply.first(), resultSetReply.last()); ri->flushMessagesToArchive(complete, resultSetReply.first(), resultSetReply.last());
} }
} }
@ -887,106 +929,51 @@ void Core::Account::onMucRoomAdded(QXmppMucRoom* room)
void Core::Account::bookmarksReceived(const QXmppBookmarkSet& bookmarks) void Core::Account::bookmarksReceived(const QXmppBookmarkSet& bookmarks)
{ {
QList<QXmppBookmarkConference> conferences = bookmarks.conferences(); QList<QXmppBookmarkConference> confs = bookmarks.conferences();
for (QList<QXmppBookmarkConference>::const_iterator itr = conferences.begin(), end = conferences.end(); itr != end; ++itr) { for (QList<QXmppBookmarkConference>::const_iterator itr = confs.begin(), end = confs.end(); itr != end; ++itr) {
const QXmppBookmarkConference& c = *itr; const QXmppBookmarkConference& c = *itr;
QString jid = c.jid(); QString jid = c.jid();
std::pair<std::map<QString, MucInfo>::iterator, bool> mi = mucInfo.insert(std::make_pair(jid, MucInfo(c.autoJoin(), false, jid, c.name(), c.nickName()))); std::map<QString, Conference*>::const_iterator cItr = conferences.find(jid);
if (mi.second) { if (cItr == conferences.end()) {
const MucInfo& info = mi.first->second;
QXmppMucRoom* room = mm->addRoom(jid); QXmppMucRoom* room = mm->addRoom(jid);
QString nick = c.nickName();
Conference* conf = new Conference(jid, getName(), c.autoJoin(), c.name(), nick == "" ? getName() : nick, room);
QObject::connect(room, SIGNAL(joined()), this, SLOT(onMucJoined())); handleNewConference(conf);
QObject::connect(room, SIGNAL(left()), this, SLOT(onMucLeft()));
QObject::connect(room, SIGNAL(nameChanged(const QString&)), this, SLOT(onMucNameChanged(const QString&)));
QObject::connect(room, SIGNAL(nickNameChanged(const QString&)), this, SLOT(onMucNickNameChanged(const QString&)));
QObject::connect(room, SIGNAL(error(const QXmppStanza::Error&)), this, SLOT(onMucError(const QXmppStanza::Error&)));
QObject::connect(room, SIGNAL(messageReceived(const QXmppMessage&)), this, SLOT(onMucMessage(const QXmppMessage&)));
emit addRoom(jid, { emit addRoom(jid, {
{"autoJoin", info.autoJoin}, {"autoJoin", conf->getAutoJoin()},
{"joined", false}, {"joined", conf->getJoined()},
{"nick", info.nick}, {"nick", conf->getNick()},
{"name", info.name} {"name", conf->getName()}
}); });
room->setNickName(info.nick == "" ? getName() : info.nick);
if (info.autoJoin) {
room->join();
}
} else { } else {
qDebug() << "Received a bookmark to a MUC " << jid << " which is already booked by another bookmark, skipping"; qDebug() << "Received a bookmark to a MUC " << jid << " which is already booked by another bookmark, skipping";
} }
} }
} }
void Core::Account::onMucJoined() void Core::Account::onMucJoinedChanged(bool joined)
{ {
QXmppMucRoom* room = static_cast<QXmppMucRoom*>(sender()); Conference* room = static_cast<Conference*>(sender());
QString jid = room->jid(); emit changeRoom(room->jid, {
std::map<QString, MucInfo>::iterator itr = mucInfo.find(jid); {"joined", joined}
if (itr != mucInfo.end()) {
itr->second.joined = true;
emit changeRoom(jid, {
{"joined", true}
}); });
} else {
qDebug() << "Seems like account" << getName() << "joined room" << jid << ", but the info about that room wasn't found, skipping";
}
} }
void Core::Account::onMucLeft() void Core::Account::onMucAutoJoinChanged(bool autoJoin)
{ {
QXmppMucRoom* room = static_cast<QXmppMucRoom*>(sender()); Conference* room = static_cast<Conference*>(sender());
QString jid = room->jid(); emit changeRoom(room->jid, {
std::map<QString, MucInfo>::iterator itr = mucInfo.find(jid); {"autoJoin", autoJoin}
if (itr != mucInfo.end()) {
itr->second.joined = false;
emit changeRoom(jid, {
{"joined", false}
}); });
} else {
qDebug() << "Seems like account" << getName() << "left room" << jid << ", but the info about that room wasn't found, skipping";
}
}
void Core::Account::onMucNameChanged(const QString& roomName)
{
QXmppMucRoom* room = static_cast<QXmppMucRoom*>(sender());
QString jid = room->jid();
std::map<QString, MucInfo>::iterator itr = mucInfo.find(jid);
if (itr != mucInfo.end()) {
itr->second.name = roomName;
emit changeRoom(jid, {
{"name", roomName}
});
} else {
qDebug() << "Account" << getName() << "received an event about room" << jid << "name change, but the info about that room wasn't found, skipping";
}
} }
void Core::Account::onMucNickNameChanged(const QString& nickName) void Core::Account::onMucNickNameChanged(const QString& nickName)
{ {
QXmppMucRoom* room = static_cast<QXmppMucRoom*>(sender()); Conference* room = static_cast<Conference*>(sender());
QString jid = room->jid(); emit changeRoom(room->jid, {
std::map<QString, MucInfo>::iterator itr = mucInfo.find(jid);
if (itr != mucInfo.end()) {
itr->second.nick = nickName;
emit changeRoom(jid, {
{"nick", nickName} {"nick", nickName}
}); });
} else {
qDebug() << "Account" << getName() << "received an event about his nick name change in room" << jid << ", but the info about that room wasn't found, skipping";
}
}
void Core::Account::onMucError(const QXmppStanza::Error& error)
{
qDebug() << "MUC error";
}
void Core::Account::onMucMessage(const QXmppMessage& message)
{
qDebug() << "Muc message";
} }

View File

@ -32,6 +32,7 @@
#include <QXmppBookmarkSet.h> #include <QXmppBookmarkSet.h>
#include "../global.h" #include "../global.h"
#include "contact.h" #include "contact.h"
#include "conference.h"
namespace Core namespace Core
{ {
@ -39,7 +40,6 @@ namespace Core
class Account : public QObject class Account : public QObject
{ {
Q_OBJECT Q_OBJECT
class MucInfo;
public: public:
Account(const QString& p_login, const QString& p_server, const QString& p_password, const QString& p_name, QObject* parent = 0); Account(const QString& p_login, const QString& p_server, const QString& p_password, const QString& p_name, QObject* parent = 0);
~Account(); ~Account();
@ -102,12 +102,12 @@ private:
QXmppMucManager* mm; QXmppMucManager* mm;
QXmppBookmarkManager* bm; QXmppBookmarkManager* bm;
std::map<QString, Contact*> contacts; std::map<QString, Contact*> contacts;
std::map<QString, Conference*> conferences;
unsigned int maxReconnectTimes; unsigned int maxReconnectTimes;
unsigned int reconnectTimes; unsigned int reconnectTimes;
std::map<QString, QString> queuedContacts; std::map<QString, QString> queuedContacts;
std::set<QString> outOfRosterContacts; std::set<QString> outOfRosterContacts;
std::map<QString, MucInfo> mucInfo;
private slots: private slots:
void onClientConnected(); void onClientConnected();
@ -130,12 +130,9 @@ private slots:
void onMamResultsReceived(const QString &queryId, const QXmppResultSetReply &resultSetReply, bool complete); void onMamResultsReceived(const QString &queryId, const QXmppResultSetReply &resultSetReply, bool complete);
void onMucRoomAdded(QXmppMucRoom* room); void onMucRoomAdded(QXmppMucRoom* room);
void onMucJoined(); void onMucJoinedChanged(bool joined);
void onMucLeft(); void onMucAutoJoinChanged(bool autoJoin);
void onMucNameChanged(const QString& roomName);
void onMucNickNameChanged(const QString& nickName); void onMucNickNameChanged(const QString& nickName);
void onMucError(const QXmppStanza::Error& error);
void onMucMessage(const QXmppMessage& message);
void bookmarksReceived(const QXmppBookmarkSet& bookmarks); void bookmarksReceived(const QXmppBookmarkSet& bookmarks);
@ -151,6 +148,8 @@ private slots:
private: private:
void addedAccount(const QString &bareJid); void addedAccount(const QString &bareJid);
void handleNewContact(Contact* contact); void handleNewContact(Contact* contact);
void handleNewRosterItem(RosterItem* contact);
void handleNewConference(Conference* contact);
bool handleChatMessage(const QXmppMessage& msg, bool outgoing = false, bool forwarded = false, bool guessing = false); bool handleChatMessage(const QXmppMessage& msg, bool outgoing = false, bool forwarded = false, bool guessing = false);
void addToGroup(const QString& jid, const QString& group); void addToGroup(const QString& jid, const QString& group);
void removeFromGroup(const QString& jid, const QString& group); void removeFromGroup(const QString& jid, const QString& group);
@ -158,24 +157,6 @@ private:
Shared::SubscriptionState castSubscriptionState(QXmppRosterIq::Item::SubscriptionType qs) const; Shared::SubscriptionState castSubscriptionState(QXmppRosterIq::Item::SubscriptionType qs) const;
void logMessage(const QXmppMessage& msg, const QString& reason = "Message wasn't handled: "); void logMessage(const QXmppMessage& msg, const QString& reason = "Message wasn't handled: ");
class MucInfo {
public:
MucInfo(bool p_al, bool p_jo, const QString& p_jid, const QString& p_name, const QString& p_nick):
autoJoin(p_al),
joined(p_jo),
jid(p_jid),
name(p_name),
nick(p_nick),
removed(false) {}
bool autoJoin;
bool joined;
QString jid;
QString name;
QString nick;
bool removed;
};
}; };
} }

122
core/conference.cpp Normal file
View File

@ -0,0 +1,122 @@
/*
* Squawk messenger.
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "conference.h"
#include <QDebug>
Core::Conference::Conference(const QString& p_jid, const QString& p_account, bool p_autoJoin, const QString& p_name, const QString& p_nick, QXmppMucRoom* p_room):
RosterItem(p_jid, p_account),
nick(p_nick),
room(p_room),
joined(false),
autoJoin(p_autoJoin)
{
name = p_name;
connect(room, SIGNAL(joined()), this, SLOT(onRoomJoined()));
connect(room, SIGNAL(left()), this, SLOT(onRoomLeft()));
connect(room, SIGNAL(nameChanged(const QString&)), this, SLOT(onRoomNameChanged(const QString&)));
connect(room, SIGNAL(nickNameChanged(const QString&)), this, SLOT(onRoomNickNameChanged(const QString&)));
connect(room, SIGNAL(error(const QXmppStanza::Error&)), this, SLOT(onRoomError(const QXmppStanza::Error&)));
room->setNickName(nick);
if (autoJoin) {
room->join();
}
}
Core::Conference::~Conference()
{
}
QString Core::Conference::getNick() const
{
return nick;
}
bool Core::Conference::getAutoJoin()
{
return autoJoin;
}
bool Core::Conference::getJoined() const
{
return joined;
}
void Core::Conference::setJoined(bool p_joined)
{
if (joined != p_joined) {
if (joined) {
room->join();
} else {
room->leave();
}
}
}
void Core::Conference::setAutoJoin(bool p_autoJoin)
{
if (autoJoin != p_autoJoin) {
autoJoin = p_autoJoin;
emit autoJoinChanged(autoJoin);
}
}
void Core::Conference::setNick(const QString& p_nick)
{
if (nick != p_nick) {
if (joined) {
room->setNickName(p_nick);
} else {
nick = p_nick;
emit nickChanged(nick);
}
}
}
void Core::Conference::onRoomJoined()
{
joined = true;
emit joinedChanged(joined);
}
void Core::Conference::onRoomLeft()
{
joined = false;
emit joinedChanged(joined);
}
void Core::Conference::onRoomNameChanged(const QString& p_name)
{
setName(p_name);
}
void Core::Conference::onRoomNickNameChanged(const QString& p_nick)
{
if (p_nick != nick) {
nick = p_nick;
emit nickChanged(nick);
}
}
void Core::Conference::onRoomError(const QXmppStanza::Error& err)
{
qDebug() << "MUC error";
}

69
core/conference.h Normal file
View File

@ -0,0 +1,69 @@
/*
* Squawk messenger.
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef CORE_CONFERENCE_H
#define CORE_CONFERENCE_H
#include "rosteritem.h"
#include <QXmppMucManager.h>
namespace Core
{
/**
* @todo write docs
*/
class Conference : public RosterItem
{
Q_OBJECT
public:
Conference(const QString& p_jid, const QString& p_account, bool p_autoJoin, const QString& p_name, const QString& p_nick, QXmppMucRoom* p_room);
~Conference();
QString getNick() const;
void setNick(const QString& p_nick);
bool getJoined() const;
void setJoined(bool p_joined);
bool getAutoJoin();
void setAutoJoin(bool p_autoJoin);
signals:
void nickChanged(const QString& nick);
void joinedChanged(bool joined);
void autoJoinChanged(bool autoJoin);
private:
QString nick;
QXmppMucRoom* room;
bool joined;
bool autoJoin;
private slots:
void onRoomJoined();
void onRoomLeft();
void onRoomNameChanged(const QString& p_name);
void onRoomNickNameChanged(const QString& p_nick);
void onRoomError(const QXmppStanza::Error& err);
};
}
#endif // CORE_CONFERENCE_H

View File

@ -21,7 +21,8 @@
Core::Contact::Contact(const QString& pJid, const QString& account, QObject* parent): Core::Contact::Contact(const QString& pJid, const QString& account, QObject* parent):
RosterItem(pJid, account, parent), RosterItem(pJid, account, parent),
groups() groups(),
subscriptionState(Shared::unknown)
{ {
} }
@ -54,3 +55,16 @@ void Core::Contact::setGroups(const QSet<QString>& set)
emit groupAdded(*itr); emit groupAdded(*itr);
} }
} }
Shared::SubscriptionState Core::Contact::getSubscriptionState() const
{
return subscriptionState;
}
void Core::Contact::setSubscriptionState(Shared::SubscriptionState state)
{
if (subscriptionState != state) {
subscriptionState = state;
emit subscriptionStateChanged(subscriptionState);
}
}

View File

@ -36,12 +36,17 @@ public:
void setGroups(const QSet<QString>& set); void setGroups(const QSet<QString>& set);
unsigned int groupsCount() const; unsigned int groupsCount() const;
void setSubscriptionState(Shared::SubscriptionState state);
Shared::SubscriptionState getSubscriptionState() const;
signals: signals:
void groupAdded(const QString& name); void groupAdded(const QString& name);
void groupRemoved(const QString& name); void groupRemoved(const QString& name);
void subscriptionStateChanged(Shared::SubscriptionState state);
private: private:
QSet<QString> groups; QSet<QString> groups;
Shared::SubscriptionState subscriptionState;
}; };
} }

View File

@ -26,7 +26,6 @@ Core::RosterItem::RosterItem(const QString& pJid, const QString& account, QObjec
name(), name(),
archiveState(empty), archiveState(empty),
archive(new Archive(jid)), archive(new Archive(jid)),
subscriptionState(Shared::unknown),
syncronizing(false), syncronizing(false),
requestedCount(0), requestedCount(0),
requestedBefore(), requestedBefore(),
@ -55,24 +54,11 @@ Core::RosterItem::ArchiveState Core::RosterItem::getArchiveState() const
return archiveState; return archiveState;
} }
Shared::SubscriptionState Core::RosterItem::getSubscriptionState() const
{
return subscriptionState;
}
QString Core::RosterItem::getName() const QString Core::RosterItem::getName() const
{ {
return name; return name;
} }
void Core::RosterItem::setSubscriptionState(Shared::SubscriptionState state)
{
if (subscriptionState != state) {
subscriptionState = state;
emit subscriptionStateChanged(subscriptionState);
}
}
void Core::RosterItem::setName(const QString& n) void Core::RosterItem::setName(const QString& n)
{ {
if (name != n) { if (name != n) {

View File

@ -50,8 +50,6 @@ public:
ArchiveState getArchiveState() const; ArchiveState getArchiveState() const;
QString getName() const; QString getName() const;
void setName(const QString& n); void setName(const QString& n);
void setSubscriptionState(Shared::SubscriptionState state);
Shared::SubscriptionState getSubscriptionState() const;
void addMessageToArchive(const Shared::Message& msg); void addMessageToArchive(const Shared::Message& msg);
void appendMessageToArchive(const Shared::Message& msg); void appendMessageToArchive(const Shared::Message& msg);
@ -72,7 +70,6 @@ protected:
QString name; QString name;
ArchiveState archiveState; ArchiveState archiveState;
Archive* archive; Archive* archive;
Shared::SubscriptionState subscriptionState;
bool syncronizing; bool syncronizing;
int requestedCount; int requestedCount;

View File

@ -461,6 +461,13 @@ void Models::Roster::changeContact(const QString& account, const QString& jid, c
cBeg->second->update(itr.key(), itr.value());; cBeg->second->update(itr.key(), itr.value());;
} }
} }
std::map<ElId, Room*>::iterator rItr = rooms.find(id);
if (rItr != rooms.end()) {
for (QMap<QString, QVariant>::const_iterator itr = data.begin(), end = data.end(); itr != end; ++itr) {
rItr->second->update(itr.key(), itr.value());;
}
}
} }
void Models::Roster::removeContact(const QString& account, const QString& jid) void Models::Roster::removeContact(const QString& account, const QString& jid)