diff options
| -rw-r--r-- | protocols/MSN/src/msn.cpp | 4 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_auth.cpp | 6 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_chat.cpp | 110 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 25 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_contact.cpp | 17 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_errors.cpp | 9 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_links.cpp | 2 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_lists.cpp | 4 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_menu.cpp | 4 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_mime.cpp | 16 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_opts.cpp | 6 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_skypeab.cpp | 130 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_soapab.cpp | 77 | ||||
| -rw-r--r-- | protocols/MSN/src/msn_svcs.cpp | 4 | ||||
| -rw-r--r-- | protocols/MSN/src/stdafx.h | 2 | 
15 files changed, 174 insertions, 242 deletions
| diff --git a/protocols/MSN/src/msn.cpp b/protocols/MSN/src/msn.cpp index d7e4f56f94..909ed04d9c 100644 --- a/protocols/MSN/src/msn.cpp +++ b/protocols/MSN/src/msn.cpp @@ -25,7 +25,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  #include "version.h"
  CLIST_INTERFACE *pcli;
 -HINSTANCE hInst;
 +HINSTANCE g_hInst;
  int hLangpack;
  /////////////////////////////////////////////////////////////////////////////////////////
 @@ -73,7 +73,7 @@ OBJLIST<CMsnProto> g_Instances(1, sttCompareProtocols);  extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID)
  {
  	if (fdwReason == DLL_PROCESS_ATTACH) {
 -		hInst = hinstDLL;
 +		g_hInst = hinstDLL;
  		DisableThreadLibraryCalls(hinstDLL);
  	}
  	return TRUE;
 diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index e9dde450aa..b8f403a100 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -835,14 +835,14 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam)      wc.cbSize = sizeof(WNDCLASSEX);
      wc.cbWndExtra = sizeof(void*);
 -    wc.hInstance = hInst;
 +    wc.hInstance = g_hInst;
      wc.lpfnWndProc = AuthWindowProc;
      wc.lpszClassName = ClassName;
      RegisterClassEx(&wc);
      if ((hWnd = CreateWindowEx(0, ClassName, _T("MSN Login"), WS_OVERLAPPEDWINDOW,
                                              CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
 -                                            HWND_DESKTOP, NULL, hInst, pParam))) {
 +                                            HWND_DESKTOP, NULL, g_hInst, pParam))) {
  		ShowWindow( hWnd, SW_SHOW );
  		UpdateWindow( hWnd );
 @@ -853,7 +853,7 @@ void __cdecl CMsnProto::msn_IEAuthThread(void *pParam)  		}
  	}
 -	UnregisterClass(ClassName, hInst);
 +	UnregisterClass(ClassName, g_hInst);
  	CoUninitialize();
  }
 diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index e1aa017893..8d7d959364 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -83,12 +83,9 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p  void CMsnProto::MSN_ChatStart(ezxml_t xmli)
  {
 -	const char *pszCreator;
 -	
 -	int j;
 +	if (!mir_strcmp(xmli->txt, "thread"))
 +		return;
 -	if (!mir_strcmp(xmli->txt, "thread")) return;
 -	
  	// If Chat ID already exists, don'T create a new one
  	const char *pszID = ezxml_txt(ezxml_child(xmli, "id"));
  	GCThreadData* info = MSN_GetThreadByChatId(_A2T(pszID));
 @@ -101,20 +98,21 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli)  		MSN_ChatInit(info, pszID, ezxml_txt(ezxml_get(xmli, "properties", 0, "topic", -1)));
  		MSN_StartStopTyping(info, false);
 -	} else  {
 +	}
 +	else {
  		GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_CONTROL };
  		GCEVENT gce = { sizeof(gce), &gcd };
  		CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
  	}
 -	pszCreator = ezxml_txt(ezxml_get(xmli, "properties", 0, "creator", -1));
 +	const char *pszCreator = ezxml_txt(ezxml_get(xmli, "properties", 0, "creator", -1));
  	for (ezxml_t memb = ezxml_get(xmli, "members", 0, "member", -1); memb != NULL; memb = ezxml_next(memb)) {
  		const char *mri = ezxml_txt(ezxml_child(memb, "mri"));
  		const char *role = ezxml_txt(ezxml_child(memb, "role"));
  		GCUserItem *gcu = NULL;
 -		for (j = 0; j < info->mJoinedContacts.getCount(); j++) {
 +		for (int j = 0; j < info->mJoinedContacts.getCount(); j++) {
  			if (!mir_strcmp(info->mJoinedContacts[j]->WLID, mri)) {
  				gcu = info->mJoinedContacts[j];
  				break;
 @@ -136,15 +134,15 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli)  	}
  	// Remove contacts not on list (not tagged)
 -	for (j = 0; j < info->mJoinedContacts.getCount(); j++) {
 +	for (int j = 0; j < info->mJoinedContacts.getCount(); j++) {
  		if (!info->mJoinedContacts[j]->btag) {
  			info->mJoinedContacts.remove(j);
  			j--;
 -		} else info->mJoinedContacts[j]->btag = 0;
 +		}
 +		else info->mJoinedContacts[j]->btag = 0;
  	}
  }
 -
  void CMsnProto::MSN_KillChatSession(const TCHAR* id)
  {
  	GCDEST gcd = { m_szModuleName, id, GC_EVENT_CONTROL };
 @@ -156,7 +154,7 @@ void CMsnProto::MSN_KillChatSession(const TCHAR* id)  void CMsnProto::MSN_Kickuser(GCHOOK *gch)
  {
 -	GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
 +	GCThreadData *thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
  	msnNsThread->sendPacketPayload("DEL", "MSGR\\THREAD", 
  		"<thread><id>%d:%s</id><members><member><mri>%s</mri></member></members></thread>",
  		thread->netId, thread->szEmail, _T2A(gch->ptszUID));
 @@ -164,7 +162,7 @@ void CMsnProto::MSN_Kickuser(GCHOOK *gch)  void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole)
  {
 -	GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
 +	GCThreadData *thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
  	msnNsThread->sendPacketPayload("PUT", "MSGR\\THREAD", 
  		"<thread><id>%d:%s</id><members><member><mri>%s</mri><role>%s</role></member></members></thread>",
  		thread->netId, thread->szEmail, _T2A(gch->ptszUID), pszRole);
 @@ -172,13 +170,11 @@ void CMsnProto::MSN_Promoteuser(GCHOOK *gch, const char *pszRole)  const TCHAR *CMsnProto::MSN_GCGetRole(GCThreadData* thread, const char *pszWLID) 
  {
 -	if (thread) {
 -		for (int j = 0; j < thread->mJoinedContacts.getCount(); j++) {
 -			if (!mir_strcmp(thread->mJoinedContacts[j]->WLID, pszWLID)) {
 +	if (thread)
 +		for (int j = 0; j < thread->mJoinedContacts.getCount(); j++)
 +			if (!mir_strcmp(thread->mJoinedContacts[j]->WLID, pszWLID))
  				return thread->mJoinedContacts[j]->role;
 -			}
 -		}
 -	}
 +
  	return NULL;
  }
 @@ -231,8 +227,7 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID)  			const char *pszTarget = NULL;
  			while (target) {
 -				switch (gcd.iType)
 -				{
 +				switch (gcd.iType) {
  				case GC_EVENT_JOIN:
  					gce.ptszStatus = MSN_GCGetRole(MSN_GetThreadByChatId(mChatID), target->txt);
  					// ..fall through.. //
 @@ -242,22 +237,22 @@ void CMsnProto::MSN_GCProcessThreadActivity(ezxml_t xmli, const TCHAR *mChatID)  					break;
  				case GC_EVENT_ADDSTATUS:
  				case GC_EVENT_REMOVESTATUS:
 -					gcd.iType = mir_strcmp(ezxml_txt(ezxml_child(target, "role")), "admin")==0?GC_EVENT_ADDSTATUS:GC_EVENT_REMOVESTATUS;
 +					gcd.iType = mir_strcmp(ezxml_txt(ezxml_child(target, "role")), "admin") == 0 ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS;
  					pszTarget = ezxml_txt(ezxml_child(target, "id"));
  					break;
  				}
 -				char* szEmail, *szNet;
 +				char *szEmail, *szNet;
  				parseWLID(NEWSTR_ALLOCA(pszTarget), &szNet, &szEmail, NULL);
  				gce.bIsMe = !mir_strcmpi(szEmail, GetMyUsername(atoi(szNet)));
  				gce.ptszUID = mir_a2t(pszTarget);
  				MCONTACT hContTarget = MSN_HContactFromEmail(pszTarget);
 -				gce.ptszNick =GetContactNameT(hContTarget);
 +				gce.ptszNick = GetContactNameT(hContTarget);
  				CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
  				mir_free((TCHAR*)gce.ptszUID);
  				if ((gcd.iType == GC_EVENT_PART || gcd.iType == GC_EVENT_KICK) && gce.bIsMe) {
 -					GCDEST gcd = { m_szModuleName, mChatID, GC_EVENT_CONTROL };
 -					GCEVENT gce = { sizeof(gce), &gcd };
 -					CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
 +					GCDEST gcd2 = { m_szModuleName, mChatID, GC_EVENT_CONTROL };
 +					GCEVENT gce2 = { sizeof(gce2), &gcd2 };
 +					CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce2);
  					break;
  				}
  				target = ezxml_next(target);
 @@ -272,9 +267,8 @@ void CMsnProto::MSN_GCRefreshThreadsInfo(void)  	MCONTACT hContact;
  	int nThreads = 0;
 -	for (hContact = db_find_first(m_szModuleName); hContact; 
 -			hContact = db_find_next(hContact, m_szModuleName)) 
 -	{
 +	for (hContact = db_find_first(m_szModuleName); hContact;
 +	hContact = db_find_next(hContact, m_szModuleName)) {
  		if (isChatRoom(hContact) != 0) {
  			DBVARIANT dbv;
  			if (getString(hContact, "ChatRoomID", &dbv) == 0) {
 @@ -307,7 +301,7 @@ void CMsnProto::MSN_GCAddMessage(TCHAR *mChatID, MCONTACT hContact, char *email,  	mir_free((void*)gce.ptszText);
  }
 -
 +/////////////////////////////////////////////////////////////////////////////////////////
  static void ChatInviteUser(ThreadData *thread, GCThreadData* info, const char* wlid)
  {
 @@ -317,8 +311,8 @@ static void ChatInviteUser(ThreadData *thread, GCThreadData* info, const char* w  				return;
  		}
  	}
 -	thread->sendPacketPayload("PUT", "MSGR\\THREAD", 
 -		"<thread><id>%d:%s</id><members><member><mri>%s</mri><role>user</role></member></members></thread>", 
 +	thread->sendPacketPayload("PUT", "MSGR\\THREAD",
 +		"<thread><id>%d:%s</id><members><member><mri>%s</mri><role>user</role></member></members></thread>",
  		info->netId, info->szEmail, wlid);
  }
 @@ -356,7 +350,6 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto  	}
  }
 -
  static void ChatValidateContact(MCONTACT hItem, HWND hwndList, CMsnProto* ppro)
  {
  	if (!ppro->MSN_IsMyContact(hItem) || ppro->isChatRoom(hItem) || ppro->MSN_IsMeByContact(hItem))
 @@ -393,8 +386,6 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
  		param = (InviteChatParam*)lParam;
 -
 -		//		WindowSetIcon(hwndDlg, "msn");
  		break;
  	case WM_CLOSE:
 @@ -402,7 +393,6 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l  		break;
  	case WM_NCDESTROY:
 -		//		WindowFreeIcon(hwndDlg);
  		delete param;
  		break;
 @@ -500,7 +490,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)  			GCThreadData* thread = MSN_GetThreadByChatId(gch->pDest->ptszID);
  			if (thread != NULL) {
  				m_arGCThreads.remove(thread);
 -				for (int i=0; i < thread->mJoinedContacts.getCount(); i++)
 +				for (int i = 0; i < thread->mJoinedContacts.getCount(); i++)
  					delete thread->mJoinedContacts[i];
  				delete thread;
  			}
 @@ -536,23 +526,23 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)  		break;
  	case GC_USER_CHANMGR:
 -		DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
 +		DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
  			LPARAM(new InviteChatParam(gch->pDest->ptszID, NULL, this)));
  		break;
  	case GC_USER_PRIVMESS:
 -	{
 -		char *email = mir_t2a(gch->ptszUID);
 -		MCONTACT hContact = MSN_HContactFromEmail(email);
 -		CallService(MS_MSG_SENDMESSAGE, hContact, 0);
 -		mir_free(email);
 +		{
 +			char *email = mir_t2a(gch->ptszUID);
 +			MCONTACT hContact = MSN_HContactFromEmail(email);
 +			CallService(MS_MSG_SENDMESSAGE, hContact, 0);
 +			mir_free(email);
 +		}
  		break;
 -	}
  	case GC_USER_LOGMENU:
  		switch (gch->dwData) {
  		case 10:
 -			DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
 +			DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
  				LPARAM(new InviteChatParam(gch->pDest->ptszID, NULL, this)));
  			break;
 @@ -578,31 +568,16 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam)  			MSN_Kickuser(gch);
  			break;
 -		case 40:
 -			{
 -				const TCHAR *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID));
 -				MSN_Promoteuser(gch, (pszRole && !mir_tstrcmp(pszRole, _T("admin")))?"user":"admin");
 -				break;
 -			}
  		case 110:
  			MSN_KillChatSession(gch->pDest->ptszID);
  			break;
 -		}
 -		break;
 -	/*	haven't implemented in chat.dll
 -			case GC_USER_TYPNOTIFY:
 -			{
 -			int chatID = atoi(p);
 -			ThreadData* thread = MSN_GetThreadByContact((HANDLE)-chatID);
 -			for (int j=0; j < thread->mJoinedCount; j++)
 -			{
 -			if ((long)thread->mJoinedContacts[j] > 0)
 -			CallService(MS_PROTO_SELFISTYPING, (WPARAM) thread->mJoinedContacts[j], (LPARAM) PROTOTYPE_SELFTYPING_ON);
 -			}
 +		case 40:
 +			const TCHAR *pszRole = MSN_GCGetRole(MSN_GetThreadByChatId(gch->pDest->ptszID), _T2A(gch->ptszUID));
 +			MSN_Promoteuser(gch, (pszRole && !mir_tstrcmp(pszRole, _T("admin"))) ? "user" : "admin");
  			break;
 -			}
 -			*/
 +		}
 +		break;
  	}
  	return 0;
 @@ -648,7 +623,8 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)  			if (thread && thread->mMe && mir_tstrcmpi(thread->mMe->role, _T("admin"))) {
  				Items[2].bDisabled = TRUE;
  				Items[3].bDisabled = TRUE;
 -			} else {
 +			}
 +			else {
  				const TCHAR *pszRole = MSN_GCGetRole(thread, email);
  				if (pszRole && !mir_tstrcmpi(pszRole, _T("admin")))
  					Items[3].pszDesc = LPGENT("&Deop user");
 diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 82532bd346..6bb8167167 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -133,19 +133,18 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para  	memcpy(msg, msgb, msgBytes);
  	msg[msgBytes] = 0;
 -	debugLogA("Message:\n%s", msg);
 +	debugLogA("Message:\n%s", msg);					                                                            
  	MimeHeaders tHeader;
  	char* msgBody = tHeader.readFromBuffer(msg);
  	if (sdgMsg) {
  		if (tHeader["Ack-Id"]) {
 -			CMStringA buf;
 -
 -			buf.AppendFormat("Ack-Id: %s\r\n", tHeader["Ack-Id"]);
 -			if (msnRegistration) buf.AppendFormat("Registration: %s\r\n", msnRegistration);
 -			buf.AppendFormat("\r\n");
 -			msnNsThread->sendPacket("ACK", "MSGR %d\r\n%s", mir_strlen(buf), buf);
 +			CMStringA szBody;
 +			szBody.AppendFormat("Ack-Id: %s\r\n", tHeader["Ack-Id"]);
 +			if (msnRegistration) szBody.AppendFormat("Registration: %s\r\n", msnRegistration);
 +			szBody.AppendFormat("\r\n");
 +			msnNsThread->sendPacket("ACK", "MSGR %d\r\n%s", mir_strlen(szBody), szBody);
  		}
  		msgBody = tHeader.readFromBuffer(msgBody);
  		if (!(email = NEWSTR_ALLOCA(tHeader["From"]))) return;
 @@ -1160,7 +1159,7 @@ LBL_InvalidCommand:  									ProtoChainRecvMsg(hContact, &pre);
  								}
  								else {
 -									DBEVENTINFO dbei = { 0 };
 +									memset(&dbei, 0, sizeof(dbei));
  									dbei.cbSize = sizeof(dbei);
  									dbei.eventType = EVENTTYPE_MESSAGE;
  									dbei.flags = DBEF_SENT | DBEF_UTF;
 @@ -1251,14 +1250,12 @@ LBL_InvalidCommand:  			}
  			else if (!mir_strcmp(data.typeId, "MSGR\\THREAD")) {
  				MimeHeaders tHeader;
 -				char *msgBody = tHeader.readFromBuffer(info->mData);
 -				ezxml_t xmli;
 -
 -				if (xmli = ezxml_parse_str(msgBody, mir_strlen(msgBody)))
 -				{
 +				char *szBody = tHeader.readFromBuffer(info->mData);
 +				ezxml_t xmli = ezxml_parse_str(szBody, mir_strlen(szBody));
 +				if (xmli) {
  					MSN_ChatStart(xmli);
  					ezxml_free(xmli);
 -				}				
 +				}
  			}
  		}
  		break;
 diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index 3c875990b7..258a003852 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -172,13 +172,14 @@ bool CMsnProto::MSN_AddUser(MCONTACT hContact, const char* email, int netId, int  				}
  				char id[MSN_GUID_LEN];
 -				if (!db_get_static(hContact, m_szModuleName, "ID", id, sizeof(id))) {
 -					int netId = Lists_GetNetId(email);
 +				if (!db_get_static(hContact, m_szModuleName, "ID", id, _countof(id))) {
 +					int netId2 = Lists_GetNetId(email);
  					if (leaveHotmail)
 -						res = MSN_ABAddRemoveContact(id, netId, false);
 +						res = MSN_ABAddRemoveContact(id, netId2, false);
  					else
  						res = MSN_ABAddDelContactGroup(id, NULL, "ABContactDelete");
 -					if (res) AddDelUserContList(email, flags, netId, true);
 +					if (res)
 +						AddDelUserContList(email, flags, netId2, true);
  					delSetting(hContact, "GroupID");
  					delSetting(hContact, "ID");
 @@ -206,10 +207,10 @@ bool CMsnProto::MSN_AddUser(MCONTACT hContact, const char* email, int netId, int  				else res = (res1 == 0);
  				if (res) {
 -					DBVARIANT dbv;
 -					if (!db_get_utf(hContact, "CList", "Group", &dbv)) {
 -						MSN_MoveContactToGroup(hContact, dbv.pszVal);
 -						db_free(&dbv);
 +					DBVARIANT dbv2;
 +					if (!db_get_utf(hContact, "CList", "Group", &dbv2)) {
 +						MSN_MoveContactToGroup(hContact, dbv2.pszVal);
 +						db_free(&dbv2);
  					}
  					char szContactID[100];
 diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp index 2f1e321c0f..6d6f31f8bc 100644 --- a/protocols/MSN/src/msn_errors.cpp +++ b/protocols/MSN/src/msn_errors.cpp @@ -58,9 +58,6 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString)  	}
  	HReadBuffer buf(info, 0);
 -//	char* msgBody = (char*)buf.surelyRead(atol(data.strMsgBytes));
 -
 -
  	debugLogA("Server error:%s", cmdString);
  	switch (errorCode) {
 @@ -90,9 +87,9 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString)  	case ERR_DETAILED_ERR_IN_PAYLOAD:
  	case ERR_LIST_UNAVAILABLE:
 -		char* tWords[4];
 -		if (sttDivideWords(cmdString, _countof(tWords), tWords) == _countof(tWords))
 -			HReadBuffer(info, 0).surelyRead(atol(tWords[3]));
 +		char* tErrWords[4];
 +		if (sttDivideWords(cmdString, _countof(tErrWords), tErrWords) == _countof(tErrWords))
 +			HReadBuffer(info, 0).surelyRead(atol(tErrWords[3]));
  		return 0;
  	case ERR_NOT_ONLINE:
 diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp index ad6489416d..5df0bee167 100644 --- a/protocols/MSN/src/msn_links.cpp +++ b/protocols/MSN/src/msn_links.cpp @@ -147,7 +147,7 @@ void MsnLinks_Init(void)  	static const char szService[] = "MSN/ParseMsnimLink";
  	hServiceParseLink = CreateServiceFunction(szService, ServiceParseMsnimLink);
 -	AssocMgr_AddNewUrlTypeT("msnim:", TranslateT("MSN Link Protocol"), hInst, IDI_MSN, szService, 0);
 +	AssocMgr_AddNewUrlTypeT("msnim:", TranslateT("MSN Link Protocol"), g_hInst, IDI_MSN, szService, 0);
  }
  void MsnLinks_Destroy(void)
 diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index 227f6ff9db..d6881c3dbd 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -363,7 +363,7 @@ static void AddPrivacyListEntries(HWND hwndList, CMsnProto *proto)  		MsnContact &cont = proto->m_arContacts[i];
  		if (!(cont.list & (LIST_FL | LIST_LL))) {
  			cii.pszText = (TCHAR*)cont.email;
 -			HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_ADDINFOITEMA, 0, (LPARAM)&cii);
 +			hItem = (HANDLE)SendMessage(hwndList, CLM_ADDINFOITEMA, 0, (LPARAM)&cii);
  			SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, (cont.list & LIST_LL) ? 1 : 0));
  			SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(1, (cont.list & LIST_FL) ? 2 : 0));
 @@ -424,7 +424,7 @@ static void SaveListItem(MCONTACT hContact, const char* szEmail, int list, int i  	if (iNewValue == 0) {
  		if (list & LIST_FL) {
  			DeleteParam param = { proto, hContact };
 -			DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), NULL, DlgDeleteContactUI, (LPARAM)¶m);
 +			DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), NULL, DlgDeleteContactUI, (LPARAM)¶m);
  			return;
  		}
 diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 43b52d153b..e199fab8da 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -112,7 +112,7 @@ INT_PTR CMsnProto::MsnEditProfile(WPARAM, LPARAM)  INT_PTR CMsnProto::MsnInviteCommand(WPARAM, LPARAM)
  {
 -	DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
 +	DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat,
  		LPARAM(new InviteChatParam(NULL, NULL, this)));
  	return 0;
  }
 @@ -253,7 +253,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam  INT_PTR CMsnProto::SetNicknameUI(WPARAM, LPARAM)
  {
 -	HWND hwndSetNickname = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETNICKNAME),
 +	HWND hwndSetNickname = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SETNICKNAME),
  		NULL, DlgProcSetNickname, (LPARAM)this);
  	SetForegroundWindow(hwndSetNickname);
 diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp index 7be06009a9..32428ca53b 100644 --- a/protocols/MSN/src/msn_mime.cpp +++ b/protocols/MSN/src/msn_mime.cpp @@ -432,12 +432,8 @@ wchar_t* MimeHeaders::decode(const char* val)  		switch (*enc) {
  		case 'b':
  		case 'B':
 -		{
 -			char* dec = (char*)mir_base64_decode(fld, 0);
 -			mir_strcpy(fld, dec);
 -			mir_free(dec);
 +			mir_strcpy(fld, ptrA((char*)mir_base64_decode(fld, 0)));
  			break;
 -		}
  		case 'q':
  		case 'Q':
 @@ -445,21 +441,19 @@ wchar_t* MimeHeaders::decode(const char* val)  			break;
  		}
 -		if (_stricmp(cp, "UTF-8") == 0) {
 +		if (_stricmp(cp, "UTF-8") == 0)
  			sz = utf8toutf16(fld, resp);
 -			ssz -= sz; resp += sz;
 -		}
  		else {
 -			int sz = MultiByteToWideChar(FindCP(cp), 0, fld, -1, resp, (int)ssz);
 +			sz = MultiByteToWideChar(FindCP(cp), 0, fld, -1, resp, (int)ssz);
  			if (sz == 0)
  				sz = MultiByteToWideChar(CP_ACP, 0, fld, -1, resp, (int)ssz);
 -			ssz -= --sz; resp += sz;
 +			sz--;
  		}
 +		ssz -= sz; resp += sz;
  		p = pe + 2;
  	}
  	utf8toutf16(p, resp);
 -
  	return res;
  }
 diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 0d40a98100..6b267e22cf 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -47,7 +47,7 @@ static IconItem iconList[] =  void MsnInitIcons(void)
  {
 -	Icon_Register(hInst, "Protocols/MSN", iconList, _countof(iconList), "MSN");
 +	Icon_Register(g_hInst, "Protocols/MSN", iconList, _countof(iconList), "MSN");
  }
  HICON LoadIconEx(const char* name, bool big)
 @@ -625,7 +625,7 @@ int CMsnProto::OnOptionsInit(WPARAM wParam, LPARAM)  {
  	OPTIONSDIALOGPAGE odp = { 0 };
  	odp.position = -790000000;
 -	odp.hInstance = hInst;
 +	odp.hInstance = g_hInst;
  	odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MSN);
  	odp.ptszTitle = m_tszUserName;
  	odp.ptszGroup = LPGENT("Network");
 @@ -655,7 +655,7 @@ int CMsnProto::OnOptionsInit(WPARAM wParam, LPARAM)  INT_PTR CMsnProto::SvcCreateAccMgrUI(WPARAM, LPARAM lParam)
  {
 -	return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ACCMGRUI),
 +	return (INT_PTR)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ACCMGRUI),
  		(HWND)lParam, DlgProcAccMgrUI, (LPARAM)this);
  }
 diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index 22821e0de8..8f86261877 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -70,15 +70,14 @@ bool CMsnProto::MSN_SKYABRefreshClist(void)  	mHttpsTS = clock();
  	NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
  	mHttpsTS = clock();
 -	if (nlhrReply)  {
 +	if (nlhrReply) {
  		hHttpsConnection = nlhrReply->nlc;
  		if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
  			JSONROOT root(nlhrReply->pData);
  			if (root == NULL) return false;
  			JSONNode *items = json_as_array(root), *item;
 -			for (size_t i = 0; i < json_size(items); i++)
 -			{
 +			for (size_t i = 0; i < json_size(items); i++) {
  				int lstId = LIST_FL;
  				ptrT nick;
 @@ -91,8 +90,7 @@ bool CMsnProto::MSN_SKYABRefreshClist(void)  				char szWLId[128];
  				mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
  				MCONTACT hContact = MSN_HContactFromEmail(szWLId, pszNick, true, false);
 -				if (hContact)
 -				{
 +				if (hContact) {
  					if (!json_as_bool(json_get(item, "authorized"))) lstId = LIST_PL;
  					if (!json_as_bool(json_get(item, "blocked"))) lstId = LIST_BL;
  					Lists_Add(lstId, NETID_SKYPE, skypename, NULL, pszNick, NULL);
 @@ -104,7 +102,8 @@ bool CMsnProto::MSN_SKYABRefreshClist(void)  			MSN_SKYABGetProfiles((const char*)post);
  		}
  		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
 -	} else hHttpsConnection = NULL;
 +	}
 +	else hHttpsConnection = NULL;
  	return bRet;
  }
 @@ -125,15 +124,14 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST)  	mHttpsTS = clock();
  	NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
  	mHttpsTS = clock();
 -	if (nlhrReply)  {
 +	if (nlhrReply) {
  		hHttpsConnection = nlhrReply->nlc;
  		if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
  			JSONROOT root(nlhrReply->pData);
  			if (root == NULL) return false;
  			JSONNode *items = json_as_array(root), *item, *node;
 -			for (size_t i = 0; i < json_size(items); i++)
 -			{
 +			for (size_t i = 0; i < json_size(items); i++) {
  				item = json_at(items, i);
  				if (item == NULL)
  					break;
 @@ -145,21 +143,21 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST)  				mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
  				MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false);
 -				if (hContact)
 -				{
 -					if (value=get_json_str(item, "firstname")) setTString(hContact, "FirstName", value);
 -					if (value=get_json_str(item, "lastname")) setTString(hContact, "LastName", value);
 -					if (value=get_json_str(item, "displayname")) setTString(hContact, "Nick", value);
 -					if (value=get_json_str(item, "country")) setString(hContact, "Country", (char*)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)(char*)_T2A(value), 0));
 -					if (value=get_json_str(item, "city")) setTString(hContact, "City", value);
 -					if (value=get_json_str(item, "mood")) db_set_ts(hContact, "CList", "StatusMsg", value);
 +				if (hContact) {
 +					if (value = get_json_str(item, "firstname")) setTString(hContact, "FirstName", value);
 +					if (value = get_json_str(item, "lastname")) setTString(hContact, "LastName", value);
 +					if (value = get_json_str(item, "displayname")) setTString(hContact, "Nick", value);
 +					if (value = get_json_str(item, "country")) setString(hContact, "Country", (char*)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)(char*)_T2A(value), 0));
 +					if (value = get_json_str(item, "city")) setTString(hContact, "City", value);
 +					if (value = get_json_str(item, "mood")) db_set_ts(hContact, "CList", "StatusMsg", value);
  				}
  			}
  			json_delete(items);
  			bRet = true;
  		}
  		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
 -	} else hHttpsConnection = NULL;
 +	}
 +	else hHttpsConnection = NULL;
  	return bRet;
  }
 @@ -179,12 +177,12 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid)  	mHttpsTS = clock();
  	NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
  	mHttpsTS = clock();
 -	if (nlhrReply)  {
 +	if (nlhrReply) {
  		hHttpsConnection = nlhrReply->nlc;
  		if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
  			JSONROOT item(nlhrReply->pData);
 -			JSONNode *node;
 -			if (item == NULL) return false;
 +			if (item == NULL)
 +				return false;
  			ptrA skypename(mir_t2a(ptrT(json_as_string(json_get(item, "username")))));
  			ptrT value;
 @@ -192,45 +190,46 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid)  			mir_snprintf(szWLId, sizeof(szWLId), "%d:%s", NETID_SKYPE, skypename);
  			MCONTACT hContact = MSN_HContactFromEmail(szWLId, skypename, false, false);
 -			if (hContact)
 -			{
 -				if (value=get_json_str(item, "firstname")) setTString(hContact, "FirstName", value);
 -				if (value=get_json_str(item, "lastname")) setTString(hContact, "LastName", value);
 -				if (value=get_json_str(item, "displayname")) setTString(hContact, "Nick", value);
 -				if (value=get_json_str(item, "gender")) setByte(hContact, "Gender", (BYTE)(_ttoi(value) == 1 ? 'M' : 'F'));
 -				if (value=get_json_str(item, "birthday")) {
 +			if (hContact) {
 +				if (value = get_json_str(item, "firstname")) setTString(hContact, "FirstName", value);
 +				if (value = get_json_str(item, "lastname")) setTString(hContact, "LastName", value);
 +				if (value = get_json_str(item, "displayname")) setTString(hContact, "Nick", value);
 +				if (value = get_json_str(item, "gender")) setByte(hContact, "Gender", (BYTE)(_ttoi(value) == 1 ? 'M' : 'F'));
 +				if (value = get_json_str(item, "birthday")) {
  					int d, m, y;
  					_stscanf(value, _T("%d-%d-%d"), &y, &m, &d);
  					setWord(hContact, "BirthYear", y);
  					setByte(hContact, "BirthDay", d);
  					setByte(hContact, "BirthMonth", m);
  				}
 -				if (value=get_json_str(item, "country")) setString(hContact, "Country", (char*)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)(char*)_T2A(value), 0));
 -				if (value=get_json_str(item, "province")) setTString(hContact, "State", value);
 -				if (value=get_json_str(item, "city")) setTString(hContact, "City", value);
 -				if (value=get_json_str(item, "homepage")) setTString(hContact, "Homepage", value);
 -				if (value=get_json_str(item, "about")) setTString(hContact, "About", value);
 -				if ((node = json_get(item, "emails")) && !json_empty(node))
 -				{
 -					JSONNode *items = json_as_array(node), *item;
 -					char szName[16];
 -					for (size_t i = 0; i < min(json_size(items), 3); i++)
 -					{
 -						if (!(item = json_at(items, i))) break;
 -						sprintf(szName, "e-mail%d", i);
 -						setTString(hContact, szName, ptrT(json_as_string(item)));
 +				if (value = get_json_str(item, "country")) setString(hContact, "Country", (char*)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)(char*)_T2A(value), 0));
 +				if (value = get_json_str(item, "province")) setTString(hContact, "State", value);
 +				if (value = get_json_str(item, "city")) setTString(hContact, "City", value);
 +				if (value = get_json_str(item, "homepage")) setTString(hContact, "Homepage", value);
 +				if (value = get_json_str(item, "about")) setTString(hContact, "About", value);
 +
 +				JSONNode *node = json_get(item, "emails");
 +				if (node && !node->empty()) {
 +					int num = 0;
 +					for (auto it = node->begin(); it != node->end(); ++it, ++num) {
 +						if (num == 3)
 +							break;
 +
 +						char szName[16];
 +						sprintf(szName, "e-mail%d", num);
 +						setStringUtf(hContact, szName, (*it).as_string().c_str());
  					}
 -					json_delete(items);
  				}
 -				if (value=get_json_str(item, "phoneMobile")) setTString(hContact, "Cellular", value);
 -				if (value=get_json_str(item, "phone")) setTString(hContact, "Phone", value);
 -				if (value=get_json_str(item, "phoneOffice")) setTString(hContact, "CompanyPhone", value);
 -				if (value=get_json_str(item, "mood")) db_set_ts(hContact, "CList", "StatusMsg", value);
 +				if (value = get_json_str(item, "phoneMobile")) setTString(hContact, "Cellular", value);
 +				if (value = get_json_str(item, "phone")) setTString(hContact, "Phone", value);
 +				if (value = get_json_str(item, "phoneOffice")) setTString(hContact, "CompanyPhone", value);
 +				if (value = get_json_str(item, "mood")) db_set_ts(hContact, "CList", "StatusMsg", value);
  			}
  			bRet = true;
  		}
  		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
 -	} else hHttpsConnection = NULL;
 +	}
 +	else hHttpsConnection = NULL;
  	return bRet;
  }
 @@ -256,11 +255,12 @@ bool CMsnProto::MSN_SKYABBlockContact(const char *wlid, const char *pszAction)  	mHttpsTS = clock();
  	NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
  	mHttpsTS = clock();
 -	if (nlhrReply)  {
 +	if (nlhrReply) {
  		hHttpsConnection = nlhrReply->nlc;
  		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
  		bRet = true;
 -	} else hHttpsConnection = NULL;
 +	}
 +	else hHttpsConnection = NULL;
  	return bRet;
  }
 @@ -283,11 +283,12 @@ bool CMsnProto::MSN_SKYABDeleteContact(const char *wlid)  	mHttpsTS = clock();
  	NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
  	mHttpsTS = clock();
 -	if (nlhrReply)  {
 +	if (nlhrReply) {
  		hHttpsConnection = nlhrReply->nlc;
  		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
  		bRet = true;
 -	} else hHttpsConnection = NULL;
 +	}
 +	else hHttpsConnection = NULL;
  	return bRet;
  }
 @@ -308,11 +309,12 @@ bool CMsnProto::MSN_SKYABAuthRsp(const char *wlid, const char *pszAction)  	mHttpsTS = clock();
  	NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
  	mHttpsTS = clock();
 -	if (nlhrReply)  {
 +	if (nlhrReply) {
  		hHttpsConnection = nlhrReply->nlc;
  		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
  		bRet = true;
 -	} else hHttpsConnection = NULL;
 +	}
 +	else hHttpsConnection = NULL;
  	return bRet;
  }
 @@ -339,11 +341,12 @@ bool CMsnProto::MSN_SKYABAuthRq(const char *wlid, const char *pszGreeting)  	mHttpsTS = clock();
  	NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
  	mHttpsTS = clock();
 -	if (nlhrReply)  {
 +	if (nlhrReply) {
  		hHttpsConnection = nlhrReply->nlc;
  		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
  		bRet = true;
 -	} else hHttpsConnection = NULL;
 +	}
 +	else hHttpsConnection = NULL;
  	return bRet;
  }
 @@ -369,19 +372,17 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch)  	mHttpsTS = clock();
  	NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
  	mHttpsTS = clock();
 -	if (nlhrReply)  {
 +	if (nlhrReply) {
  		hHttpsConnection = nlhrReply->nlc;
  		if (nlhrReply->resultCode == 200 && nlhrReply->pData) {
  			JSONROOT root(nlhrReply->pData);
 -			if (root == NULL)
 -			{
 +			if (root == NULL) {
  				ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, hSearch, 0);
  				return false;
  			}
  			JSONNode *items = json_as_array(root);
 -			for (size_t i = 0; i < json_size(items); i++)
 -			{
 +			for (size_t i = 0; i < json_size(items); i++) {
  				JSONNode *item = json_at(items, i);
  				JSONNode *ContactCards = json_get(item, "ContactCards");
  				JSONNode *Skype = json_get(ContactCards, "Skype");
 @@ -400,7 +401,8 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch)  			bRet = true;
  		}
  		CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
 -	} else hHttpsConnection = NULL;
 +	}
 +	else hHttpsConnection = NULL;
  	return bRet;
  }
 @@ -432,6 +434,4 @@ public:  	}
  };
 -
 -
 -*/
