Commit 0b238ed5 authored by Rafał Malinowski's avatar Rafał Malinowski

jabber: #2886 fixed: add option to stay in chat room after closing chat window

Signed-off-by: Rafał Malinowski's avatarRafał Przemysław Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent d968e2e9
......@@ -9,6 +9,7 @@
* indicator_docking: #2682 done: support for new versions of Unity (Vogel)
* unity_integration: #2892 done: display number of unread messages in Unity Launcher (Vogel)
* history: #2902 fixed: clear history menu item dissappear after a second (Vogel)
* jabber: #2886 fixed: add option to stay in chat room after closing chat window (Vogel)
+++ version 1.3
* gui: #2869 fixed: uuids visible in info panel after adding new buddy (Vogel)
......
......@@ -66,6 +66,7 @@ private:
PROPERTY_DEC(bool, SendGoneNotification)
PROPERTY_DEC(bool, PublishSystemInfo)
PROPERTY_DEC(bool, StayInRoomAfterClosingWindow)
protected:
virtual void load();
virtual void store();
......
......@@ -33,8 +33,7 @@ namespace XMPP
{
JabberRoomChatService::JabberRoomChatService(Account account, QObject *parent) :
AccountService{account, parent},
m_leaveOnChatClose{true}
AccountService{account, parent}
{
}
......@@ -67,11 +66,6 @@ void JabberRoomChatService::setXmppClient(Client *xmppClient)
connect(m_client.data(), SIGNAL(groupChatPresence(Jid,Status)), this, SLOT(groupChatPresence(Jid,Status)));
}
void JabberRoomChatService::setLeaveOnChatClose(bool leaveOnChatClose)
{
m_leaveOnChatClose = leaveOnChatClose;
}
ChatDetailsRoom * JabberRoomChatService::myRoomChatDetails(const Chat &chat) const
{
if (chat.chatAccount() != account())
......@@ -86,6 +80,9 @@ void JabberRoomChatService::chatOpened(const Chat &chat)
if (!details)
return;
if (m_openedRoomChats.contains(details->room()))
return;
m_openedRoomChats.insert(details->room(), chat);
auto jid = Jid{details->room()};
......@@ -94,7 +91,8 @@ void JabberRoomChatService::chatOpened(const Chat &chat)
void JabberRoomChatService::chatClosed(const Chat &chat)
{
if (m_leaveOnChatClose)
auto details = dynamic_cast<JabberAccountDetails *>(account().details());
if (!details || !details->stayInRoomAfterClosingWindow())
leaveChat(chat);
}
......@@ -111,7 +109,7 @@ void JabberRoomChatService::leaveChat(const Chat &chat)
m_openedRoomChats.remove(details->room());
m_closedRoomChats.insert(details->room(), chat);
Jid jid = details->room();
auto jid = Jid{details->room()};
m_client.data()->groupChatLeave(jid.domain(), jid.node());
}
......
......@@ -53,8 +53,6 @@ public:
void setXmppClient(Client *xmppClient);
void setLeaveOnChatClose(bool leaveOnChatClose);
bool shouldHandleReceivedMessage(const XMPP::Message &msg) const;
::Message handleReceivedMessage(const XMPP::Message &msg) const;
......@@ -75,7 +73,6 @@ private:
QPointer<ContactManager> m_contactManager;
QPointer<Client> m_client;
bool m_leaveOnChatClose;
QMap<QString, Chat> m_openedRoomChats;
QMap<QString, Chat> m_closedRoomChats;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment