summaryrefslogtreecommitdiff
path: root/protocols/MSN
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-08 22:10:14 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-08 22:10:14 +0000
commitbb952e431866d131bae95c08e579ec8a00f00343 (patch)
tree60881668cf328b50906346c5f66ce47da2d9ad88 /protocols/MSN
parentc181af64bab27eb50e684c64c0a3caa49f8bbe39 (diff)
core protocol helpers for creating protocol evengs, services & threads
git-svn-id: http://svn.miranda-ng.org/main/trunk@5286 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN')
-rw-r--r--protocols/MSN/src/msn_chat.cpp4
-rw-r--r--protocols/MSN/src/msn_commands.cpp4
-rw-r--r--protocols/MSN/src/msn_contact.cpp4
-rw-r--r--protocols/MSN/src/msn_errors.cpp2
-rw-r--r--protocols/MSN/src/msn_global.h2
-rw-r--r--protocols/MSN/src/msn_menu.cpp12
-rw-r--r--protocols/MSN/src/msn_misc.cpp6
-rw-r--r--protocols/MSN/src/msn_msgqueue.cpp4
-rw-r--r--protocols/MSN/src/msn_opts.cpp14
-rw-r--r--protocols/MSN/src/msn_p2p.cpp2
-rw-r--r--protocols/MSN/src/msn_proto.cpp61
-rw-r--r--protocols/MSN/src/msn_proto.h14
-rw-r--r--protocols/MSN/src/msn_soapab.cpp6
-rw-r--r--protocols/MSN/src/msn_srv.cpp10
-rw-r--r--protocols/MSN/src/msn_std.cpp42
-rw-r--r--protocols/MSN/src/msn_svcs.cpp8
16 files changed, 68 insertions, 127 deletions
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 1c78c2af7d..ca49d3d11f 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -35,7 +35,7 @@ HANDLE CMsnProto::MSN_GetChatInernalHandle(HANDLE hContact)
if (getString(hContact, "ChatRoomID", &dbv) == 0)
{
result = (HANDLE)(-atol(dbv.pszVal));
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
return result;
@@ -368,7 +368,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
mir_free((void*)gce.ptszUID);
if (!bError)
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
break;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index 8b4091c313..d696d0d709 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -1378,7 +1378,7 @@ LBL_InvalidCommand:
if (lastStatus == ID_STATUS_OFFLINE) {
DBVARIANT dbv;
bool always = getString(hContact, "MirVer", &dbv) != 0;
- if (!always) MSN_FreeVariant(&dbv);
+ if (!always) db_free(&dbv);
sttSetMirVer(hContact, cont->cap1, always);
}
@@ -1602,7 +1602,7 @@ remove:
if (info->mJoinedContactsWLID.getCount() > 0 && MyOptions.SlowSend)
ProtoBroadcastAck(info->getContactHandle(),
ACKTYPE_MESSAGE, ACKRESULT_FAILED,
- (HANDLE)trid, (LPARAM)MSN_Translate("Message delivery failed"));
+ (HANDLE)trid, (LPARAM)Translate("Message delivery failed"));
MSN_DebugLog("Message send failed (trid=%d)", trid);
break;
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp
index f1848a738e..93bad80d1e 100644
--- a/protocols/MSN/src/msn_contact.cpp
+++ b/protocols/MSN/src/msn_contact.cpp
@@ -188,7 +188,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f
if (!db_get_utf(hContact, "CList", "Group", &dbv))
{
MSN_MoveContactToGroup(hContact, dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
char szContactID[100];
@@ -205,7 +205,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f
if (netId == 1 && strstr(email, "@yahoo.com") != 0)
MSN_FindYahooUser(email);
}
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
else if (flags == LIST_LL)
diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp
index fae9fd65f7..9a4acbe0c8 100644
--- a/protocols/MSN/src/msn_errors.cpp
+++ b/protocols/MSN/src/msn_errors.cpp
@@ -64,7 +64,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString)
case ERR_NOT_ONLINE:
if (info->mInitialContactWLID)
ProtoBroadcastAck(MSN_HContactFromEmail(info->mInitialContactWLID), ACKTYPE_MESSAGE, ACKRESULT_FAILED,
- (HANDLE)999999, (LPARAM)MSN_Translate("User not online"));
+ (HANDLE)999999, (LPARAM)Translate("User not online"));
else
MSN_ShowError("User not online");
diff --git a/protocols/MSN/src/msn_global.h b/protocols/MSN/src/msn_global.h
index aa7ed0f001..33dc271cfc 100644
--- a/protocols/MSN/src/msn_global.h
+++ b/protocols/MSN/src/msn_global.h
@@ -179,8 +179,6 @@ bool MSN_MsgWndExist(HANDLE hContact);
#define MSN_SendNickname(a) MSN_SendNicknameUtf(UTF8(a))
-void MSN_FreeVariant(DBVARIANT* dbv);
-char* MSN_Translate(const char* str);
unsigned MSN_GenRandom(void);
void MSN_InitContactMenu(void);
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp
index a42aa7016e..eb0bf372b2 100644
--- a/protocols/MSN/src/msn_menu.cpp
+++ b/protocols/MSN/src/msn_menu.cpp
@@ -230,7 +230,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam
DBVARIANT dbv;
if (!proto->getTString("Nick", &dbv)) {
SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.ptszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
@@ -307,35 +307,35 @@ void CMsnProto::MsnInitMainMenu(void)
mi.pszService = servicefunction;
strcpy(tDest, MS_SET_NICKNAME_UI);
- CreateProtoService(MS_SET_NICKNAME_UI, &CMsnProto::SetNicknameUI);
+ CreateService(MS_SET_NICKNAME_UI, &CMsnProto::SetNicknameUI);
mi.position = 201001;
mi.icolibItem = GetIconHandle(IDI_MSN);
mi.pszName = LPGEN("Set &Nickname");
menuItemsMain[0] = Menu_AddProtoMenuItem(&mi);
strcpy(tDest, MSN_INVITE);
- CreateProtoService(MSN_INVITE, &CMsnProto::MsnInviteCommand);
+ CreateService(MSN_INVITE, &CMsnProto::MsnInviteCommand);
mi.position = 201002;
mi.icolibItem = GetIconHandle(IDI_INVITE);
mi.pszName = LPGEN("Create &Chat");
menuItemsMain[0] = Menu_AddProtoMenuItem(&mi);
strcpy(tDest, MS_GOTO_INBOX);
- CreateProtoService(MS_GOTO_INBOX, &CMsnProto::MsnGotoInbox);
+ CreateService(MS_GOTO_INBOX, &CMsnProto::MsnGotoInbox);
mi.position = 201003;
mi.icolibItem = GetIconHandle(IDI_INBOX);
mi.pszName = LPGEN("Display &Hotmail Inbox");
menuItemsMain[1] = Menu_AddProtoMenuItem(&mi);
strcpy(tDest, MS_EDIT_PROFILE);
- CreateProtoService(MS_EDIT_PROFILE, &CMsnProto::MsnEditProfile);
+ CreateService(MS_EDIT_PROFILE, &CMsnProto::MsnEditProfile);
mi.position = 201004;
mi.icolibItem = GetIconHandle(IDI_PROFILE);
mi.pszName = LPGEN("View &Profile");
menuItemsMain[2] = Menu_AddProtoMenuItem(&mi);
strcpy(tDest, MS_EDIT_ALERTS);
- CreateProtoService(MS_EDIT_ALERTS, &CMsnProto::MsnSetupAlerts);
+ CreateService(MS_EDIT_ALERTS, &CMsnProto::MsnSetupAlerts);
mi.position = 201004;
mi.icolibItem = GetIconHandle(IDI_PROFILE);
mi.pszName = LPGEN("Setup Live &Alerts");
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 12c8d24064..183f50c6c0 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -235,7 +235,7 @@ void CMsnProto::MSN_GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t c
deleteSetting(hContact, "PictContext");
if (cbLen) pszDest[0] = 0;
}
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
else if (cbLen)
pszDest[0] = 0;
@@ -517,7 +517,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha
if (*p == 0) {
UrlEncode(dbv.pszVal, tFontName, sizeof(tFontName));
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -806,7 +806,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus)
if (!getStringUtf("Nick", &dbv)) {
if (dbv.pszVal[0])
MSN_SetNicknameUtf(dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/protocols/MSN/src/msn_msgqueue.cpp b/protocols/MSN/src/msn_msgqueue.cpp
index 3bc2eb25c4..a82cad6a49 100644
--- a/protocols/MSN/src/msn_msgqueue.cpp
+++ b/protocols/MSN/src/msn_msgqueue.cpp
@@ -158,7 +158,7 @@ void CMsnProto::MsgQueue_Clear(const char* wlid, bool msg)
{
HANDLE hContact = MSN_HContactFromEmail(E.wlid);
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED,
- (HANDLE)E.seq, (LPARAM)MSN_Translate("Message delivery failed"));
+ (HANDLE)E.seq, (LPARAM)Translate("Message delivery failed"));
}
mir_free(E.message);
mir_free(E.wlid);
@@ -189,7 +189,7 @@ void CMsnProto::MsgQueue_Clear(const char* wlid, bool msg)
LeaveCriticalSection(&csMsgQueue);
HANDLE hContact = MSN_HContactFromEmail(wlid);
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)seq,
- (LPARAM)MSN_Translate("Message delivery failed"));
+ (LPARAM)Translate("Message delivery failed"));
i = 0;
EnterCriticalSection(&csMsgQueue);
}
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index 37c9ec9db6..934e996c43 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -105,7 +105,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (!proto->getTString("Nick", &dbv))
{
SetWindowText(wnd, dbv.ptszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
EnableWindow(wnd, proto->msnLoggedIn);
EnableWindow(GetDlgItem(hwndDlg, IDC_MOBILESEND), proto->msnLoggedIn &&
@@ -260,7 +260,7 @@ LBL_Continue:
reconnectRequired = true;
proto->setString("Password", password);
}
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -273,7 +273,7 @@ LBL_Continue:
{
if (_tcscmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
if (!proto->getString(NULL, "DirectServer", &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, MSN_DEFAULT_LOGIN_SERVER);
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
if (!proto->getString(NULL, "GatewayServer", &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, MSN_DEFAULT_GATEWAY);
@@ -585,7 +585,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (!proto->getTString("Place", &dbv))
{
SetDlgItemText(hwndDlg, IDC_PLACE, dbv.ptszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
@@ -628,7 +628,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
{
if (strcmp(password, dbv.pszVal))
proto->setString("Password", password);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
else
proto->setString("Password", password);
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp
index 353b4d1a95..b87455d070 100644
--- a/protocols/MSN/src/msn_p2p.cpp
+++ b/protocols/MSN/src/msn_p2p.cpp
@@ -1260,7 +1260,7 @@ void CMsnProto::p2p_InitFileTransfer(
ezxml_free(xmlcon);
ezxml_free(xmldb);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
if (pictmatch)
{
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index 3834980ec7..188533496d 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -34,6 +34,7 @@ static int CompareLists(const MsnContact* p1, const MsnContact* p2)
}
CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
+ PROTO<CMsnProto>(aProtoName, aUserName),
contList(10, CompareLists),
grpList(10, CompareId),
sttThreads(10, PtrKeySortT),
@@ -43,8 +44,6 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
lsAvatarQueue(1),
msgCache(5, CompareId)
{
- ProtoConstructor(this, aProtoName, aUserName);
-
db_set_resident(m_szModuleName, "Status");
db_set_resident(m_szModuleName, "IdleTS");
db_set_resident(m_szModuleName, "p2pMsgId");
@@ -52,32 +51,32 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
db_set_resident(m_szModuleName, "MobileAllowed");
// Protocol services and events...
- hMSNNudge = CreateProtoEvent("/Nudge");
+ hMSNNudge = CreateHookableEvent("/Nudge");
- CreateProtoService(PS_CREATEACCMGRUI, &CMsnProto::SvcCreateAccMgrUI);
+ CreateService(PS_CREATEACCMGRUI, &CMsnProto::SvcCreateAccMgrUI);
- CreateProtoService(PS_GETAVATARINFOT, &CMsnProto::GetAvatarInfo);
- CreateProtoService(PS_GETMYAWAYMSG, &CMsnProto::GetMyAwayMsg);
+ CreateService(PS_GETAVATARINFOT, &CMsnProto::GetAvatarInfo);
+ CreateService(PS_GETMYAWAYMSG, &CMsnProto::GetMyAwayMsg);
- CreateProtoService(PS_LEAVECHAT, &CMsnProto::OnLeaveChat);
+ CreateService(PS_LEAVECHAT, &CMsnProto::OnLeaveChat);
- CreateProtoService(PS_GETMYAVATART, &CMsnProto::GetAvatar);
- CreateProtoService(PS_SETMYAVATART, &CMsnProto::SetAvatar);
- CreateProtoService(PS_GETAVATARCAPS, &CMsnProto::GetAvatarCaps);
+ CreateService(PS_GETMYAVATART, &CMsnProto::GetAvatar);
+ CreateService(PS_SETMYAVATART, &CMsnProto::SetAvatar);
+ CreateService(PS_GETAVATARCAPS, &CMsnProto::GetAvatarCaps);
- CreateProtoService(PS_GET_LISTENINGTO, &CMsnProto::GetCurrentMedia);
- CreateProtoService(PS_SET_LISTENINGTO, &CMsnProto::SetCurrentMedia);
+ CreateService(PS_GET_LISTENINGTO, &CMsnProto::GetCurrentMedia);
+ CreateService(PS_SET_LISTENINGTO, &CMsnProto::SetCurrentMedia);
- CreateProtoService(PS_SETMYNICKNAME, &CMsnProto::SetNickName);
- CreateProtoService(MSN_SEND_NUDGE, &CMsnProto::SendNudge);
+ CreateService(PS_SETMYNICKNAME, &CMsnProto::SetNickName);
+ CreateService(MSN_SEND_NUDGE, &CMsnProto::SendNudge);
- CreateProtoService(MSN_GETUNREAD_EMAILCOUNT, &CMsnProto::GetUnreadEmailCount);
+ CreateService(MSN_GETUNREAD_EMAILCOUNT, &CMsnProto::GetUnreadEmailCount);
// event hooks
- HookProtoEvent(ME_MSG_WINDOWPOPUP, &CMsnProto::OnWindowPopup);
- HookProtoEvent(ME_CLIST_GROUPCHANGE, &CMsnProto::OnGroupChange);
- HookProtoEvent(ME_OPT_INITIALISE, &CMsnProto::OnOptionsInit);
- HookProtoEvent(ME_CLIST_DOUBLECLICKED, &CMsnProto::OnContactDoubleClicked);
+ HookEvent(ME_MSG_WINDOWPOPUP, &CMsnProto::OnWindowPopup);
+ HookEvent(ME_CLIST_GROUPCHANGE, &CMsnProto::OnGroupChange);
+ HookEvent(ME_OPT_INITIALISE, &CMsnProto::OnOptionsInit);
+ HookEvent(ME_CLIST_DOUBLECLICKED, &CMsnProto::OnContactDoubleClicked);
LoadOptions();
@@ -178,10 +177,8 @@ CMsnProto::~CMsnProto()
mir_free(storageCacheKey);
FreeAuthTokens();
- ProtoDestructor(this);
}
-
int CMsnProto::OnModulesLoaded(WPARAM, LPARAM)
{
if (msnHaveChatDll) {
@@ -195,11 +192,11 @@ int CMsnProto::OnModulesLoaded(WPARAM, LPARAM)
gcr.pszModule = m_szModuleName;
CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
- HookProtoEvent(ME_GC_EVENT, &CMsnProto::MSN_GCEventHook);
- HookProtoEvent(ME_GC_BUILDMENU, &CMsnProto::MSN_GCMenuHook);
+ HookEvent(ME_GC_EVENT, &CMsnProto::MSN_GCEventHook);
+ HookEvent(ME_GC_BUILDMENU, &CMsnProto::MSN_GCMenuHook);
}
- HookProtoEvent(ME_IDLE_CHANGED, &CMsnProto::OnIdleChanged);
+ HookEvent(ME_IDLE_CHANGED, &CMsnProto::OnIdleChanged);
InitPopups();
return 0;
}
@@ -666,7 +663,7 @@ void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg)
DBVARIANT dbv;
if (!db_get_ts(inf->hContact, "CList", "StatusMsg", &dbv)) {
ProtoBroadcastAck(inf->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)inf->id, (LPARAM)dbv.ptszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
else ProtoBroadcastAck(inf->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)inf->id, 0);
@@ -708,7 +705,7 @@ DWORD_PTR __cdecl CMsnProto::GetCaps(int type, HANDLE hContact)
return PF2_ONTHEPHONE;
case PFLAG_UNIQUEIDTEXT:
- return (UINT_PTR)MSN_Translate("Live ID");
+ return (UINT_PTR)Translate("Live ID");
case PFLAG_UNIQUEIDSETTING:
return (UINT_PTR)"e-mail";
@@ -862,7 +859,7 @@ int __cdecl CMsnProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc)
if (!msnLoggedIn)
{
- errMsg = MSN_Translate("Protocol is offline");
+ errMsg = Translate("Protocol is offline");
ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, 999999, errMsg, this));
return 999999;
}
@@ -870,7 +867,7 @@ int __cdecl CMsnProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc)
char tEmail[MSN_MAX_EMAIL_LEN];
if (MSN_IsMeByContact(hContact, tEmail))
{
- errMsg = MSN_Translate("You cannot send message to yourself");
+ errMsg = Translate("You cannot send message to yourself");
ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, 999999, errMsg, this));
return 999999;
}
@@ -901,7 +898,7 @@ int __cdecl CMsnProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc)
case NETID_MOB:
if (strlen(msg) > 133)
{
- errMsg = MSN_Translate("Message is too long: SMS page limited to 133 UTF8 chars");
+ errMsg = Translate("Message is too long: SMS page limited to 133 UTF8 chars");
seq = 999997;
}
else
@@ -916,7 +913,7 @@ int __cdecl CMsnProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc)
if (strlen(msg) > 1202)
{
seq = 999996;
- errMsg = MSN_Translate("Message is too long: MSN messages are limited by 1202 UTF8 chars");
+ errMsg = Translate("Message is too long: MSN messages are limited by 1202 UTF8 chars");
ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, errMsg, this));
}
else
@@ -930,7 +927,7 @@ int __cdecl CMsnProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc)
if (strlen(msg) > 1202)
{
seq = 999996;
- errMsg = MSN_Translate("Message is too long: MSN messages are limited by 1202 UTF8 chars");
+ errMsg = Translate("Message is too long: MSN messages are limited by 1202 UTF8 chars");
ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, errMsg, this));
}
else
@@ -950,7 +947,7 @@ int __cdecl CMsnProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc)
else
{
seq = 999993;
- errMsg = MSN_Translate("Offline messaging is not allowed for LCS contacts");
+ errMsg = Translate("Offline messaging is not allowed for LCS contacts");
ForkThread(&CMsnProto::MsnFakeAck, new TFakeAckParams(hContact, seq, errMsg, this));
}
}
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h
index 1f729be394..d3362fbd40 100644
--- a/protocols/MSN/src/msn_proto.h
+++ b/protocols/MSN/src/msn_proto.h
@@ -23,13 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <m_protoint.h>
-struct CMsnProto;
-typedef void (__cdecl CMsnProto::*MsnThreadFunc)(void*);
-typedef int (__cdecl CMsnProto::*MsnEventFunc)(WPARAM, LPARAM);
-typedef INT_PTR (__cdecl CMsnProto::*MsnServiceFunc)(WPARAM, LPARAM);
-typedef INT_PTR (__cdecl CMsnProto::*MsnServiceFuncParam)(WPARAM, LPARAM, LPARAM);
-
-struct CMsnProto : public PROTO_INTERFACE
+struct CMsnProto : public PROTO<CMsnProto>
{
CMsnProto(const char*, const TCHAR*);
~CMsnProto();
@@ -570,12 +564,6 @@ struct CMsnProto : public PROTO_INTERFACE
//////////////////////////////////////////////////////////////////////////////////////
- HANDLE CreateProtoEvent(const char* szEvent);
- void CreateProtoService(const char* szService, MsnServiceFunc serviceProc);
- void CreateProtoServiceParam(const char* szService, MsnServiceFuncParam serviceProc, LPARAM lParam);
- void HookProtoEvent(const char* szEvent, MsnEventFunc pFunc);
- void ForkThread(MsnThreadFunc pFunc, void* param);
-
TCHAR* GetContactNameT(HANDLE hContact);
void deleteSetting(HANDLE hContact, const char* valueName);
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp
index 2010a9b6dd..9dce4dbdae 100644
--- a/protocols/MSN/src/msn_soapab.cpp
+++ b/protocols/MSN/src/msn_soapab.cpp
@@ -266,7 +266,7 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse)
if (!getString("SharingLastChange", &dbv) && dbv.pszVal[0])
{
szLastChange = NEWSTR_ALLOCA(dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
deltas &= (szLastChange != NULL);
}
@@ -630,7 +630,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
if (!getString("ABFullLastChange", &dbv) && dbv.pszVal[0])
{
szLastChange = NEWSTR_ALLOCA(dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
deltas &= (szLastChange != NULL);
}
@@ -641,7 +641,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
if (!getString("ABFullDynLastChange", &dbv) && dbv.pszVal[0])
{
szDynLastChange = NEWSTR_ALLOCA(dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
deltas &= (szDynLastChange != NULL);
}
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp
index 55d46c4c80..a3fc024b1b 100644
--- a/protocols/MSN/src/msn_srv.cpp
+++ b/protocols/MSN/src/msn_srv.cpp
@@ -246,7 +246,7 @@ void CMsnProto::MSN_UploadServerGroups(char* group)
{
MSN_MoveContactToGroup(msc->hContact, dbv.pszVal);
}
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -267,17 +267,17 @@ void CMsnProto::MSN_SyncContactToServerGroup(HANDLE hContact, const char* szCont
{
if (strcmp(dbv.pszVal, "MetaContacts Hidden Group") == 0)
{
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
if (!db_get_utf(hContact, "MetaContacts", "OldCListGroup", &dbv))
{
szGrpName = NEWSTR_ALLOCA(dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
{
szGrpName = NEWSTR_ALLOCA(dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -401,5 +401,5 @@ void CMsnProto::msn_storeProfileThread(void* param)
// MSN_ABUpdateNick(nickname, NULL);
}
- if (needFree) MSN_FreeVariant(&dbv);
+ if (needFree) db_free(&dbv);
}
diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp
index 2ca835621b..da31858fd9 100644
--- a/protocols/MSN/src/msn_std.cpp
+++ b/protocols/MSN/src/msn_std.cpp
@@ -141,38 +141,6 @@ void CMsnProto::setWord(HANDLE hContact, const char* name, WORD value)
/////////////////////////////////////////////////////////////////////////////////////////
-void CMsnProto::CreateProtoService(const char* szService, MsnServiceFunc serviceProc)
-{
- char str[MAXMODULELABELLENGTH];
-
- mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
- ::CreateServiceFunctionObj(str, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
-}
-
-void CMsnProto::CreateProtoServiceParam(const char* szService, MsnServiceFuncParam serviceProc, LPARAM lParam)
-{
- char str[MAXMODULELABELLENGTH];
- mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
- ::CreateServiceFunctionObjParam(str, (MIRANDASERVICEOBJPARAM)*(void**)&serviceProc, this, lParam);
-}
-
-HANDLE CMsnProto::CreateProtoEvent(const char* szService)
-{
- char str[MAXMODULELABELLENGTH];
- mir_snprintf(str, sizeof(str), "%s%s", m_szModuleName, szService);
- return ::CreateHookableEvent(str);
-}
-
-void CMsnProto::HookProtoEvent(const char* szEvent, MsnEventFunc pFunc)
-{ ::HookEventObj(szEvent, (MIRANDAHOOKOBJ)*(void**)&pFunc, this);
-}
-
-void CMsnProto::ForkThread(MsnThreadFunc pFunc, void* param)
-{
- UINT threadID;
- CloseHandle((HANDLE)mir_forkthreadowner((pThreadFuncOwner)*(void**)&pFunc, this, param, &threadID));
-}
-
TCHAR* CMsnProto::GetContactNameT(HANDLE hContact)
{
if (hContact)
@@ -190,16 +158,6 @@ TCHAR* CMsnProto::GetContactNameT(HANDLE hContact)
}
}
-void MSN_FreeVariant(DBVARIANT* dbv)
-{
- db_free(dbv);
-}
-
-char* MSN_Translate(const char* str)
-{
- return Translate(str);
-}
-
unsigned MSN_GenRandom(void)
{
unsigned rndnum;
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp
index e8c6b80a12..40dc63464f 100644
--- a/protocols/MSN/src/msn_svcs.cpp
+++ b/protocols/MSN/src/msn_svcs.cpp
@@ -87,7 +87,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
if ( getString(AI->hContact, AI->hContact ? "PictContext" : "PictObject", &dbv) == 0) {
szContext = (char*)NEWSTR_ALLOCA(dbv.pszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
else return GAIR_NOAVATAR;
@@ -98,7 +98,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam)
bool needupdate = true;
if (getString(AI->hContact, "PictSavedContext", &dbv) == 0) {
needupdate = strcmp(dbv.pszVal, szContext) != 0;
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
if (needupdate) {
@@ -392,7 +392,7 @@ int CMsnProto::OnContactDeleted(WPARAM wParam, LPARAM lParam)
DBVARIANT dbv;
if (!getTString(hContact, "ChatRoomID", &dbv)) {
MSN_KillChatSession(dbv.ptszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
@@ -630,7 +630,7 @@ INT_PTR CMsnProto::OnLeaveChat(WPARAM wParam,LPARAM lParam)
if (getTString(hContact, "ChatRoomID", &dbv) == 0)
{
MSN_KillChatSession(dbv.ptszVal);
- MSN_FreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;