diff options
Diffstat (limited to 'Swift/Controllers/Chat/ChatsManager.cpp')
| -rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 3cd9169..30870fa 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp | |||
| @@ -688,8 +688,6 @@ void ChatsManager::setOnline(bool enabled) { | |||
| 688 | } | 688 | } |
| 689 | } | 689 | } |
| 690 | if (!enabled) { | 690 | if (!enabled) { |
| 691 | delete mucBookmarkManager_; | ||
| 692 | mucBookmarkManager_ = NULL; | ||
| 693 | chatListWindow_->setBookmarksEnabled(false); | 691 | chatListWindow_->setBookmarksEnabled(false); |
| 694 | markAllRecentsOffline(); | 692 | markAllRecentsOffline(); |
| 695 | } else { | 693 | } else { |
| @@ -775,10 +773,6 @@ void ChatsManager::rebindControllerJID(const JID& from, const JID& to) { | |||
| 775 | 773 | ||
| 776 | MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::optional<std::string>& password, const boost::optional<std::string>& nickMaybe, bool addAutoJoin, bool createAsReservedIfNew, bool isImpromptu, ChatWindow* reuseChatwindow) { | 774 | MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::optional<std::string>& password, const boost::optional<std::string>& nickMaybe, bool addAutoJoin, bool createAsReservedIfNew, bool isImpromptu, ChatWindow* reuseChatwindow) { |
| 777 | MUC::ref muc; | 775 | MUC::ref muc; |
| 778 | if (!stanzaChannel_->isAvailable()) { | ||
| 779 | /* This is potentially not the optimal solution, but it will avoid consistency issues.*/ | ||
| 780 | return muc; | ||
| 781 | } | ||
| 782 | if (addAutoJoin) { | 776 | if (addAutoJoin) { |
| 783 | MUCBookmark bookmark(mucJID, mucJID.getNode()); | 777 | MUCBookmark bookmark(mucJID, mucJID.getNode()); |
| 784 | bookmark.setAutojoin(true); | 778 | bookmark.setAutojoin(true); |
| @@ -793,7 +787,9 @@ MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::opti | |||
| 793 | 787 | ||
| 794 | std::map<JID, MUCController*>::iterator it = mucControllers_.find(mucJID); | 788 | std::map<JID, MUCController*>::iterator it = mucControllers_.find(mucJID); |
| 795 | if (it != mucControllers_.end()) { | 789 | if (it != mucControllers_.end()) { |
| 796 | it->second->rejoin(); | 790 | if (stanzaChannel_->isAvailable()) { |
| 791 | it->second->rejoin(); | ||
| 792 | } | ||
| 797 | } else { | 793 | } else { |
| 798 | std::string nick = (nickMaybe && !(*nickMaybe).empty()) ? nickMaybe.get() : nickResolver_->jidToNick(jid_); | 794 | std::string nick = (nickMaybe && !(*nickMaybe).empty()) ? nickMaybe.get() : nickResolver_->jidToNick(jid_); |
| 799 | muc = mucManager->createMUC(mucJID); | 795 | muc = mucManager->createMUC(mucJID); |
| @@ -825,6 +821,13 @@ MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::opti | |||
| 825 | controller->onUserNicknameChanged.connect(boost::bind(&ChatsManager::handleUserNicknameChanged, this, controller, _1, _2)); | 821 | controller->onUserNicknameChanged.connect(boost::bind(&ChatsManager::handleUserNicknameChanged, this, controller, _1, _2)); |
| 826 | controller->onActivity.connect(boost::bind(&ChatsManager::handleChatActivity, this, mucJID.toBare(), _1, true)); | 822 | controller->onActivity.connect(boost::bind(&ChatsManager::handleChatActivity, this, mucJID.toBare(), _1, true)); |
| 827 | controller->onUnreadCountChanged.connect(boost::bind(&ChatsManager::handleUnreadCountChanged, this, controller)); | 823 | controller->onUnreadCountChanged.connect(boost::bind(&ChatsManager::handleUnreadCountChanged, this, controller)); |
| 824 | if (!stanzaChannel_->isAvailable()) { | ||
| 825 | /* When online, the MUC is added to the registry in MUCImpl::internalJoin. This method is not | ||
| 826 | * called when Swift is offline, so we add it here as only MUCs in the registry are rejoined | ||
| 827 | * when going back online. | ||
| 828 | */ | ||
| 829 | mucRegistry_->addMUC(mucJID.toBare()); | ||
| 830 | } | ||
| 828 | handleChatActivity(mucJID.toBare(), "", true); | 831 | handleChatActivity(mucJID.toBare(), "", true); |
| 829 | } | 832 | } |
| 830 | 833 | ||
Swift