From 68d3fd47bb9b75e65859d14199ffee01f16ac9a7 Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Mon, 10 Feb 2014 20:47:51 +0000
Subject: HCONTACT is not needed anymore

git-svn-id: http://svn.miranda-ng.org/main/trunk@8086 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 protocols/MSN/src/msn_avatar.cpp      |  2 +-
 protocols/MSN/src/msn_chat.cpp        | 24 ++++-----
 protocols/MSN/src/msn_commands.cpp    | 32 ++++++------
 protocols/MSN/src/msn_contact.cpp     | 10 ++--
 protocols/MSN/src/msn_global.h        | 18 +++----
 protocols/MSN/src/msn_links.cpp       | 12 ++---
 protocols/MSN/src/msn_lists.cpp       | 32 ++++++------
 protocols/MSN/src/msn_mail.cpp        |  4 +-
 protocols/MSN/src/msn_menu.cpp        | 26 +++++-----
 protocols/MSN/src/msn_misc.cpp        | 22 ++++----
 protocols/MSN/src/msn_msgqueue.cpp    |  4 +-
 protocols/MSN/src/msn_opts.cpp        |  2 +-
 protocols/MSN/src/msn_p2ps.cpp        |  8 +--
 protocols/MSN/src/msn_proto.cpp       | 58 ++++++++++-----------
 protocols/MSN/src/msn_proto.h         | 94 +++++++++++++++++------------------
 protocols/MSN/src/msn_soapab.cpp      |  8 +--
 protocols/MSN/src/msn_srv.cpp         |  4 +-
 protocols/MSN/src/msn_std.cpp         |  6 +--
 protocols/MSN/src/msn_svcs.cpp        | 10 ++--
 protocols/MSN/src/msn_switchboard.cpp |  2 +-
 protocols/MSN/src/msn_threads.cpp     |  4 +-
 protocols/MSN/src/msn_ws.cpp          |  4 +-
 22 files changed, 193 insertions(+), 193 deletions(-)

(limited to 'protocols/MSN/src')

diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp
index ae8ca277cb..6f6f86998a 100644
--- a/protocols/MSN/src/msn_avatar.cpp
+++ b/protocols/MSN/src/msn_avatar.cpp
@@ -34,7 +34,7 @@ void CMsnProto::AvatarQueue_Uninit()
 	::CloseHandle(hevAvatarQueue);
 }
 
