summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-10 13:54:28 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-10 13:54:28 +0000
commit3bcc4ebb3e1a43574fb934a80903feaa56642089 (patch)
tree254424be4b3f19e17a089bee94c66ce2acac0106
parentd5d50b471277d5d69f59a8f29bf87201149ce191 (diff)
obsolete helper removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@5306 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp8
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp12
-rw-r--r--protocols/JabberG/src/jabber_proto.h1
-rw-r--r--protocols/JabberG/src/jabber_search.cpp5
-rw-r--r--protocols/JabberG/src/jabber_std.cpp17
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp16
-rw-r--r--protocols/JabberG/src/jabber_util.cpp36
7 files changed, 31 insertions, 64 deletions
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 120109c9ad..a099108366 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -209,13 +209,11 @@ void CJabberProto::OnLoggedIn()
QueryPrivacyLists(m_ThreadInfo);
- char szServerName[ sizeof(m_ThreadInfo->server) ];
- if (JGetStaticString("LastLoggedServer", NULL, szServerName, sizeof(szServerName)))
+ ptrA szServerName( getStringA("LastLoggedServer"));
+ if (szServerName == NULL || strcmp(m_ThreadInfo->server, szServerName))
SendGetVcard(m_szJabberJID);
- else if (strcmp(m_ThreadInfo->server, szServerName))
- SendGetVcard(m_szJabberJID);
- setString("LastLoggedServer", m_ThreadInfo->server);
+ setString("LastLoggedServer", m_ThreadInfo->server);
m_pepServices.ResetPublishAll();
}
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 3a67f25fe6..6e2e1d0d84 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -878,13 +878,11 @@ HANDLE __cdecl CJabberProto::SearchByEmail(const TCHAR *email)
if ( !m_bJabberOnline || email == NULL)
return 0;
- char szServerName[100];
- if (JGetStaticString("Jud", NULL, szServerName, sizeof(szServerName)))
- strcpy(szServerName, "users.jabber.org");
+ ptrA szServerName( getStringA("Jud"));
int iqId = SerialNext();
IqAdd(iqId, IQ_PROC_GETSEARCH, &CJabberProto::OnIqResultSetSearch);
- m_ThreadInfo->send( XmlNodeIq(_T("set"), iqId, _A2T(szServerName)) << XQUERY(_T("jabber:iq:search"))
+ m_ThreadInfo->send( XmlNodeIq(_T("set"), iqId, _A2T(szServerName ? szServerName : "users.jabber.org")) << XQUERY(_T("jabber:iq:search"))
<< XCHILD(_T("email"), email));
return (HANDLE)iqId;
}
@@ -899,12 +897,10 @@ HANDLE __cdecl CJabberProto::SearchByName(const TCHAR *nick, const TCHAR *firstN
BOOL bIsExtFormat = m_options.ExtendedSearch;
- char szServerName[100];
- if (JGetStaticString("Jud", NULL, szServerName, sizeof(szServerName)))
- strcpy(szServerName, "users.jabber.org");
+ ptrA szServerName( getStringA("Jud"));
int iqId = SerialNext();
- XmlNodeIq iq(_T("set"), iqId, _A2T(szServerName));
+ XmlNodeIq iq(_T("set"), iqId, _A2T(szServerName ? szServerName : "users.jabber.org"));
HXML query = iq << XQUERY(_T("jabber:iq:search"));
if (bIsExtFormat) {
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 81e0f8a3a7..d6edb36de7 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -784,7 +784,6 @@ struct CJabberProto : public PROTO<CJabberProto>
//---- jabber_std.cpp ----------------------------------------------
void JDeleteSetting(HANDLE hContact, const char* valueName);
- int JGetStaticString(const char* valueName, HANDLE hContact, char* dest, int dest_len);
int JGetStringUtf(HANDLE hContact, char* valueName, DBVARIANT* dbv);
TCHAR *JGetStringT(HANDLE hContact, char* valueName);
TCHAR *JGetStringT(HANDLE hContact, char* valueName, TCHAR *&out);
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp
index a02630dca3..409f0cc4df 100644
--- a/protocols/JabberG/src/jabber_search.cpp
+++ b/protocols/JabberG/src/jabber_search.cpp
@@ -540,9 +540,8 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
/* Server Combo box */
- char szServerName[100];
- if (dat->ppro->JGetStaticString("Jud", NULL, szServerName, sizeof(szServerName)))
- strcpy(szServerName, "users.jabber.org");
+ ptrA jud(dat->ppro->getStringA("Jud"));
+ char *szServerName = (jud != NULL) ? jud : "users.jabber.org";
SetDlgItemTextA(hwndDlg,IDC_SERVER,szServerName);
SendDlgItemMessageA(hwndDlg,IDC_SERVER,CB_ADDSTRING,0,(LPARAM)szServerName);
//TO DO: Add Transports here
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp
index df45146891..c7b206e5ef 100644
--- a/protocols/JabberG/src/jabber_std.cpp
+++ b/protocols/JabberG/src/jabber_std.cpp
@@ -30,23 +30,6 @@ void CJabberProto::JDeleteSetting(HANDLE hContact, const char* valueName)
db_unset(hContact, m_szModuleName, valueName);
}
-int CJabberProto::JGetStaticString(const char* valueName, HANDLE hContact, char* dest, int dest_len)
-{
- DBVARIANT dbv;
- dbv.pszVal = dest;
- dbv.cchVal = dest_len;
- dbv.type = DBVT_ASCIIZ;
-
- DBCONTACTGETSETTING sVal;
- sVal.pValue = &dbv;
- sVal.szModule = m_szModuleName;
- sVal.szSetting = valueName;
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0)
- return 1;
-
- return (dbv.type != DBVT_ASCIIZ);
-}
-
int CJabberProto::JGetStringUtf(HANDLE hContact, char* valueName, DBVARIANT* dbv)
{
return db_get_utf(hContact, m_szModuleName, valueName, dbv);
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index bb43eb2406..6248a03a23 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -129,8 +129,8 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
PROTO_AVATAR_INFORMATIONT* AI = (PROTO_AVATAR_INFORMATIONT*)lParam;
- char szHashValue[ MAX_PATH ];
- if (JGetStaticString("AvatarHash", AI->hContact, szHashValue, sizeof szHashValue)) {
+ ptrA szHashValue( getStringA(AI->hContact, "AvatarHash"));
+ if (szHashValue == NULL) {
Log("No avatar");
return GAIR_NOAVATAR;
}
@@ -142,12 +142,12 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
AI->format = (AI->hContact == NULL) ? PA_FORMAT_PNG : getByte(AI->hContact, "AvatarType", 0);
if (::_taccess(AI->filename, 0) == 0) {
- char szSavedHash[ 256 ];
- if ( !JGetStaticString("AvatarSaved", AI->hContact, szSavedHash, sizeof szSavedHash)) {
- if ( !strcmp(szSavedHash, szHashValue)) {
- Log("Avatar is Ok: %s == %s", szSavedHash, szHashValue);
- return GAIR_SUCCESS;
- } } }
+ ptrA szSavedHash( getStringA(AI->hContact, "AvatarSaved"));
+ if (szSavedHash != NULL && !strcmp(szSavedHash, szHashValue)) {
+ Log("Avatar is Ok: %s == %s", szSavedHash, szHashValue);
+ return GAIR_SUCCESS;
+ }
+ }
if ((wParam & GAIF_FORCE) != 0 && AI->hContact != NULL && m_bJabberOnline) {
DBVARIANT dbv;
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 4fe35b0694..834f515da8 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -884,15 +884,13 @@ void CJabberProto::SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR
xmlAddAttr(c, _T("ext"), szExtCaps);
if (m_options.EnableAvatars) {
- char hashValue[ 50 ];
- if ( !JGetStaticString("AvatarHash", NULL, hashValue, sizeof(hashValue))) {
- // XEP-0153: vCard-Based Avatars
- HXML x = p << XCHILDNS(_T("x"), _T("vcard-temp:x:update"));
+ HXML x = p << XCHILDNS(_T("x"), _T("vcard-temp:x:update"));
+
+ ptrA hashValue( getStringA("AvatarHash"));
+ if (hashValue != NULL) // XEP-0153: vCard-Based Avatars
x << XCHILD(_T("photo"), _A2T(hashValue));
- } else {
- HXML x = p << XCHILDNS(_T("x"), _T("vcard-temp:x:update"));
+ else
x << XCHILD(_T("photo"));
- }
}
EnterCriticalSection(&m_csModeMsgMutex);
@@ -1750,8 +1748,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
{
OBJLIST<JABBER_HTTP_AVATARS> &avs = *(OBJLIST<JABBER_HTTP_AVATARS>*)param;
HANDLE hHttpCon = NULL;
- for (int i = 0; i < avs.getCount(); i++)
- {
+ for (int i = 0; i < avs.getCount(); i++) {
NETLIBHTTPREQUEST nlhr = {0};
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
@@ -1760,29 +1757,24 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
nlhr.nlc = hHttpCon;
NETLIBHTTPREQUEST * res = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&nlhr);
- if (res)
- {
+ if (res) {
hHttpCon = res->nlc;
- if (res->resultCode == 200 && res->dataLength)
- {
+ if (res->resultCode == 200 && res->dataLength) {
int pictureType = JabberGetPictureType(res->pData);
- if (pictureType != PA_FORMAT_UNKNOWN)
- {
- TCHAR tszFileName[ MAX_PATH ];
-
+ if (pictureType != PA_FORMAT_UNKNOWN) {
PROTO_AVATAR_INFORMATIONT AI;
AI.cbSize = sizeof(AI);
AI.format = pictureType;
AI.hContact = avs[i].hContact;
if (getByte(AI.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
+ TCHAR tszFileName[ MAX_PATH ];
GetAvatarFileName(AI.hContact, tszFileName, SIZEOF(tszFileName));
DeleteFile(tszFileName);
}
setByte(AI.hContact, "AvatarType", pictureType);
- char cmpsha[ 41 ];
char buffer[ 41 ];
mir_sha1_byte_t digest[20];
mir_sha1_ctx sha;
@@ -1792,8 +1784,9 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
for (int i=0; i<20; i++)
sprintf(buffer+(i<<1), "%02x", digest[i]);
- if (JGetStaticString("AvatarSaved", AI.hContact, cmpsha, sizeof(cmpsha)) || strnicmp(cmpsha, buffer, sizeof(buffer)))
- {
+ ptrA cmpsha( getStringA(AI.hContact, "AvatarSaved"));
+ if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
+ TCHAR tszFileName[ MAX_PATH ];
GetAvatarFileName(AI.hContact, tszFileName, SIZEOF(tszFileName));
_tcsncpy(AI.filename, tszFileName, SIZEOF(AI.filename));
FILE* out = _tfopen(tszFileName, _T("wb"));
@@ -1810,8 +1803,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
}
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)res);
}
- else
- hHttpCon = NULL;
+ else hHttpCon = NULL;
}
delete &avs;
if (hHttpCon)