summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src/utilities.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-09 22:02:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-09 22:02:18 +0000
commitd5d50b471277d5d69f59a8f29bf87201149ce191 (patch)
tree92d10ad5b0a1116ba08eca98cf025cb07578784e /protocols/IcqOscarJ/src/utilities.cpp
parent9dd56da9d9ccbce2f1e1539acb5cfcad7650916a (diff)
applied protocol helpers
git-svn-id: http://svn.miranda-ng.org/main/trunk@5305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/src/utilities.cpp')
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index 99d9b690dc..b98dd5034d 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -503,14 +503,14 @@ HANDLE CIcqProto::HContactFromUIN(DWORD dwUin, int *Added)
return INVALID_HANDLE_VALUE;
}
- setSettingDword(hContact, UNIQUEIDSETTING, dwUin);
+ setDword(hContact, UNIQUEIDSETTING, dwUin);
if (!bIsSyncingCL)
{
db_set_b(hContact, "CList", "NotOnList", 1);
setContactHidden(hContact, 1);
- setSettingWord(hContact, "Status", ID_STATUS_OFFLINE);
+ setWord(hContact, "Status", ID_STATUS_OFFLINE);
icq_QueueUser(hContact);
@@ -555,7 +555,7 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added)
{
if (strcmpnull(szContactUid, szUid))
{ // fix case in SN
- setSettingString(hContact, UNIQUEIDSETTING, szUid);
+ setString(hContact, UNIQUEIDSETTING, szUid);
}
return hContact;
}
@@ -569,14 +569,14 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added)
hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName);
- setSettingString(hContact, UNIQUEIDSETTING, szUid);
+ setString(hContact, UNIQUEIDSETTING, szUid);
if (!bIsSyncingCL)
{
db_set_b(hContact, "CList", "NotOnList", 1);
setContactHidden(hContact, 1);
- setSettingWord(hContact, "Status", ID_STATUS_OFFLINE);
+ setWord(hContact, "Status", ID_STATUS_OFFLINE);
if (icqOnline())
icq_sendNewContact(0, szUid);
@@ -959,25 +959,25 @@ char *ApplyEncoding(const char *string, const char *pszEncoding)
void CIcqProto::ResetSettingsOnListReload()
{
// Reset a bunch of session specific settings
- setSettingWord(NULL, DBSETTING_SERVLIST_PRIVACY, 0);
- setSettingWord(NULL, DBSETTING_SERVLIST_METAINFO, 0);
- setSettingWord(NULL, DBSETTING_SERVLIST_AVATAR, 0);
- setSettingWord(NULL, DBSETTING_SERVLIST_PHOTO, 0);
- setSettingWord(NULL, "SrvRecordCount", 0);
- deleteSetting(NULL, DBSETTING_SERVLIST_UNHANDLED);
+ setWord(DBSETTING_SERVLIST_PRIVACY, 0);
+ setWord(DBSETTING_SERVLIST_METAINFO, 0);
+ setWord(DBSETTING_SERVLIST_AVATAR, 0);
+ setWord(DBSETTING_SERVLIST_PHOTO, 0);
+ setWord("SrvRecordCount", 0);
+ db_unset(NULL, m_szModuleName, DBSETTING_SERVLIST_UNHANDLED);
HANDLE hContact = FindFirstContact();
while (hContact)
{
// All these values will be restored during the serv-list receive
- setSettingWord(hContact, DBSETTING_SERVLIST_ID, 0);
- setSettingWord(hContact, DBSETTING_SERVLIST_GROUP, 0);
- setSettingWord(hContact, DBSETTING_SERVLIST_PERMIT, 0);
- setSettingWord(hContact, DBSETTING_SERVLIST_DENY, 0);
- deleteSetting(hContact, DBSETTING_SERVLIST_IGNORE);
- setSettingByte(hContact, "Auth", 0);
- deleteSetting(hContact, DBSETTING_SERVLIST_DATA);
+ setWord(hContact, DBSETTING_SERVLIST_ID, 0);
+ setWord(hContact, DBSETTING_SERVLIST_GROUP, 0);
+ setWord(hContact, DBSETTING_SERVLIST_PERMIT, 0);
+ setWord(hContact, DBSETTING_SERVLIST_DENY, 0);
+ db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_IGNORE);
+ setByte(hContact, "Auth", 0);
+ db_unset(hContact, m_szModuleName, DBSETTING_SERVLIST_DATA);
hContact = FindNextContact(hContact);
}
@@ -988,21 +988,21 @@ void CIcqProto::ResetSettingsOnListReload()
void CIcqProto::ResetSettingsOnConnect()
{
// Reset a bunch of session specific settings
- setSettingByte(NULL, "SrvVisibility", 0);
- setSettingDword(NULL, "IdleTS", 0);
+ setByte("SrvVisibility", 0);
+ setDword("IdleTS", 0);
HANDLE hContact = FindFirstContact();
while (hContact)
{
- setSettingDword(hContact, "LogonTS", 0);
- setSettingDword(hContact, "IdleTS", 0);
- setSettingDword(hContact, "TickTS", 0);
- setSettingByte(hContact, "TemporaryVisible", 0);
+ setDword(hContact, "LogonTS", 0);
+ setDword(hContact, "IdleTS", 0);
+ setDword(hContact, "TickTS", 0);
+ setByte(hContact, "TemporaryVisible", 0);
// All these values will be restored during the login
if (getContactStatus(hContact) != ID_STATUS_OFFLINE)
- setSettingWord(hContact, "Status", ID_STATUS_OFFLINE);
+ setWord(hContact, "Status", ID_STATUS_OFFLINE);
hContact = FindNextContact(hContact);
}
@@ -1010,25 +1010,25 @@ void CIcqProto::ResetSettingsOnConnect()
void CIcqProto::ResetSettingsOnLoad()
{
- setSettingDword(NULL, "IdleTS", 0);
- setSettingDword(NULL, "LogonTS", 0);
+ setDword("IdleTS", 0);
+ setDword("LogonTS", 0);
HANDLE hContact = FindFirstContact();
while (hContact)
{
- setSettingDword(hContact, "LogonTS", 0);
- setSettingDword(hContact, "IdleTS", 0);
- setSettingDword(hContact, "TickTS", 0);
+ setDword(hContact, "LogonTS", 0);
+ setDword(hContact, "IdleTS", 0);
+ setDword(hContact, "TickTS", 0);
if (getContactStatus(hContact) != ID_STATUS_OFFLINE)
{
- setSettingWord(hContact, "Status", ID_STATUS_OFFLINE);
+ setWord(hContact, "Status", ID_STATUS_OFFLINE);
- deleteSetting(hContact, DBSETTING_XSTATUS_ID);
- deleteSetting(hContact, DBSETTING_XSTATUS_NAME);
- deleteSetting(hContact, DBSETTING_XSTATUS_MSG);
+ db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_ID);
+ db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME);
+ db_unset(hContact, m_szModuleName, DBSETTING_XSTATUS_MSG);
}
- setSettingByte(hContact, "DCStatus", 0);
+ setByte(hContact, "DCStatus", 0);
hContact = FindNextContact(hContact);
}
@@ -1221,7 +1221,7 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay)
char *szCurrentStatusMood = NULL;
DBVARIANT dbv = {DBVT_DELETED};
- if (m_bMoodsEnabled && !getSettingString(NULL, DBSETTING_STATUS_MOOD, &dbv))
+ if (m_bMoodsEnabled && !getString(DBSETTING_STATUS_MOOD, &dbv))
szCurrentStatusMood = dbv.pszVal;
if (!setStatusNoteText && szCurrentStatusNote)
@@ -1231,9 +1231,9 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay)
if (strcmpnull(szCurrentStatusNote, setStatusNoteText) || (m_bMoodsEnabled && strcmpnull(szCurrentStatusMood, setStatusMoodData)))
{
- setSettingStringUtf(NULL, DBSETTING_STATUS_NOTE, setStatusNoteText);
+ db_set_utf(NULL, m_szModuleName, DBSETTING_STATUS_NOTE, setStatusNoteText);
if (m_bMoodsEnabled)
- setSettingString(NULL, DBSETTING_STATUS_MOOD, setStatusMoodData);
+ setString(DBSETTING_STATUS_MOOD, setStatusMoodData);
WORD wStatusNoteLen = strlennull(setStatusNoteText);
WORD wStatusMoodLen = m_bMoodsEnabled ? strlennull(setStatusMoodData) : 0;
@@ -1328,7 +1328,7 @@ int CIcqProto::SetStatusMood(const char *szMoodData, DWORD dwDelay)
char *szCurrentStatusMood = NULL;
DBVARIANT dbv = {DBVT_DELETED};
- if (!getSettingString(NULL, DBSETTING_STATUS_MOOD, &dbv))
+ if (!getString(DBSETTING_STATUS_MOOD, &dbv))
szCurrentStatusMood = dbv.pszVal;
if (strcmpnull(szCurrentStatusMood, szMoodData))
@@ -1366,10 +1366,10 @@ void CIcqProto::writeDbInfoSettingTLVStringUtf(HANDLE hContact, const char *szSe
memcpy(str, pTLV->pData, pTLV->wLen);
str[pTLV->wLen] = '\0';
- setSettingStringUtf(hContact, szSetting, str);
+ db_set_utf(hContact, m_szModuleName, szSetting, str);
}
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
}
@@ -1378,9 +1378,9 @@ void CIcqProto::writeDbInfoSettingTLVWord(HANDLE hContact, const char *szSetting
int num = chain->getNumber(wTlv, 1);
if (num > 0)
- setSettingWord(hContact, szSetting, num);
+ setWord(hContact, szSetting, num);
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
}
@@ -1389,9 +1389,9 @@ void CIcqProto::writeDbInfoSettingTLVByte(HANDLE hContact, const char *szSetting
int num = chain->getNumber(wTlv, 1);
if (num > 0)
- setSettingByte(hContact, szSetting, num);
+ setByte(hContact, szSetting, num);
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
}
@@ -1402,7 +1402,7 @@ void CIcqProto::writeDbInfoSettingTLVDouble(HANDLE hContact, const char *szSetti
if (num > 0)
setSettingDouble(hContact, szSetting, num);
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
}
void CIcqProto::writeDbInfoSettingTLVDate(HANDLE hContact, const char* szSettingYear, const char* szSettingMonth, const char* szSettingDay, oscar_tlv_chain* chain, WORD wTlv)
@@ -1414,22 +1414,22 @@ void CIcqProto::writeDbInfoSettingTLVDate(HANDLE hContact, const char* szSetting
SYSTEMTIME sTime = {0};
if (VariantTimeToSystemTime(time + 2, &sTime))
{
- setSettingWord(hContact, szSettingYear, sTime.wYear);
- setSettingByte(hContact, szSettingMonth, (BYTE)sTime.wMonth);
- setSettingByte(hContact, szSettingDay, (BYTE)sTime.wDay);
+ setWord(hContact, szSettingYear, sTime.wYear);
+ setByte(hContact, szSettingMonth, (BYTE)sTime.wMonth);
+ setByte(hContact, szSettingDay, (BYTE)sTime.wDay);
}
else
{
- deleteSetting(hContact, szSettingYear);
- deleteSetting(hContact, szSettingMonth);
- deleteSetting(hContact, szSettingDay);
+ db_unset(hContact, m_szModuleName, szSettingYear);
+ db_unset(hContact, m_szModuleName, szSettingMonth);
+ db_unset(hContact, m_szModuleName, szSettingDay);
}
}
else
{
- deleteSetting(hContact, szSettingYear);
- deleteSetting(hContact, szSettingMonth);
- deleteSetting(hContact, szSettingDay);
+ db_unset(hContact, m_szModuleName, szSettingYear);
+ db_unset(hContact, m_szModuleName, szSettingMonth);
+ db_unset(hContact, m_szModuleName, szSettingDay);
}
}
@@ -1441,7 +1441,7 @@ void CIcqProto::writeDbInfoSettingTLVBlob(HANDLE hContact, const char *szSetting
if (pTLV && pTLV->wLen > 0)
setSettingBlob(hContact, szSetting, pTLV->pData, pTLV->wLen);
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
}
@@ -1460,7 +1460,7 @@ BOOL CIcqProto::writeDbInfoSettingString(HANDLE hContact, const char* szSetting,
if ((wLen > 0) && (**buf) && ((*buf)[wLen-1]==0)) // Make sure we have a proper string
{
- WORD wCp = getSettingWord(hContact, "InfoCodePage", getSettingWord(hContact, "InfoCP", CP_ACP));
+ WORD wCp = getWord(hContact, "InfoCodePage", getWord(hContact, "InfoCP", CP_ACP));
if (wCp != CP_ACP)
{
@@ -1468,17 +1468,17 @@ BOOL CIcqProto::writeDbInfoSettingString(HANDLE hContact, const char* szSetting,
if (szUtf)
{
- setSettingStringUtf(hContact, szSetting, szUtf);
+ db_set_utf(hContact, m_szModuleName, szSetting, szUtf);
SAFE_FREE((void**)&szUtf);
}
else
- setSettingString(hContact, szSetting, *buf);
+ setString(hContact, szSetting, *buf);
}
else
- setSettingString(hContact, szSetting, *buf);
+ setString(hContact, szSetting, *buf);
}
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
*buf += wLen;
*pwLength -= wLen;
@@ -1498,9 +1498,9 @@ BOOL CIcqProto::writeDbInfoSettingWord(HANDLE hContact, const char *szSetting, c
*pwLength -= 2;
if (wVal != 0)
- setSettingWord(hContact, szSetting, wVal);
+ setWord(hContact, szSetting, wVal);
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
return TRUE;
}
@@ -1519,9 +1519,9 @@ BOOL CIcqProto::writeDbInfoSettingWordWithTable(HANDLE hContact, const char *szS
text = LookupFieldNameUtf(table, wVal, sbuf, MAX_PATH);
if (text)
- setSettingStringUtf(hContact, szSetting, text);
+ db_set_utf(hContact, m_szModuleName, szSetting, text);
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
return TRUE;
}
@@ -1537,9 +1537,9 @@ BOOL CIcqProto::writeDbInfoSettingByte(HANDLE hContact, const char *pszSetting,
*pwLength -= 1;
if (byVal != 0)
- setSettingByte(hContact, pszSetting, byVal);
+ setByte(hContact, pszSetting, byVal);
else
- deleteSetting(hContact, pszSetting);
+ db_unset(hContact, m_szModuleName, pszSetting);
return TRUE;
}
@@ -1558,9 +1558,9 @@ BOOL CIcqProto::writeDbInfoSettingByteWithTable(HANDLE hContact, const char *szS
text = LookupFieldNameUtf(table, byVal, sbuf, MAX_PATH);
if (text)
- setSettingStringUtf(hContact, szSetting, text);
+ db_set_utf(hContact, m_szModuleName, szSetting, text);
else
- deleteSetting(hContact, szSetting);
+ db_unset(hContact, m_szModuleName, szSetting);
return TRUE;
}
@@ -1583,7 +1583,7 @@ char* time2text(time_t time)
BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType)
{
// Privacy control
- if (getSettingByte(NULL, "StatusMsgReplyCList", 0))
+ if (getByte("StatusMsgReplyCList", 0))
{
// Don't send statusmessage to unknown contacts
if (hContact == INVALID_HANDLE_VALUE)
@@ -1595,7 +1595,7 @@ BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType
return FALSE;
// Don't send statusmessage to invisible contacts
- if (getSettingByte(NULL, "StatusMsgReplyVisible", 0))
+ if (getByte("StatusMsgReplyVisible", 0))
{
WORD wStatus = getContactStatus(hContact);
if (wStatus == ID_STATUS_OFFLINE)
@@ -1605,7 +1605,7 @@ BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType
// Dont send messages to people you are hiding from
if (hContact != INVALID_HANDLE_VALUE &&
- getSettingWord(hContact, "ApparentMode", 0) == ID_STATUS_OFFLINE)
+ getWord(hContact, "ApparentMode", 0) == ID_STATUS_OFFLINE)
{
return FALSE;
}
@@ -1622,9 +1622,9 @@ BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType
}
if (hContact != INVALID_HANDLE_VALUE && m_iStatus==ID_STATUS_INVISIBLE &&
- getSettingWord(hContact, "ApparentMode", 0) != ID_STATUS_ONLINE)
+ getWord(hContact, "ApparentMode", 0) != ID_STATUS_ONLINE)
{
- if (!getSettingByte(hContact, "TemporaryVisible", 0))
+ if (!getByte(hContact, "TemporaryVisible", 0))
{ // Allow request to temporary visible contacts
return FALSE;
}
@@ -1863,11 +1863,11 @@ WORD CIcqProto::GetMyStatusFlags()
WORD wFlags = 0;
// Webaware setting bit flag
- if (getSettingByte(NULL, "WebAware", 0))
+ if (getByte("WebAware", 0))
wFlags |= STATUS_WEBAWARE;
// DC setting bit flag
- switch (getSettingByte(NULL, "DCType", 0))
+ switch (getByte("DCType", 0))
{
case 0:
break;
@@ -2089,7 +2089,7 @@ int MessageBoxUtf(HWND hWnd, const char *szText, const char *szCaption, UINT uTy
char* CIcqProto::ConvertMsgToUserSpecificAnsi(HANDLE hContact, const char* szMsg)
{ // this takes utf-8 encoded message
- WORD wCP = getSettingWord(hContact, "CodePage", m_wAnsiCodepage);
+ WORD wCP = getWord(hContact, "CodePage", m_wAnsiCodepage);
char* szAnsi = NULL;
if (wCP != CP_ACP) // convert to proper codepage