diff options
author | George Hazan <ghazan@miranda.im> | 2017-12-29 18:15:20 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-12-29 18:15:20 +0300 |
commit | 74608bcc6cb28e2d5e111dbc30c2009ea01bffc0 (patch) | |
tree | b40e2d190550658c467dad7956bb75e48e0d89e9 | |
parent | 7c4d37c907ad4fabe55d4bc2b115604b346c547a (diff) |
removing obsolete C-style helpers
-rw-r--r-- | include/m_protoint.h | 36 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 131600 -> 130396 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 127142 -> 126010 bytes | |||
-rw-r--r-- | src/mir_app/src/mir_app.def | 9 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 9 | ||||
-rw-r--r-- | src/mir_app/src/proto_internal.cpp | 82 | ||||
-rw-r--r-- | src/mir_app/src/proto_utils.cpp | 34 |
7 files changed, 77 insertions, 93 deletions
diff --git a/include/m_protoint.h b/include/m_protoint.h index d0a40c5587..64d423fab0 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -77,33 +77,32 @@ typedef INT_PTR (__cdecl PROTO_INTERFACE::*ProtoServiceFuncParam)(WPARAM, LPARAM EXTERN_C MIR_APP_DLL(void) ProtoCreateServiceParam(PROTO_INTERFACE *pThis, const char* szService, ProtoServiceFuncParam, LPARAM);
#endif
-EXTERN_C MIR_APP_DLL(void) ProtoLogA(PROTO_INTERFACE *pThis, LPCSTR szFormat, va_list args);
-EXTERN_C MIR_APP_DLL(void) ProtoLogW(PROTO_INTERFACE *pThis, LPCWSTR wszFormat, va_list args);
-
/////////////////////////////////////////////////////////////////////////////////////////
// interface declaration
struct MIR_APP_EXPORT PROTO_INTERFACE : public MZeroedObject
{
- int m_iStatus, // current protocol status
- m_iDesiredStatus, // status to be set after logging in
- m_iXStatus, // extanded status
- m_iVersion; // version 2 or higher designate support of Unicode services
+
+protected:
+ MWindowList m_hWindowList; // list of all windows which belong to this protocol's instance
+
+public:
+ int m_iStatus; // current protocol status
+ int m_iDesiredStatus; // status to be set after logging in
+ int m_iXStatus; // extanded status
+ int m_iVersion; // version 2 or higher designate support of Unicode services
wchar_t* m_tszUserName; // human readable protocol's name
char* m_szModuleName; // internal protocol name, also its database module name
HANDLE m_hProtoIcon; // icon to be displayed in the account manager
HNETLIBUSER m_hNetlibUser; // network agent
- MWindowList m_hWindowList; // list of all windows which belong to this protocol's instance
HGENMENU m_hMainMenuItem; // if protocol menus are displayed in the main menu, this is the root
+ PROTO_INTERFACE(const char *pszModuleName, const wchar_t *ptszUserName);
+ ~PROTO_INTERFACE();
+
//////////////////////////////////////////////////////////////////////////////////////
// Helpers
- __forceinline void WindowSubscribe(HWND hwnd) {
- ::ProtoWindowAdd(this, hwnd); }
- __forceinline void WindowUnsubscribe(HWND hwnd) {
- ::ProtoWindowRemove(this, hwnd); }
-
__forceinline INT_PTR ProtoBroadcastAck(MCONTACT hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam = 0) {
return ::ProtoBroadcastAck(m_szModuleName, hContact, type, hResult, hProcess, lParam); }
@@ -175,6 +174,9 @@ struct MIR_APP_EXPORT PROTO_INTERFACE : public MZeroedObject void setAllContactStatuses(int iStatus, bool bSkipChats = true);
+ void WindowSubscribe(HWND hwnd);
+ void WindowUnsubscribe(HWND hwnd);
+
//////////////////////////////////////////////////////////////////////////////////////
// Virtual functions
@@ -227,11 +229,9 @@ struct MIR_APP_EXPORT PROTO_INTERFACE : public MZeroedObject template<class T> struct PROTO : public PROTO_INTERFACE
{
- __forceinline PROTO(const char *szProto, const wchar_t *tszUserName) {
- ::ProtoConstructor(this, szProto, tszUserName); }
-
- __forceinline ~PROTO() {
- ::ProtoDestructor(this); }
+ __forceinline PROTO(const char *szProto, const wchar_t *tszUserName) :
+ PROTO_INTERFACE(szProto, tszUserName)
+ {}
__forceinline HANDLE CreateProtoEvent(const char *name) {
return ::ProtoCreateHookableEvent(this, name); }
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 5a277efb35..e4b132a7da 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 1afae60c19..68389ff7aa 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 304f189b4f..e07917fdb9 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -26,7 +26,6 @@ Skin_GetIconName @24 ??0CProtoIntDlgBase@@QAE@ABV0@@Z @25 NONAME
??0CProtoIntDlgBase@@QAE@PAUPROTO_INTERFACE@@H_N@Z @26 NONAME
??0PROTO_INTERFACE@@QAE@ABU0@@Z @27 NONAME
-??0PROTO_INTERFACE@@QAE@XZ @28 NONAME
??1CProtoIntDlgBase@@UAE@XZ @29 NONAME
??4CProtoIntDlgBase@@QAEAAV0@ABV0@@Z @30 NONAME
??4PROTO_INTERFACE@@QAEAAU0@ABU0@@Z @31 NONAME
@@ -110,11 +109,9 @@ Skin_GetIconName @24 ?setWord@PROTO_INTERFACE@@QAEXPBDG@Z @109 NONAME
GetPluginLangByInstance @110
ProtoBroadcastAck @111
-ProtoConstructor @112
ProtoCreateHookableEvent @113
ProtoCreateService @114
ProtoCreateServiceParam @115
-ProtoDestructor @116
ProtoForkThread @117
ProtoForkThreadEx @118
ProtoGetAvatarExtension @119
@@ -122,8 +119,6 @@ ProtoGetAvatarFileFormat @120 ProtoGetAvatarFormat @121
ProtoGetBufferFormat @122
ProtoHookEvent @123
-ProtoWindowAdd @126
-ProtoWindowRemove @127
Proto_IsProtocolLoaded @128
GetPluginLangId @129
Proto_GetAccount @130
@@ -462,14 +457,12 @@ Clist_SetStatusMode @464 ??0MIDatabase@@QAE@$$QAU0@@Z @469 NONAME
??0MIDatabase@@QAE@ABU0@@Z @470 NONAME
??0MIDatabase@@QAE@XZ @471 NONAME
-??0PROTO_INTERFACE@@QAE@$$QAU0@@Z @472 NONAME
??1MDatabaseCommon@@QAE@XZ @473 NONAME
??4CProtoIntDlgBase@@QAEAAV0@$$QAV0@@Z @474 NONAME
??4MDatabaseCommon@@QAEAAV0@$$QAV0@@Z @475 NONAME
??4MDatabaseCommon@@QAEAAV0@ABV0@@Z @476 NONAME
??4MIDatabase@@QAEAAU0@$$QAU0@@Z @477 NONAME
??4MIDatabase@@QAEAAU0@ABU0@@Z @478 NONAME
-??4PROTO_INTERFACE@@QAEAAU0@$$QAU0@@Z @479 NONAME
??_7MDatabaseCommon@@6B@ @480 NONAME
??_7MIDatabase@@6B@ @481 NONAME
?FreeVariant@MDatabaseCommon@@UAGHPAUDBVARIANT@@@Z @482 NONAME
@@ -491,3 +484,5 @@ Contact_Add @497 Contact_AddByEvent @498
Contact_AddBySearch @499
?setAllContactStatuses@PROTO_INTERFACE@@QAEXH_N@Z @500 NONAME
+??0PROTO_INTERFACE@@QAE@PBDPB_W@Z @501 NONAME
+??1PROTO_INTERFACE@@QAE@XZ @502 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 93bdf48d98..528431bf8c 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -26,7 +26,6 @@ Skin_GetIconName @24 ??0CProtoIntDlgBase@@QEAA@AEBV0@@Z @25 NONAME
??0CProtoIntDlgBase@@QEAA@PEAUPROTO_INTERFACE@@H_N@Z @26 NONAME
??0PROTO_INTERFACE@@QEAA@AEBU0@@Z @27 NONAME
-??0PROTO_INTERFACE@@QEAA@XZ @28 NONAME
??1CProtoIntDlgBase@@UEAA@XZ @29 NONAME
??4CProtoIntDlgBase@@QEAAAEAV0@AEBV0@@Z @30 NONAME
??4PROTO_INTERFACE@@QEAAAEAU0@AEBU0@@Z @31 NONAME
@@ -110,11 +109,9 @@ Skin_GetIconName @24 ?setWord@PROTO_INTERFACE@@QEAAXPEBDG@Z @109 NONAME
GetPluginLangByInstance @110
ProtoBroadcastAck @111
-ProtoConstructor @112
ProtoCreateHookableEvent @113
ProtoCreateService @114
ProtoCreateServiceParam @115
-ProtoDestructor @116
ProtoForkThread @117
ProtoForkThreadEx @118
ProtoGetAvatarExtension @119
@@ -122,8 +119,6 @@ ProtoGetAvatarFileFormat @120 ProtoGetAvatarFormat @121
ProtoGetBufferFormat @122
ProtoHookEvent @123
-ProtoWindowAdd @126
-ProtoWindowRemove @127
Proto_IsProtocolLoaded @128
GetPluginLangId @129
Proto_GetAccount @130
@@ -462,14 +457,12 @@ Clist_SetStatusMode @464 ??0MIDatabase@@QEAA@$$QEAU0@@Z @469 NONAME
??0MIDatabase@@QEAA@AEBU0@@Z @470 NONAME
??0MIDatabase@@QEAA@XZ @471 NONAME
-??0PROTO_INTERFACE@@QEAA@$$QEAU0@@Z @472 NONAME
??1MDatabaseCommon@@QEAA@XZ @473 NONAME
??4CProtoIntDlgBase@@QEAAAEAV0@$$QEAV0@@Z @474 NONAME
??4MDatabaseCommon@@QEAAAEAV0@$$QEAV0@@Z @475 NONAME
??4MDatabaseCommon@@QEAAAEAV0@AEBV0@@Z @476 NONAME
??4MIDatabase@@QEAAAEAU0@$$QEAU0@@Z @477 NONAME
??4MIDatabase@@QEAAAEAU0@AEBU0@@Z @478 NONAME
-??4PROTO_INTERFACE@@QEAAAEAU0@$$QEAU0@@Z @479 NONAME
??_7MDatabaseCommon@@6B@ @480 NONAME
??_7MIDatabase@@6B@ @481 NONAME
?FreeVariant@MDatabaseCommon@@UEAAHPEAUDBVARIANT@@@Z @482 NONAME
@@ -491,3 +484,5 @@ Contact_Add @497 Contact_AddByEvent @498
Contact_AddBySearch @499
?setAllContactStatuses@PROTO_INTERFACE@@QEAAXH_N@Z @500 NONAME
+??0PROTO_INTERFACE@@QEAA@PEBDPEB_W@Z @501 NONAME
+??1PROTO_INTERFACE@@QEAA@XZ @502 NONAME
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp index 9e90990f9e..58ead50a13 100644 --- a/src/mir_app/src/proto_internal.cpp +++ b/src/mir_app/src/proto_internal.cpp @@ -46,22 +46,26 @@ void FreeFilesMatrix(wchar_t ***files) struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
{
- MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT *psr)
+ DEFAULT_PROTO_INTERFACE(const char *pszModuleName, const wchar_t *ptszUserName) :
+ PROTO_INTERFACE(pszModuleName, ptszUserName)
+ {}
+
+ virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT *psr) override
{
return (MCONTACT)ProtoCallService(m_szModuleName, PS_ADDTOLIST, flags, (LPARAM)psr);
}
- MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent)
+ virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) override
{
return (MCONTACT)ProtoCallService(m_szModuleName, PS_ADDTOLISTBYEVENT, MAKELONG(flags, iContact), hDbEvent);
}
- int __cdecl Authorize(MEVENT hDbEvent)
+ virtual int __cdecl Authorize(MEVENT hDbEvent) override
{
return (int)ProtoCallService(m_szModuleName, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
}
- int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason)
+ virtual int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason) override
{
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, hDbEvent, (LPARAM)szReason);
@@ -69,13 +73,13 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, hDbEvent, _T2A(szReason));
}
- int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT *evt)
+ virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT *evt) override
{
CCSDATA ccs = { hContact, PSR_AUTH, 0, (LPARAM)evt };
return (int)ProtoCallService(m_szModuleName, PSR_AUTH, 0, (LPARAM)&ccs);
}
- int __cdecl AuthRequest(MCONTACT hContact, const wchar_t *szMessage)
+ virtual int __cdecl AuthRequest(MCONTACT hContact, const wchar_t *szMessage) override
{
CCSDATA ccs = { hContact, PSS_AUTHREQUEST, 0, (LPARAM)szMessage };
if (m_iVersion > 1)
@@ -87,7 +91,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return res;
}
- HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath)
+ virtual HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath) override
{
CCSDATA ccs = { hContact, PSS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath };
if (m_iVersion > 1)
@@ -99,13 +103,13 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return res;
}
- int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer)
+ virtual int __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer) override
{
CCSDATA ccs = { hContact, PSS_FILECANCEL, (WPARAM)hTransfer, 0 };
return (int)ProtoCallService(m_szModuleName, PSS_FILECANCEL, 0, (LPARAM)&ccs);
}
- int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason)
+ virtual int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason) override
{
CCSDATA ccs = { hContact, PSS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason };
if (m_iVersion > 1)
@@ -117,7 +121,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return res;
}
- int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
+ virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename) override
{
PROTOFILERESUME pfr = { *action, *szFilename };
if (m_iVersion > 1)
@@ -131,23 +135,18 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return res;
}
- DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact)
+ virtual DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact) override
{
return (DWORD_PTR)ProtoCallService(m_szModuleName, PS_GETCAPS, type, hContact);
}
- HICON __cdecl GetIcon(int iconIndex)
- {
- return (HICON)ProtoCallService(m_szModuleName, PS_LOADICON, iconIndex, 0);
- }
-
- int __cdecl GetInfo(MCONTACT hContact, int flags)
+ virtual int __cdecl GetInfo(MCONTACT hContact, int flags) override
{
CCSDATA ccs = { hContact, PSS_GETINFO, (WPARAM)flags, 0 };
return ProtoCallService(m_szModuleName, PSS_GETINFO, 0, (LPARAM)&ccs);
}
- HANDLE __cdecl SearchBasic(const wchar_t* id)
+ virtual HANDLE __cdecl SearchBasic(const wchar_t* id) override
{
if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)id);
@@ -155,14 +154,14 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, _T2A(id));
}
- HANDLE __cdecl SearchByEmail(const wchar_t* email)
+ virtual HANDLE __cdecl SearchByEmail(const wchar_t* email) override
{
if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYEMAIL, 0, (LPARAM)email);
return (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYEMAIL, 0, _T2A(email));
}
- HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName)
+ virtual HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName) override
{
PROTOSEARCHBYNAME psn;
psn.pszNick = (wchar_t*)mir_u2a(nick);
@@ -176,47 +175,47 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE }
- HWND __cdecl SearchAdvanced(HWND owner)
+ virtual HWND __cdecl SearchAdvanced(HWND owner) override
{
return (HWND)ProtoCallService(m_szModuleName, PS_SEARCHBYADVANCED, 0, (LPARAM)owner);
}
- HWND __cdecl CreateExtendedSearchUI(HWND owner)
+ virtual HWND __cdecl CreateExtendedSearchUI(HWND owner) override
{
return (HWND)ProtoCallService(m_szModuleName, PS_CREATEADVSEARCHUI, 0, (LPARAM)owner);
}
- int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT* evt)
+ virtual int __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT* evt) override
{
CCSDATA ccs = { hContact, PSR_CONTACTS, 0, (LPARAM)evt };
return (int)ProtoCallService(m_szModuleName, PSR_CONTACTS, 0, (LPARAM)&ccs);
}
- int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILET* evt)
+ virtual int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILET* evt) override
{
CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)evt };
return ProtoCallService(m_szModuleName, PSR_FILE, 0, (LPARAM)&ccs);
}
- int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT* evt)
+ virtual int __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT* evt) override
{
CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)evt };
return (int)ProtoCallService(m_szModuleName, PSR_MESSAGE, 0, (LPARAM)&ccs);
}
- int __cdecl RecvUrl(MCONTACT hContact, PROTORECVEVENT* evt)
+ virtual int __cdecl RecvUrl(MCONTACT hContact, PROTORECVEVENT* evt) override
{
CCSDATA ccs = { hContact, PSR_URL, 0, (LPARAM)evt };
return (int)ProtoCallService(m_szModuleName, PSR_URL, 0, (LPARAM)&ccs);
}
- int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList)
+ virtual int __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList) override
{
CCSDATA ccs = { hContact, PSS_CONTACTS, MAKEWPARAM(flags, nContacts), (LPARAM)hContactsList };
return (int)ProtoCallService(m_szModuleName, PSS_CONTACTS, 0, (LPARAM)&ccs);
}
- HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
+ virtual HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles) override
{
CCSDATA ccs = { hContact, PSS_FILE, (WPARAM)szDescription, (LPARAM)ppszFiles };
@@ -231,55 +230,55 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return res;
}
- int __cdecl SendMsg(MCONTACT hContact, const char* msg)
+ virtual int __cdecl SendMsg(MCONTACT hContact, int /*flags*/, const char *msg) override
{
CCSDATA ccs = { hContact, PSS_MESSAGE, 0, (LPARAM)msg };
return (int)ProtoCallService(m_szModuleName, PSS_MESSAGE, 0, (LPARAM)&ccs);
}
- int __cdecl SendUrl(MCONTACT hContact, int flags, const char* url)
+ virtual int __cdecl SendUrl(MCONTACT hContact, int flags, const char* url) override
{
CCSDATA ccs = { hContact, PSS_URL, (WPARAM)flags, (LPARAM)url };
return (int)ProtoCallService(m_szModuleName, PSS_URL, 0, (LPARAM)&ccs);
}
- int __cdecl SetApparentMode(MCONTACT hContact, int mode)
+ virtual int __cdecl SetApparentMode(MCONTACT hContact, int mode) override
{
CCSDATA ccs = { hContact, PSS_SETAPPARENTMODE, (WPARAM)mode, 0 };
return (int)ProtoCallService(m_szModuleName, PSS_SETAPPARENTMODE, 0, (LPARAM)&ccs);
}
- int __cdecl SetStatus(int iNewStatus)
+ virtual int __cdecl SetStatus(int iNewStatus) override
{
return (int)ProtoCallService(m_szModuleName, PS_SETSTATUS, iNewStatus, 0);
}
- HANDLE __cdecl GetAwayMsg(MCONTACT hContact)
+ virtual HANDLE __cdecl GetAwayMsg(MCONTACT hContact) override
{
CCSDATA ccs = { hContact, PSS_GETAWAYMSG, 0, 0 };
return (HANDLE)ProtoCallService(m_szModuleName, PSS_GETAWAYMSG, 0, (LPARAM)&ccs);
}
- int __cdecl RecvAwayMsg(MCONTACT hContact, int statusMode, PROTORECVEVENT* evt)
+ virtual int __cdecl RecvAwayMsg(MCONTACT hContact, int statusMode, PROTORECVEVENT* evt) override
{
CCSDATA ccs = { hContact, PSR_AWAYMSG, (WPARAM)statusMode, (LPARAM)evt };
return (int)ProtoCallService(m_szModuleName, PSR_AWAYMSG, 0, (LPARAM)&ccs);
}
- int __cdecl SetAwayMsg(int iStatus, const wchar_t *msg)
+ virtual int __cdecl SetAwayMsg(int iStatus, const wchar_t *msg) override
{
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)msg);
return (int)ProtoCallService(m_szModuleName, PS_SETAWAYMSG, iStatus, _T2A(msg));
}
- int __cdecl UserIsTyping(MCONTACT hContact, int type)
+ virtual int __cdecl UserIsTyping(MCONTACT hContact, int type) override
{
CCSDATA ccs = { hContact, PSS_USERISTYPING, hContact, type };
return ProtoCallService(m_szModuleName, PSS_USERISTYPING, 0, (LPARAM)&ccs);
}
- int __cdecl OnEvent(PROTOEVENTTYPE, WPARAM, LPARAM)
+ virtual int __cdecl OnEvent(PROTOEVENTTYPE, WPARAM, LPARAM) override
{
return 1;
}
@@ -289,16 +288,11 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE PROTO_INTERFACE* AddDefaultAccount(const char *szProtoName)
{
- PROTO_INTERFACE* ppi = new DEFAULT_PROTO_INTERFACE;
- ppi->m_szModuleName = mir_strdup(szProtoName);
- ppi->m_tszUserName = mir_a2u(szProtoName);
- return ppi;
+ return new DEFAULT_PROTO_INTERFACE(szProtoName, _A2T(szProtoName));
}
-int FreeDefaultAccount(PROTO_INTERFACE* ppi)
+int FreeDefaultAccount(PROTO_INTERFACE *ppi)
{
- mir_free(ppi->m_szModuleName);
- mir_free(ppi->m_tszUserName);
delete ppi;
return 0;
}
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 13b4a14e52..13ca07eaf2 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -79,22 +79,22 @@ void PROTO_INTERFACE::setAllContactStatuses(int iStatus, bool bSkipChats) /////////////////////////////////////////////////////////////////////////////////////////
// protocol constructor & destructor
-MIR_APP_DLL(void) ProtoConstructor(PROTO_INTERFACE *pThis, LPCSTR pszModuleName, LPCTSTR ptszUserName)
+PROTO_INTERFACE::PROTO_INTERFACE(const char *pszModuleName, const wchar_t *ptszUserName)
{
- pThis->m_iVersion = 2;
- pThis->m_iStatus = pThis->m_iDesiredStatus = ID_STATUS_OFFLINE;
- pThis->m_szModuleName = mir_strdup(pszModuleName);
- pThis->m_hProtoIcon = IcoLib_IsManaged(Skin_LoadProtoIcon(pszModuleName, ID_STATUS_ONLINE));
- pThis->m_tszUserName = mir_wstrdup(ptszUserName);
- db_set_resident(pThis->m_szModuleName, "Status");
+ m_iVersion = 2;
+ m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
+ m_szModuleName = mir_strdup(pszModuleName);
+ m_hProtoIcon = IcoLib_IsManaged(Skin_LoadProtoIcon(pszModuleName, ID_STATUS_ONLINE));
+ m_tszUserName = mir_wstrdup(ptszUserName);
+ db_set_resident(m_szModuleName, "Status");
}
-MIR_APP_DLL(void) ProtoDestructor(PROTO_INTERFACE *pThis)
+PROTO_INTERFACE::~PROTO_INTERFACE()
{
- mir_free(pThis->m_szModuleName);
- mir_free(pThis->m_tszUserName);
+ mir_free(m_szModuleName);
+ mir_free(m_tszUserName);
- WindowList_Destroy(pThis->m_hWindowList);
+ WindowList_Destroy(m_hWindowList);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -150,17 +150,17 @@ MIR_APP_DLL(HANDLE) ProtoForkThreadEx(PROTO_INTERFACE *pThis, ProtoThreadFunc pF /////////////////////////////////////////////////////////////////////////////////////////
// protocol windows
-MIR_APP_DLL(void) ProtoWindowAdd(PROTO_INTERFACE *pThis, HWND hwnd)
+void PROTO_INTERFACE::WindowSubscribe(HWND hwnd)
{
- if (pThis->m_hWindowList == nullptr)
- pThis->m_hWindowList = WindowList_Create();
+ if (m_hWindowList == nullptr)
+ m_hWindowList = WindowList_Create();
- WindowList_Add(pThis->m_hWindowList, hwnd, 0);
+ WindowList_Add(m_hWindowList, hwnd, 0);
}
-MIR_APP_DLL(void) ProtoWindowRemove(PROTO_INTERFACE *pThis, HWND hwnd)
+void PROTO_INTERFACE::WindowUnsubscribe(HWND hwnd)
{
- WindowList_Remove(pThis->m_hWindowList, hwnd);
+ WindowList_Remove(m_hWindowList, hwnd);
}
/////////////////////////////////////////////////////////////////////////////////////////
|