summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-03-19 00:12:54 +0000
committerRobert Pösel <robyer@seznam.cz>2014-03-19 00:12:54 +0000
commit887abb55d8fe93f158ce21eb1ecce4375ddabccb (patch)
tree6083645b7711fcb7d43088ceead3ce0cd4d1b54f /protocols/FacebookRM/src
parent4c6d7054a9d545c8d8978b6fe1d1f8a89119f2c7 (diff)
Facebook: Implemented function to manually refresh contact info; version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@8656 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r--protocols/FacebookRM/src/json.cpp7
-rw-r--r--protocols/FacebookRM/src/proto.cpp28
-rw-r--r--protocols/FacebookRM/src/stubs.cpp6
-rw-r--r--protocols/FacebookRM/src/version.h2
4 files changed, 36 insertions, 7 deletions
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index ee2c9abbab..34b23a1fc9 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -165,6 +165,12 @@ void parseUser(JSONNODE *it, facebook_user *fbu)
{
fbu->user_id = json_name(it);
+ JSONNODE *id = json_get(it, "id");
+ if (id == NULL || json_as_pstring(id) == "0" || json_as_pstring(id).empty()) {
+ // this user has deleted account or is just unavailable for us (e.g., ignore list) -> don't read dummy name and avatar and rather ignore that completely
+ return;
+ }
+
JSONNODE *name = json_get(it, "name");
JSONNODE *thumbSrc = json_get(it, "thumbSrc");
JSONNODE *gender = json_get(it, "gender");
@@ -187,6 +193,7 @@ void parseUser(JSONNODE *it, facebook_user *fbu)
case 2: // male
fbu->gender = 77;
break;
+ // case 7: not available female?
}
}
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 7ec20b4790..1627cecb13 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -311,6 +311,34 @@ int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason)
return 0;
}
+int FacebookProto::GetInfo(MCONTACT hContact, int infoType)
+{
+ facebook_user fbu;
+ fbu.user_id = ptrA(getStringA(hContact, FACEBOOK_KEY_ID));
+
+ if (fbu.user_id.empty())
+ return 1;
+
+ LoadContactInfo(&fbu);
+
+ // TODO: don't duplicate code this way, refactor all this userInfo loading
+
+ std::string homepage = FACEBOOK_URL_PROFILE + fbu.user_id;
+ setString(hContact, "Homepage", homepage.c_str());
+
+ if (!fbu.real_name.empty()) {
+ SaveName(hContact, &fbu);
+ }
+
+ if (fbu.gender)
+ setByte(hContact, "Gender", fbu.gender);
+
+ if (!fbu.image_url.empty())
+ setString(hContact, FACEBOOK_KEY_AV_URL, fbu.image_url.c_str());
+
+ return 1;
+}
+
//////////////////////////////////////////////////////////////////////////////
// SERVICES
diff --git a/protocols/FacebookRM/src/stubs.cpp b/protocols/FacebookRM/src/stubs.cpp
index 47553993e6..e53960636f 100644
--- a/protocols/FacebookRM/src/stubs.cpp
+++ b/protocols/FacebookRM/src/stubs.cpp
@@ -52,12 +52,6 @@ int FacebookProto::FileResume(HANDLE hTransfer,int *action,const PROTOCHAR **fil
return 1;
}
-int FacebookProto::GetInfo(MCONTACT hContact, int infoType)
-{
- // TODO: Most probably some ProtoAck should be here instead
- return 1;
-}
-
HWND FacebookProto::SearchAdvanced(HWND owner)
{
return NULL;
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index 96e0535f12..b1525a0be3 100644
--- a/protocols/FacebookRM/src/version.h
+++ b/protocols/FacebookRM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 3
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>