-void CMsnProto::pushAvatarRequest(HCONTACT hContact, LPCSTR pszUrl)
+void CMsnProto::pushAvatarRequest(MCONTACT hContact, LPCSTR pszUrl)
 {
 	ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
 
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 76688d5235..1ffd87f65d 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -25,13 +25,13 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "msn_proto.h"
 #include <m_history.h>
 
-HCONTACT CMsnProto::MSN_GetChatInernalHandle(HCONTACT hContact)
+MCONTACT CMsnProto::MSN_GetChatInernalHandle(MCONTACT hContact)
 {
-	HCONTACT result = hContact;
+	MCONTACT result = hContact;
 	if ( isChatRoom(hContact)) {
 		DBVARIANT dbv;
 		if (getString(hContact, "ChatRoomID", &dbv) == 0) {
-			result = (HCONTACT)(-atol(dbv.pszVal));
+			result = (MCONTACT)(-atol(dbv.pszVal));
 			db_free(&dbv);
 		}
 	}
@@ -98,7 +98,7 @@ void CMsnProto::MSN_ChatStart(ThreadData* info)
 
 	for (int j=0; j < info->mJoinedContactsWLID.getCount(); j++)
 	{
-		HCONTACT hContact = MSN_HContactFromEmail(info->mJoinedContactsWLID[j]);
+		MCONTACT hContact = MSN_HContactFromEmail(info->mJoinedContactsWLID[j]);
 		TCHAR *wlid = mir_a2t(info->mJoinedContactsWLID[j]);
 
 		gce.ptszNick = GetContactNameT(hContact);
@@ -169,23 +169,23 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto
 }
 
 
-static void ChatValidateContact(HCONTACT hItem, HWND hwndList, CMsnProto* ppro)
+static void ChatValidateContact(MCONTACT hItem, HWND hwndList, CMsnProto* ppro)
 {
 	if (!ppro->MSN_IsMyContact(hItem) || ppro->isChatRoom(hItem) || ppro->MSN_IsMeByContact(hItem))
 		SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
 }
 
-static void ChatPrepare(HCONTACT hItem, HWND hwndList, CMsnProto* ppro)
+static void ChatPrepare(MCONTACT hItem, HWND hwndList, CMsnProto* ppro)
 {
 	if (hItem == NULL)
-		hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
+		hItem = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
 
 	while (hItem)
 	{
-		HCONTACT hItemN = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
+		MCONTACT hItemN = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
 
 		if (IsHContactGroup(hItem)) {
-			HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+			MCONTACT hItemT = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
 			if (hItemT)
 				ChatPrepare(hItemT, hwndList, ppro);
 		}
@@ -229,7 +229,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
 			{
 			case CLN_NEWCONTACT:
 				if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
-					ChatValidateContact((HCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro);
+					ChatValidateContact((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro);
 				break;
 
 			case CLN_LISTREBUILT:
@@ -361,7 +361,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
 		case GC_USER_PRIVMESS:
 		{
 			char *email = mir_t2a(gch->ptszUID);
-			HCONTACT hContact = MSN_HContactFromEmail(email);
+			MCONTACT hContact = MSN_HContactFromEmail(email);
 			CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
 			mir_free(email);
 			break;
@@ -384,7 +384,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)
 		case GC_USER_NICKLISTMENU:
 		{
 			char *email = mir_t2a(gch->ptszUID);
-			HCONTACT hContact = MSN_HContactFromEmail(email);
+			MCONTACT hContact = MSN_HContactFromEmail(email);
 			mir_free(email);
 
 			switch(gch->dwData)
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index 56dc3e9807..c8b7e9029c 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -46,7 +46,7 @@ void MSN_ConnectionProc(HANDLE hNewConnection, DWORD /* dwRemoteIP */, void* ext
 	}
 }
 
-void CMsnProto::sttSetMirVer(HCONTACT hContact, DWORD dwValue, bool always)
+void CMsnProto::sttSetMirVer(MCONTACT hContact, DWORD dwValue, bool always)
 {
 	static const char* MirVerStr[] =
 	{
@@ -253,7 +253,7 @@ void CMsnProto::sttInviteMessage(ThreadData* info, char* msgBody, char* email, c
 
 void CMsnProto::sttCustomSmiley(const char* msgBody, char* email, char* nick, int iSmileyType)
 {
-	HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true);
+	MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true);
 
 	char smileyList[500] = "";
 
@@ -389,7 +389,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
 		tFileInfo.readFromBuffer(msgBody);
 		info->firstMsgRecv = true;
 
-		HCONTACT hContact = MSN_HContactFromEmail(email);
+		MCONTACT hContact = MSN_HContactFromEmail(email);
 		const char* mirver = tFileInfo["Client-Name"];
 		if (hContact != NULL && mirver != NULL) {
 			setString(hContact, "MirVer", mirver);
@@ -404,7 +404,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
 	}
 
 	if (!_strnicmp(tContentType, "text/plain", 10)) {
-		HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true);
+		MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true);
 
 		const char* p = tHeader["X-MMS-IM-Format"];
 		bool isRtl = p != NULL && strstr(p, "RL=1") != NULL;
@@ -490,13 +490,13 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
 		const char* tTypingUser = tHeader["TypingUser"];
 
 		if (tTypingUser != NULL && info->mChatID[0] == 0 && _stricmp(email, MyOptions.szEmail)) {
-			HCONTACT hContact = MSN_HContactFromEmail(tTypingUser, tTypingUser);
+			MCONTACT hContact = MSN_HContactFromEmail(tTypingUser, tTypingUser);
 			CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, 7);
 		}
 	}
 	else if (!_strnicmp(tContentType, "text/x-msnmsgr-datacast", 23)) {
 		if (info->mJoinedContactsWLID.getCount()) {
-			HCONTACT tContact;
+			MCONTACT tContact;
 
 			if (info->mChatID[0]) {
 				GC_INFO gci = { 0 };
@@ -602,7 +602,7 @@ void CMsnProto::sttProcessYFind(char* buf, size_t len)
 	else {
 		if (szNetId != NULL) {
 			int netId = atol(szNetId);
-			HCONTACT hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false);
+			MCONTACT hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false);
 			if (MSN_AddUser(hContact, szEmail, netId, LIST_FL)) {
 				MSN_AddUser(hContact, szEmail, netId, LIST_PL + LIST_REMOVE);
 				MSN_AddUser(hContact, szEmail, netId, LIST_BL + LIST_REMOVE);
@@ -640,7 +640,7 @@ void CMsnProto::sttProcessAdd(char* buf, size_t len)
 			UrlDecode((char*)szNick);
 
 			if (listId == LIST_FL) {
-				HCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick, true, false);
+				MCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick, true, false);
 				MSN_SetContactDb(hContact, szEmail);
 			}
 
@@ -706,7 +706,7 @@ void CMsnProto::sttProcessRemove(char* buf, size_t len)
 
 void CMsnProto::sttProcessStatusMessage(char* buf, unsigned len, const char* wlid)
 {
-	HCONTACT hContact = MSN_HContactFromEmail(wlid);
+	MCONTACT hContact = MSN_HContactFromEmail(wlid);
 	if (hContact == NULL) return;
 
 	ezxml_t xmli = ezxml_parse_str(buf, len);
@@ -1048,12 +1048,12 @@ LBL_InvalidCommand:
 
 			if (strchr(data.userEmail, ';')) {
 				if (info->mJoinedContactsWLID.getCount() == 1)
-					p2p_clearThreadSessions((HCONTACT)info->mJoinedContactsWLID[0], info->mType);
+					p2p_clearThreadSessions((MCONTACT)info->mJoinedContactsWLID[0], info->mType);
 				info->contactLeft(data.userEmail);
 				break;
 			}
 
-			HCONTACT hContact = MSN_HContactFromEmail(data.userEmail);
+			MCONTACT hContact = MSN_HContactFromEmail(data.userEmail);
 
 			if (getByte("EnableSessionPopup", 0))
 				MSN_ShowPopup(hContact, TranslateT("Contact left channel"), 0);
@@ -1098,7 +1098,7 @@ LBL_InvalidCommand:
 						MSN_KillChatSession(info->mChatID);
 
 						// open up srmm dialog when quit while 1 person left
-						HCONTACT hContact = info->getContactHandle();
+						MCONTACT hContact = info->getContactHandle();
 						if (hContact) CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
 					}
 				}
@@ -1162,7 +1162,7 @@ LBL_InvalidCommand:
 			if (tArgs < 2)
 				goto LBL_InvalidCommand;
 
-			HCONTACT hContact = MSN_HContactFromEmail(data.userEmail);
+			MCONTACT hContact = MSN_HContactFromEmail(data.userEmail);
 			if (hContact != NULL) {
 				setWord(hContact, "Status", MSN_GetThreadByContact(data.userEmail) ? ID_STATUS_INVISIBLE : ID_STATUS_OFFLINE);
 				setDword(hContact, "IdleTS", 0);
@@ -1203,7 +1203,7 @@ LBL_InvalidCommand:
 
 			MsnContact *cont = Lists_Get(szEmail);
 
-			HCONTACT hContact = NULL;
+			MCONTACT hContact = NULL;
 			if (!cont && !isMe) {
 				hContact = MSN_HContactFromEmail(data.wlid, data.userNick, true, true);
 				cont = Lists_Get(szEmail);
@@ -1293,7 +1293,7 @@ remove:
 
 			if (!strchr(data.userEmail, ';')) {
 				UrlDecode(data.userNick);
-				HCONTACT hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true);
+				MCONTACT hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true);
 
 				if (tNumTokens == 5 && strcmp(data.flags, "0:0")) {
 					MsnContact *cont = Lists_Get(data.userEmail);
@@ -1385,7 +1385,7 @@ remove:
 			stripBBCode(data.userNick);
 			stripColorCode(data.userNick);
 
-			HCONTACT hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true);
+			MCONTACT hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true);
 			if (tNumTokens == 3) {
 				MsnContact *cont = Lists_Get(data.userEmail);
 				if (cont) {
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp
index 1fdef99e6b..bb7bd6c559 100644
--- a/protocols/MSN/src/msn_contact.cpp
+++ b/protocols/MSN/src/msn_contact.cpp
@@ -23,9 +23,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "msn_global.h"
 #include "msn_proto.h"
 
-HCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, bool addIfNeeded, bool temporary)
+MCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, bool addIfNeeded, bool temporary)
 {
-	HCONTACT hContact = NULL;
+	MCONTACT hContact = NULL;
 
 	char* szEmail;
 	parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, NULL);
@@ -34,7 +34,7 @@ HCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick,
 	if (msc && msc->hContact) hContact = msc->hContact;
 
 	if (hContact == NULL && addIfNeeded) {
-		hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+		hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
 		CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName);
 		setString(hContact, "e-mail", szEmail);
 		setStringUtf(hContact, "Nick", msnNick ? msnNick : wlid);
@@ -48,7 +48,7 @@ HCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick,
 }
 
 
-void CMsnProto::MSN_SetContactDb(HCONTACT hContact, const char *szEmail)
+void CMsnProto::MSN_SetContactDb(MCONTACT hContact, const char *szEmail)
 {
 	MsnContact *cont = Lists_Get(szEmail);
 	const int listId = cont->list;
@@ -119,7 +119,7 @@ void CMsnProto::AddDelUserContList(const char* email, const int list, const int
 /////////////////////////////////////////////////////////////////////////////////////////
 // MSN_AddUser - adds a e-mail address to one of the MSN server lists
 
-bool CMsnProto::MSN_AddUser(HCONTACT hContact, const char* email, int netId, int flags, const char *msg)
+bool CMsnProto::MSN_AddUser(MCONTACT hContact, const char* email, int netId, int flags, const char *msg)
 {
 	bool needRemove     = (flags & LIST_REMOVE) != 0;
 	bool leaveHotmail   = (flags & LIST_REMOVENH) == LIST_REMOVENH;
diff --git a/protocols/MSN/src/msn_global.h b/protocols/MSN/src/msn_global.h
index fac52f59d7..d1efa2736b 100644
--- a/protocols/MSN/src/msn_global.h
+++ b/protocols/MSN/src/msn_global.h
@@ -167,7 +167,7 @@ template <class chartype> void UrlDecode(chartype* str);
 void		__cdecl MSN_ConnectionProc(HANDLE hNewConnection, DWORD dwRemoteIP, void*);
 
 char*		MSN_GetAvatarHash(char* szContext, char** pszUrl = NULL);
-bool		MSN_MsgWndExist(HCONTACT hContact);
+bool		MSN_MsgWndExist(MCONTACT hContact);
 
 #define		MSN_SendNickname(a) MSN_SendNicknameUtf(UTF8(a))
 
@@ -542,7 +542,7 @@ struct ThreadData
 
    int           contactJoined(const char* email);
    int           contactLeft(const char* email);
-   HCONTACT      getContactHandle(void);
+   MCONTACT      getContactHandle(void);
 };
 
 
@@ -569,7 +569,7 @@ struct ThreadData
 
 
 
-inline bool IsChatHandle(HCONTACT hContact) { return (INT_PTR)hContact < 0; }
+inline bool IsChatHandle(MCONTACT hContact) { return (INT_PTR)hContact < 0; }
 
 
 /////////////////////////////////////////////////////////////////////////////////////////
@@ -596,10 +596,10 @@ struct MsgQueueEntry
 
 struct AvatarQueueEntry
 {
-	HCONTACT hContact;
+	MCONTACT hContact;
 	char *pszUrl;
 
-	__forceinline AvatarQueueEntry(HCONTACT _contact, LPCSTR _url) :
+	__forceinline AvatarQueueEntry(MCONTACT _contact, LPCSTR _url) :
 		hContact(_contact),
 		pszUrl( mir_strdup(_url))
 	{}
@@ -639,7 +639,7 @@ struct MsnContact
 	char *email;
 	char *invite;
 	char *nick;
-	HCONTACT hContact;
+	MCONTACT hContact;
 	int list;
 	int netId;
 	int p2pMsgId;
@@ -863,7 +863,7 @@ struct chunkedmsg
 struct DeleteParam
 {
 	CMsnProto *proto;
-	HCONTACT hContact;
+	MCONTACT hContact;
 };
 
 INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -871,10 +871,10 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
 struct InviteChatParam
 {
 	TCHAR* id;
-	HCONTACT hContact;
+	MCONTACT hContact;
 	CMsnProto* ppro;
 
-	InviteChatParam(const TCHAR* id, HCONTACT hContact, CMsnProto* ppro)
+	InviteChatParam(const TCHAR* id, MCONTACT hContact, CMsnProto* ppro)
 		: id(mir_tstrdup(id)), hContact(hContact), ppro(ppro) {}
 
 	~InviteChatParam()
diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp
index e41bf5becb..e058d9194b 100644
--- a/protocols/MSN/src/msn_links.cpp
+++ b/protocols/MSN/src/msn_links.cpp
@@ -27,7 +27,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 static HANDLE hServiceParseLink;
 
-static HCONTACT GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto)
+static MCONTACT GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto)
 {
 	TCHAR* email = NULL;
 	do
@@ -51,7 +51,7 @@ static HCONTACT GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto)
 		return NULL;
 	}
 	if (pemail) *pemail = email;
-	HCONTACT hContact = proto->MSN_HContactFromEmail(UTF8(email), NULL, true, true);
+	MCONTACT hContact = proto->MSN_HContactFromEmail(UTF8(email), NULL, true, true);
 	return hContact;
 }
 
@@ -96,7 +96,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam)
 		arg += 4;
 
 		TCHAR *email;
-		HCONTACT hContact = GetContact(arg, &email, proto);
+		MCONTACT hContact = GetContact(arg, &email, proto);
 		if (email == NULL) return 1;
 
 		/* does not yet check if email is current user */
@@ -121,7 +121,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam)
 	{
 		arg += 5;
 
-		HCONTACT hContact = GetContact(arg, NULL, proto);
+		MCONTACT hContact = GetContact(arg, NULL, proto);
 
 		if (hContact != NULL)
 		{
@@ -133,7 +133,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam)
 	{
 		arg += 6;
 
-		HCONTACT hContact = GetContact(arg, NULL, proto);
+		MCONTACT hContact = GetContact(arg, NULL, proto);
 
 		if (hContact != NULL)
 		{
@@ -145,7 +145,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam)
 	{
 		arg += 6;
 
-		HCONTACT hContact = GetContact(arg, NULL, proto);
+		MCONTACT hContact = GetContact(arg, NULL, proto);
 
 		if (hContact != NULL)
 		{
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp
index bd3ab46208..b091510004 100644
--- a/protocols/MSN/src/msn_lists.cpp
+++ b/protocols/MSN/src/msn_lists.cpp
@@ -65,7 +65,7 @@ MsnContact* CMsnProto::Lists_Get(const char* email)
 	return p;
 }
 
-MsnContact* CMsnProto::Lists_Get(HCONTACT hContact)
+MsnContact* CMsnProto::Lists_Get(MCONTACT hContact)
 {
 	EnterCriticalSection(&csLists);
 
@@ -188,7 +188,7 @@ unsigned CMsnProto::p2p_getPktNum(const char* wlid)
 	return res;
 }
 
-int CMsnProto::Lists_Add(int list, int netId, const char* email, HCONTACT hContact, const char* nick, const char* invite)
+int CMsnProto::Lists_Add(int list, int netId, const char* email, MCONTACT hContact, const char* nick, const char* invite)
 {
 	EnterCriticalSection(&csLists);
 
@@ -238,9 +238,9 @@ void CMsnProto::Lists_Remove(int list, const char* email)
 
 void CMsnProto::Lists_Populate(void)
 {
-	HCONTACT hContact = db_find_first(m_szModuleName);
+	MCONTACT hContact = db_find_first(m_szModuleName);
 	while (hContact) {
-		HCONTACT hNext = db_find_next(hContact, m_szModuleName);
+		MCONTACT hNext = db_find_next(hContact, m_szModuleName);
 		char szEmail[MSN_MAX_EMAIL_LEN] = "";
 		if (db_get_static(hContact, m_szModuleName, "wlid", szEmail, sizeof(szEmail)))
 			db_get_static(hContact, m_szModuleName, "e-mail", szEmail, sizeof(szEmail));
@@ -439,7 +439,7 @@ static void ResetListOptions(HWND hwndList)
 		SendMessage(hwndList, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT));
 }
 
-static void SetContactIcons(HCONTACT hItem, HWND hwndList, CMsnProto* proto)
+static void SetContactIcons(MCONTACT hItem, HWND hwndList, CMsnProto* proto)
 {
 	if (!proto->MSN_IsMyContact(hItem)) {
 		SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
@@ -460,17 +460,17 @@ static void SetContactIcons(HCONTACT hItem, HWND hwndList, CMsnProto* proto)
 	SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(4,(dwMask & LIST_RL)?5:0));
 }
 
-static void SetAllContactIcons(HCONTACT hItem, HWND hwndList, CMsnProto* proto)
+static void SetAllContactIcons(MCONTACT hItem, HWND hwndList, CMsnProto* proto)
 {
 	if (hItem == NULL)
-		hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
+		hItem = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
 
 	while (hItem)
 	{
-		HCONTACT hItemN = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
+		MCONTACT hItemN = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
 
 		if (IsHContactGroup(hItem)) {
-			HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+			MCONTACT hItemT = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
 			if (hItemT)
 				SetAllContactIcons(hItemT, hwndList, proto);
 		}
@@ -481,7 +481,7 @@ static void SetAllContactIcons(HCONTACT hItem, HWND hwndList, CMsnProto* proto)
 	}
 }
 
-static void SaveListItem(HCONTACT hContact, const char* szEmail, int list, int iPrevValue, int iNewValue, CMsnProto* proto)
+static void SaveListItem(MCONTACT hContact, const char* szEmail, int list, int iPrevValue, int iNewValue, CMsnProto* proto)
 {
 	if (iPrevValue == iNewValue)
 		return;
@@ -499,15 +499,15 @@ static void SaveListItem(HCONTACT hContact, const char* szEmail, int list, int i
 	proto->MSN_AddUser(hContact, szEmail, proto->Lists_GetNetId(szEmail), list);
 }
 
-static void SaveSettings(HCONTACT hItem, HWND hwndList, CMsnProto* proto)
+static void SaveSettings(MCONTACT hItem, HWND hwndList, CMsnProto* proto)
 {
 	if (hItem == NULL)
-		hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
+		hItem = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0);
 
 	while (hItem)
 	{
 		if (IsHContactGroup(hItem)) {
-			HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
+			MCONTACT hItemT = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
 			if (hItemT)
 				SaveSettings(hItemT, hwndList, proto);
 		}
@@ -536,7 +536,7 @@ static void SaveSettings(HCONTACT hItem, HWND hwndList, CMsnProto* proto)
 
 			if (xorMask && newMask & (LIST_FL | LIST_LL))
 			{
-				HCONTACT hContact = IsHContactInfo(hItem) ? proto->MSN_HContactFromEmail(szEmail, szEmail, true, false) : hItem;
+				MCONTACT hContact = IsHContactInfo(hItem) ? proto->MSN_HContactFromEmail(szEmail, szEmail, true, false) : hItem;
 				proto->MSN_SetContactDb(hContact, szEmail);
 			}
 
@@ -550,7 +550,7 @@ static void SaveSettings(HCONTACT hItem, HWND hwndList, CMsnProto* proto)
 				}
 			}
 		}
-		hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
+		hItem = (MCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem);
 	}
 }
 
@@ -632,7 +632,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
 			{
 			case CLN_NEWCONTACT:
 				if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0)
-					SetContactIcons((HCONTACT)nmc->hItem, nmc->hdr.hwndFrom, proto);
+					SetContactIcons((MCONTACT)nmc->hItem, nmc->hdr.hwndFrom, proto);
 				break;
 
 			case CLN_LISTREBUILT:
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp
index d74d62ff33..f3c84f36af 100644
--- a/protocols/MSN/src/msn_mail.cpp
+++ b/protocols/MSN/src/msn_mail.cpp
@@ -293,7 +293,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
 
 	ShowPopup &= mUnreadMessages != 0 || (mUnreadJunkEmails != 0 && !getByte("DisableHotmailJunk", 0));
 
-	HCONTACT hContact = MSN_HContactFromEmail(MyOptions.szEmail);
+	MCONTACT hContact = MSN_HContactFromEmail(MyOptions.szEmail);
 	if (hContact)
 	{
 		CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1);
@@ -398,7 +398,7 @@ static void TruncUtf8(char *str, size_t sz)
 	str[cntl] = 0;
 }
 
-void CMsnProto::displayEmailCount(HCONTACT hContact)
+void CMsnProto::displayEmailCount(MCONTACT hContact)
 {
 	if (!emailEnabled || getByte("DisableHotmailCL", 0)) return;
 
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp
index e9e6cf3b1a..f36fccd9e2 100644
--- a/protocols/MSN/src/msn_menu.cpp
+++ b/protocols/MSN/src/msn_menu.cpp
@@ -33,7 +33,7 @@ HANDLE hNetMeeting, hBlockCom, hSendHotMail, hInviteChat, hViewProfile;
 INT_PTR CMsnProto::MsnBlockCommand(WPARAM wParam, LPARAM)
 {
 	if (msnLoggedIn) {
-		HCONTACT hContact = (HCONTACT)wParam;
+		MCONTACT hContact = (MCONTACT)wParam;
 
 		char tEmail[MSN_MAX_EMAIL_LEN];
 		db_get_static(hContact, m_szModuleName, "e-mail", tEmail, sizeof(tEmail));
@@ -51,7 +51,7 @@ INT_PTR CMsnProto::MsnBlockCommand(WPARAM wParam, LPARAM)
 
 INT_PTR CMsnProto::MsnGotoInbox(WPARAM, LPARAM)
 {
-	HCONTACT hContact = MSN_HContactFromEmail(MyOptions.szEmail);
+	MCONTACT hContact = MSN_HContactFromEmail(MyOptions.szEmail);
 	if (hContact) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1);
 
 	MsnInvokeMyURL(true, "http://mail.live.com?rru=inbox");
@@ -60,7 +60,7 @@ INT_PTR CMsnProto::MsnGotoInbox(WPARAM, LPARAM)
 
 INT_PTR CMsnProto::MsnSendHotmail(WPARAM wParam, LPARAM)
 {
-	HCONTACT hContact = (HCONTACT)wParam;
+	MCONTACT hContact = (MCONTACT)wParam;
 	char szEmail[MSN_MAX_EMAIL_LEN];
 
 	if (MSN_IsMeByContact(hContact, szEmail))
@@ -85,7 +85,7 @@ INT_PTR CMsnProto::MsnSetupAlerts(WPARAM, LPARAM)
 
 INT_PTR CMsnProto::MsnViewProfile(WPARAM wParam, LPARAM)
 {
-	HCONTACT hContact = (HCONTACT)wParam;
+	MCONTACT hContact = (MCONTACT)wParam;
 	char buf[64], *cid;
 
 	if (hContact == NULL)
@@ -127,7 +127,7 @@ INT_PTR CMsnProto::MsnInviteCommand(WPARAM, LPARAM)
 
 int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
 {
-	HCONTACT hContact = (HCONTACT)wParam;
+	MCONTACT hContact = (MCONTACT)wParam;
 	char szEmail[MSN_MAX_EMAIL_LEN];
 
 	if ( !MSN_IsMyContact(hContact))
@@ -157,7 +157,7 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
 
 int CMsnProto::OnContactDoubleClicked(WPARAM wParam, LPARAM)
 {
-	HCONTACT hContact = (HCONTACT)wParam;
+	MCONTACT hContact = (MCONTACT)wParam;
 
 	if (emailEnabled && MSN_IsMeByContact(hContact)) {
 		MsnSendHotmail(wParam, 0);
@@ -173,7 +173,7 @@ INT_PTR CMsnProto::MsnSendNetMeeting(WPARAM wParam, LPARAM)
 {
 	if (!msnLoggedIn) return 0;
 
-	HCONTACT hContact = HCONTACT(wParam);
+	MCONTACT hContact = MCONTACT(wParam);
 
 	char szEmail[MSN_MAX_EMAIL_LEN];
 	if (MSN_IsMeByContact(hContact, szEmail)) return 0;
@@ -359,7 +359,7 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable)
 
 //////////////////////////////////////////////////////////////////////////////////////
 
-static CMsnProto* GetProtoInstanceByHContact(HCONTACT hContact)
+static CMsnProto* GetProtoInstanceByHContact(MCONTACT hContact)
 {
 	char* szProto = GetContactProto(hContact);
 	if (szProto == NULL)
@@ -374,31 +374,31 @@ static CMsnProto* GetProtoInstanceByHContact(HCONTACT hContact)
 
 static INT_PTR MsnMenuBlockCommand(WPARAM wParam, LPARAM lParam)
 {
-	CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam);
+	CMsnProto* ppro = GetProtoInstanceByHContact((MCONTACT)wParam);
 	return (ppro) ? ppro->MsnBlockCommand(wParam, lParam) : 0;
 }
 
 static INT_PTR MsnMenuViewProfile(WPARAM wParam, LPARAM lParam)
 {
-	CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam);
+	CMsnProto* ppro = GetProtoInstanceByHContact((MCONTACT)wParam);
 	return (ppro) ? ppro->MsnViewProfile(wParam, lParam) : 0;
 }
 
 static INT_PTR MsnMenuSendNetMeeting(WPARAM wParam, LPARAM lParam)
 {
-	CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam);
+	CMsnProto* ppro = GetProtoInstanceByHContact((MCONTACT)wParam);
 	return (ppro) ? ppro->MsnSendNetMeeting(wParam, lParam) : 0;
 }
 
 static INT_PTR MsnMenuSendHotmail(WPARAM wParam, LPARAM lParam)
 {
-	CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam);
+	CMsnProto* ppro = GetProtoInstanceByHContact((MCONTACT)wParam);
 	return (ppro) ? ppro->MsnSendHotmail(wParam, lParam) : 0;
 }
 
 static int MSN_OnPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
 {
-	CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam);
+	CMsnProto* ppro = GetProtoInstanceByHContact((MCONTACT)wParam);
 	if (ppro)
 		ppro->OnPrebuildContactMenu(wParam, lParam);
 	else {
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 704adaf6f4..f3c74618e2 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -88,7 +88,7 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch
 {
 	//blob is: UIN=0(DWORD), hContact(DWORD), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
 
-	HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true);
+	MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true);
 
 	int emaillen = (int)strlen(email);
 
@@ -176,7 +176,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MSN_GetAvatarFileName - gets a file name for an contact's avatar
 
-void CMsnProto::MSN_GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext)
+void CMsnProto::MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext)
 {
 	size_t tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
 
@@ -321,7 +321,7 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MSN_GetCustomSmileyFileName - gets a file name for an contact's custom smiley
 
-void CMsnProto::MSN_GetCustomSmileyFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int type)
+void CMsnProto::MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int type)
 {
 	size_t tPathLen;
 
@@ -834,7 +834,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
 	case WM_COMMAND:
 		if (tData != NULL) {
 			if (tData->flags & MSN_HOTMAIL_POPUP) {
-				HCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL);
+				MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL);
 				if (hContact) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1);
 				if (tData->flags & MSN_ALLOW_ENTER)
 					tData->proto->MsnInvokeMyURL(true, tData->url);
@@ -847,7 +847,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
 
 	case WM_CONTEXTMENU:
 		if (tData != NULL && tData->flags & MSN_HOTMAIL_POPUP) {
-			HCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL);
+			MCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL);
 			if (hContact)
 				CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1);
 		}
@@ -946,7 +946,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam)
 	CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
 }
 
-void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url, HCONTACT hContact)
+void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url, MCONTACT hContact)
 {
 	if (Miranda_Terminated()) return;
 
@@ -961,7 +961,7 @@ void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags
 }
 
 
