diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-03 20:11:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-03 20:11:26 +0000 |
commit | e84b97a0622a26fe474ccd840dcadb320520601c (patch) | |
tree | 7c1725e6eddbb47d618c8574147dd998feb8ea52 /protocols | |
parent | e82c4d5d574191f432716049218b4b7b5162ec38 (diff) |
- new helpers for reading db strings into static buffers;
- MS_DB_CONTACT_GETSETTINGSTATIC died;
- DBCONTACTGETSETTING is detouched from all services;
- these service calls are rewritten using parameters
git-svn-id: http://svn.miranda-ng.org/main/trunk@8035 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/GTalkExt/src/inbox.cpp | 13 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_db.cpp | 23 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_servlist.cpp | 24 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_uploadui.cpp | 21 | ||||
-rw-r--r-- | protocols/MSN/src/msn_auth.cpp | 4 | ||||
-rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 4 | ||||
-rw-r--r-- | protocols/MSN/src/msn_contact.cpp | 8 | ||||
-rw-r--r-- | protocols/MSN/src/msn_lists.cpp | 8 | ||||
-rw-r--r-- | protocols/MSN/src/msn_mail.cpp | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_menu.cpp | 4 | ||||
-rw-r--r-- | protocols/MSN/src/msn_misc.cpp | 6 | ||||
-rw-r--r-- | protocols/MSN/src/msn_natdetect.cpp | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_opts.cpp | 14 | ||||
-rw-r--r-- | protocols/MSN/src/msn_proto.cpp | 8 | ||||
-rw-r--r-- | protocols/MSN/src/msn_proto.h | 1 | ||||
-rw-r--r-- | protocols/MSN/src/msn_soapab.cpp | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_soapstore.cpp | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_srv.cpp | 10 | ||||
-rw-r--r-- | protocols/MSN/src/msn_std.cpp | 17 | ||||
-rw-r--r-- | protocols/MSN/src/msn_svcs.cpp | 4 | ||||
-rw-r--r-- | protocols/MSN/src/msn_threads.cpp | 4 |
21 files changed, 52 insertions, 129 deletions
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 1cb4a3aa88..51a0cf5ddd 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -158,19 +158,10 @@ void OpenUrlThread(void *param) int GetMailboxPwd(LPCSTR acc, LPCTSTR mailbox, LPSTR *pwd, int buffSize)
{
char buff[256];
-
- DBCONTACTGETSETTING cgs;
- DBVARIANT dbv;
- cgs.szModule = acc;
- cgs.szSetting = LOGIN_PASS_SETTING_NAME;
- cgs.pValue = &dbv;
- dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = &buff[0];
- dbv.cchVal = sizeof(buff);
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, 0, (LPARAM)&cgs))
+ if (db_get_static(NULL, acc, LOGIN_PASS_SETTING_NAME, buff, sizeof(buff)))
return 0;
- int result = dbv.cchVal;
+ int result = (int)strlen(buff);
if (pwd) {
if (buffSize < result + 1)
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index ecf76ebfc4..8841ce24fc 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -107,27 +107,10 @@ WORD CIcqProto::getContactStatus(HANDLE hContact) int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, char *dest, int dest_len)
{
- DBVARIANT dbv = {DBVT_DELETED};
- DBCONTACTGETSETTING sVal = {0};
-
- dbv.pszVal = dest;
- dbv.cchVal = dest_len;
- dbv.type = DBVT_ASCIIZ;
-
- sVal.pValue = &dbv;
- sVal.szModule = m_szModuleName;
- sVal.szSetting = szSetting;
-
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0) {
- dbv.pszVal = dest;
- dbv.cchVal = dest_len;
- dbv.type = DBVT_UTF8;
-
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, (WPARAM)hContact, (LPARAM)&sVal) != 0)
- return 1; // nothing found
- }
+ if (!db_get_static(hContact, m_szModuleName, szSetting, dest, dest_len))
+ return 0;
- return (dbv.type != DBVT_ASCIIZ);
+ return db_get_static_utf(hContact, m_szModuleName, szSetting, dest, dest_len);
}
int CIcqProto::setSettingDouble(HANDLE hContact, const char *szSetting, double dValue)
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 44e6ef480e..5eac04a78b 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -930,28 +930,10 @@ static int GroupReserveIdsEnumProc(const char *szSetting,LPARAM lParam) // it is probably server group
GroupReserveIdsEnumParam *param = (GroupReserveIdsEnumParam*)lParam;
char val[MAX_PATH+2]; // dummy
-
- DBVARIANT dbv = {DBVT_DELETED};
- dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = val;
- dbv.cchVal = MAX_PATH;
-
- DBCONTACTGETSETTING cgs;
- cgs.szModule = param->szModule;
- cgs.szSetting = szSetting;
- cgs.pValue = &dbv;
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC,0,(LPARAM)&cgs))
- { // we failed to read setting, try also utf8 - DB bug
- dbv.type = DBVT_UTF8;
- dbv.pszVal = val;
- dbv.cchVal = MAX_PATH;
- if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC,0,(LPARAM)&cgs))
+ if (db_get_static(0, param->szModule, szSetting, val, MAX_PATH))
+ if (db_get_static_utf(0, param->szModule, szSetting, val, MAX_PATH))
return 0; // we failed also, invalid setting
- }
- if (dbv.type != DBVT_ASCIIZ)
- { // it is not a cached server-group name
- return 0;
- }
+
param->ppro->ReserveServerID((WORD)strtoul(szSetting, NULL, 0x10), SSIT_GROUP, 0);
#ifdef _DEBUG
param->ppro->debugLogA("Loaded group %u:'%s'", strtoul(szSetting, NULL, 0x10), val);
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index 01e7b14f6b..7b4aa7d4ba 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -148,25 +148,12 @@ static void GetLastUploadLogLine(HWND hwndDlg, char *szBuf, size_t cbBuf) static int GroupEnumIdsEnumProc(const char *szSetting,LPARAM lParam)
{
- if (szSetting && strlennull(szSetting)<5)
- { // it is probably server group
+ // it is probably server group
+ if (szSetting && strlennull(szSetting) < 5) {
char val[MAX_PATH+2]; // dummy
- DBVARIANT dbv;
- DBCONTACTGETSETTING cgs;
-
- dbv.type = DBVT_ASCIIZ;
- dbv.pszVal = val;
- dbv.cchVal = MAX_PATH;
-
- cgs.szModule=(char*)lParam;
- cgs.szSetting=szSetting;
- cgs.pValue=&dbv;
- if(CallService(MS_DB_CONTACT_GETSETTINGSTATIC,0,(LPARAM)&cgs))
+ if (db_get_static(NULL, (char*)lParam, szSetting, val, MAX_PATH))
return 0; // this converts all string types to DBVT_ASCIIZ
- if(dbv.type!=DBVT_ASCIIZ)
- { // it is not a cached server-group name
- return 0;
- }
+
pwGroupIds = (WORD*)SAFE_REALLOC(pwGroupIds, (cbGroupIds+1)*sizeof(WORD));
pwGroupIds[cbGroupIds] = (WORD)strtoul(szSetting, NULL, 0x10);
cbGroupIds++;
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 50fa33305d..9474b71dfc 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -134,7 +134,7 @@ int CMsnProto::MSN_GetPassportAuth(void) int retVal = -1;
char szPassword[100];
- getStaticString(NULL, "Password", szPassword, sizeof(szPassword));
+ db_get_static(NULL, m_szModuleName, "Password", szPassword, sizeof(szPassword));
szPassword[16] = 0;
char* szEncPassword = HtmlEncode(szPassword);
@@ -156,7 +156,7 @@ int CMsnProto::MSN_GetPassportAuth(void) mir_free(szEncPassword);
char* szPassportHost = (char*)mir_alloc(256);
- if (getStaticString(NULL, "MsnPassportHost", szPassportHost, 256))
+ if (db_get_static(NULL, m_szModuleName, "MsnPassportHost", szPassportHost, 256))
strcpy(szPassportHost, defaultPassportUrl);
bool defaultUrlAllow = strcmp(szPassportHost, defaultPassportUrl) != 0;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index bd5ce999d9..9701adc096 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -1250,12 +1250,12 @@ LBL_InvalidCommand: if (hContact != NULL) {
char szSavedHash[64] = "";
- getStaticString(hContact, "AvatarSavedHash", szSavedHash, sizeof(szSavedHash));
+ db_get_static(hContact, m_szModuleName, "AvatarSavedHash", szSavedHash, sizeof(szSavedHash));
if (stricmp(szSavedHash, pszAvatarHash))
pushAvatarRequest(hContact, pszUrl);
else {
char szSavedContext[64];
- int result = getStaticString(hContact, "PictSavedContext", szSavedContext, sizeof(szSavedContext));
+ int result = db_get_static(hContact, m_szModuleName, "PictSavedContext", szSavedContext, sizeof(szSavedContext));
if (result || strcmp(szSavedContext, data.cmdstring))
pushAvatarRequest(hContact, pszUrl);
}
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index 132b73c8ae..3412165ef1 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -142,7 +142,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f }
char id[MSN_GUID_LEN];
- if (!getStaticString(hContact, "ID", id, sizeof(id)))
+ if (!db_get_static(hContact, m_szModuleName, "ID", id, sizeof(id)))
{
int netId = Lists_GetNetId(email);
if (leaveHotmail)
@@ -172,7 +172,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f {
char szContactID[100];
hContact = MSN_HContactFromEmail(email);
- if (getStaticString(hContact, "ID", szContactID, sizeof(szContactID)) == 0)
+ if (db_get_static(hContact, m_szModuleName, "ID", szContactID, sizeof(szContactID)) == 0)
{
MSN_ABAddRemoveContact(szContactID, netId, true);
res = true;
@@ -192,10 +192,8 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f }
char szContactID[100];
- if (getStaticString(hContact, "ID", szContactID, sizeof(szContactID)) == 0)
- {
+ if (db_get_static(hContact, m_szModuleName, "ID", szContactID, sizeof(szContactID)) == 0)
MSN_ABFind("ABFindByContacts", szContactID);
- }
MSN_SharingFindMembership(true);
AddDelUserContList(email, flags, netId, false);
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index ad4098edd6..1a5d372fce 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -242,8 +242,8 @@ void CMsnProto::Lists_Populate(void) while (hContact) {
HANDLE hNext = db_find_next(hContact, m_szModuleName);
char szEmail[MSN_MAX_EMAIL_LEN] = "";
- if (getStaticString(hContact, "wlid", szEmail, sizeof(szEmail)))
- getStaticString(hContact, "e-mail", szEmail, sizeof(szEmail));
+ if (db_get_static(hContact, m_szModuleName, "wlid", szEmail, sizeof(szEmail)))
+ db_get_static(hContact, m_szModuleName, "e-mail", szEmail, sizeof(szEmail));
if (szEmail[0]) {
bool localList = getByte(hContact, "LocalList", 0) != 0;
if (localList)
@@ -447,7 +447,7 @@ static void SetContactIcons(HANDLE hItem, HWND hwndList, CMsnProto* proto) }
char szEmail[MSN_MAX_EMAIL_LEN];
- if (proto->getStaticString(hItem, "e-mail", szEmail, sizeof(szEmail))) {
+ if (db_get_static(hItem, proto->m_szModuleName, "e-mail", szEmail, sizeof(szEmail))) {
SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0);
return;
}
@@ -521,7 +521,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto) if (IsHContactContact(hItem))
{
- if (proto->getStaticString(hItem, "e-mail", szEmail, sizeof(szEmail))) continue;
+ if (db_get_static(hItem, proto->m_szModuleName, "e-mail", szEmail, sizeof(szEmail))) continue;
}
else if (IsHContactInfo(hItem))
{
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index e095eb8856..180d3e77a3 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -345,7 +345,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) return;
char mailerpath[MAX_PATH];
- if (!getStaticString(NULL, "MailerPath", mailerpath, sizeof(mailerpath)))
+ if (!db_get_static(NULL, m_szModuleName, "MailerPath", mailerpath, sizeof(mailerpath)))
{
if (mailerpath[0])
{
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 3bff6fdec8..76e2e9f784 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -37,7 +37,7 @@ INT_PTR CMsnProto::MsnBlockCommand(WPARAM wParam, LPARAM) const HANDLE hContact = (HANDLE)wParam;
char tEmail[MSN_MAX_EMAIL_LEN];
- getStaticString(hContact, "e-mail", tEmail, sizeof(tEmail));
+ db_get_static(hContact, m_szModuleName, "e-mail", tEmail, sizeof(tEmail));
if (Lists_IsInList(LIST_BL, tEmail))
delSetting(hContact, "ApparentMode");
@@ -94,7 +94,7 @@ INT_PTR CMsnProto::MsnViewProfile(WPARAM wParam, LPARAM) else
{
cid = buf;
- if (getStaticString(hContact, "CID", buf, 30))
+ if (db_get_static(hContact, m_szModuleName, "CID", buf, 30))
return 0;
}
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 0d568107f6..f774da7cde 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -305,7 +305,7 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) _close(fileId);
char szAvatarHashdOld[41] = "";
- getStaticString(NULL, "AvatarHash", szAvatarHashdOld, sizeof(szAvatarHashdOld));
+ db_get_static(NULL, m_szModuleName, "AvatarHash", szAvatarHashdOld, sizeof(szAvatarHashdOld));
char *szAvatarHash = arrayToHex(sha1d, sizeof(sha1d));
if (strcmp(szAvatarHashdOld, szAvatarHash)) {
setString("PictObject", szEncodedBuffer);
@@ -786,7 +786,7 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url) const char *postdata = ismail ? postdataM : postdataS;
char passport[256];
- if (getStaticString(NULL, "MsnPassportHost", passport, 256))
+ if (db_get_static(NULL, m_szModuleName, "MsnPassportHost", passport, 256))
strcpy(passport, "https://login.live.com/");
char *p = strchr(passport, '/');
@@ -1206,7 +1206,7 @@ bool CMsnProto::MSN_IsMeByContact(HANDLE hContact, char* szEmail) char *emailPtr = szEmail ? szEmail : tEmail;
*emailPtr = 0;
- if (getStaticString(hContact, "e-mail", emailPtr, sizeof(tEmail)))
+ if (db_get_static(hContact, m_szModuleName, "e-mail", emailPtr, sizeof(tEmail)))
return false;
return _stricmp(emailPtr, MyOptions.szEmail) == 0;
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index 60a47a0895..c6569ff817 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -385,7 +385,7 @@ void CMsnProto::MSNConnDetectThread( void* ) // User specified host by himself so check if it matches MSN information
// if it does, move to connection type autodetection,
// if it does not, guess connection type from available info
- getStaticString(NULL, "YourHost", parBuf, sizeof(parBuf));
+ db_get_static(NULL, m_szModuleName, "YourHost", parBuf, sizeof(parBuf));
if (msnExternalIP == NULL || strcmp(msnExternalIP, parBuf) != 0)
{
MyConnection.extIP = inet_addr(parBuf);
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 79139c3b23..26aa551c2d 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -90,7 +90,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemTextA(hwndDlg, IDC_HANDLE, proto->MyOptions.szEmail);
char tBuffer[MAX_PATH];
- if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer))) {
+ if (!db_get_static(NULL, proto->m_szModuleName, "Password", tBuffer, sizeof(tBuffer))) {
tBuffer[16] = 0;
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, tBuffer);
}
@@ -115,7 +115,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP EnableWindow(GetDlgItem(hwndDlg, IDC_MAILER_APP), tValue);
EnableWindow(GetDlgItem(hwndDlg, IDC_ENTER_MAILER_APP), tValue);
- if (!proto->getStaticString(NULL, "MailerPath", tBuffer, sizeof(tBuffer)))
+ if (!db_get_static(NULL, proto->m_szModuleName, "MailerPath", tBuffer, sizeof(tBuffer)))
SetDlgItemTextA(hwndDlg, IDC_MAILER_APP, tBuffer);
if (!proto->msnLoggedIn) {
@@ -328,7 +328,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam char ipaddr[256] = "";
if (gethst == 1)
- if (proto->getStaticString(NULL, "YourHost", ipaddr, sizeof(ipaddr)))
+ if (db_get_static(NULL, proto->m_szModuleName, "YourHost", ipaddr, sizeof(ipaddr)))
gethst = 0;
if (gethst == 0)
@@ -516,7 +516,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L SetDlgItemTextA(hwndDlg, IDC_HANDLE, proto->MyOptions.szEmail);
char tBuffer[MAX_PATH];
- if (!proto->getStaticString(NULL, "Password", tBuffer, sizeof(tBuffer))) {
+ if (!db_get_static(NULL, proto->m_szModuleName, "Password", tBuffer, sizeof(tBuffer))) {
tBuffer[16] = 0;
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, tBuffer);
}
@@ -601,7 +601,7 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DeleteParam *param = (DeleteParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
char szEmail[MSN_MAX_EMAIL_LEN];
- if (!param->proto->getStaticString(param->hContact, "e-mail", szEmail, sizeof(szEmail))) {
+ if (!db_get_static(param->hContact, param->proto->m_szModuleName, "e-mail", szEmail, sizeof(szEmail))) {
param->proto->MSN_AddUser(param->hContact, szEmail, 0, LIST_FL | (isHot ? LIST_REMOVE : LIST_REMOVENH));
if (isBlock) {
param->proto->MSN_AddUser(param->hContact, szEmail, 0, LIST_AL | LIST_REMOVE);
@@ -669,11 +669,11 @@ void CMsnProto::LoadOptions(void) MyOptions.ManageServer = getByte("ManageServer", TRUE) != 0;
MyOptions.ShowErrorsAsPopups = getByte("ShowErrorsAsPopups", TRUE) != 0;
MyOptions.SlowSend = getByte("SlowSend", FALSE) != 0;
- if (getStaticString(NULL, "e-mail", MyOptions.szEmail, sizeof(MyOptions.szEmail)))
+ if (db_get_static(NULL, m_szModuleName, "e-mail", MyOptions.szEmail, sizeof(MyOptions.szEmail)))
MyOptions.szEmail[0] = 0;
_strlwr(MyOptions.szEmail);
- if (getStaticString(NULL, "MachineGuid", MyOptions.szMachineGuid, sizeof(MyOptions.szMachineGuid))) {
+ if (db_get_static(NULL, m_szModuleName, "MachineGuid", MyOptions.szMachineGuid, sizeof(MyOptions.szMachineGuid))) {
char* uuid = getNewUuid();
strcpy(MyOptions.szMachineGuid, uuid);
setString("MachineGuid", MyOptions.szMachineGuid);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 46e40adbef..d6f7fbef5c 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -90,7 +90,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : delSetting("MobileAllowed");
char path[MAX_PATH];
- if (getStaticString(NULL, "LoginServer", path, sizeof(path)) == 0 &&
+ if (db_get_static(NULL, m_szModuleName, "LoginServer", path, sizeof(path)) == 0 &&
(strcmp(path, MSN_DEFAULT_LOGIN_SERVER) == 0 ||
strcmp(path, MSN_DEFAULT_GATEWAY) == 0))
delSetting("LoginServer");
@@ -291,7 +291,7 @@ int __cdecl CMsnProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) if (msnLoggedIn)
{
char email[MSN_MAX_EMAIL_LEN];
- if (getStaticString(hContact, "e-mail", email, sizeof(email)))
+ if (db_get_static(hContact, m_szModuleName, "e-mail", email, sizeof(email)))
return 1;
char* szMsg = mir_utf8encodeT(szMessage);
@@ -746,7 +746,7 @@ int __cdecl CMsnProto::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) int __cdecl CMsnProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre)
{
char tEmail[MSN_MAX_EMAIL_LEN];
- getStaticString(hContact, "e-mail", tEmail, sizeof(tEmail));
+ db_get_static(hContact, m_szModuleName, "e-mail", tEmail, sizeof(tEmail));
if (Lists_IsInList(LIST_FL, tEmail))
db_unset(hContact, "CList", "Hidden");
@@ -1025,7 +1025,7 @@ int __cdecl CMsnProto::SetStatus(int iNewStatus) else if (!msnLoggedIn && m_iStatus == ID_STATUS_OFFLINE)
{
char szPassword[100];
- int ps = getStaticString(NULL, "Password", szPassword, sizeof(szPassword));
+ int ps = db_get_static(NULL, m_szModuleName, "Password", szPassword, sizeof(szPassword));
if (ps != 0 || *szPassword == 0)
{
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index d738dca64c..8d95a7e76d 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -562,7 +562,6 @@ struct CMsnProto : public PROTO<CMsnProto> TCHAR* GetContactNameT(HANDLE hContact);
- int getStaticString(HANDLE hContact, const char* valueName, char* dest, unsigned dest_len);
int getStringUtf(HANDLE hContact, const char* name, DBVARIANT* result);
int getStringUtf(const char* name, DBVARIANT* result);
void setStringUtf(HANDLE hContact, const char* name, const char* value);
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index d602d6d96d..10f22e1df1 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -123,7 +123,7 @@ char* CMsnProto::GetABHost(const char* service, bool isSharing) mir_snprintf(hostname, sizeof(hostname), "ABHost-%s", service);
char* host = (char*)mir_alloc(256);
- if (getStaticString(NULL, hostname, host, 256))
+ if (db_get_static(NULL, m_szModuleName, hostname, host, 256))
{
mir_snprintf(host, 256, "https://byrdr.omega.contacts.msn.com/abservice/%s.asmx",
isSharing ? "SharingService" : "abservice");
diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp index bc947a30ca..0edbe6b9b0 100644 --- a/protocols/MSN/src/msn_soapstore.cpp +++ b/protocols/MSN/src/msn_soapstore.cpp @@ -75,7 +75,7 @@ char* CMsnProto::GetStoreHost(const char* service) mir_snprintf(hostname, sizeof(hostname), "StoreHost-%s", service);
char* host = (char*)mir_alloc(256);
- if (getStaticString(NULL, hostname, host, 256))
+ if (db_get_static(NULL, m_szModuleName, hostname, host, 256))
strcpy(host, "https://tkrdr.storage.msn.com/storageservice/SchematizedStore.asmx");
return host;
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index c77d2e8997..bf86fc1706 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -74,7 +74,7 @@ void CMsnProto::MSN_DeleteServerGroup(LPCSTR szId) if (msc == NULL) break;
char szGroupID[100];
- if (!getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)))
+ if (!db_get_static(msc->hContact, m_szModuleName, "GroupID", szGroupID, sizeof(szGroupID)))
{
if (strcmp(szGroupID, szId) == 0)
delSetting(msc->hContact, "GroupID");
@@ -139,10 +139,10 @@ void CMsnProto::MSN_MoveContactToGroup(HANDLE hContact, const char* grpName) LPCSTR szId = NULL;
char szContactID[100], szGroupID[100];
- if (getStaticString(hContact, "ID", szContactID, sizeof(szContactID)))
+ if (db_get_static(hContact, m_szModuleName, "ID", szContactID, sizeof(szContactID)))
return;
- if (getStaticString(hContact, "GroupID", szGroupID, sizeof(szGroupID)))
+ if (db_get_static(hContact, m_szModuleName, "GroupID", szGroupID, sizeof(szGroupID)))
szGroupID[0] = 0;
bool bInsert = false, bDelete = szGroupID[0] != 0;
@@ -194,7 +194,7 @@ void CMsnProto::MSN_RemoveEmptyGroups(void) if (msc == NULL) break;
char szGroupID[100];
- if (!getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)))
+ if (!db_get_static(msc->hContact, m_szModuleName, "GroupID", szGroupID, sizeof(szGroupID)))
{
const char *pId = szGroupID;
int i = grpList.getIndex((ServerGroupItem*)&pId);
@@ -237,7 +237,7 @@ void CMsnProto::MSN_UploadServerGroups(char* group) {
char szGroupID[100];
if (group == NULL || (strcmp(group, dbv.pszVal) == 0 &&
- getStaticString(msc->hContact, "GroupID", szGroupID, sizeof(szGroupID)) != 0))
+ db_get_static(msc->hContact, m_szModuleName, "GroupID", szGroupID, sizeof(szGroupID)) != 0))
{
MSN_MoveContactToGroup(msc->hContact, dbv.pszVal);
}
diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index 2917b8e05b..3816e2035e 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -34,23 +34,6 @@ int CMsnProto::getStringUtf(const char* name, DBVARIANT* result) { return db_get_utf(NULL, m_szModuleName, name, result);
}
-int CMsnProto::getStaticString(HANDLE hContact, const char* valueName, char* dest, unsigned dest_len)
-{
- DBVARIANT dbv;
- dbv.pszVal = dest;
- dbv.cchVal = (WORD)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);
-}
-
void CMsnProto::setStringUtf(HANDLE hContact, const char* name, const char* value)
{ db_set_utf(hContact, m_szModuleName, name, value);
}
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 518fd045a3..5ed7d2f7b3 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -480,7 +480,7 @@ int CMsnProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam) if (!strcmp(cws->szSetting, "ApparentMode"))
{
char tEmail[MSN_MAX_EMAIL_LEN];
- if (!getStaticString(hContact, "e-mail", tEmail, sizeof(tEmail)))
+ if (!db_get_static(hContact, m_szModuleName, "e-mail", tEmail, sizeof(tEmail)))
{
bool isBlocked = Lists_IsInList(LIST_BL, tEmail);
@@ -503,7 +503,7 @@ int CMsnProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam) if (!isMe || !nickChg)
{
char szContactID[100];
- if (!getStaticString(hContact, "ID", szContactID, sizeof(szContactID)))
+ if (!db_get_static(hContact, m_szModuleName, "ID", szContactID, sizeof(szContactID)))
{
if (cws->value.type != DBVT_DELETED)
{
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index 41c67ad031..a7f3027cbe 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -100,13 +100,13 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) strcpy(info->mGatewayIP, info->mServer);
else
{
- if (info->mGatewayIP[0] == 0 && getStaticString(NULL, "GatewayServer", info->mGatewayIP, sizeof(info->mGatewayIP)))
+ if (info->mGatewayIP[0] == 0 && db_get_static(NULL, m_szModuleName, "GatewayServer", info->mGatewayIP, sizeof(info->mGatewayIP)))
strcpy(info->mGatewayIP, MSN_DEFAULT_GATEWAY);
}
}
else
{
- if (info->mServer[0] == 0 && getStaticString(NULL, "DirectServer", info->mServer, sizeof(info->mServer)))
+ if (info->mServer[0] == 0 && db_get_static(NULL, m_szModuleName, "DirectServer", info->mServer, sizeof(info->mServer)))
strcpy(info->mServer, MSN_DEFAULT_LOGIN_SERVER);
}
|