summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/process.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-08-07 00:09:49 +0000
committerRobert Pösel <robyer@seznam.cz>2014-08-07 00:09:49 +0000
commit868e1f90c63aec0b5a22db8bfd65ed482326b0f4 (patch)
tree5cb6147bd0bbd71d5f245fa5db291f16d193fb5e /protocols/FacebookRM/src/process.cpp
parent2a8f165b498b1f8210f97e8c1f55d226d9b95da4 (diff)
Facebook: Remove DBVARIANT where possible
git-svn-id: http://svn.miranda-ng.org/main/trunk@10101 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/process.cpp')
-rw-r--r--protocols/FacebookRM/src/process.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index f3d91e02f1..357e6dd655 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -180,15 +180,12 @@ void FacebookProto::ProcessFriendList(void*)
if ( isChatRoom(hContact))
continue;
- DBVARIANT dbv;
facebook_user *fbu;
- if (!getString(hContact, FACEBOOK_KEY_ID, &dbv)) {
- std::string id = dbv.pszVal;
- db_free(&dbv);
-
+ ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));
+ if (id != NULL) {
std::map< std::string, facebook_user* >::iterator iter;
- if ((iter = friends.find(id)) != friends.end()) {
+ if ((iter = friends.find(std::string(id))) != friends.end()) {
// Found contact, update it and remove from map
fbu = iter->second;
@@ -247,8 +244,10 @@ void FacebookProto::ProcessFriendList(void*)
if (!getDword(hContact, FACEBOOK_KEY_DELETED, 0) && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, 0) == CONTACT_FRIEND) {
setDword(hContact, FACEBOOK_KEY_DELETED, ::time(NULL));
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE);
-
+
std::string contactname = id;
+
+ DBVARIANT dbv;
if (!getStringUtf(hContact, FACEBOOK_KEY_NICK, &dbv)) {
contactname = dbv.pszVal;
db_free(&dbv);
@@ -874,15 +873,8 @@ void FacebookProto::ProcessFriendRequests(void*)
MCONTACT hContact = AddToContactList(fbu, CONTACT_APPROVE);
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_APPROVE);
- bool seen = false;
-
- DBVARIANT dbv;
- if (!getString(hContact, "RequestTime", &dbv)) {
- seen = !strcmp(dbv.pszVal, time.c_str());
- db_free(&dbv);
- }
-
- if (!seen) {
+ ptrA oldTime(getStringA(hContact, "RequestTime"));
+ if (oldTime == NULL || strcmp(oldTime, time.c_str())) {
// This is new request
setString(hContact, "RequestTime", time.c_str());