\ No newline at end of file +*/
 diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index 85395980f5..c9404004f9 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -59,10 +59,8 @@ ezxml_t CMsnProto::abSoapHdr(const char* service, const char* scenario, ezxml_t&  	tbdy = ezxml_add_child(bdy, service, 0);
  	ezxml_set_attr(tbdy, "xmlns", "http://www.msn.com/webservices/AddressBook");
 -	if (strstr(service, "Member") == NULL && mir_strcmp(service, "ABAdd") != 0 && mir_strcmp(service, "ABFindContactsPaged")) {
 -		ezxml_t node = ezxml_add_child(tbdy, "abId", 0);
 -		ezxml_set_txt(node, "00000000-0000-0000-0000-000000000000");
 -	}
 +	if (!strstr(service, "Member") && mir_strcmp(service, "ABAdd") && mir_strcmp(service, "ABFindContactsPaged"))
 +		ezxml_set_txt(ezxml_add_child(tbdy, "abId", 0), "00000000-0000-0000-0000-000000000000");
  	size_t hdrsz = mir_strlen(service) + sizeof(abReqHdr) + 20;
  	httphdr = (char*)mir_alloc(hdrsz);
 @@ -189,27 +187,10 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse)  	ezxml_t tps = ezxml_add_child(svcflt, "Types", 0);
  	ezxml_t node = ezxml_add_child(tps, "ServiceType", 0);
  	ezxml_set_txt(node, "Messenger");
 -	/*
 -		node = ezxml_add_child(tps, "ServiceType", 0);
 -		ezxml_set_txt(node, "Invitation");
 -		node = ezxml_add_child(tps, "ServiceType", 0);
 -		ezxml_set_txt(node, "SocialNetwork");
 -		node = ezxml_add_child(tps, "ServiceType", 0);
 -		ezxml_set_txt(node, "Space");
 -		node = ezxml_add_child(tps, "ServiceType", 0);
 -		ezxml_set_txt(node, "Profile");
 -		node = ezxml_add_child(tps, "ServiceType", 0);
 -		ezxml_set_txt(node, "Folder");
 -		node = ezxml_add_child(tps, "ServiceType", 0);
 -		ezxml_set_txt(node, "OfficeLiveWebNotification");
 -		*/
 -	const char *szLastChange = NULL;
 +
 +	ptrA szLastChange;
  	if (deltas) {
 -		DBVARIANT dbv;
 -		if (!getString("SharingLastChange", &dbv) && dbv.pszVal[0]) {
 -			szLastChange = NEWSTR_ALLOCA(dbv.pszVal);
 -			db_free(&dbv);
 -		}
 +		szLastChange = getStringA("SharingLastChange");
  		deltas &= (szLastChange != NULL);
  	}
 @@ -253,9 +234,9 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse)  				svcs = ezxml_next(svcs);
  			}
 -			const char* szLastChange = ezxml_txt(ezxml_child(svcs, "LastChange"));
 -			if (szLastChange[0])
 -				setString("SharingLastChange", szLastChange);
 +			const char* pszLastChange = ezxml_txt(ezxml_child(svcs, "LastChange"));
 +			if (pszLastChange[0])
 +				setString("SharingLastChange", pszLastChange);
  			for (ezxml_t mems = ezxml_get(svcs, "Memberships", 0, "Membership", -1); mems != NULL; mems = ezxml_next(mems)) {
  				const char* szRole = ezxml_txt(ezxml_child(mems, "MemberRole"));
 @@ -533,23 +514,12 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas  	ezxml_t tbdy;
  	ezxml_t xmlp = abSoapHdr(szMethod, "Initial", tbdy, reqHdr);
 -
 -	const char *szLastChange = NULL;
 +	ptrA szLastChange, szDynLastChange;
  	if (deltas) {
 -		DBVARIANT dbv;
 -		if (!getString("ABFullLastChange", &dbv) && dbv.pszVal[0]) {
 -			szLastChange = NEWSTR_ALLOCA(dbv.pszVal);
 -			db_free(&dbv);
 -		}
 +		szLastChange = getStringA("ABFullLastChange");
  		deltas &= (szLastChange != NULL);
 -	}
 -	const char *szDynLastChange = NULL;
 -	if (deltas) {
 -		DBVARIANT dbv;
 -		if (!getString("ABFullDynLastChange", &dbv) && dbv.pszVal[0]) {
 -			szDynLastChange = NEWSTR_ALLOCA(dbv.pszVal);
 -			db_free(&dbv);
 -		}
 +
 +		szDynLastChange = getStringA("ABFullDynLastChange");
  		deltas &= (szDynLastChange != NULL);
  	}
 @@ -626,12 +596,12 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas  			ezxml_t ab = ezxml_child(body, "Ab");
  			if (mir_strcmp(szMethod, "ABFindByContacts")) {
 -				const char* szLastChange = ezxml_txt(ezxml_child(ab, szLastChangeStr));
 -				if (szLastChange[0])
 -					setString("ABFullLastChange", szLastChange);
 -				szLastChange = ezxml_txt(ezxml_child(ab, "DynamicItemLastChanged"));
 -				if (szLastChange[0])
 -					setString("ABFullDynLastChange", szLastChange);
 +				const char *pszLastChange = ezxml_txt(ezxml_child(ab, szLastChangeStr));
 +				if (pszLastChange[0])
 +					setString("ABFullLastChange", pszLastChange);
 +				pszLastChange = ezxml_txt(ezxml_child(ab, "DynamicItemLastChanged"));
 +				if (pszLastChange[0])
 +					setString("ABFullDynLastChange", pszLastChange);
  			}
  			ezxml_t abinf = ezxml_child(ab, "abInfo");
 @@ -1482,7 +1452,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in  		if (status == 200) {
  			ezxml_t body = getSoapResponse(xmlm, "ABContactAdd");
 -			const char* szContId = ezxml_txt(ezxml_child(body, "guid"));
 +			const char *szContId = ezxml_txt(ezxml_child(body, "guid"));
  			if (search)
  				MSN_ABAddDelContactGroup(szContId, NULL, "ABContactDelete");
 @@ -1494,7 +1464,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in  			status = 0;
  		}
  		else if (status == 500) {
 -			const char* szErr = ezxml_txt(getSoapFault(xmlm, true));
 +			const char *szErr = ezxml_txt(getSoapFault(xmlm, true));
  			if (mir_strcmp(szErr, "InvalidPassportUser") == 0)
  				status = 1;
 @@ -1507,10 +1477,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in  			else if (mir_strcmp(szErr, "ContactAlreadyExists") == 0) {
  				status = 3;
 -				ezxml_t node = getSoapFault(xmlm, false);
 -				node = ezxml_get(node, "detail", 0, "additionalDetails", 0, "conflictObjectId", -1);
 -				const char* szContId = ezxml_txt(node);
 -
 +				const char *szContId = ezxml_txt(ezxml_get(getSoapFault(xmlm, false), "detail", 0, "additionalDetails", 0, "conflictObjectId", -1));
  				if (search) {
  					if (retry) {
  						MSN_ABAddDelContactGroup(szContId, NULL, "ABContactDelete");
 @@ -1538,7 +1505,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in  void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse)
  {
 -	char* reqHdr;
 +	char *reqHdr;
  	ezxml_t tbdy;
  	ezxml_t xmlp = abSoapHdr("UpdateDynamicItem", "RoamingIdentityChanged", tbdy, reqHdr);
 diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 93144442b1..d08aa5bf7b 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -400,7 +400,7 @@ int CMsnProto::OnContactDeleted(WPARAM hContact, LPARAM)  			if (Lists_IsInList(LIST_FL, szEmail)) {
  				DeleteParam param = { this, hContact };
 -				DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), NULL, DlgDeleteContactUI, (LPARAM)¶m);
 +				DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), NULL, DlgDeleteContactUI, (LPARAM)¶m);
  				MsnContact *msc = Lists_Get(szEmail);
  				if (msc)
 @@ -571,7 +571,7 @@ int CMsnProto::OnWindowPopup(WPARAM, LPARAM lParam)  	case MSG_WINDOWPOPUP_SELECTED:
  		if (mwpd->selection == 13465)
 -			DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat, LPARAM(new InviteChatParam(NULL, mwpd->hContact, this)));
 +			DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL, DlgInviteToChat, LPARAM(new InviteChatParam(NULL, mwpd->hContact, this)));
  		break;
  	}
 diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h index 1f34366308..fb1bfcdb5d 100644 --- a/protocols/MSN/src/stdafx.h +++ b/protocols/MSN/src/stdafx.h @@ -882,7 +882,7 @@ const char msnStoreAppId[] = "Skype";  const char msnProductVer[] = "0/6.16.0.105/259/";
  const char msnProtID[] = "MSNP24";
 -extern HINSTANCE hInst;
 +extern HINSTANCE g_hInst;
  extern bool g_bTerminated;
  ///////////////////////////////////////////////////////////////////////////////
 | 