-void CMsnProto::MSN_ShowPopup(const HCONTACT hContact, const TCHAR* msg, int flags)
+void CMsnProto::MSN_ShowPopup(const MCONTACT hContact, const TCHAR* msg, int flags)
 {
 	const TCHAR* nickname = hContact ? GetContactNameT(hContact) : _T("Me");
 	MSN_ShowPopup(nickname, msg, flags, NULL, hContact);
@@ -1194,13 +1194,13 @@ char* TWinErrorCode::getText()
 	return mErrorText;
 }
 
-bool CMsnProto::MSN_IsMyContact(HCONTACT hContact)
+bool CMsnProto::MSN_IsMyContact(MCONTACT hContact)
 {
 	const char* szProto = GetContactProto(hContact);
 	return szProto != NULL && strcmp(m_szModuleName, szProto) == 0;
 }
 
-bool CMsnProto::MSN_IsMeByContact(HCONTACT hContact, char* szEmail)
+bool CMsnProto::MSN_IsMeByContact(MCONTACT hContact, char* szEmail)
 {
 	char tEmail[MSN_MAX_EMAIL_LEN];
 	char *emailPtr = szEmail ? szEmail : tEmail;
@@ -1212,7 +1212,7 @@ bool CMsnProto::MSN_IsMeByContact(HCONTACT hContact, char* szEmail)
 	return _stricmp(emailPtr, MyOptions.szEmail) == 0;
 }
 
