From af1424f225d57168297e1be919343ff7d8e25d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Fri, 21 Dec 2012 18:31:46 +0000 Subject: Facebook: Fixed Visit Profile git-svn-id: http://svn.miranda-ng.org/main/trunk@2779 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/proto.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'protocols/FacebookRM') diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 2fcc2177ba..657c36c00a 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -480,28 +480,28 @@ int FacebookProto::RefreshBuddyList(WPARAM, LPARAM) int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) -{ - HANDLE hContact = reinterpret_cast(wParam); +{ + HANDLE hContact = reinterpret_cast(wParam); + std::string url = FACEBOOK_URL_PROFILE; DBVARIANT dbv; - if ( wParam != 0 && !DBGetContactSettingString(hContact,m_szModuleName,"Homepage",&dbv)) - { - CallService(MS_UTILS_OPENURL,1,reinterpret_cast(dbv.pszVal)); - DBFreeVariant(&dbv); - } - else if (DBGetContactSettingByte(hContact,m_szModuleName,"ChatRoom",0)) - { - std::string url = FACEBOOK_URL_GROUP; - if (!DBGetContactSettingString(hContact,m_szModuleName,"ChatRoomID",&dbv)) { + + // TODO: why isn't wParam == 0 when is status menu moved to main menu? + if (wParam != 0 && IsMyContact(hContact)) { + if (!DBGetContactSettingString(hContact, m_szModuleName, "Homepage", &dbv)) { + // Homepage link already present, get it + url = dbv.pszVal; + DBFreeVariant(&dbv); + } else if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) { + // No homepage link, create and save it url += dbv.pszVal; + DBWriteContactSettingString(hContact, m_szModuleName, "Homepage", url.c_str()); DBFreeVariant(&dbv); } - CallService(MS_UTILS_OPENURL,1,reinterpret_cast(url.c_str())); - } else { - // TODO: why isn't wParam == 0 when is status menu moved to main menu? - CallService(MS_UTILS_OPENURL,1,reinterpret_cast(FACEBOOK_URL_PROFILE)); } + CallService(MS_UTILS_OPENURL, 1, reinterpret_cast(url.c_str())); + return 0; } -- cgit v1.2.3