diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-11-19 16:58:01 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-11-19 16:58:01 +0000 |
commit | 8586f966f558d317d79b3ec25d0bf21d3d92498d (patch) | |
tree | b0e7c9e04d8a841cc9eb546372624fb7f1a91799 /protocols/FacebookRM/src/process.cpp | |
parent | 0e80ad0d4c150fa947849cdad07a7d0d34d7340e (diff) |
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
Diffstat (limited to 'protocols/FacebookRM/src/process.cpp')
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
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)
|