-bool MSN_MsgWndExist(HCONTACT hContact)
+bool MSN_MsgWndExist(MCONTACT hContact)
 {
 	MessageWindowInputData msgWinInData =
 	{ sizeof(MessageWindowInputData), hContact, MSG_WINDOW_UFLAG_MSG_BOTH };
@@ -1222,7 +1222,7 @@ bool MSN_MsgWndExist(HCONTACT hContact)
 	bool res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0;
 	res = res || msgWinData.hwndWindow;
 	if (res) {
-		msgWinInData.hContact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
+		msgWinInData.hContact = (MCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0);
 		if (msgWinInData.hContact != NULL) {
 			res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0;
 			res |= (msgWinData.hwndWindow == NULL);
diff --git a/protocols/MSN/src/msn_msgqueue.cpp b/protocols/MSN/src/msn_msgqueue.cpp
index 0bbd87c01b..ae231e7097 100644
--- a/protocols/MSN/src/msn_msgqueue.cpp
+++ b/protocols/MSN/src/msn_msgqueue.cpp
@@ -156,7 +156,7 @@ void CMsnProto::MsgQueue_Clear(const char* wlid, bool msg)
 			const MsgQueueEntry& E = lsMessageQueue[i];
 			if (E.msgSize == 0)
 			{
-				HCONTACT hContact = MSN_HContactFromEmail(E.wlid);
+				MCONTACT hContact = MSN_HContactFromEmail(E.wlid);
 				ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED,
 					(HANDLE)E.seq, (LPARAM)Translate("Message delivery failed"));
 			}
@@ -187,7 +187,7 @@ void CMsnProto::MsgQueue_Clear(const char* wlid, bool msg)
 				if (msgfnd)
 				{
 					LeaveCriticalSection(&csMsgQueue);
-					HCONTACT hContact = MSN_HContactFromEmail(wlid);
+					MCONTACT hContact = MSN_HContactFromEmail(wlid);
 					ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)seq,
 						(LPARAM)Translate("Message delivery failed"));
 					i = 0;
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index b4c00ca167..ae6276b6f3 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -490,7 +490,7 @@ static INT_PTR CALLBACK DlgProcHotmailPopupOpts(HWND hwndDlg, UINT msg, WPARAM w
 				proto->setByte("EnableDeliveryPopup", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFY_FIRSTMSG));
 				proto->setByte("EnableSessionPopup", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFY_ENDSESSION));
 
-				HCONTACT hContact = proto->MSN_HContactFromEmail(proto->MyOptions.szEmail);
+				MCONTACT hContact = proto->MSN_HContactFromEmail(proto->MyOptions.szEmail);
 				if (hContact)
 					proto->displayEmailCount(hContact);
 				return TRUE;
