Skip to content
Permalink
Browse files

Join conferences from a transport only when the transport is connected

  • Loading branch information...
Sergey Il'inykh
Sergey Il'inykh committed Jun 15, 2017
1 parent b60abb8 commit 1362a0d55428ce6c053648c06d3890cfa9fc9649
Showing with 23 additions and 3 deletions.
  1. +5 −0 src/conferencebookmark.cpp
  2. +1 −0 src/conferencebookmark.h
  3. +17 −3 src/psiaccount.cpp
@@ -70,6 +70,11 @@ ConferenceBookmark::JoinType ConferenceBookmark::autoJoin() const
return auto_join_;
}

bool ConferenceBookmark::needJoin() const
{
return auto_join_ == ConferenceBookmark::Always || auto_join_ == ConferenceBookmark::OnlyThisComputer;
}

const QString& ConferenceBookmark::nick() const
{
return nick_;
@@ -48,6 +48,7 @@ class ConferenceBookmark
const QString& name() const;
const XMPP::Jid& jid() const;
JoinType autoJoin() const;
bool needJoin() const;
void setAutoJoin(JoinType type);
const QString& nick() const;
const QString& password() const;
@@ -2386,9 +2386,12 @@ void PsiAccount::bookmarksAvailabilityChanged()

#ifdef GROUPCHAT
foreach(ConferenceBookmark c, d->bookmarkManager->conferences()) {
if (!findDialog<GCMainDlg*>(Jid(c.jid().bare())) &&
(c.autoJoin() == ConferenceBookmark::Always || c.autoJoin() == ConferenceBookmark::OnlyThisComputer)) {
actionJoin(c, true, MUCJoinDlg::MucAutoJoin);
Jid cj = c.jid().withResource(QString());
if (!findDialog<GCMainDlg*>(cj) && c.needJoin()) {
auto ul = findRelevant(Jid(QString(),cj.domain()));
if (ul.isEmpty() || !ul[0]->isTransport() || !ul[0]->resourceList().isEmpty()) { // don't join to MUCs on disconnected transports
actionJoin(c, true, MUCJoinDlg::MucAutoJoin);
}
}
}
#endif
@@ -2538,6 +2541,17 @@ void PsiAccount::client_resourceAvailable(const Jid &j, const Resource &r)
if(doAnim && PsiOptions::instance()->getOption("options.ui.contactlist.use-status-change-animation").toBool())
profileAnimateNick(u->jid());

#ifdef GROUPCHAT
if (u->isTransport()) {
foreach(ConferenceBookmark c, d->bookmarkManager->conferences()) {
Jid cj = c.jid().withResource(QString());
if (u->jid().domain() == cj.domain() && !findDialog<GCMainDlg*>(cj) && c.needJoin()) {
// now join MUCs on connected transport
actionJoin(c, true, MUCJoinDlg::MucAutoJoin);
}
}
}
#endif
}

if(doSound)

0 comments on commit 1362a0d

Please sign in to comment.
You can’t perform that action at this time.