summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-03 15:54:00 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-03 15:54:00 +0300
commitdd1aac53b981fc57b3fc23ad25bdfd3ce8adc15f (patch)
tree0da69ce043ef952596dbe714a3fc9f2982a6254e
parent0805744c4b2f73149d27f5fbadb767d3d5bd50b1 (diff)
NewStory: a service for returning SRMM dialog that owns NS window
-rw-r--r--plugins/ExternalAPI/m_NewStory.h9
-rw-r--r--plugins/NewStory/src/history_svc.cpp7
-rw-r--r--protocols/Telegram/src/menus.cpp9
3 files changed, 20 insertions, 5 deletions
diff --git a/plugins/ExternalAPI/m_NewStory.h b/plugins/ExternalAPI/m_NewStory.h
index 9350672f62..ef2a247426 100644
--- a/plugins/ExternalAPI/m_NewStory.h
+++ b/plugins/ExternalAPI/m_NewStory.h
@@ -25,6 +25,15 @@ enum
};
/////////////////////////////////////////////////////////////////////////////////////////
+// NS get SRMM dialog
+// returns a pointer to the parent SRMM dialog, if used as a log window, or nullptr otherwise
+
+__forceinline CSrmmBaseDialog* NS_GetSrmm(HANDLE hwnd)
+{
+ return (CSrmmBaseDialog *)CallService("NewStory/GetSrmm", WPARAM(hwnd), 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// NS get current event
__forceinline MEVENT NS_GetCurrent(HANDLE hwnd)
diff --git a/plugins/NewStory/src/history_svc.cpp b/plugins/NewStory/src/history_svc.cpp
index 9043ed95fe..e8dc1a154f 100644
--- a/plugins/NewStory/src/history_svc.cpp
+++ b/plugins/NewStory/src/history_svc.cpp
@@ -27,6 +27,12 @@ static INT_PTR SvcGetCurrent(WPARAM wParam, LPARAM)
return 0;
}
+static INT_PTR SvcGetSrmm(WPARAM wParam, LPARAM)
+{
+ auto *pData = (NewstoryListData *)wParam;
+ return (pData) ? INT_PTR(pData->pMsgDlg) : 0;
+}
+
static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam)
{
auto *pData = (NewstoryListData *)wParam;
@@ -51,6 +57,7 @@ static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam)
void InitServices()
{
+ CreateServiceFunction("NewStory/GetSrmm", &SvcGetSrmm);
CreateServiceFunction("NewStory/GetCurrent", &SvcGetCurrent);
CreateServiceFunction("NewStory/GetSelection", &SvcGetSelection);
}
diff --git a/protocols/Telegram/src/menus.cpp b/protocols/Telegram/src/menus.cpp
index cd77cbe396..6efe0de807 100644
--- a/protocols/Telegram/src/menus.cpp
+++ b/protocols/Telegram/src/menus.cpp
@@ -180,7 +180,7 @@ public:
INT_PTR CTelegramProto::SvcExecMenu(WPARAM iCommand, LPARAM pHandle)
{
- MEVENT hCurrentEvent;
+ MEVENT hCurrentEvent = NS_GetCurrent((HANDLE)pHandle);
switch (iCommand) {
case 1: // forward message
@@ -191,15 +191,14 @@ INT_PTR CTelegramProto::SvcExecMenu(WPARAM iCommand, LPARAM pHandle)
break;
case 2: // reactions
- hCurrentEvent = NS_GetCurrent((HANDLE)pHandle);
if (hCurrentEvent != -1)
CReactionsDlg(this, hCurrentEvent).DoModal();
break;
case 3: // reply
- hCurrentEvent = NS_GetCurrent((HANDLE)pHandle);
- // if (hCurrentEvent != -1)
- // CReplyDlg(this, hCurrentEvent).DoModal();
+ if (hCurrentEvent != -1)
+ if (auto *pDlg = NS_GetSrmm((HANDLE)pHandle))
+ pDlg->SetQuoteEvent(hCurrentEvent);
break;
}
return 0;