diff --git a/protocols/MSN/src/msn_p2ps.cpp b/protocols/MSN/src/msn_p2ps.cpp
index 697bb49c0b..780c27b197 100644
--- a/protocols/MSN/src/msn_p2ps.cpp
+++ b/protocols/MSN/src/msn_p2ps.cpp
@@ -110,7 +110,7 @@ bool CMsnProto::p2p_sessionRegistered(filetransfer* ft)
 	return idx > -1;
 }
 
-filetransfer* CMsnProto::p2p_getThreadSession(HCONTACT hContact, TInfoType mType)
+filetransfer* CMsnProto::p2p_getThreadSession(MCONTACT hContact, TInfoType mType)
 {
 	EnterCriticalSection(&sessionLock);
 
@@ -129,7 +129,7 @@ filetransfer* CMsnProto::p2p_getThreadSession(HCONTACT hContact, TInfoType mType
 	return result;
 }
 
-void CMsnProto::p2p_clearThreadSessions(HCONTACT hContact, TInfoType mType)
+void CMsnProto::p2p_clearThreadSessions(MCONTACT hContact, TInfoType mType)
 {
 	EnterCriticalSection(&sessionLock);
 
@@ -147,7 +147,7 @@ void CMsnProto::p2p_clearThreadSessions(HCONTACT hContact, TInfoType mType)
 	LeaveCriticalSection(&sessionLock);
 }
 
-filetransfer* CMsnProto::p2p_getAvatarSession(HCONTACT hContact)
+filetransfer* CMsnProto::p2p_getAvatarSession(MCONTACT hContact)
 {
 	EnterCriticalSection(&sessionLock);
 
@@ -165,7 +165,7 @@ filetransfer* CMsnProto::p2p_getAvatarSession(HCONTACT hContact)
 	return result;
 }
 
-bool CMsnProto::p2p_isAvatarOnly(HCONTACT hContact)
+bool CMsnProto::p2p_isAvatarOnly(MCONTACT hContact)
 {
 	EnterCriticalSection(&sessionLock);
 
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index 7f4ad25621..1c21cb445e 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -80,7 +80,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
 
 	LoadOptions();
 
-	for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
+	for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
 		delSetting(hContact, "Status");
 		delSetting(hContact, "IdleTS");
 		delSetting(hContact, "p2pMsgId");
@@ -216,9 +216,9 @@ int CMsnProto::OnPreShutdown(WPARAM, LPARAM)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnAddToList - adds contact to the server list
 
-HCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD flags)
+MCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD flags)
 {
-	HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, flags & PALF_TEMPORARY);
+	MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, flags & PALF_TEMPORARY);
 
 	if (flags & PALF_TEMPORARY)
 	{
@@ -249,7 +249,7 @@ HCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD
 	return hContact;
 }
 
-HCONTACT __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
+MCONTACT __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
 {
 	TCHAR *id = psr->id ? psr->id : psr->email;
 	return AddToListByEmail(
@@ -258,7 +258,7 @@ HCONTACT __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
 		flags);
 }
 
-HCONTACT __cdecl CMsnProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
+MCONTACT __cdecl CMsnProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
 {
 	DBEVENTINFO dbei = { sizeof(dbei) };
 	if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
@@ -277,7 +277,7 @@ HCONTACT __cdecl CMsnProto::AddToListByEvent(int flags, int iContact, HANDLE hDb
 	return AddToListByEmail(email, nick, flags);
 }
 
-int CMsnProto::AuthRecv(HCONTACT hContact, PROTORECVEVENT* pre)
+int CMsnProto::AuthRecv(MCONTACT hContact, PROTORECVEVENT* pre)
 {
 	Proto_AuthRecv(m_szModuleName, pre);
 	return 0;
@@ -286,7 +286,7 @@ int CMsnProto::AuthRecv(HCONTACT hContact, PROTORECVEVENT* pre)
 ////////////////////////////////////////////////////////////////////////////////////////
 // PSS_AUTHREQUEST
 
-int __cdecl CMsnProto::AuthRequest(HCONTACT hContact, const TCHAR* szMessage)
+int __cdecl CMsnProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage)
 {
 	if (msnLoggedIn)
 	{
@@ -349,7 +349,7 @@ int CMsnProto::Authorize(HANDLE hDbEvent)
 	char* lastName = firstName + strlen(firstName) + 1;
 	char* email = lastName + strlen(lastName) + 1;
 
-	HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, 0);
+	MCONTACT hContact = MSN_HContactFromEmail(email, nick, true, 0);
 	int netId = Lists_GetNetId(email);
 
 	MSN_AddUser(hContact, email, netId, LIST_AL);
@@ -398,7 +398,7 @@ int CMsnProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason)
 	{
 		if (msc->hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)msc->hContact, 0);
 		msc->hContact = NULL;
-		HCONTACT hContact = MSN_HContactFromEmail(email);
+		MCONTACT hContact = MSN_HContactFromEmail(email);
 		if (hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
 	}
 
@@ -518,7 +518,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg)
 	ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ft, 0);
 }
 
-HANDLE __cdecl CMsnProto::FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath)
+HANDLE __cdecl CMsnProto::FileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath)
 {
 	filetransfer* ft = (filetransfer*)hTransfer;
 
@@ -546,7 +546,7 @@ HANDLE __cdecl CMsnProto::FileAllow(HCONTACT hContact, HANDLE hTransfer, const P
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnFileCancel - cancels the active file transfer
 
-int __cdecl CMsnProto::FileCancel(HCONTACT hContact, HANDLE hTransfer)
+int __cdecl CMsnProto::FileCancel(MCONTACT hContact, HANDLE hTransfer)
 {
 	filetransfer* ft = (filetransfer*)hTransfer;
 
@@ -579,7 +579,7 @@ int __cdecl CMsnProto::FileCancel(HCONTACT hContact, HANDLE hTransfer)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnFileDeny - rejects the file transfer request
 
-int __cdecl CMsnProto::FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* /*szReason*/)
+int __cdecl CMsnProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* /*szReason*/)
 {
 	filetransfer* ft = (filetransfer*)hTransfer;
 
@@ -650,7 +650,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const PROTOCHAR
 typedef struct AwayMsgInfo_tag
 {
 	INT_PTR id;
-	HCONTACT hContact;
+	MCONTACT hContact;
 } AwayMsgInfo;
 
 void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg)
@@ -668,7 +668,7 @@ void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg)
 	mir_free(inf);
 }
 
-HANDLE __cdecl CMsnProto::GetAwayMsg(HCONTACT hContact)
+HANDLE __cdecl CMsnProto::GetAwayMsg(MCONTACT hContact)
 {
 	AwayMsgInfo* inf = (AwayMsgInfo*)mir_alloc(sizeof(AwayMsgInfo));
 	inf->hContact = hContact;
@@ -681,7 +681,7 @@ HANDLE __cdecl CMsnProto::GetAwayMsg(HCONTACT hContact)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnGetCaps - obtain the protocol capabilities
 
-DWORD_PTR __cdecl CMsnProto::GetCaps(int type, HCONTACT hContact)
+DWORD_PTR __cdecl CMsnProto::GetCaps(int type, MCONTACT hContact)
 {
 	switch(type) {
 	case PFLAGNUM_1:
@@ -718,7 +718,7 @@ DWORD_PTR __cdecl CMsnProto::GetCaps(int type, HCONTACT hContact)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnGetInfo - nothing to do, cause we cannot obtain information from the server
 
-int __cdecl CMsnProto::GetInfo(HCONTACT hContact, int infoType)
+int __cdecl CMsnProto::GetInfo(MCONTACT hContact, int infoType)
 {
 	return 1;
 }
@@ -726,7 +726,7 @@ int __cdecl CMsnProto::GetInfo(HCONTACT hContact, int infoType)
 ////////////////////////////////////////////////////////////////////////////////////////
 // RecvContacts
 
-int __cdecl CMsnProto::RecvContacts(HCONTACT hContact, PROTORECVEVENT*)
+int __cdecl CMsnProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT*)
 {
 	return 1;
 }
@@ -735,7 +735,7 @@ int __cdecl CMsnProto::RecvContacts(HCONTACT hContact, PROTORECVEVENT*)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnRecvFile - creates a database event from the file request been received
 
-int __cdecl CMsnProto::RecvFile(HCONTACT hContact, PROTOFILEEVENT* evt)
+int __cdecl CMsnProto::RecvFile(MCONTACT hContact, PROTOFILEEVENT* evt)
 {
 	return Proto_RecvFile(hContact, evt);
 }
@@ -743,7 +743,7 @@ int __cdecl CMsnProto::RecvFile(HCONTACT hContact, PROTOFILEEVENT* evt)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnRecvMessage - creates a database event from the message been received
 
-int __cdecl CMsnProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT* pre)
+int __cdecl CMsnProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre)
 {
 	char tEmail[MSN_MAX_EMAIL_LEN];
 	db_get_static(hContact, m_szModuleName, "e-mail", tEmail, sizeof(tEmail));
@@ -757,7 +757,7 @@ int __cdecl CMsnProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT* pre)
 ////////////////////////////////////////////////////////////////////////////////////////
 // RecvUrl
 
