summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/oauth.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-10 20:18:54 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-10 20:18:54 +0000
commit6ce6a5277e749cf6082ae42f005b68b3ec763c6c (patch)
treeb9cde795c6ed4863d97428f05482bf44576c031b /protocols/Gadu-Gadu/src/oauth.cpp
parent00c866aaa0b79c354f9c71ca5d61f57daeec6e6a (diff)
protocol DB helpers for GG
git-svn-id: http://svn.miranda-ng.org/main/trunk@5314 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/oauth.cpp')
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index 6d0bbc9c7b..f172b5ba8d 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -338,12 +338,12 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD
char* GGPROTO::oauth_header(const char *httpmethod, const char *url)
{
char uin[32];
- UIN2IDA( db_get_dw(NULL, m_szModuleName, GG_KEY_UIN, 0), uin);
- ptrA token( db_get_sa(NULL, m_szModuleName, GG_KEY_TOKEN));
- ptrA password( db_get_sa(NULL, m_szModuleName, GG_KEY_PASSWORD));
+ UIN2IDA( getDword(GG_KEY_UIN, 0), uin);
+ ptrA token( getStringA(GG_KEY_TOKEN));
+ ptrA password( getStringA(GG_KEY_PASSWORD));
if (password != NULL)
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)strlen(password) + 1, (LPARAM)password);
- ptrA token_secret( db_get_sa(NULL, m_szModuleName, GG_KEY_TOKENSECRET));
+ ptrA token_secret( getStringA(GG_KEY_TOKENSECRET));
if (token_secret != NULL)
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)strlen(token_secret) + 1, (LPARAM)token_secret);
@@ -357,8 +357,8 @@ int GGPROTO::oauth_receivetoken()
int res = 0;
HANDLE nlc = NULL;
- UIN2IDA( db_get_dw(NULL, m_szModuleName, GG_KEY_UIN, 0), uin);
- if (!db_get_s(NULL, m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
+ UIN2IDA( getDword(GG_KEY_UIN, 0), uin);
+ if (!getString(GG_KEY_PASSWORD, &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
password = mir_strdup(dbv.pszVal);
db_free(&dbv);
@@ -480,15 +480,15 @@ int GGPROTO::oauth_receivetoken()
mir_free(str);
if (token != NULL && token_secret != NULL) {
- db_set_s(NULL, m_szModuleName, GG_KEY_TOKEN, token);
+ setString(GG_KEY_TOKEN, token);
CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)(int)strlen(token_secret) + 1, (LPARAM) token_secret);
- db_set_s(NULL, m_szModuleName, GG_KEY_TOKENSECRET, token_secret);
+ setString(GG_KEY_TOKENSECRET, token_secret);
netlog("oauth_receivetoken(): Access Token obtained successfully.");
res = 1;
}
else {
- db_unset(NULL, m_szModuleName, GG_KEY_TOKEN);
- db_unset(NULL, m_szModuleName, GG_KEY_TOKENSECRET);
+ delSetting(GG_KEY_TOKEN);
+ delSetting(GG_KEY_TOKENSECRET);
netlog("oauth_receivetoken(): Failed to obtain Access Token.");
}
mir_free(token);
@@ -502,8 +502,8 @@ int GGPROTO::oauth_checktoken(int force)
if (force)
return oauth_receivetoken();
- ptrA token( db_get_sa(NULL, m_szModuleName, GG_KEY_TOKEN));
- ptrA token_secret( db_get_sa(NULL, m_szModuleName, GG_KEY_TOKENSECRET));
+ ptrA token( getStringA(GG_KEY_TOKEN));
+ ptrA token_secret( getStringA(GG_KEY_TOKENSECRET));
if (token == NULL || token_secret == NULL)
return oauth_receivetoken();