From bf40980c0484f7c0639a040b5abc80f181084283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 25 Oct 2015 11:41:08 +0000 Subject: Dummy: Simplify settings by provide list of existing protocols to choose from; Version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@15612 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Dummy/res/resource.aps | Bin 3220 -> 3476 bytes protocols/Dummy/res/resource.rc | 199 ++++++++++++++++----------------- protocols/Dummy/src/dummy.h | 81 ++++++++++---- protocols/Dummy/src/dummy_options.cpp | 201 +++++++++++++++++++--------------- protocols/Dummy/src/dummy_proto.cpp | 15 ++- protocols/Dummy/src/dummy_proto.h | 2 + protocols/Dummy/src/main.cpp | 200 ++++++++++++++++----------------- protocols/Dummy/src/resource.h | 39 +++---- protocols/Dummy/src/version.h | 2 +- 9 files changed, 410 insertions(+), 329 deletions(-) (limited to 'protocols') diff --git a/protocols/Dummy/res/resource.aps b/protocols/Dummy/res/resource.aps index 368e406239..b342d02388 100644 Binary files a/protocols/Dummy/res/resource.aps and b/protocols/Dummy/res/resource.aps differ diff --git a/protocols/Dummy/res/resource.rc b/protocols/Dummy/res/resource.rc index 8e73d05bb1..19b1fb4949 100644 --- a/protocols/Dummy/res/resource.rc +++ b/protocols/Dummy/res/resource.rc @@ -1,98 +1,101 @@ -// Microsoft Visual C++ generated resource script. -// -#include "..\src\resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ACCMGRUI DIALOGEX 0, 0, 186, 93 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - LTEXT "Unique ID setting:",IDC_STATIC,0,0,95,12 - EDITTEXT IDC_ID_SETTING,96,0,89,12,ES_AUTOHSCROLL - LTEXT "Name of setting that holds unique identifier of contacts",IDC_STATIC,10,15,175,18 - LTEXT "Unique ID text:",IDC_STATIC,0,36,94,12 - EDITTEXT IDC_ID_TEXT,95,36,90,12,ES_AUTOHSCROLL - LTEXT "Visible name of unique identifier of contacts",IDC_STATIC,10,52,175,18 - LTEXT "Restart is required to apply these changes.",IDC_STATIC,0,78,185,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ACCMGRUI, DIALOG - BEGIN - RIGHTMARGIN, 185 - VERTGUIDE, 10 - , 50 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "..\\src\\resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\0" - "#include ""..\\src\\version.h""\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ACCMGRUI DIALOGEX 0, 0, 186, 122 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + LTEXT "Protocol template:",IDC_STATIC,0,7,95,12 + COMBOBOX IDC_TEMPLATE,95,5,90,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + LTEXT "Unique ID setting:",IDC_STATIC,0,27,95,12 + EDITTEXT IDC_ID_SETTING,95,27,90,12,ES_AUTOHSCROLL + LTEXT "Name of setting that holds unique identifier of contacts",IDC_STATIC,10,42,175,18 + LTEXT "Unique ID text:",IDC_STATIC,0,63,95,12 + EDITTEXT IDC_ID_TEXT,95,63,90,12,ES_AUTOHSCROLL + LTEXT "Visible name of unique identifier of contacts",IDC_STATIC,10,79,175,18 + LTEXT "Restart is required to apply these changes.",IDC_STATIC,0,105,185,8 +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "..\\src\\resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\0" + "#include ""..\\src\\version.h""\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ACCMGRUI, DIALOG + BEGIN + VERTGUIDE, 10 + VERTGUIDE, 95 + VERTGUIDE, 185 + BOTTOMMARGIN, 93 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/protocols/Dummy/src/dummy.h b/protocols/Dummy/src/dummy.h index 9fa7c9d0c1..34f2ad3a7d 100644 --- a/protocols/Dummy/src/dummy.h +++ b/protocols/Dummy/src/dummy.h @@ -1,23 +1,58 @@ -/* -Copyright (c) 2014 Robert Pösel - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -struct CDummyProto; -extern LIST dummy_Instances; -extern HINSTANCE hInst; - -#define DUMMY_ID_TEXT "UniqueIdText" -#define DUMMY_ID_SETTING "UniqueIdSetting" \ No newline at end of file +/* +Copyright (c) 2014 Robert Pösel + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation version 2 +of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +struct CDummyProto; +extern LIST dummy_Instances; +extern HINSTANCE hInst; + +#define DUMMY_ID_TEMPLATE "Template" +#define DUMMY_ID_TEXT "UniqueIdText" +#define DUMMY_ID_SETTING "UniqueIdSetting" + +typedef struct { + const char *name; + const char *setting; + const char *text; +} ttemplate; + +static const ttemplate templates[] = { + { LPGEN("Custom"), "", "" }, + { "AIM", "SN", LPGEN("Screen Name") }, + { "EmLAN", "Nick", LPGEN("User name") }, + { "Facebook", "ID", LPGEN("Facebook ID") }, + { "GG", "UIN", LPGEN("Gadu-Gadu Number") }, + { "ICQ", "UIN", LPGEN("User ID") }, + { "ICQCorp", "UIN", LPGEN("ICQ number") }, + { "IRC", "Nick", LPGEN("Nickname") }, + { "Jabber", "jid", LPGEN("JID") }, + { "MinecraftDynmap", "Nick", LPGEN("Visible name") }, + { "MRA", "e-mail", LPGEN("E-mail address") }, + { "MSN", "e-mail", LPGEN("Live ID") }, + { "Omegle", "nick", LPGEN("Visible name") }, + { "Sametime", "stid", LPGEN("ID") }, + { "Skype (SkypeKit)", "sid", LPGEN("Skype name") }, + { "Skype (Classic)", "Username", LPGEN("Skype name") }, + { "Skype (Web)", "Username", LPGEN("Skype name") }, + { "Steam", "SteamID", LPGEN("Steam ID") }, + { "Tlen", "jid", LPGEN("Tlen login") }, + { "Tox", "ToxID", LPGEN("Tox ID") }, + { "Twitter", "Username", LPGEN("Username") }, + { "VK", "ID", LPGEN("VK ID") }, + { "WhatsApp", "ID", LPGEN("WhatsApp ID") }, + { "XFire", "Username", LPGEN("Username") }, + { "Yahoo", "yahoo_id", LPGEN("ID") }, +}; diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp index 4ff413d2dd..aa6cb6d798 100644 --- a/protocols/Dummy/src/dummy_options.cpp +++ b/protocols/Dummy/src/dummy_options.cpp @@ -1,86 +1,115 @@ -/* -Copyright (c) 2014 Robert Pösel - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "stdafx.h" - -////////////////////////////////////////////////////////////////////////////// -// Account manager dialog - -INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - CDummyProto *ppro = (CDummyProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - - switch (uMsg) { - case WM_INITDIALOG: - TranslateDialogDefault(hwndDlg); - - ppro = (CDummyProto*)lParam; - SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - - SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, true)); - SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon)); - { - ptrA tszIdText(ppro->getStringA(DUMMY_ID_TEXT)); - if (tszIdText != NULL) - SetDlgItemTextA(hwndDlg, IDC_ID_TEXT, tszIdText); - - ptrA tszIdSetting(ppro->getStringA(DUMMY_ID_SETTING)); - if (tszIdSetting != NULL) - SetDlgItemTextA(hwndDlg, IDC_ID_SETTING, tszIdSetting); - } - return TRUE; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_ID_TEXT: - case IDC_ID_SETTING: - if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) { - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - } - break; - - case WM_NOTIFY: - switch (((LPNMHDR)lParam)->code) { - case PSN_APPLY: - char str[128]; - GetDlgItemTextA(hwndDlg, IDC_ID_TEXT, str, _countof(str)); - ppro->setString(DUMMY_ID_TEXT, str); - - GetDlgItemTextA(hwndDlg, IDC_ID_SETTING, str, _countof(str)); - ppro->setString(DUMMY_ID_SETTING, str); - } - break; - - case WM_CLOSE: - EndDialog(hwndDlg, 0); - break; - - case WM_DESTROY: - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); - IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); - break; - } - - return FALSE; -} - -INT_PTR CDummyProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) -{ - return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, DummyAccountProc, (LPARAM)this); -} +/* +Copyright (c) 2014 Robert Pösel + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation version 2 +of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdafx.h" + +////////////////////////////////////////////////////////////////////////////// +// 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); + + switch (uMsg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + + ppro = (CDummyProto*)lParam; + SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); + + SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon, true)); + SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIconByHandle(ppro->m_hProtoIcon)); + { + SendDlgItemMessageA(hwndDlg, IDC_TEMPLATE, CB_INSERTSTRING, 0, reinterpret_cast(Translate(templates[0].name))); + for (size_t i = 1; i < _countof(templates); i++) + SendDlgItemMessageA(hwndDlg, IDC_TEMPLATE, CB_INSERTSTRING, i, reinterpret_cast(templates[i].name)); + + int templateId = ppro->getTemplateId(); + SendDlgItemMessage(hwndDlg, IDC_TEMPLATE, CB_SETCURSEL, templateId, 0); + + onTemplateSelected(hwndDlg, ppro, templateId); + } + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_TEMPLATE: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int templateId = SendDlgItemMessage(hwndDlg, IDC_TEMPLATE, CB_GETCURSEL, 0, 0); + onTemplateSelected(hwndDlg, ppro, templateId); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + } + break; + case IDC_ID_TEXT: + case IDC_ID_SETTING: + if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) { + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + } + break; + + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + int templateId = SendDlgItemMessage(hwndDlg, IDC_TEMPLATE, CB_GETCURSEL, 0, 0); + ppro->setByte(DUMMY_ID_TEMPLATE, templateId); + + // Save custom fields only when this is custom template + if (templateId == 0) { + char str[128]; + GetDlgItemTextA(hwndDlg, IDC_ID_TEXT, str, _countof(str)); + ppro->setString(DUMMY_ID_TEXT, str); + + GetDlgItemTextA(hwndDlg, IDC_ID_SETTING, str, _countof(str)); + ppro->setString(DUMMY_ID_SETTING, str); + } + } + break; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + break; + + case WM_DESTROY: + IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0)); + IcoLib_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0)); + break; + } + + return FALSE; +} + +INT_PTR CDummyProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam) +{ + return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, DummyAccountProc, (LPARAM)this); +} diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 2503e15ea0..531cf9d627 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -50,6 +50,15 @@ CDummyProto::~CDummyProto() ////////////////////////////////////////////////////////////////////////////// +int CDummyProto::getTemplateId() +{ + int id = this->getByte(DUMMY_ID_TEMPLATE, 0); + if (id < 0 || id >= _countof(templates)) { + return 0; + } + return id; +} + DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT) { switch(type) { @@ -73,7 +82,8 @@ DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT) case PFLAG_UNIQUEIDTEXT: if (uniqueIdSetting[0] == '\0') { - ptrA setting(getStringA(DUMMY_ID_TEXT)); + int id = getTemplateId(); + ptrA setting(id > 0 ? mir_strdup(Translate(templates[id].text)) : getStringA(DUMMY_ID_TEXT)); if (setting != NULL) strncpy_s(uniqueIdSetting, setting, _TRUNCATE); } @@ -81,7 +91,8 @@ DWORD_PTR CDummyProto::GetCaps(int type, MCONTACT) case PFLAG_UNIQUEIDSETTING: if (uniqueIdText[0] == '\0') { - ptrA setting(getStringA(DUMMY_ID_SETTING)); + int id = getTemplateId(); + ptrA setting(id > 0 ? mir_strdup(templates[id].setting) : getStringA(DUMMY_ID_SETTING)); if (setting != NULL) strncpy_s(uniqueIdText, setting, _TRUNCATE); } diff --git a/protocols/Dummy/src/dummy_proto.h b/protocols/Dummy/src/dummy_proto.h index 69e153b91a..61292aa366 100644 --- a/protocols/Dummy/src/dummy_proto.h +++ b/protocols/Dummy/src/dummy_proto.h @@ -46,4 +46,6 @@ struct CDummyProto : public PROTO char uniqueIdText[100]; char uniqueIdSetting[100]; + + int getTemplateId(); }; diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp index d5cb7ab141..87b112e219 100644 --- a/protocols/Dummy/src/main.cpp +++ b/protocols/Dummy/src/main.cpp @@ -1,102 +1,102 @@ -/* -Copyright (c) 2014 Robert Pösel - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "stdafx.h" -#include "version.h" - -HINSTANCE hInst; -int hLangpack; -CLIST_INTERFACE *pcli; - -PLUGININFOEX pluginInfo = -{ - sizeof(PLUGININFOEX), - __PLUGIN_NAME, - PLUGIN_MAKE_VERSION(__MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM), - __DESCRIPTION, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - UNICODE_AWARE, - // {2A1081D1-AEE3-4091-B70D-AE46D09F9A7F} - { 0x2a1081d1, 0xaee3, 0x4091, {0xb7, 0xd, 0xae, 0x46, 0xd0, 0x9f, 0x9a, 0x7f}} -}; - -///////////////////////////////////////////////////////////////////////////////////////// - -BOOL WINAPI DllMain(HINSTANCE hModule, DWORD, LPVOID) -{ - hInst = hModule; - return TRUE; -} - -extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) -{ - return &pluginInfo; -} - -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST}; - -///////////////////////////////////////////////////////////////////////////////////////// -// OnModulesLoaded - execute some code when all plugins are initialized - -static int OnModulesLoaded(WPARAM, LPARAM) -{ - return 0; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// OnLoad - initialize the plugin instance - -static CDummyProto* dummyProtoInit(const char* pszProtoName, const TCHAR *tszUserName) -{ - CDummyProto *ppro = new CDummyProto(pszProtoName, tszUserName); - return ppro; -} - -static int dummyProtoUninit(CDummyProto *ppro) -{ - delete ppro; - return 0; -} - -extern "C" int __declspec(dllexport) Load() -{ - mir_getLP(&pluginInfo); - mir_getCLI(); - - // Register protocol module +/* +Copyright (c) 2014 Robert Pösel + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation version 2 +of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdafx.h" +#include "version.h" + +HINSTANCE hInst; +int hLangpack; +CLIST_INTERFACE *pcli; + +PLUGININFOEX pluginInfo = +{ + sizeof(PLUGININFOEX), + __PLUGIN_NAME, + PLUGIN_MAKE_VERSION(__MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM), + __DESCRIPTION, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + UNICODE_AWARE, + // {2A1081D1-AEE3-4091-B70D-AE46D09F9A7F} + { 0x2a1081d1, 0xaee3, 0x4091, {0xb7, 0xd, 0xae, 0x46, 0xd0, 0x9f, 0x9a, 0x7f}} +}; + +///////////////////////////////////////////////////////////////////////////////////////// + +BOOL WINAPI DllMain(HINSTANCE hModule, DWORD, LPVOID) +{ + hInst = hModule; + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) +{ + return &pluginInfo; +} + +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST}; + +///////////////////////////////////////////////////////////////////////////////////////// +// OnModulesLoaded - execute some code when all plugins are initialized + +static int OnModulesLoaded(WPARAM, LPARAM) +{ + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// OnLoad - initialize the plugin instance + +static CDummyProto* dummyProtoInit(const char* pszProtoName, const TCHAR *tszUserName) +{ + CDummyProto *ppro = new CDummyProto(pszProtoName, tszUserName); + return ppro; +} + +static int dummyProtoUninit(CDummyProto *ppro) +{ + delete ppro; + return 0; +} + +extern "C" int __declspec(dllexport) Load() +{ + mir_getLP(&pluginInfo); + mir_getCLI(); + + // Register protocol module PROTOCOLDESCRIPTOR pd = { 0 }; pd.cbSize = sizeof(pd); - pd.szName = "Dummy"; - pd.fnInit = (pfnInitProto)dummyProtoInit; - pd.fnUninit = (pfnUninitProto)dummyProtoUninit; - pd.type = PROTOTYPE_PROTOCOL; - Proto_RegisterModule(&pd); - - HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - return 0; -} - -///////////////////////////////////////////////////////////////////////////////////////// -// Unload - destroy the plugin instance - -extern "C" int __declspec(dllexport) Unload(void) -{ - return 0; -} + pd.szName = "Dummy"; + pd.fnInit = (pfnInitProto)dummyProtoInit; + pd.fnUninit = (pfnUninitProto)dummyProtoUninit; + pd.type = PROTOTYPE_PROTOCOL; + Proto_RegisterModule(&pd); + + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Unload - destroy the plugin instance + +extern "C" int __declspec(dllexport) Unload(void) +{ + return 0; +} diff --git a/protocols/Dummy/src/resource.h b/protocols/Dummy/src/resource.h index 3dbd026269..bf5d6ff711 100644 --- a/protocols/Dummy/src/resource.h +++ b/protocols/Dummy/src/resource.h @@ -1,19 +1,20 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by D:\Development\Miranda NG\protocols\Dummy\res\resource.rc -// -#define IDD_ACCMGRUI 101 -#define IDC_ID_TEXT 1030 -#define IDC_ID_SETTING 1031 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1032 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by D:\Development\Miranda\Miranda NG\protocols\Dummy\res\resource.rc +// +#define IDD_ACCMGRUI 101 +#define IDC_ID_TEXT 1030 +#define IDC_ID_SETTING 1031 +#define IDC_TEMPLATE 1032 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1033 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/protocols/Dummy/src/version.h b/protocols/Dummy/src/version.h index f48ea816ae..7cae5b996e 100644 --- a/protocols/Dummy/src/version.h +++ b/protocols/Dummy/src/version.h @@ -1,5 +1,5 @@ #define __MAJOR_VERSION 0 -#define __MINOR_VERSION 1 +#define __MINOR_VERSION 2 #define __RELEASE_NUM 0 #define __BUILD_NUM 0 -- cgit v1.2.3