-int __cdecl CMsnProto::RecvUrl(HCONTACT hContact, PROTORECVEVENT*)
+int __cdecl CMsnProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT*)
 {
 	return 1;
 }
@@ -765,7 +765,7 @@ int __cdecl CMsnProto::RecvUrl(HCONTACT hContact, PROTORECVEVENT*)
 ////////////////////////////////////////////////////////////////////////////////////////
 // SendContacts
 
-int __cdecl CMsnProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList)
+int __cdecl CMsnProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList)
 {
 	return 1;
 }
@@ -773,7 +773,7 @@ int __cdecl CMsnProto::SendContacts(HCONTACT hContact, int flags, int nContacts,
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnSendFile - initiates a file transfer
 
-HANDLE __cdecl CMsnProto::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles)
+HANDLE __cdecl CMsnProto::SendFile(MCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles)
 {
 	if (!msnLoggedIn)
 		return 0;
@@ -826,14 +826,14 @@ HANDLE __cdecl CMsnProto::SendFile(HCONTACT hContact, const PROTOCHAR* szDescrip
 
 struct TFakeAckParams
 {
-	inline TFakeAckParams(HCONTACT p2, long p3, const char* p4, CMsnProto *p5) :
+	inline TFakeAckParams(MCONTACT p2, long p3, const char* p4, CMsnProto *p5) :
 		hContact(p2),
 		id(p3),
 		msg(p4),
 		proto(p5)
 		{}
 
-	HCONTACT hContact;
+	MCONTACT hContact;
 	long	id;
 	const char*	msg;
 	CMsnProto *proto;
@@ -851,7 +851,7 @@ void CMsnProto::MsnFakeAck(void* arg)
 	delete tParam;
 }
 
-int __cdecl CMsnProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc)
+int __cdecl CMsnProto::SendMsg(MCONTACT hContact, int flags, const char* pszSrc)
 {
 	const char *errMsg = NULL;
 
@@ -1002,7 +1002,7 @@ int __cdecl CMsnProto::SetAwayMsg(int status, const TCHAR* msg)
 ////////////////////////////////////////////////////////////////////////////////////////
 // PSR_AWAYMSG
 
-int __cdecl CMsnProto::RecvAwayMsg(HCONTACT hContact, int statusMode, PROTORECVEVENT* evt)
+int __cdecl CMsnProto::RecvAwayMsg(MCONTACT hContact, int statusMode, PROTORECVEVENT* evt)
 {
 	return 1;
 }
@@ -1065,7 +1065,7 @@ int __cdecl CMsnProto::SetStatus(int iNewStatus)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MsnUserIsTyping - notify another contact that we're typing a message
 
-int __cdecl CMsnProto::UserIsTyping(HCONTACT hContact, int type)
+int __cdecl CMsnProto::UserIsTyping(MCONTACT hContact, int type)
 {
 	if (!msnLoggedIn) return 0;
 
@@ -1108,7 +1108,7 @@ int __cdecl CMsnProto::UserIsTyping(HCONTACT hContact, int type)
 ////////////////////////////////////////////////////////////////////////////////////////
 // SendUrl
 
-int __cdecl CMsnProto::SendUrl(HCONTACT hContact, int flags, const char* url)
+int __cdecl CMsnProto::SendUrl(MCONTACT hContact, int flags, const char* url)
 {
 	return 1;
 }
@@ -1116,7 +1116,7 @@ int __cdecl CMsnProto::SendUrl(HCONTACT hContact, int flags, const char* url)
 /////////////////////////////////////////////////////////////////////////////////////////
 //	MsnSetApparentMode - controls contact visibility
 
-int __cdecl CMsnProto::SetApparentMode(HCONTACT hContact, int mode)
+int __cdecl CMsnProto::SetApparentMode(MCONTACT hContact, int mode)
 {
 	if (mode && mode != ID_STATUS_OFFLINE)
 	  return 1;
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h
index cf40b2b89e..74d758dcbf 100644
--- a/protocols/MSN/src/msn_proto.h
+++ b/protocols/MSN/src/msn_proto.h
@@ -32,23 +32,23 @@ struct CMsnProto : public PROTO<CMsnProto>
 	// PROTO_INTERFACE
 	//====================================================================================
 
-	virtual	HCONTACT  __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
-	virtual	HCONTACT  __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent);
+	virtual	MCONTACT  __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);
+	virtual	MCONTACT  __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent);
 
 	virtual	int       __cdecl Authorize(HANDLE hDbEvent);
 	virtual	int       __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR* szReason);
-	virtual	int       __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*);
-	virtual	int       __cdecl AuthRequest(HCONTACT hContact, const TCHAR* szMessage);
+	virtual	int       __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*);
+	virtual	int       __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage);
 
 	virtual	HANDLE    __cdecl ChangeInfo(int iInfoType, void* pInfoData);
 
-	virtual	HANDLE    __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath);
-	virtual	int       __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer);
-	virtual	int       __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason);
+	virtual	HANDLE    __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath);
+	virtual	int       __cdecl FileCancel(MCONTACT hContact, HANDLE hTransfer);
+	virtual	int       __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason);
 	virtual	int       __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename);
 
-	virtual	DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL);
-	virtual	int       __cdecl GetInfo(HCONTACT hContact, int infoType);
+	virtual	DWORD_PTR __cdecl GetCaps(int type, MCONTACT hContact = NULL);
+	virtual	int       __cdecl GetInfo(MCONTACT hContact, int infoType);
 
 	virtual	HANDLE    __cdecl SearchBasic(const PROTOCHAR* id);
 	virtual	HANDLE    __cdecl SearchByEmail(const PROTOCHAR* email);
@@ -56,24 +56,24 @@ struct CMsnProto : public PROTO<CMsnProto>
 	virtual	HWND      __cdecl SearchAdvanced(HWND owner);
 	virtual	HWND      __cdecl CreateExtendedSearchUI(HWND owner);
 
-	virtual	int       __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*);
-	virtual	int       __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT*);
-	virtual	int       __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*);
-	virtual	int       __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*);
+	virtual	int       __cdecl RecvContacts(MCONTACT hContact, PROTORECVEVENT*);
+	virtual	int       __cdecl RecvFile(MCONTACT hContact, PROTOFILEEVENT*);
+	virtual	int       __cdecl RecvMsg(MCONTACT hContact, PROTORECVEVENT*);
+	virtual	int       __cdecl RecvUrl(MCONTACT hContact, PROTORECVEVENT*);
 
-	virtual	int       __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList);
-	virtual	HANDLE    __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles);
-	virtual	int       __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg);
-	virtual	int       __cdecl SendUrl(HCONTACT hContact, int flags, const char* url);
+	virtual	int       __cdecl SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList);
+	virtual	HANDLE    __cdecl SendFile(MCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles);
+	virtual	int       __cdecl SendMsg(MCONTACT hContact, int flags, const char* msg);
+	virtual	int       __cdecl SendUrl(MCONTACT hContact, int flags, const char* url);
 
-	virtual	int       __cdecl SetApparentMode(HCONTACT hContact, int mode);
+	virtual	int       __cdecl SetApparentMode(MCONTACT hContact, int mode);
 	virtual	int       __cdecl SetStatus(int iNewStatus);
 
-	virtual	HANDLE    __cdecl GetAwayMsg(HCONTACT hContact);
-	virtual	int       __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt);
+	virtual	HANDLE    __cdecl GetAwayMsg(MCONTACT hContact);
+	virtual	int       __cdecl RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt);
 	virtual	int       __cdecl SetAwayMsg(int m_iStatus, const TCHAR* msg);
 
-	virtual	int       __cdecl UserIsTyping(HCONTACT hContact, int type);
+	virtual	int       __cdecl UserIsTyping(MCONTACT hContact, int type);
 
 	virtual	int       __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam);
 
@@ -195,7 +195,7 @@ struct CMsnProto : public PROTO<CMsnProto>
 	bool        getMyAvatarFile(char *url, TCHAR *fname);
 
 	void        MSN_GoOffline(void);
-	void        MSN_GetCustomSmileyFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int Type);
+	void        MSN_GetCustomSmileyFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int Type);
 
 	const char*	MirandaStatusToMSN(int status);
 	WORD        MSNStatusToMiranda(const char *status);
@@ -218,13 +218,13 @@ struct CMsnProto : public PROTO<CMsnProto>
 	void        sttProcessYFind(char* buf, size_t len);
 	void        sttCustomSmiley(const char* msgBody, char* email, char* nick, int iSmileyType);
 	void        sttInviteMessage(ThreadData* info, char* msgBody, char* email, char* nick);
-	void        sttSetMirVer(HCONTACT hContact, DWORD dwValue, bool always);
+	void        sttSetMirVer(MCONTACT hContact, DWORD dwValue, bool always);
 
 	void        LoadOptions(void);
 
 	void        InitPopups(void);
-	void        MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url, HCONTACT hContact = NULL);
-	void        MSN_ShowPopup(const HCONTACT hContact, const TCHAR* msg, int flags);
+	void        MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url, MCONTACT hContact = NULL);
+	void        MSN_ShowPopup(const MCONTACT hContact, const TCHAR* msg, int flags);
 	void        MSN_ShowError(const char* msgtext, ...);
 
 	void        MSN_SetNicknameUtf(const char* nickname);
