diff options
author | George Hazan <ghazan@miranda.im> | 2017-07-10 19:44:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-07-10 19:44:03 +0300 |
commit | a2e38963a647f9f58ff276d2ad9f89f7202c47eb (patch) | |
tree | ca043ab94971b442f02ec690d739031eee92f9c5 /plugins/TabSRMM | |
parent | 18873004444063ae98a9e7fc9214bd3edaa146a7 (diff) |
fixes #855 (TabSRMM - Move chat tab to another container switches chat into single conversation)
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/chat.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_main.cpp | 7 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_tools.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 11 | ||||
-rw-r--r-- | plugins/TabSRMM/src/hotkeyhandler.cpp | 6 | ||||
-rw-r--r-- | plugins/TabSRMM/src/version.h | 2 |
6 files changed, 21 insertions, 9 deletions
diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h index 7d26ac9b29..987f30696d 100644 --- a/plugins/TabSRMM/src/chat.h +++ b/plugins/TabSRMM/src/chat.h @@ -109,7 +109,7 @@ void AddIcons(void); HICON LoadIconEx(char *pszIcoLibName);
// services.c
-void ShowRoom(SESSION_INFO *si);
+void ShowRoom(TContainerData *pContainer, SESSION_INFO *si);
// manager.c
SESSION_INFO* SM_FindSessionByHWND(HWND h);
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index de304dfc85..02c906685f 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -242,6 +242,11 @@ static int OnHandleGCMenu(WPARAM, LPARAM lParam) return 0;
}
+static void stubShowRoom(SESSION_INFO *si)
+{
+ ShowRoom(nullptr, si);
+}
+
// load the module
int Chat_Load()
{
@@ -259,7 +264,7 @@ int Chat_Load() pci->OnReplaceSession = OnReplaceSession;
pci->OnChangeNick = OnChangeNick;
- pci->ShowRoom = ShowRoom;
+ pci->ShowRoom = stubShowRoom;
pci->OnLoadSettings = OnLoadSettings;
// this operation is unsafe, that's why we restore the old pci state on exit
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 0caa7224a3..b27e605d2a 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -31,7 +31,7 @@ static void __stdcall ShowRoomFromPopup(void *pi)
{
SESSION_INFO *si = (SESSION_INFO*)pi;
- ShowRoom(si);
+ ShowRoom(nullptr, si);
}
static void __stdcall Chat_DismissPopup(void *pi)
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 0aa80fbfca..c13e94dc84 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -2396,7 +2396,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // chat session creator -void ShowRoom(SESSION_INFO *si) +void ShowRoom(TContainerData *pContainer, SESSION_INFO *si) { if (si == nullptr) return; @@ -2407,9 +2407,11 @@ void ShowRoom(SESSION_INFO *si) } wchar_t szName[CONTAINER_NAMELEN + 2]; szName[0] = 0; - TContainerData *pContainer = nullptr; - if (si->pDlg != nullptr) - pContainer = si->pDlg->m_pContainer; + + if (pContainer == nullptr) + if (si->pDlg != nullptr) + pContainer = si->pDlg->m_pContainer; + if (pContainer == nullptr) { GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN); if (!g_Settings.bOpenInDefault && !mir_wstrcmp(szName, L"default")) @@ -2417,6 +2419,7 @@ void ShowRoom(SESSION_INFO *si) szName[CONTAINER_NAMELEN] = 0; pContainer = FindContainerByName(szName); } + if (pContainer == nullptr) pContainer = CreateContainer(szName, FALSE, si->hContact); if (pContainer == nullptr) diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 865f2a77af..af951250db 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -365,7 +365,11 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP else
SendMessage(hWnd, WM_CLOSE, 0, 1);
- CreateNewTabForContact((TContainerData*)wParam, lParam, true, true, false);
+ char *szProto = GetContactProto(lParam);
+ if (szProto != nullptr && db_get_b(lParam, szProto, "ChatRoom", 0))
+ ShowRoom((TContainerData*)wParam, SM_FindSessionByHCONTACT(lParam));
+ else
+ CreateNewTabForContact((TContainerData*)wParam, lParam, true, true, false);
}
}
}
diff --git a/plugins/TabSRMM/src/version.h b/plugins/TabSRMM/src/version.h index 15cef1d4f9..bd3ed36318 100644 --- a/plugins/TabSRMM/src/version.h +++ b/plugins/TabSRMM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 3
#define __MINOR_VERSION 5
#define __RELEASE_NUM 0
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#include <stdver.h>
|