joining groups on opening them, leaving on closing

This commit is contained in:
Blue 2019-08-29 17:19:35 +03:00
parent 023494de0b
commit a51907b810
14 changed files with 84 additions and 16 deletions

View file

@ -1033,3 +1033,25 @@ void Core::Account::onMucNickNameChanged(const QString& nickName)
{"nick", nickName}
});
}
void Core::Account::setRoomAutoJoin(const QString& jid, bool joined)
{
std::map<QString, Conference*>::const_iterator cItr = conferences.find(jid);
if (cItr == conferences.end()) {
qDebug() << "An attempt to set auto join to the non existing room" << jid << "of the account" << getName() << ", skipping";
return;
}
cItr->second->setAutoJoin(joined);
}
void Core::Account::setRoomJoined(const QString& jid, bool joined)
{
std::map<QString, Conference*>::const_iterator cItr = conferences.find(jid);
if (cItr == conferences.end()) {
qDebug() << "An attempt to set joined to the non existing room" << jid << "of the account" << getName() << ", skipping";
return;
}
cItr->second->setJoined(joined);
}

View file

@ -71,6 +71,9 @@ public:
void removeContactRequest(const QString& jid);
void addContactRequest(const QString& jid, const QString& name, const QSet<QString>& groups);
void setRoomJoined(const QString& jid, bool joined);
void setRoomAutoJoin(const QString& jid, bool joined);
signals:
void connectionStateChanged(int);
void availabilityChanged(int);

View file

@ -419,3 +419,24 @@ void Core::Squawk::onAccountRemoveRoom(const QString jid)
Account* acc = static_cast<Account*>(sender());
emit removeRoom(acc->getName(), jid);
}
void Core::Squawk::setRoomJoined(const QString& account, const QString& jid, bool joined)
{
AccountsMap::const_iterator itr = amap.find(account);
if (itr == amap.end()) {
qDebug() << "An attempt to set autoJoin to the room" << jid << "of non existing account" << account << ", skipping";
return;
}
itr->second->setRoomJoined(jid, joined);
}
void Core::Squawk::setRoomAutoJoin(const QString& account, const QString& jid, bool joined)
{
AccountsMap::const_iterator itr = amap.find(account);
if (itr == amap.end()) {
qDebug() << "An attempt to set autoJoin to the room" << jid << "of non existing account" << account << ", skipping";
return;
}
itr->second->setRoomAutoJoin(jid, joined);
}

View file

@ -74,6 +74,8 @@ public slots:
void unsubscribeContact(const QString& account, const QString& jid, const QString& reason);
void removeContactRequest(const QString& account, const QString& jid);
void addContactRequest(const QString& account, const QString& jid, const QString& name, const QSet<QString>& groups);
void setRoomJoined(const QString& account, const QString& jid, bool joined);
void setRoomAutoJoin(const QString& account, const QString& jid, bool joined);
private:
typedef std::deque<Account*> Accounts;