@@ -337,7 +337,7 @@ struct CMsnProto : public PROTO<CMsnProto>
 	void  p2p_cancelAllSessions(void);
 	void  p2p_redirectSessions(const char* wlid);
 	void  p2p_startSessions(const char* wlid);
-	void  p2p_clearThreadSessions(HCONTACT hContact, TInfoType mType);
+	void  p2p_clearThreadSessions(MCONTACT hContact, TInfoType mType);
 
 	void  p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid);
 	void  p2p_inviteDc(filetransfer* ft, const char *wlid);
@@ -380,14 +380,14 @@ struct CMsnProto : public PROTO<CMsnProto>
 	void P2pSessions_Init(void);
 	void P2pSessions_Uninit(void);
 
-	filetransfer*  p2p_getAvatarSession(HCONTACT hContact);
-	filetransfer*  p2p_getThreadSession(HCONTACT hContact, TInfoType mType);
+	filetransfer*  p2p_getAvatarSession(MCONTACT hContact);
+	filetransfer*  p2p_getThreadSession(MCONTACT hContact, TInfoType mType);
 	filetransfer*  p2p_getSessionByID(unsigned id);
 	filetransfer*  p2p_getSessionByUniqueID(unsigned id);
 	filetransfer*  p2p_getSessionByCallID(const char* CallID, const char* wlid);
 
 	bool     p2p_sessionRegistered(filetransfer* ft);
-	bool     p2p_isAvatarOnly(HCONTACT hContact);
+	bool     p2p_isAvatarOnly(MCONTACT hContact);
 	unsigned p2p_getMsgId(const char* wlid, int inc);
 	unsigned p2p_getPktNum(const char* wlid);
 
@@ -413,7 +413,7 @@ struct CMsnProto : public PROTO<CMsnProto>
 	void MSN_ChatStart(ThreadData* info);
 	void MSN_KillChatSession(const TCHAR* id);
 
-	HCONTACT MSN_GetChatInernalHandle(HCONTACT hContact);
+	MCONTACT MSN_GetChatInernalHandle(MCONTACT hContact);
 
 	int __cdecl MSN_GCEventHook(WPARAM wParam, LPARAM lParam);
 	int __cdecl MSN_GCMenuHook(WPARAM wParam, LPARAM lParam);
@@ -421,7 +421,7 @@ struct CMsnProto : public PROTO<CMsnProto>
 	/////////////////////////////////////////////////////////////////////////////////////////
 	//	MSN contact list
 
-	int      Lists_Add(int list, int netId, const char* email, HCONTACT hContact = NULL, const char* nick = NULL, const char* invite = NULL);
+	int      Lists_Add(int list, int netId, const char* email, MCONTACT hContact = NULL, const char* nick = NULL, const char* invite = NULL);
 	bool     Lists_IsInList(int list, const char* email);
 	int      Lists_GetMask(const char* email);
 	int      Lists_GetNetId(const char* email);
@@ -430,7 +430,7 @@ struct CMsnProto : public PROTO<CMsnProto>
 	void     Lists_Wipe(void);
 
 	MsnContact* Lists_Get(const char* email);
-	MsnContact* Lists_Get(HCONTACT hContact);
+	MsnContact* Lists_Get(MCONTACT hContact);
 	MsnContact* Lists_GetNext(int& i);
 
 	MsnPlace* Lists_GetPlace(const char* wlid);
@@ -446,13 +446,13 @@ struct CMsnProto : public PROTO<CMsnProto>
 	void     MSN_FindYahooUser(const char* email);
 	bool     MSN_RefreshContactList(void);
 
-	bool     MSN_IsMyContact(HCONTACT hContact);
-	bool     MSN_IsMeByContact(HCONTACT hContact, char* szEmail  = NULL);
-	bool     MSN_AddUser(HCONTACT hContact, const char* email, int netId, int flags, const char *msg = NULL);
+	bool     MSN_IsMyContact(MCONTACT hContact);
+	bool     MSN_IsMeByContact(MCONTACT hContact, char* szEmail  = NULL);
+	bool     MSN_AddUser(MCONTACT hContact, const char* email, int netId, int flags, const char *msg = NULL);
 	void     MSN_AddAuthRequest(const char *email, const char *nick, const char *reason);
-	void     MSN_SetContactDb(HCONTACT hContact, const char *szEmail);
-	HCONTACT MSN_HContactFromEmail(const char* msnEmail, const char* msnNick = NULL, bool addIfNeeded = false, bool temporary = false);
-	HCONTACT AddToListByEmail(const char *email, const char *nick, DWORD flags);
+	void     MSN_SetContactDb(MCONTACT hContact, const char *szEmail);
+	MCONTACT MSN_HContactFromEmail(const char* msnEmail, const char* msnNick = NULL, bool addIfNeeded = false, bool temporary = false);
+	MCONTACT AddToListByEmail(const char *email, const char *nick, DWORD flags);
 
 	/////////////////////////////////////////////////////////////////////////////////////////
 	//	MSN server groups
@@ -464,11 +464,11 @@ struct CMsnProto : public PROTO<CMsnProto>
 	LPCSTR   MSN_GetGroupByName(const char* pName);
 	void     MSN_SetGroupName(const char* pId, const char* pName);
 
-	void     MSN_MoveContactToGroup(HCONTACT hContact, const char* grpName);
+	void     MSN_MoveContactToGroup(MCONTACT hContact, const char* grpName);
 	void     MSN_RenameServerGroup(LPCSTR szId, const char* newName);
 	void     MSN_DeleteServerGroup(LPCSTR szId);
 	void     MSN_RemoveEmptyGroups(void);
-	void     MSN_SyncContactToServerGroup(HCONTACT hContact, const char* szContId, ezxml_t cgrp);
+	void     MSN_SyncContactToServerGroup(MCONTACT hContact, const char* szContId, ezxml_t cgrp);
 	void     MSN_UploadServerGroups(char* group);
 
 	/////////////////////////////////////////////////////////////////////////////////////////
@@ -485,12 +485,12 @@ struct CMsnProto : public PROTO<CMsnProto>
 	void   AvatarQueue_Init(void);
 	void   AvatarQueue_Uninit(void);
 
-	void   MSN_GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext);
+	void   MSN_GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext);
 	int    MSN_SetMyAvatar(const TCHAR* szFname, void* pData, size_t cbLen);
 
 	void   __cdecl MSN_AvatarsThread(void*);
 
-	void   pushAvatarRequest(HCONTACT hContact, LPCSTR pszUrl);
+	void   pushAvatarRequest(MCONTACT hContact, LPCSTR pszUrl);
 	bool   loadHttpAvatar(AvatarQueueEntry *p);
 
 	/////////////////////////////////////////////////////////////////////////////////////////
@@ -504,7 +504,7 @@ struct CMsnProto : public PROTO<CMsnProto>
 
 	void processMailData(char* mailData);
 	void sttNotificationMessage(char* msgBody, bool isInitial);
-	void displayEmailCount(HCONTACT hContact);
+	void displayEmailCount(MCONTACT hContact);
 
 	/////////////////////////////////////////////////////////////////////////////////////////
 	//	MSN SOAP Address Book
@@ -526,7 +526,7 @@ struct CMsnProto : public PROTO<CMsnProto>
 
 	ezxml_t abSoapHdr(const char* service, const char* scenario, ezxml_t& tbdy, char*& httphdr);
 	char* GetABHost(const char* service, bool isSharing);
-	void SetAbParam(HCONTACT hContact, const char *name, const char *par);
+	void SetAbParam(MCONTACT hContact, const char *name, const char *par);
 	void UpdateABHost(const char* service, const char* url);
 	void UpdateABCacheKey(ezxml_t bdy,  bool isSharing);
 
@@ -560,11 +560,11 @@ struct CMsnProto : public PROTO<CMsnProto>
 
 	//////////////////////////////////////////////////////////////////////////////////////
 
-	TCHAR* GetContactNameT(HCONTACT hContact);
+	TCHAR* GetContactNameT(MCONTACT hContact);
 
-	int    getStringUtf(HCONTACT hContact, const char* name, DBVARIANT* result);
+	int    getStringUtf(MCONTACT hContact, const char* name, DBVARIANT* result);
 	int    getStringUtf(const char* name, DBVARIANT* result);
-	void   setStringUtf(HCONTACT hContact, const char* name, const char* value);
+	void   setStringUtf(MCONTACT hContact, const char* name, const char* value);
 };
 
 extern OBJLIST<CMsnProto> g_Instances;
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp
index 5f528760f0..7545a1d7d7 100644
--- a/protocols/MSN/src/msn_soapab.cpp
+++ b/protocols/MSN/src/msn_soapab.cpp
@@ -609,7 +609,7 @@ bool CMsnProto::MSN_SharingMyProfile(bool allowRecurse)
 }
 
 
