From 8586f966f558d317d79b3ec25d0bf21d3d92498d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 19 Nov 2013 16:58:01 +0000 Subject: Facebook: Correctly load contacts on mobile phone that are online right now (also removed old related option) git-svn-id: http://svn.miranda-ng.org/main/trunk@6936 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/process.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'protocols/FacebookRM/src/process.cpp') diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 5a9ffb26f5..d62271b1a3 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -42,28 +42,24 @@ void FacebookProto::ProcessBuddyList(void* data) p->parse_buddy_list(data, &facy.buddies); delete p; - bool use_mobile_status = getByte(FACEBOOK_KEY_LOAD_MOBILE, DEFAULT_LOAD_MOBILE) != 0; - for (List::Item< facebook_user >* i = facy.buddies.begin(); i != NULL;) { facebook_user* fbu = i->data; - bool on_mobile = false; - char *status; + std::string status; switch (fbu->status_id) { case ID_STATUS_OFFLINE: status = "Offline"; break; case ID_STATUS_ONLINE: status = "Online"; break; case ID_STATUS_ONTHEPHONE: - on_mobile = true; - status = "Phone"; - - if (!use_mobile_status) - fbu->status_id = ID_STATUS_OFFLINE; - break; + status = "Mobile"; break; } - debugLogA(" Now %s: %s", status, fbu->user_id.c_str()); + + if (fbu->idle) + status += " (idle)"; + + debugLogA(" Now %s: %s", status.c_str(), fbu->user_id.c_str()); if (!fbu->deleted) { @@ -71,14 +67,16 @@ void FacebookProto::ProcessBuddyList(void* data) if (!hContact) hContact = AddToContactList(fbu, CONTACT_FRIEND); - DBVARIANT dbv; - TCHAR* client = on_mobile ? _T(FACEBOOK_MOBILE) : _T(FACEBOOK_NAME); - if (!getTString(hContact, "MirVer", &dbv)) { - if (_tcscmp(dbv.ptszVal, client)) - setTString(hContact, "MirVer", client); - db_free(&dbv); + ptrT client( getTStringA(hContact, "MirVer")); + if (!client || _tcscmp(client, fbu->mobile ? _T(FACEBOOK_CLIENT_MOBILE) : _T(FACEBOOK_CLIENT))) + setTString(hContact, "MirVer", fbu->mobile ? _T(FACEBOOK_CLIENT_MOBILE) : _T(FACEBOOK_CLIENT)); + + if (getDword(fbu->handle, "IdleTS", 0) != fbu->last_active) { + if ((fbu->idle || fbu->status_id == ID_STATUS_OFFLINE) && fbu->last_active > 0) + setDword(fbu->handle, "IdleTS", fbu->last_active); + else + delSetting(fbu->handle, "IdleTS"); } - else setTString(hContact, "MirVer", client); } if (fbu->status_id == ID_STATUS_OFFLINE || fbu->deleted) -- cgit v1.2.3