summaryrefslogtreecommitdiff
path: root/protocols/MRA/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-03-28 16:34:30 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-03-28 16:34:30 +0300
commit81ce57622c3166830b23eae534dacc6b008c659d (patch)
tree6d6ac74667f733a20b94fa27cc01c2f45688c533 /protocols/MRA/src
parentc2bb7727483b9b5620e8cc0ce6adae35ee78d0a4 (diff)
common protocol instance management code went into template
Diffstat (limited to 'protocols/MRA/src')
-rw-r--r--protocols/MRA/src/Mra.cpp30
-rw-r--r--protocols/MRA/src/MraProto.cpp2
-rw-r--r--protocols/MRA/src/MraProto.h7
-rw-r--r--protocols/MRA/src/Mra_proto.cpp2
-rw-r--r--protocols/MRA/src/stdafx.h9
5 files changed, 11 insertions, 39 deletions
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp
index 49eded7d0a..79dfebf977 100644
--- a/protocols/MRA/src/Mra.cpp
+++ b/protocols/MRA/src/Mra.cpp
@@ -1,9 +1,9 @@
#include "stdafx.h"
-LIST<CMraProto> g_Instances(1, PtrKeySortT);
+CMPlugin g_plugin;
-CLIST_INTERFACE *pcli;
int hLangpack;
+CLIST_INTERFACE *pcli;
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
@@ -78,29 +78,3 @@ extern "C" __declspec(dllexport) int Unload(void)
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static PROTO_INTERFACE* mraProtoInit(const char* pszProtoName, const wchar_t* tszUserName)
-{
- CMraProto *ppro = new CMraProto(pszProtoName, tszUserName);
- g_Instances.insert(ppro);
- return ppro;
-}
-
-static int mraProtoUninit(PROTO_INTERFACE *ppro)
-{
- g_Instances.remove((CMraProto*)ppro);
- delete (CMraProto*)ppro;
- return 0;
-}
-
-struct CMPlugin : public CMPluginBase
-{
- CMPlugin() :
- CMPluginBase("MRA")
- {
- RegisterProtocol(PROTOTYPE_PROTOCOL, mraProtoInit, mraProtoUninit);
- }
-}
- g_plugin;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index 5fd2a0f03f..89f2046dae 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -2,7 +2,7 @@
static int MraExtraIconsApplyAll(WPARAM, LPARAM)
{
- for (auto &it : g_Instances)
+ for (auto &it : CMPlugin::g_arInstances)
it->MraExtraIconsApply(0, 0);
return 0;
}
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index a9a95fbc07..b6f2bede82 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -339,3 +339,10 @@ struct CMraProto : public PROTO<CMraProto>
void __cdecl MraAvatarsThreadProc(LPVOID lpParameter);
};
+
+struct CMPlugin : public ACCPROTOPLUGIN<CMraProto>
+{
+ CMPlugin() :
+ ACCPROTOPLUGIN<CMraProto>("MRA")
+ {}
+};
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index 35faa0405c..bad5ab3340 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -1647,7 +1647,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA &
debugLogA("Processing message: %08X, from '%s', text '%S'\n", dwFlags, plpsFrom.c_str(), wszMessage.c_str());
// processing
- if (dwFlags & (MESSAGE_FLAG_SMS | MESSAGE_SMS_DELIVERY_REPORT)) {// SMS //if (IsPhone(plpsFrom->lpszData, plpsFrom->dwSize))
+ if (dwFlags & (MESSAGE_FLAG_SMS | MESSAGE_SMS_DELIVERY_REPORT)) { // SMS
INTERNET_TIME itTime;
InternetTimeGetCurrentTime(&itTime);
CMStringA szTime = InternetTimeGetString(&itTime);
diff --git a/protocols/MRA/src/stdafx.h b/protocols/MRA/src/stdafx.h
index dd94bdfbb9..df92980ad9 100644
--- a/protocols/MRA/src/stdafx.h
+++ b/protocols/MRA/src/stdafx.h
@@ -169,12 +169,8 @@ extern WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
/////////////////////////////////////////////////////////////////////////////////////////
// External variables
-extern LIST<CMraProto> g_Instances;
-
extern HANDLE hXStatusAdvancedStatusIcons[];
-void InitExtraIcons();
-
CMStringA MraGetSelfVersionString();
#define SetBit(bytes, bitpos) bytes |= (1<<bitpos)
@@ -204,12 +200,7 @@ bool IsContactMraProto(MCONTACT hContact);
bool IsEMailMR(const CMStringA& szEmail);
bool GetEMailFromString(const CMStringA& szBuff, CMStringA& szEmail);
-bool IsPhone(LPSTR lpszString, size_t dwStringSize);
-bool IsContactPhone(MCONTACT hContact, LPSTR lpszPhone, size_t dwPhoneSize);
-HANDLE MraHContactFromPhone(LPSTR lpszPhone, size_t dwPhoneSize, BOOL bAddIfNeeded, BOOL bTemporary, BOOL *pbAdded);
void EnableControlsArray(HWND hWndDlg, WORD *pwControlsList, size_t dwControlsListCount, BOOL bEnabled);
-bool MraRequestXStatusDetails(DWORD dwXStatus);
-bool MraSendReplyBlogStatus(MCONTACT hContact);
DWORD GetYears(CONST PSYSTEMTIME pcstSystemTime);
DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwFileNameLen, LPWSTR lpszRetFilePathName, DWORD dwRetFilePathLen, DWORD *pdwRetFilePathLen);