-void CMsnProto::SetAbParam(HCONTACT hContact, const char *name, const char *par)
+void CMsnProto::SetAbParam(MCONTACT hContact, const char *name, const char *par)
 {
 	if (*par) setStringUtf(hContact, name, (char*)par);
 //	else delSetting(hContact, "FirstName");
@@ -814,7 +814,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
 	//				Depricated in WLM 8.1
 	//				const char* szNick  = ezxml_txt(ezxml_child(contInf, "displayName"));
 	//				if (*szNick == '\0') szNick = szEmail;
-					HCONTACT hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false);
+					MCONTACT hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false);
 	//				setStringUtf(hContact, "Nick", (char*)szNick);
 
 					if (MyOptions.ManageServer)
@@ -1555,7 +1555,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in
 			else
 			{
 				MSN_ABAddRemoveContact(szContId, NETID_MSN, true);
-				HCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false);
+				MCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false);
 				setString(hContact, "ID", szContId);
 			}
 			status = 0;
@@ -1590,7 +1590,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in
 				}
 				else
 				{
-					HCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false);
+					MCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false);
 					setString(hContact, "ID", szContId);
 				}
 			}
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp
index 472e7fafd8..5d655a2d31 100644
--- a/protocols/MSN/src/msn_srv.cpp
+++ b/protocols/MSN/src/msn_srv.cpp
@@ -133,7 +133,7 @@ void CMsnProto::MSN_SetGroupName(const char* pId, const char* pNewName)
 /////////////////////////////////////////////////////////////////////////////////////////
 // MSN_MoveContactToGroup - sends a contact to the specified group
 
-void CMsnProto::MSN_MoveContactToGroup(HCONTACT hContact, const char* grpName)
+void CMsnProto::MSN_MoveContactToGroup(MCONTACT hContact, const char* grpName)
 {
 	if (!MyOptions.ManageServer) return;
 
@@ -251,7 +251,7 @@ void CMsnProto::MSN_UploadServerGroups(char* group)
 // if contact in multiple server groups it get removed from all of them other them it's
 // in or the last one
 
-void CMsnProto::MSN_SyncContactToServerGroup(HCONTACT hContact, const char* szContId, ezxml_t cgrp)
+void CMsnProto::MSN_SyncContactToServerGroup(MCONTACT hContact, const char* szContId, ezxml_t cgrp)
 {
 	if (!MyOptions.ManageServer) return;
 
diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp
index 78655c0035..b6e2163e4d 100644
--- a/protocols/MSN/src/msn_std.cpp
+++ b/protocols/MSN/src/msn_std.cpp
@@ -26,7 +26,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /////////////////////////////////////////////////////////////////////////////////////////
 // Standard functions
 
-int CMsnProto::getStringUtf(HCONTACT hContact, const char* name, DBVARIANT* result)
+int CMsnProto::getStringUtf(MCONTACT hContact, const char* name, DBVARIANT* result)
 {	return db_get_utf(hContact, m_szModuleName, name, result);
 }
 
@@ -34,13 +34,13 @@ int CMsnProto::getStringUtf(const char* name, DBVARIANT* result)
 {	return db_get_utf(NULL, m_szModuleName, name, result);
 }
 
-void CMsnProto::setStringUtf(HCONTACT hContact, const char* name, const char* value)
+void CMsnProto::setStringUtf(MCONTACT hContact, const char* name, const char* value)
 {	db_set_utf(hContact, m_szModuleName, name, value);
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////
 
-TCHAR* CMsnProto::GetContactNameT(HCONTACT hContact)
+TCHAR* CMsnProto::GetContactNameT(MCONTACT hContact)
 {
 	if (hContact)
 		return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR);
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp
index 73a74e0670..f19cbc0dec 100644
--- a/protocols/MSN/src/msn_svcs.cpp
+++ b/protocols/MSN/src/msn_svcs.cpp
@@ -246,7 +246,7 @@ INT_PTR CMsnProto::SendNudge(WPARAM wParam, LPARAM lParam)
 {
 	if (!msnLoggedIn) return 0;
 
-	HCONTACT hContact = (HCONTACT)wParam;
+	MCONTACT hContact = (MCONTACT)wParam;
 
 	char tEmail[MSN_MAX_EMAIL_LEN];
 	if (MSN_IsMeByContact(hContact, tEmail)) return 0;
@@ -380,7 +380,7 @@ INT_PTR CMsnProto::SetCurrentMedia(WPARAM wParam, LPARAM lParam)
 
 int CMsnProto::OnContactDeleted(WPARAM wParam, LPARAM lParam)
 {
-	const HCONTACT hContact = (HCONTACT)wParam;
+	const MCONTACT hContact = (MCONTACT)wParam;
 
 	if (!msnLoggedIn)  //should never happen for MSN contacts
 		return 0;
@@ -424,7 +424,7 @@ int CMsnProto::OnGroupChange(WPARAM wParam,LPARAM lParam)
 {
 	if (!msnLoggedIn || !MyOptions.ManageServer) return 0;
 
-	const HCONTACT hContact = (HCONTACT)wParam;
+	const MCONTACT hContact = (MCONTACT)wParam;
 	const CLISTGROUPCHANGE* grpchg = (CLISTGROUPCHANGE*)lParam;
 
 	if (hContact == NULL)
@@ -458,7 +458,7 @@ int CMsnProto::OnGroupChange(WPARAM wParam,LPARAM lParam)
 
 int CMsnProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam)
 {
-	HCONTACT hContact = (HCONTACT)wParam;
+	MCONTACT hContact = (MCONTACT)wParam;
 	DBCONTACTWRITESETTING* cws = (DBCONTACTWRITESETTING*)lParam;
 
 	if (!msnLoggedIn)
@@ -619,7 +619,7 @@ INT_PTR CMsnProto::GetUnreadEmailCount(WPARAM wParam, LPARAM lParam)
 
 INT_PTR CMsnProto::OnLeaveChat(WPARAM wParam,LPARAM lParam)
 {
-	HCONTACT hContact = (HCONTACT)wParam;
+	MCONTACT hContact = (MCONTACT)wParam;
 	if (isChatRoom(hContact) != 0) {
 		DBVARIANT dbv;
 		if (getTString(hContact, "ChatRoomID", &dbv) == 0) {
diff --git a/protocols/MSN/src/msn_switchboard.cpp b/protocols/MSN/src/msn_switchboard.cpp
index 582ea94452..4ff32a7938 100644
--- a/protocols/MSN/src/msn_switchboard.cpp
+++ b/protocols/MSN/src/msn_switchboard.cpp
@@ -47,7 +47,7 @@ int ThreadData::contactLeft(const char* email)
 	return mJoinedContactsWLID.getCount();
 }
 
-HCONTACT ThreadData::getContactHandle(void)
+MCONTACT ThreadData::getContactHandle(void)
 {
 	return mJoinedContactsWLID.getCount() ? proto->MSN_HContactFromEmail(mJoinedContactsWLID[0]) : NULL;
 }
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp
index 5abc87ed2a..057f694311 100644
--- a/protocols/MSN/src/msn_threads.cpp
+++ b/protocols/MSN/src/msn_threads.cpp
@@ -552,7 +552,7 @@ ThreadData* CMsnProto::MSN_StartSB(const char* wlid, bool& isOffline)
 	ThreadData* thread = MSN_GetThreadByContact(wlid);
 	if (thread == NULL)
 	{
-		HCONTACT hContact = MSN_HContactFromEmail(wlid);
+		MCONTACT hContact = MSN_HContactFromEmail(wlid);
 		WORD wStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
 		if (wStatus != ID_STATUS_OFFLINE)
 		{
@@ -664,7 +664,7 @@ ThreadData::~ThreadData()
 		for (i=0; i<mJoinedContactsWLID.getCount(); ++i)
 		{
 			const char* wlid = mJoinedContactsWLID[i];
-			HCONTACT hContact = proto->MSN_HContactFromEmail(wlid);
+			MCONTACT hContact = proto->MSN_HContactFromEmail(wlid);
 			int temp_status = proto->getWord(hContact, "Status", ID_STATUS_OFFLINE);
 			if (temp_status == ID_STATUS_INVISIBLE && proto->MSN_GetThreadByContact(wlid) == NULL)
 				proto->setWord(hContact, "Status", ID_STATUS_OFFLINE);
diff --git a/protocols/MSN/src/msn_ws.cpp b/protocols/MSN/src/msn_ws.cpp
index 95f0ba5cea..22a4cbc0aa 100644
--- a/protocols/MSN/src/msn_ws.cpp
+++ b/protocols/MSN/src/msn_ws.cpp
@@ -67,7 +67,7 @@ bool ThreadData::isTimeout(void)
 	}
 	else if (mJoinedContactsWLID.getCount() <= 1 || mChatID[0] == 0)
 	{
-		HCONTACT hContact = getContactHandle();
+		MCONTACT hContact = getContactHandle();
 
 		if (mJoinedContactsWLID.getCount() == 0 || termPending)
 			res = true;
@@ -96,7 +96,7 @@ bool ThreadData::isTimeout(void)
 
 		if (proto->getByte("EnableSessionPopup", 0))
 		{
-			HCONTACT hContact = NULL;
+			MCONTACT hContact = NULL;
 			if (mJoinedContactsWLID.getCount())
 				hContact = proto->MSN_HContactFromEmail(mJoinedContactsWLID[0]);
 			else if (mInitialContactWLID)
-- 
cgit v1.2.3