summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-09-18 18:14:53 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-09-18 18:14:53 +0300
commit78c5dd9a8648dba7ca09f59b4b7460610c6ff3a6 (patch)
tree0a49a7e53e8ba05f501f46dd6ed36e355b49158b /plugins/NewStory/src
parent41e677d44f0efc241bf484252af6de64b0d00a6c (diff)
Telegram: ability to add custom chat reactions using NewHistory
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r--plugins/NewStory/src/history_svc.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/NewStory/src/history_svc.cpp b/plugins/NewStory/src/history_svc.cpp
index ad59635956..6ddaae2add 100644
--- a/plugins/NewStory/src/history_svc.cpp
+++ b/plugins/NewStory/src/history_svc.cpp
@@ -17,6 +17,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+static INT_PTR SvcGetCurrent(WPARAM wParam, LPARAM)
+{
+ if (auto *pData = (NewstoryListData *)wParam)
+ if (auto *p = pData->GetItem(pData->caret))
+ return p->hEvent;
+
+ return 0;
+}
+
static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam)
{
auto *pData = (NewstoryListData *)wParam;
@@ -27,6 +36,10 @@ static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam)
if (p->m_bSelected)
pRet->push_back(p->hEvent);
}
+
+ if (pRet->empty() && pData->caret != -1)
+ if (auto *p = pData->GetItem(pData->caret))
+ pRet->push_back(p->hEvent);
}
return 0;
@@ -37,5 +50,6 @@ static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam)
void InitServices()
{
+ CreateServiceFunction(MS_NEWSTORY_GETCURRENT, &SvcGetCurrent);
CreateServiceFunction(MS_NEWSTORY_GETSELECTION, &SvcGetSelection);
}