summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2013-09-27 11:49:36 +0000
committerRobert Pösel <robyer@seznam.cz>2013-09-27 11:49:36 +0000
commit93803b014deca7d3cd450b4536cb0baa310f612b (patch)
tree4a896182495f8c3602eee98880fab83ffaaa1b6d /protocols
parentc8eca678b7dbde203e2f778cabd590c846391411 (diff)
Facebook: new getStringUtf and setStringUtf helpers
git-svn-id: http://svn.miranda-ng.org/main/trunk@6249 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/contacts.cpp8
-rw-r--r--protocols/FacebookRM/src/process.cpp4
-rw-r--r--protocols/FacebookRM/src/proto.h10
3 files changed, 16 insertions, 6 deletions
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 5449847d08..28b2b25d79 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -32,14 +32,14 @@ void FacebookProto::SaveName(HANDLE hContact, const facebook_user *fbu)
return;
}
- db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
+ setStringUtf(hContact, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
// Explode whole name into first, second and last name
std::vector<std::string> names;
utils::text::explode(fbu->real_name, " ", &names);
- db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_FIRST_NAME, names.front().c_str());
- db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_LAST_NAME, names.back().c_str());
+ setStringUtf(hContact, FACEBOOK_KEY_FIRST_NAME, names.front().c_str());
+ setStringUtf(hContact, FACEBOOK_KEY_LAST_NAME, names.back().c_str());
if (names.size() > 2) {
std::string middle = "";
@@ -49,7 +49,7 @@ void FacebookProto::SaveName(HANDLE hContact, const facebook_user *fbu)
middle += names.at(i);
}
- db_set_utf(hContact, m_szModuleName, FACEBOOK_KEY_SECOND_NAME, middle.c_str());
+ setStringUtf(hContact, FACEBOOK_KEY_SECOND_NAME, middle.c_str());
} else {
delSetting(hContact, FACEBOOK_KEY_SECOND_NAME);
}
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 2643a899ab..ba898f0ca1 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -188,7 +188,7 @@ void FacebookProto::ProcessFriendList(void* data)
if (realname != NULL) {
delSetting(hContact, "RealName");
}
- else if (!db_get_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, &dbv))
+ else if (!getStringUtf(hContact, FACEBOOK_KEY_NICK, &dbv))
{
update_required = strcmp(dbv.pszVal, fbu->real_name.c_str()) != 0;
db_free(&dbv);
@@ -228,7 +228,7 @@ void FacebookProto::ProcessFriendList(void* data)
setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE);
std::string contactname = id;
- if (!db_get_utf(hContact, m_szModuleName, FACEBOOK_KEY_NICK, &dbv)) {
+ if (!getStringUtf(hContact, FACEBOOK_KEY_NICK, &dbv)) {
contactname = dbv.pszVal;
db_free(&dbv);
}
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 8105d921a7..65aa316ee5 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -50,6 +50,16 @@ public:
return (m_iStatus == ID_STATUS_INVISIBLE);
}
+ // DB utils missing in proto_interface
+
+ __forceinline INT_PTR getStringUtf(const char *name, DBVARIANT *result) {
+ return db_get_utf(NULL, m_szModuleName, name, result); }
+ __forceinline INT_PTR getStringUtf(HANDLE hContact, const char *name, DBVARIANT *result) {
+ return db_get_utf(hContact, m_szModuleName, name, result); }
+
+ __forceinline void setStringUtf(const char *name, const char* value) { db_set_utf(NULL, m_szModuleName, name, value); }
+ __forceinline void setStringUtf(HANDLE hContact, const char *name, const char* value) { db_set_utf(hContact, m_szModuleName, name, value); }
+
//PROTO_INTERFACE
virtual HANDLE __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr);