summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-05-10 17:50:04 +0000
committerRobert Pösel <robyer@seznam.cz>2014-05-10 17:50:04 +0000
commit1a925674503aee8b5fe40354f923647736169039 (patch)
tree2f35d08ec1337ea99b826e57a13e1654b48c8020 /protocols/FacebookRM
parent8762a11a5053c1a7f12d6390c4edfa86533e796f (diff)
Facebook: better version of previous commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@9158 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/contacts.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 3191289146..07c123b6c5 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -182,6 +182,8 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, b
if (hContact && !force_save)
return hContact;
+ force_save = !hContact;
+
// If not, try to make a new contact
if (!hContact) {
hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
@@ -194,17 +196,25 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, b
// If we have some contact, we'll save its data
if (hContact) {
- setString(hContact, FACEBOOK_KEY_ID, fbu->user_id.c_str());
+ if (force_save) {
+ // Save these values only when adding new contact, not when updating existing
+ setString(hContact, FACEBOOK_KEY_ID, fbu->user_id.c_str());
+
+ std::string homepage = FACEBOOK_URL_PROFILE + fbu->user_id;
+ setString(hContact, "Homepage", homepage.c_str());
+ setTString(hContact, "MirVer", fbu->getMirVer());
+
+ db_unset(hContact, "CList", "MyHandle");
- std::string homepage = FACEBOOK_URL_PROFILE + fbu->user_id;
- setString(hContact, "Homepage", homepage.c_str());
- setTString(hContact, "MirVer", fbu->getMirVer());
+ ptrT group(getTStringA(NULL, FACEBOOK_KEY_DEF_GROUP));
+ if (group)
+ db_set_ts(hContact, "CList", "Group", group);
- db_unset(hContact, "CList", "MyHandle");
+ setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, type);
- ptrT group( getTStringA(NULL, FACEBOOK_KEY_DEF_GROUP));
- if (group)
- db_set_ts(hContact, "CList", "Group", group);
+ if (getByte(FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, 0))
+ CallService(MS_IGNORE_IGNORE, hContact, (LPARAM)IGNOREEVENT_USERONLINE);
+ }
if (!fbu->real_name.empty())
SaveName(hContact, fbu);
@@ -214,11 +224,6 @@ MCONTACT FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, b
if (!fbu->image_url.empty())
setString(hContact, FACEBOOK_KEY_AV_URL, fbu->image_url.c_str());
-
- setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, type);
-
- if (getByte(FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, 0))
- CallService(MS_IGNORE_IGNORE, hContact, (LPARAM)IGNOREEVENT_USERONLINE);
}
return hContact;