diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-20 11:57:43 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-20 11:57:43 +0300 |
commit | 3420f0f1d98d5c7076f4cb9c6ea23b2e4ab462e1 (patch) | |
tree | 96364f577cfe62e8bb61f2c7948c545a6a89025c /protocols/Dummy/src | |
parent | 3d56e7622af87e2f39ba759ee3761dafc8278d56 (diff) |
Dummy: the support for Discord accounts disabled in the trunk version
Diffstat (limited to 'protocols/Dummy/src')
-rw-r--r-- | protocols/Dummy/src/dummy.h | 3 | ||||
-rw-r--r-- | protocols/Dummy/src/dummy_options.cpp | 21 | ||||
-rw-r--r-- | protocols/Dummy/src/dummy_proto.cpp | 20 | ||||
-rw-r--r-- | protocols/Dummy/src/dummy_proto.h | 1 | ||||
-rw-r--r-- | protocols/Dummy/src/main.cpp | 2 |
5 files changed, 25 insertions, 22 deletions
diff --git a/protocols/Dummy/src/dummy.h b/protocols/Dummy/src/dummy.h index 4efb643d61..2bffe7c45a 100644 --- a/protocols/Dummy/src/dummy.h +++ b/protocols/Dummy/src/dummy.h @@ -31,8 +31,7 @@ struct ttemplate const char *text;
};
-#define DUMMY_PROTO_COUNT 26
-extern const ttemplate templates[DUMMY_PROTO_COUNT];
+extern const ttemplate templates[];
struct CMPlugin : public ACCPROTOPLUGIN<CDummyProto>
{
diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp index 350f5398c0..807ea84bb7 100644 --- a/protocols/Dummy/src/dummy_options.cpp +++ b/protocols/Dummy/src/dummy_options.cpp @@ -20,21 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. //////////////////////////////////////////////////////////////////////////////
// Account manager dialog
-void onTemplateSelected(HWND hwndDlg, CDummyProto *ppro, int templateId)
-{
- // Enable custom fields when selected custom template
- EnableWindow(GetDlgItem(hwndDlg, IDC_ID_TEXT), templateId == 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ID_SETTING), templateId == 0);
-
- ptrA tszIdText(templateId > 0 ? mir_strdup(Translate(templates[templateId].text)) : ppro->getStringA(DUMMY_ID_TEXT));
- if (tszIdText != NULL)
- SetDlgItemTextA(hwndDlg, IDC_ID_TEXT, tszIdText);
-
- ptrA tszIdSetting(templateId > 0 ? mir_strdup(templates[templateId].setting) : ppro->getStringA(DUMMY_ID_SETTING));
- if (tszIdSetting != NULL)
- SetDlgItemTextA(hwndDlg, IDC_ID_SETTING, tszIdSetting);
-}
-
INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CDummyProto *ppro = (CDummyProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -49,7 +34,7 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM Window_SetIcon_IcoLib(hwndDlg, ppro->m_hProtoIcon);
{
SendDlgItemMessageA(hwndDlg, IDC_TEMPLATE, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(Translate(templates[0].name)));
- for (size_t i = 1; i < _countof(templates); i++)
+ for (size_t i = 1; templates[i].name != 0; i++)
SendDlgItemMessageA(hwndDlg, IDC_TEMPLATE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(templates[i].name));
int templateId = ppro->getTemplateId();
@@ -58,7 +43,7 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM boolean allowSending = ppro->getByte(DUMMY_KEY_ALLOW_SENDING, 0);
CheckDlgButton(hwndDlg, IDC_ALLOW_SENDING, allowSending ? BST_CHECKED : BST_UNCHECKED);
- onTemplateSelected(hwndDlg, ppro, templateId);
+ ppro->selectTemplate(hwndDlg, templateId);
}
return TRUE;
@@ -67,7 +52,7 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case IDC_TEMPLATE:
if (HIWORD(wParam) == CBN_SELCHANGE) {
int templateId = SendDlgItemMessage(hwndDlg, IDC_TEMPLATE, CB_GETCURSEL, 0, 0);
- onTemplateSelected(hwndDlg, ppro, templateId);
+ ppro->selectTemplate(hwndDlg, templateId);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
break;
diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 37e2aa3958..27d2858600 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -17,11 +17,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
-const ttemplate templates[DUMMY_PROTO_COUNT] =
+const ttemplate templates[] =
{
{ LPGEN("Custom"), "", "" },
{ "AIM", "SN", LPGEN("Screen name") },
+#ifndef MIRANDA_VERSION_ISALPHA
{ "Discord", "id", LPGEN("Discord ID") },
+#endif
{ "EmLAN", "Nick", LPGEN("User name") },
{ "Facebook", "ID", LPGEN("Facebook ID") },
{ "GG", "UIN", LPGEN("Gadu-Gadu number") },
@@ -45,6 +47,7 @@ const ttemplate templates[DUMMY_PROTO_COUNT] = { "WhatsApp", "ID", LPGEN("WhatsApp ID") },
{ "XFire", "Username", LPGEN("Username") },
{ "Yahoo", "yahoo_id", LPGEN("ID") },
+ { 0, 0, 0 }
};
void CDummyProto::SearchIdAckThread(void *targ)
@@ -101,6 +104,21 @@ int CDummyProto::getTemplateId() return 0;
}
+void CDummyProto::selectTemplate(HWND hwndDlg, int templateId)
+{
+ // Enable custom fields when selected custom template
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ID_TEXT), templateId == 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ID_SETTING), templateId == 0);
+
+ ptrA tszIdText(templateId > 0 ? mir_strdup(Translate(templates[templateId].text)) : getStringA(DUMMY_ID_TEXT));
+ if (tszIdText != NULL)
+ SetDlgItemTextA(hwndDlg, IDC_ID_TEXT, tszIdText);
+
+ ptrA tszIdSetting(templateId > 0 ? mir_strdup(templates[templateId].setting) : getStringA(DUMMY_ID_SETTING));
+ if (tszIdSetting != NULL)
+ SetDlgItemTextA(hwndDlg, IDC_ID_SETTING, tszIdSetting);
+}
+
INT_PTR CDummyProto::GetCaps(int type, MCONTACT)
{
switch(type) {
diff --git a/protocols/Dummy/src/dummy_proto.h b/protocols/Dummy/src/dummy_proto.h index 0c502977bc..b56795eedf 100644 --- a/protocols/Dummy/src/dummy_proto.h +++ b/protocols/Dummy/src/dummy_proto.h @@ -48,6 +48,7 @@ struct CDummyProto : public PROTO<CDummyProto> wchar_t uniqueIdSetting[100];
int getTemplateId();
+ void selectTemplate(HWND, int templateId);
volatile unsigned int msgid;
};
diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp index cac974280c..340b79fae8 100644 --- a/protocols/Dummy/src/main.cpp +++ b/protocols/Dummy/src/main.cpp @@ -38,7 +38,7 @@ CMPlugin::CMPlugin() : ACCPROTOPLUGIN<CDummyProto>("Dummy", pluginInfoEx)
{
int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1);
- if (id < 0 || id >= _countof(templates))
+ if (id < 0)
SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING)));
else
SetUniqueId(templates[id].setting);
|