diff options
Diffstat (limited to 'protocols/Dummy')
-rw-r--r-- | protocols/Dummy/src/dummy.h | 73 | ||||
-rw-r--r-- | protocols/Dummy/src/dummy_options.cpp | 2 | ||||
-rw-r--r-- | protocols/Dummy/src/dummy_proto.cpp | 8 | ||||
-rw-r--r-- | protocols/Dummy/src/main.cpp | 15 |
4 files changed, 47 insertions, 51 deletions
diff --git a/protocols/Dummy/src/dummy.h b/protocols/Dummy/src/dummy.h index 90b08dd243..32ddb8d345 100644 --- a/protocols/Dummy/src/dummy.h +++ b/protocols/Dummy/src/dummy.h @@ -18,8 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once
struct CDummyProto;
-extern LIST<CDummyProto> dummy_Instances;
-extern HINSTANCE g_hInstance;
#define DUMMY_ID_TEMPLATE "Template"
#define DUMMY_ID_TEXT "UniqueIdText"
@@ -34,36 +32,51 @@ struct message_data int msgid;
};
-typedef struct {
+struct ttemplate
+{
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("VKontakte ID") },
+ { "WhatsApp", "ID", LPGEN("WhatsApp ID") },
+ { "XFire", "Username", LPGEN("Username") },
+ { "Yahoo", "yahoo_id", LPGEN("ID") },
+};
-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("VKontakte ID") },
- { "WhatsApp", "ID", LPGEN("WhatsApp ID") },
- { "XFire", "Username", LPGEN("Username") },
- { "Yahoo", "yahoo_id", LPGEN("ID") },
+struct CMPlugin : public ACCPROTOPLUGIN<CDummyProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<CDummyProto>("Dummy")
+ {
+ int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1);
+ if (id < 0 || id >= _countof(templates))
+ SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING)));
+ else
+ SetUniqueId(templates[id].setting);
+ }
};
diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp index 701d647589..3312d83f35 100644 --- a/protocols/Dummy/src/dummy_options.cpp +++ b/protocols/Dummy/src/dummy_options.cpp @@ -116,5 +116,5 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM INT_PTR CDummyProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
{
- return (INT_PTR)CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, DummyAccountProc, (LPARAM)this);
+ return (INT_PTR)CreateDialogParam(g_plugin.getInst(), 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 f95c8ccfb4..c68b687c18 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -52,8 +52,6 @@ static int sttCompareProtocols(const CDummyProto *p1, const CDummyProto *p2) return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName); } -LIST<CDummyProto> dummy_Instances(1, sttCompareProtocols); - CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName) : PROTO<CDummyProto>(szModuleName, ptszUserName) { @@ -70,14 +68,12 @@ CDummyProto::CDummyProto(const char *szModuleName, const wchar_t *ptszUserName) else uniqueIdText[0] = '\0'; uniqueIdSetting[0] = '\0'; - - dummy_Instances.insert(this); } CDummyProto::~CDummyProto() { - Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = nullptr; - dummy_Instances.remove(this); + Netlib_CloseHandle(m_hNetlibUser); + m_hNetlibUser = nullptr; } ////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Dummy/src/main.cpp b/protocols/Dummy/src/main.cpp index 93492c1df6..453a68b51c 100644 --- a/protocols/Dummy/src/main.cpp +++ b/protocols/Dummy/src/main.cpp @@ -18,7 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
#include "version.h"
-HINSTANCE g_hInstance;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -75,18 +74,6 @@ extern "C" int __declspec(dllexport) Unload(void) /////////////////////////////////////////////////////////////////////////////////////////
-struct CMPlugin : public ACCPROTOPLUGIN<CDummyProto>
-{
- CMPlugin() :
- ACCPROTOPLUGIN<CDummyProto>("Dummy")
- {
- int id = db_get_b(0, m_szModuleName, DUMMY_ID_TEMPLATE, -1);
- if (id < 0 || id >= _countof(templates))
- SetUniqueId(ptrA(db_get_sa(0, m_szModuleName, DUMMY_ID_SETTING)));
- else
- SetUniqueId(templates[id].setting);
- }
-}
- g_plugin;
+CMPlugin g_plugin;
extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
|