summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-07-17 13:11:49 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-07-17 13:11:49 +0300
commit5fdd629c6420a1ce0751291e348b3eee9c6db15e (patch)
treec5b217cf17187564bffdf390d0d0c7503f578ec4
parentb54524918f547089772bb0c30db5f8510ed2a426 (diff)
fixes #4543 (Dummy: групчаты глючат)
-rw-r--r--protocols/Dummy/src/dummy_options.cpp2
-rw-r--r--protocols/Dummy/src/dummy_proto.cpp19
-rw-r--r--protocols/Dummy/src/dummy_proto.h3
-rw-r--r--protocols/Dummy/src/main.cpp12
-rw-r--r--protocols/Dummy/src/stdafx.h1
5 files changed, 24 insertions, 13 deletions
diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp
index d1d7175905..31af8ffa80 100644
--- a/protocols/Dummy/src/dummy_options.cpp
+++ b/protocols/Dummy/src/dummy_options.cpp
@@ -35,7 +35,7 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
{
FillTemplateCombo(hwndDlg, IDC_TEMPLATE);
- int templateId = ppro->getTemplateId();
+ int templateId = getDummyProtocolId(ppro->m_szModuleName);
SendDlgItemMessage(hwndDlg, IDC_TEMPLATE, CB_SETCURSEL, templateId, 0);
boolean allowSending = ppro->getByte(DUMMY_KEY_ALLOW_SENDING, 0);
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp
index 285cbe0f21..6864135748 100644
--- a/protocols/Dummy/src/dummy_proto.cpp
+++ b/protocols/Dummy/src/dummy_proto.cpp
@@ -19,11 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
const ttemplate templates[] =
{
- { LPGEN("Custom"), "", "" },
- { "AIM", "SN", LPGEN("Screen name") },
-#ifndef MIRANDA_VERSION_ISALPHA
- { "Discord", "id", LPGEN("Discord ID") },
-#endif
+ { LPGEN("Custom"), "", "" },
+ { "AIM", "SN", LPGEN("Screen name") },
{ "EmLAN", "Nick", LPGEN("User name") },
{ "Facebook", "ID", LPGEN("Facebook ID") },
{ "GG", "UIN", LPGEN("Gadu-Gadu number") },
@@ -83,7 +80,7 @@ CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName)
{
msgid = 0;
- int id = getTemplateId();
+ int id = getDummyProtocolId(m_szModuleName);
ptrA setting(id > 0 ? mir_strdup(templates[id].setting) : getStringA(DUMMY_ID_SETTING));
if (setting != NULL) {
strncpy_s(uniqueIdText, setting, _TRUNCATE);
@@ -100,18 +97,18 @@ CDummyProto::~CDummyProto()
//////////////////////////////////////////////////////////////////////////////
-int CDummyProto::getTemplateId()
+int getDummyProtocolId(const char *pszModuleName)
{
- int id = this->getByte(DUMMY_ID_TEMPLATE, -1);
+ int id = db_get_b(0, pszModuleName, DUMMY_ID_TEMPLATE, -1);
if (id >= 0 && id < _countof(templates))
return id;
- CMStringA szProto(getMStringA("AM_BaseProto"));
+ CMStringA szProto(db_get_sm(0, pszModuleName, "AM_BaseProto"));
for (auto &it : templates)
if (!stricmp(it.name, szProto))
return int(&it - templates);
- return 0;
+ return -1;
}
void CDummyProto::selectTemplate(HWND hwndDlg, int templateId)
@@ -152,7 +149,7 @@ INT_PTR CDummyProto::GetCaps(int type, MCONTACT)
case PFLAG_UNIQUEIDTEXT:
if (uniqueIdSetting[0] == '\0') {
- int id = getTemplateId();
+ int id = getDummyProtocolId(m_szModuleName);
ptrW setting(id > 0 ? mir_a2u(Translate(templates[id].text)) : getWStringA(DUMMY_ID_TEXT));
if (setting != NULL)
wcsncpy_s(uniqueIdSetting, setting, _TRUNCATE);
diff --git a/protocols/Dummy/src/dummy_proto.h b/protocols/Dummy/src/dummy_proto.h
index b56795eedf..2138d36466 100644
--- a/protocols/Dummy/src/dummy_proto.h
+++ b/protocols/Dummy/src/dummy_proto.h
@@ -47,8 +47,9 @@ struct CDummyProto : public PROTO<CDummyProto>
char uniqueIdText[100];
wchar_t uniqueIdSetting[100];
- int getTemplateId();
void selectTemplate(HWND, int templateId);
volatile unsigned int msgid;
};
+
+int getDummyProtocolId(const char *pszModuleName);
diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp
index 29a6cf6ef8..70100b0ce1 100644
--- a/protocols/Dummy/src/main.cpp
+++ b/protocols/Dummy/src/main.cpp
@@ -51,8 +51,20 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
/////////////////////////////////////////////////////////////////////////////////////////
// OnLoad - initialize the plugin instance
+static int OnDummyDoubleClicked(WPARAM hContact, LPARAM)
+{
+ if (auto *pa = Proto_GetContactAccount(hContact))
+ if (getDummyProtocolId(pa->szModuleName) != -1 && Contact::IsGroupChat(hContact)) {
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0);
+ return 1;
+ }
+
+ return 0;
+}
+
int CMPlugin::Load()
{
+ HookEvent(ME_CLIST_DOUBLECLICKED, OnDummyDoubleClicked);
return 0;
}
diff --git a/protocols/Dummy/src/stdafx.h b/protocols/Dummy/src/stdafx.h
index 4dd662c2db..254731c90d 100644
--- a/protocols/Dummy/src/stdafx.h
+++ b/protocols/Dummy/src/stdafx.h
@@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_file.h>
#include <m_fontservice.h>
#include <m_genmenu.h>
+#include <m_history.h>
#include <m_hotkeys.h>
#include <m_icolib.h>
#include <m_idle.h>