From a0c93d2ab7d8473cdbb62f939d92dbb4613e0780 Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Sun, 6 Jan 2013 11:19:33 +0000
Subject: fix for receiving messages in YAHOO

git-svn-id: http://svn.miranda-ng.org/main/trunk@2991 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 protocols/Yahoo/src/im.cpp | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

(limited to 'protocols/Yahoo/src')

diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp
index 52d21112ae..9f5e94bf9e 100644
--- a/protocols/Yahoo/src/im.cpp
+++ b/protocols/Yahoo/src/im.cpp
@@ -34,9 +34,6 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
 	char 		*umsg;
 	const char	*c = msg;
 	int 		oidx = 0;
-	PROTORECVEVENT 	pre;
-	HANDLE 			hContact = NULL;
-
 
 	LOG(("YAHOO_GOT_IM id:%s %s: %s (len: %d) tm:%lu stat:%i utf8:%i buddy_icon: %i", me, who, msg, lstrlenA(msg), tm, stat, utf8, buddy_icon));
 
@@ -103,19 +100,19 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
 	/* Need to strip off formatting stuff first. Then do all decoding/converting */
 	LOG(("%s: %s", who, umsg));
 
+	HANDLE hContact = add_buddy(who, who, protocol, PALF_TEMPORARY);
 	//SetWord(hContact, "yprotoid", protocol);
 	Set_Protocol(hContact, protocol);
 
+	PROTORECVEVENT pre;
 	pre.flags = (utf8) ? PREF_UTF : 0;
 
 	if (tm) {
 		HANDLE hEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0);
 
 		if (hEvent) { // contact has events
-			DBEVENTINFO dbei;
 			DWORD dummy;
-
-			dbei.cbSize = sizeof (DBEVENTINFO);
+			DBEVENTINFO dbei = { sizeof (dbei) };
 			dbei.pBlob = (BYTE*)&dummy;
 			dbei.cbBlob = 2;
 			if (!CallService(MS_DB_EVENT_GET, (WPARAM)hEvent, (LPARAM)&dbei)) 
@@ -128,8 +125,8 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons
 		if ((DWORD)tm < pre.timestamp)
 			pre.timestamp = tm;
 		
-	} else
-		pre.timestamp = (DWORD)time(NULL);
+	}
+	else pre.timestamp = (DWORD)time(NULL);
 
 	pre.szMessage = umsg;
 	pre.lParam = 0;
-- 
cgit v1.2.3