summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-05 22:27:16 +0000
commit007b4c7301f0d26a72f89f74e9929f42e24eb3e6 (patch)
treeb1ee30b70c6e36d1a06aed6885cb80dc560a68ca /protocols
parentf4a1bbc6ba4b8137cb868639ac146aa97e97e9df (diff)
- rest of menus cleared;
- old database macroses wiped out from all plugins (left in m_database.h for compatibility) git-svn-id: http://svn.miranda-ng.org/main/trunk@4324 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/AimOscar/src/avatars.cpp2
-rw-r--r--protocols/AimOscar/src/connection.cpp2
-rw-r--r--protocols/AimOscar/src/proto.cpp12
-rw-r--r--protocols/AimOscar/src/server.cpp30
-rw-r--r--protocols/AimOscar/src/services.cpp24
-rw-r--r--protocols/AimOscar/src/theme.cpp2
-rw-r--r--protocols/AimOscar/src/ui.cpp30
-rw-r--r--protocols/AimOscar/src/utility.cpp76
-rw-r--r--protocols/EmLanProto/src/mlan.cpp54
-rw-r--r--protocols/FacebookRM/src/avatars.cpp20
-rw-r--r--protocols/FacebookRM/src/communication.cpp20
-rw-r--r--protocols/FacebookRM/src/connection.cpp16
-rw-r--r--protocols/FacebookRM/src/contacts.cpp62
-rw-r--r--protocols/FacebookRM/src/db.h22
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp96
-rw-r--r--protocols/FacebookRM/src/json.cpp6
-rw-r--r--protocols/FacebookRM/src/messages.cpp24
-rw-r--r--protocols/FacebookRM/src/process.cpp66
-rw-r--r--protocols/FacebookRM/src/proto.cpp46
-rw-r--r--protocols/FacebookRM/src/theme.cpp49
-rw-r--r--protocols/FacebookRM/src/theme.h1
-rw-r--r--protocols/FacebookRM/src/utils.cpp2
-rw-r--r--protocols/GTalkExt/src/handlers.cpp2
-rw-r--r--protocols/GTalkExt/src/inbox.cpp4
-rw-r--r--protocols/GTalkExt/src/notifications.cpp10
-rw-r--r--protocols/GTalkExt/src/options.cpp8
-rw-r--r--protocols/GTalkExt/src/tipper_items.cpp20
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp22
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp24
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp26
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp12
-rw-r--r--protocols/Gadu-Gadu/src/services.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/userutils.cpp2
-rw-r--r--protocols/IRCG/src/clist.cpp30
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp48
-rw-r--r--protocols/IRCG/src/input.cpp8
-rw-r--r--protocols/IRCG/src/irclib.cpp4
-rw-r--r--protocols/IRCG/src/ircproto.cpp14
-rw-r--r--protocols/IRCG/src/options.cpp24
-rw-r--r--protocols/IRCG/src/services.cpp24
-rw-r--r--protocols/IRCG/src/tools.cpp42
-rw-r--r--protocols/IRCG/src/ui_utils.cpp20
-rw-r--r--protocols/IRCG/src/userinfo.cpp32
-rw-r--r--protocols/IRCG/src/windows.cpp16
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp4
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp6
-rw-r--r--protocols/JabberG/src/jabber_db_utils.h2
-rw-r--r--protocols/JabberG/src/jabber_events.cpp6
-rw-r--r--protocols/JabberG/src/jabber_file.cpp2
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp8
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp6
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp6
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp12
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp8
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp2
-rw-r--r--protocols/JabberG/src/jabber_std.cpp6
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp6
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp22
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp4
-rw-r--r--protocols/JabberG/src/ui_utils.cpp2
-rw-r--r--protocols/MRA/src/MraAntiSpam.cpp2
-rw-r--r--protocols/MRA/src/MraAvatars.cpp28
-rw-r--r--protocols/MRA/src/MraChat.cpp2
-rw-r--r--protocols/MRA/src/MraIcons.cpp2
-rw-r--r--protocols/MRA/src/MraProto.cpp4
-rw-r--r--protocols/MRA/src/MraProto.h21
-rw-r--r--protocols/MRA/src/Mra_functions.cpp28
-rw-r--r--protocols/MRA/src/Mra_proto.cpp10
-rw-r--r--protocols/MRA/src/Mra_svcs.cpp24
-rw-r--r--protocols/MSN/src/msn_commands.cpp8
-rw-r--r--protocols/MSN/src/msn_contact.cpp10
-rw-r--r--protocols/MSN/src/msn_mail.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp10
-rw-r--r--protocols/MSN/src/msn_opts.cpp4
-rw-r--r--protocols/MSN/src/msn_proto.cpp20
-rw-r--r--protocols/MSN/src/msn_soapab.cpp8
-rw-r--r--protocols/MSN/src/msn_srv.cpp10
-rw-r--r--protocols/MSN/src/msn_std.cpp50
-rw-r--r--protocols/MSN/src/msn_useropts.cpp4
-rw-r--r--protocols/Omegle/src/chat.cpp10
-rw-r--r--protocols/Omegle/src/communication.cpp20
-rw-r--r--protocols/Omegle/src/db.h22
-rw-r--r--protocols/Omegle/src/dialogs.cpp20
-rw-r--r--protocols/Omegle/src/proto.cpp2
-rw-r--r--protocols/Omegle/src/utils.cpp2
-rw-r--r--protocols/Tlen/src/jabber.h16
-rw-r--r--protocols/Tlen/src/jabber_iqid.cpp110
-rw-r--r--protocols/Tlen/src/jabber_misc.cpp30
-rw-r--r--protocols/Tlen/src/jabber_opt.cpp214
-rw-r--r--protocols/Tlen/src/jabber_svc.cpp110
-rw-r--r--protocols/Tlen/src/jabber_thread.cpp64
-rw-r--r--protocols/Tlen/src/tlen.cpp83
-rw-r--r--protocols/Tlen/src/tlen_avatar.cpp14
-rw-r--r--protocols/Tlen/src/tlen_muc.cpp36
-rw-r--r--protocols/Tlen/src/tlen_p2p_old.cpp20
-rw-r--r--protocols/Tlen/src/tlen_picture.cpp4
-rw-r--r--protocols/Tlen/src/tlen_presence.cpp28
-rw-r--r--protocols/Tlen/src/tlen_userinfo.cpp42
-rw-r--r--protocols/Tlen/src/tlen_voice.cpp26
-rw-r--r--protocols/Twitter/src/theme.cpp11
-rw-r--r--protocols/Xfire/src/Xfire_base.cpp40
-rw-r--r--protocols/Xfire/src/Xfire_game.cpp12
-rw-r--r--protocols/Xfire/src/Xfire_game.h2
-rw-r--r--protocols/Xfire/src/Xfire_gamelist.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_icon_mng.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_voicechat.cpp14
-rw-r--r--protocols/Xfire/src/all_statusmsg.cpp48
-rw-r--r--protocols/Xfire/src/buddylist.cpp8
-rw-r--r--protocols/Xfire/src/iniupdater.cpp12
-rw-r--r--protocols/Xfire/src/main.cpp780
-rw-r--r--protocols/Xfire/src/options.cpp106
-rw-r--r--protocols/Xfire/src/processbuddyinfo.cpp28
-rw-r--r--protocols/Xfire/src/searching4games.cpp18
-rw-r--r--protocols/Xfire/src/services.cpp42
-rw-r--r--protocols/Xfire/src/setnickname.cpp4
-rw-r--r--protocols/Xfire/src/tools.cpp4
-rw-r--r--protocols/Xfire/src/userdetails.cpp60
-rw-r--r--protocols/Xfire/src/variables.cpp36
-rw-r--r--protocols/Yahoo/src/avatar.cpp24
-rw-r--r--protocols/Yahoo/src/file_transfer.cpp2
-rw-r--r--protocols/Yahoo/src/im.cpp4
-rw-r--r--protocols/Yahoo/src/options.cpp14
-rw-r--r--protocols/Yahoo/src/proto.cpp22
-rw-r--r--protocols/Yahoo/src/services.cpp10
-rw-r--r--protocols/Yahoo/src/user_info.cpp6
-rw-r--r--protocols/Yahoo/src/util.cpp8
-rw-r--r--protocols/Yahoo/src/yahoo.cpp18
130 files changed, 1753 insertions, 1878 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp
index 2e8ab42266..26cabfb9a8 100644
--- a/protocols/AimOscar/src/avatars.cpp
+++ b/protocols/AimOscar/src/avatars.cpp
@@ -199,7 +199,7 @@ int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen
DBVARIANT dbv;
if (getTString(hContact, AIM_KEY_AH, &dbv)) return GAIR_NOAVATAR;
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (ext == NULL)
{
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index 3b98a8ae7c..216821a790 100644
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -89,7 +89,7 @@ void CAimProto::aim_connection_authorization(void)
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
goto exit;
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp
index 10d9a0a594..629bd50c3a 100644
--- a/protocols/AimOscar/src/proto.cpp
+++ b/protocols/AimOscar/src/proto.cpp
@@ -180,10 +180,10 @@ int __cdecl CAimProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage)
return 1;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
+ if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
{
add_contact_to_group(hContact, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
@@ -537,7 +537,7 @@ HANDLE __cdecl CAimProto::SendFile(HANDLE hContact, const PROTOCHAR* szDescripti
aim_send_file(hServerConn, seqno, detected_ip, ft->local_port, false, ft);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return ft;
}
@@ -722,9 +722,9 @@ void __cdecl CAimProto::get_online_msg_thread(void* arg)
const HANDLE hContact = arg;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact, MOD_KEY_CL, OTH_KEY_SM, &dbv)) {
+ if (!db_get_ts(hContact, MOD_KEY_CL, OTH_KEY_SM, &dbv)) {
sendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else sendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
@@ -827,7 +827,7 @@ int __cdecl CAimProto::UserIsTyping(HANDLE hContact, int type)
aim_typing_notification(hServerConn, seqno, dbv.pszVal, 0x0002);
else if (type == PROTOTYPE_SELFTYPING_OFF)
aim_typing_notification(hServerConn, seqno, dbv.pszVal, 0x0000);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index a56fbbaab3..883905bd86 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -545,7 +545,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
msg_exist = true;
char* msg = tlv.part(i + 6, len);
char* msg_s = process_status_msg(msg, sn);
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s);
+ db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_SM, msg_s);
TCHAR* tszMsg = mir_utf8decodeT(msg_s);
sendBroadcast(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, NULL, (LPARAM)tszMsg);
@@ -560,7 +560,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
}
if (!msg_exist)
- DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_SM);
+ db_unset(hContact, MOD_KEY_CL, OTH_KEY_SM);
}
}
else if (tlv.cmp(0x0004))//idle tlv
@@ -676,20 +676,20 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset)
{
bool ok = false;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
+ if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
{
ok = strcmp(group, dbv.pszVal) == 0;
if (strcmp(dbv.pszVal, "MetaContacts Hidden Group") == 0)
{
- DBFreeVariant(&dbv);
- if (!DBGetContactSettingStringUtf(hContact, "MetaContacts", "OldCListGroup", &dbv))
+ db_free(&dbv);
+ if (!db_get_utf(hContact, "MetaContacts", "OldCListGroup", &dbv))
{
ok = strcmp(group, dbv.pszVal) == 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -698,9 +698,9 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset)
if (!ok)
{
if (strcmp(group, AIM_DEFAULT_GROUP))
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, group);
+ db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, group);
else
- DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_GP);
+ db_unset(hContact, MOD_KEY_CL, OTH_KEY_GP);
}
}
}
@@ -714,7 +714,7 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset)
if (tlv.cmp(0x0131) && tlv.len())
{
char* nick = tlv.dup();
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, "MyHandle", nick);
+ db_set_utf(hContact, MOD_KEY_CL, "MyHandle", nick);
mir_free(nick);
nickfound = true;
}
@@ -726,7 +726,7 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset)
tlv_offset += TLV_HEADER_SIZE + tlv.len();
}
if (!nickfound && getDword(AIM_KEY_LV, 0) >= 0x80500)
- DBDeleteContactSetting(hContact, MOD_KEY_CL, "MyHandle");
+ db_unset(hContact, MOD_KEY_CL, "MyHandle");
}
break;
}
@@ -884,9 +884,9 @@ void CAimProto::modify_ssi_list(SNAC &snac, int &offset)
{
char* nick = tlv.dup();
if (nick)
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, "MyHandle", nick);
+ db_set_utf(hContact, MOD_KEY_CL, "MyHandle", nick);
else
- DBDeleteContactSetting(hContact, MOD_KEY_CL, "MyHandle");
+ db_unset(hContact, MOD_KEY_CL, "MyHandle");
mir_free(nick);
}
@@ -1058,10 +1058,10 @@ void CAimProto::snac_contact_list(SNAC &snac,HANDLE hServerConn,unsigned short &
aim_request_offline_msgs(hServerConn,seqno);
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(NULL, m_szModuleName, AIM_KEY_PR, &dbv))
+ if (!db_get_utf(NULL, m_szModuleName, AIM_KEY_PR, &dbv))
{
aim_set_profile(hServerConn, seqno, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (getDword(AIM_KEY_LV, 0) < 0x80500)
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp
index 3ab5b37754..52c9bf37ce 100644
--- a/protocols/AimOscar/src/services.cpp
+++ b/protocols/AimOscar/src/services.cpp
@@ -79,7 +79,7 @@ int CAimProto::OnWindowEvent(WPARAM wParam, LPARAM lParam)
{
if (_stricmp(dbv.pszVal, SYSTEM_BUDDY))
aim_typing_notification(hServerConn, seqno, dbv.pszVal, 0x000f);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -95,7 +95,7 @@ INT_PTR CAimProto::GetProfile(WPARAM wParam, LPARAM lParam)
{
request_HTML_profile = 1;
aim_query_profile(hServerConn, seqno, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -126,10 +126,10 @@ int CAimProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam)
if (cws->value.type == DBVT_DELETED)
{
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
+ if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
{
add_contact_to_group(hContact, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
@@ -172,7 +172,7 @@ int CAimProto::OnContactDeleted(WPARAM wParam,LPARAM /*lParam*/)
const HANDLE hContact = (HANDLE)wParam;
- if (DBGetContactSettingByte(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
+ if (db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
return 0;
DBVARIANT dbv;
@@ -194,7 +194,7 @@ int CAimProto::OnContactDeleted(WPARAM wParam,LPARAM /*lParam*/)
aim_ssi_update(hServerConn, seqno, false);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -237,7 +237,7 @@ int CAimProto::OnGroupChange(WPARAM wParam,LPARAM lParam)
else
{
if (is_my_contact(hContact) && getBuddyId(hContact, 1) &&
- !DBGetContactSettingByte(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
+ !db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0))
{
if (grpchg->pszNewName)
{
@@ -258,10 +258,10 @@ INT_PTR CAimProto::AddToServerList(WPARAM wParam, LPARAM /*lParam*/)
HANDLE hContact = (HANDLE)wParam;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
+ if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0])
{
add_contact_to_group(hContact, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
add_contact_to_group(hContact, AIM_DEFAULT_GROUP);
@@ -315,7 +315,7 @@ INT_PTR CAimProto::BlockBuddy(WPARAM wParam, LPARAM /*lParam*/)
}
break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -337,7 +337,7 @@ INT_PTR CAimProto::OnJoinChat(WPARAM wParam, LPARAM /*lParam*/)
{
chatnav_param* par = new chatnav_param(dbv.pszVal, getWord(hContact, "Exchange", 4));
ForkThread(&CAimProto::chatnav_request_thread, par);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -352,7 +352,7 @@ INT_PTR CAimProto::OnLeaveChat(WPARAM wParam, LPARAM /*lParam*/)
if (!getString(hContact, "ChatRoomID", &dbv))
{
chat_leave(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index f20de16ff5..c32409f5b2 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -255,7 +255,7 @@ int CAimProto::OnPreBuildContactMenu(WPARAM wParam,LPARAM /*lParam*/)
}
Menu_ModifyItem(hBlockContextMenuItem, &mi);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index 249a0cc573..25e04fd38e 100644
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -205,13 +205,13 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, LPARAM(ppro));
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv))
+ if (!db_get_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, &dbv))
{
html_decode(dbv.pszVal);
TCHAR *txt = mir_utf8decodeT(dbv.pszVal);
SetDlgItemText(hwndDlg, IDC_PROFILE, txt);
mir_free(txt);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -432,7 +432,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L
case IDC_SETPROFILE:
{
char* buf = rtf_to_html(hwndDlg, IDC_PROFILE);
- DBWriteContactSettingStringUtf(NULL, ppro->m_szModuleName, AIM_KEY_PR, buf);
+ db_set_utf(NULL, ppro->m_szModuleName, AIM_KEY_PR, buf);
if (ppro->state==1)
ppro->aim_set_profile(ppro->hServerConn, ppro->seqno, buf);//also see set caps for profile setting
@@ -676,12 +676,12 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (!ppro->getString(AIM_KEY_SN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_FNAME, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_EM, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_CEMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
}
@@ -699,7 +699,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
{
if (strcmp(name, dbv.pszVal))
ppro->aim_admin_format_name(ppro->hAdminConn,ppro->admin_seqno,name);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
char email[254];
@@ -708,7 +708,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
{
if (strcmp(email, dbv.pszVal))
ppro->aim_admin_change_email(ppro->hAdminConn,ppro->admin_seqno,email);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
ShowWindow(GetDlgItem(hwndDlg, IDC_PINFO), SW_HIDE);
@@ -795,28 +795,28 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (!ppro->getString(AIM_KEY_SN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_SN, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_NK, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_NK, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else if (!ppro->getString(AIM_KEY_SN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_NK, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_PW, &dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PW, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_HN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_HN, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemTextA(hwndDlg, IDC_HN, ppro->getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_SERVER_NS : AIM_DEFAULT_SERVER);
@@ -1186,14 +1186,14 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (!ppro->getString(AIM_KEY_SN, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_SN, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!ppro->getString(AIM_KEY_PW, &dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PW, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
@@ -1391,7 +1391,7 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, chat_list_item*
{
ppro->aim_chat_invite(ppro->hServerConn, ppro->seqno,
item->cookie, item->exchange, item->instance, dbv.pszVal, msg);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 549f2e4235..cabadfffb0 100644
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -94,7 +94,7 @@ void CAimProto::start_connection(void *arg)
offline_contacts();
DBVARIANT dbv;
if (!getString(AIM_KEY_SN, &dbv))
- DBFreeVariant(&dbv);
+ db_free(&dbv);
else
{
ShowPopup(LPGEN("Please, enter a username in the options dialog."), 0);
@@ -102,7 +102,7 @@ void CAimProto::start_connection(void *arg)
return;
}
if (!getString(AIM_KEY_PW, &dbv))
- DBFreeVariant(&dbv);
+ db_free(&dbv);
else
{
ShowPopup(LPGEN("Please, enter a password in the options dialog."), 0);
@@ -177,7 +177,7 @@ HANDLE CAimProto::find_chat_contact(const char* room)
if (!getString(hContact, "ChatRoomID", &dbv))
{
bool found = !strcmp(room, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (found) return hContact;
}
}
@@ -199,7 +199,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora
if (!getString(hContact, AIM_KEY_SN, &dbv))
{
bool found = !strcmp(norm_sn, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (found)
{
mir_free(norm_sn);
@@ -221,7 +221,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora
setString(hContact, AIM_KEY_NK, sn);
LOG("Adding contact %s to client side list.",norm_sn);
if (temporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
mir_free(norm_sn);
return hContact;
}
@@ -271,10 +271,10 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group)
DBVARIANT dbv;
char *nick = NULL;
- if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, "MyHandle", &dbv))
+ if (!db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv))
{
nick = NEWSTR_ALLOCA(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (getString(hContact, AIM_KEY_SN, &dbv)) return;
@@ -288,9 +288,9 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group)
setGroupId(hContact, 1, new_group_id);
if (new_group && strcmp(new_group, AIM_DEFAULT_GROUP))
- DBWriteContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, new_group);
+ db_set_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, new_group);
else
- DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_GP);
+ db_unset(hContact, MOD_KEY_CL, OTH_KEY_GP);
aim_ssi_update(hServerConn, seqno, true);
@@ -319,7 +319,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group)
aim_ssi_update(hServerConn, seqno, false);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
void CAimProto::offline_contact(HANDLE hContact, bool remove_settings)
@@ -333,7 +333,7 @@ void CAimProto::offline_contact(HANDLE hContact, bool remove_settings)
deleteGroupId(hContact, i);
}
- DBDeleteContactSetting(hContact, MOD_KEY_CL, OTH_KEY_SM);
+ db_unset(hContact, MOD_KEY_CL, OTH_KEY_SM);
}
setWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE);
}
@@ -467,10 +467,10 @@ void CAimProto::upload_nicks(void)
while (hContact)
{
DBVARIANT dbv;
- if (is_my_contact(hContact) && !DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, "MyHandle", &dbv))
+ if (is_my_contact(hContact) && !db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv))
{
set_local_nick(hContact, dbv.pszVal, NULL);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
hContact = db_find_next(hContact);
}
@@ -491,7 +491,7 @@ void CAimProto::set_local_nick(HANDLE hContact, char* nick, char* note)
aim_mod_buddy(hServerConn, seqno, dbv.pszVal, group_id, buddy_id, nick, note);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -749,105 +749,105 @@ unsigned short get_random(void)
// Standard functions
int CAimProto::deleteSetting(HANDLE hContact, const char* setting)
-{ return DBDeleteContactSetting(hContact, m_szModuleName, setting);
+{ return db_unset(hContact, m_szModuleName, setting);
}
bool CAimProto::getBool(HANDLE hContact, const char* name, bool defaultValue)
-{ return DBGetContactSettingByte(hContact, m_szModuleName, name, defaultValue) != 0;
+{ return db_get_b(hContact, m_szModuleName, name, defaultValue) != 0;
}
int CAimProto::getByte(const char* name, BYTE defaultValue)
-{ return DBGetContactSettingByte(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_b(NULL, m_szModuleName, name, defaultValue);
}
int CAimProto::getByte(HANDLE hContact, const char* name, BYTE defaultValue)
-{ return DBGetContactSettingByte(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_b(hContact, m_szModuleName, name, defaultValue);
}
int CAimProto::getDword(const char* name, DWORD defaultValue)
-{ return DBGetContactSettingDword(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_dw(NULL, m_szModuleName, name, defaultValue);
}
int CAimProto::getDword(HANDLE hContact, const char* name, DWORD defaultValue)
-{ return DBGetContactSettingDword(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_dw(hContact, m_szModuleName, name, defaultValue);
}
int CAimProto::getString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(NULL, m_szModuleName, name, result);
+{ return db_get_s(NULL, m_szModuleName, name, result);
}
int CAimProto::getString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(hContact, m_szModuleName, name, result);
+{ return db_get_s(hContact, m_szModuleName, name, result);
}
int CAimProto::getTString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingTString(NULL, m_szModuleName, name, result);
+{ return db_get_ts(NULL, m_szModuleName, name, result);
}
int CAimProto::getTString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingTString(hContact, m_szModuleName, name, result);
+{ return db_get_ts(hContact, m_szModuleName, name, result);
}
WORD CAimProto::getWord(const char* name, WORD defaultValue)
-{ return (WORD)DBGetContactSettingWord(NULL, m_szModuleName, name, defaultValue);
+{ return (WORD)db_get_w(NULL, m_szModuleName, name, defaultValue);
}
WORD CAimProto::getWord(HANDLE hContact, const char* name, WORD defaultValue)
-{ return (WORD)DBGetContactSettingWord(hContact, m_szModuleName, name, defaultValue);
+{ return (WORD)db_get_w(hContact, m_szModuleName, name, defaultValue);
}
char* CAimProto::getSetting(HANDLE hContact, const char* setting)
{
DBVARIANT dbv;
- return DBGetContactSettingString(hContact, m_szModuleName, setting, &dbv) ?
+ return db_get_s(hContact, m_szModuleName, setting, &dbv) ?
NULL : dbv.pszVal;
}
char* CAimProto::getSetting(const char* setting)
{
DBVARIANT dbv;
- return DBGetContactSettingString(NULL, m_szModuleName, setting, &dbv) ?
+ return db_get_s(NULL, m_szModuleName, setting, &dbv) ?
NULL : dbv.pszVal;
}
void CAimProto::setByte(const char* name, BYTE value)
-{ DBWriteContactSettingByte(NULL, m_szModuleName, name, value);
+{ db_set_b(NULL, m_szModuleName, name, value);
}
void CAimProto::setByte(HANDLE hContact, const char* name, BYTE value)
-{ DBWriteContactSettingByte(hContact, m_szModuleName, name, value);
+{ db_set_b(hContact, m_szModuleName, name, value);
}
void CAimProto::setDword(const char* name, DWORD value)
-{ DBWriteContactSettingDword(NULL, m_szModuleName, name, value);
+{ db_set_dw(NULL, m_szModuleName, name, value);
}
void CAimProto::setDword(HANDLE hContact, const char* name, DWORD value)
-{ DBWriteContactSettingDword(hContact, m_szModuleName, name, value);
+{ db_set_dw(hContact, m_szModuleName, name, value);
}
void CAimProto::setString(const char* name, const char* value)
-{ DBWriteContactSettingString(NULL, m_szModuleName, name, value);
+{ db_set_s(NULL, m_szModuleName, name, value);
}
void CAimProto::setString(HANDLE hContact, const char* name, const char* value)
-{ DBWriteContactSettingString(hContact, m_szModuleName, name, value);
+{ db_set_s(hContact, m_szModuleName, name, value);
}
void CAimProto::setTString(const char* name, const TCHAR* value)
-{ DBWriteContactSettingTString(NULL, m_szModuleName, name, value);
+{ db_set_ts(NULL, m_szModuleName, name, value);
}
void CAimProto::setTString(HANDLE hContact, const char* name, const TCHAR* value)
-{ DBWriteContactSettingTString(hContact, m_szModuleName, name, value);
+{ db_set_ts(hContact, m_szModuleName, name, value);
}
void CAimProto::setWord(const char* name, WORD value)
-{ DBWriteContactSettingWord(NULL, m_szModuleName, name, value);
+{ db_set_w(NULL, m_szModuleName, name, value);
}
void CAimProto::setWord(HANDLE hContact, const char* name, WORD value)
-{ DBWriteContactSettingWord(hContact, m_szModuleName, name, value);
+{ db_set_w(hContact, m_szModuleName, name, value);
}
int CAimProto::sendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp
index 09627c327f..165a18afa6 100644
--- a/protocols/EmLanProto/src/mlan.cpp
+++ b/protocols/EmLanProto/src/mlan.cpp
@@ -131,8 +131,8 @@ void CMLan::SetAllOffline()
while (hContact != NULL) {
char *svc = GetContactProto(hContact);
if (svc != NULL && lstrcmp(PROTONAME,svc) == 0) {
- DBWriteContactSettingWord(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
- DBDeleteContactSetting(hContact, PROTONAME, "IP");
+ db_set_w(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
+ db_unset(hContact, PROTONAME, "IP");
}
hContact = db_find_next(hContact);
}
@@ -212,7 +212,7 @@ void CMLan::Check()
HANDLE hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false);
if (hContact)
{
- DBWriteContactSettingWord(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
+ db_set_w(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE);
}
}
}
@@ -250,9 +250,9 @@ HANDLE CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, boo
u_long caddr = db_get_dw(res, PROTONAME, "ipaddr", -1);
if (caddr==addr.S_un.S_addr) {
if (make_permanent)
- DBDeleteContactSetting(res,"CList","NotOnList");
+ db_unset(res,"CList","NotOnList");
if (make_visible)
- DBDeleteContactSetting(res,"CList","Hidden");
+ db_unset(res,"CList","Hidden");
return res;
}
}
@@ -262,15 +262,15 @@ HANDLE CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, boo
if (add_to_list) {
res=(HANDLE)CallService(MS_DB_CONTACT_ADD,0,0);
CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)res,(LPARAM)PROTONAME);
- DBWriteContactSettingDword(res,PROTONAME, "ipaddr", addr.S_un.S_addr);
- DBWriteContactSettingString(res,PROTONAME, "Nick", nick);
+ db_set_dw(res,PROTONAME, "ipaddr", addr.S_un.S_addr);
+ db_set_s(res,PROTONAME, "Nick", nick);
if (!make_permanent)
- DBWriteContactSettingByte(res,"CList","NotOnList",1);
+ db_set_b(res,"CList","NotOnList",1);
if (!make_visible)
- DBWriteContactSettingByte(res,"CList","Hidden",1);
+ db_set_b(res,"CList","Hidden",1);
- DBWriteContactSettingWord(res,PROTONAME, "Status", status);
+ db_set_w(res,PROTONAME, "Status", status);
}
else res = NULL;
@@ -328,17 +328,17 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from)
HANDLE hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false);
if (hContact)
{
- DBWriteContactSettingWord(hContact,PROTONAME, "Status", cont->m_status);
+ db_set_w(hContact,PROTONAME, "Status", cont->m_status);
if (db_get_dw(hContact,PROTONAME, "RemoteVersion", 0)!=cont->m_ver)
- DBWriteContactSettingDword(hContact,PROTONAME, "RemoteVersion", cont->m_ver);
+ db_set_dw(hContact,PROTONAME, "RemoteVersion", cont->m_ver);
if (old_status = ID_STATUS_OFFLINE)
{
u_int rip = cont->m_addr.S_un.S_addr;
int tip = (rip<<24)|((rip&0xff00)<<8)|((rip&0xff0000)>>8)|(rip>>24);
- DBWriteContactSettingDword(hContact, PROTONAME, "IP", tip);
+ db_set_dw(hContact, PROTONAME, "IP", tip);
// HOSTENT* host = gethostbyaddr((const char*)&rip, sizeof(rip), AF_INET);
// if (host)
-// DBWriteContactSettingString(hContact, PROTONAME, "UID", host->h_name);
+// db_set_s(hContact, PROTONAME, "UID", host->h_name);
}
}
LeaveCriticalSection(&m_csAccessClass);
@@ -401,9 +401,9 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from)
// case ID_STATUS_FREECHAT: IcqStatus = ICQ_MSGTYPE_GETFFCMSG; break;
// }
// // HACK: this is a real hack
-// DBWriteContactSettingDword(hContact, "ICQ", "UIN", 1/*0xffffffff*/);
+// db_set_dw(hContact, "ICQ", "UIN", 1/*0xffffffff*/);
// NotifyEventHooks(m_hookIcqMsgReq, IcqStatus, 1/*0xffffffff*/);
-// DBDeleteContactSetting(hContact, "ICQ", "UIN");
+// db_unset(hContact, "ICQ", "UIN");
// }
EnterCriticalSection(&m_csAccessAwayMes);
@@ -457,7 +457,7 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs)
}
dbei.pBlob = (PBYTE)pre->szMessage;
- DBDeleteContactSetting(ccs->hContact,"CList","Hidden");
+ db_unset(ccs->hContact,"CList","Hidden");
db_event_add(ccs->hContact, &dbei);
}
@@ -475,8 +475,8 @@ int CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT* psr)
HANDLE contact = FindContact(addr, psr->hdr.nick, true, !TempAdd, !TempAdd, psr->stat);
if (contact!=NULL)
{
- DBWriteContactSettingWord(contact,PROTONAME,"Status", psr->stat );
- DBWriteContactSettingWord(contact,PROTONAME,"RemoteVersion", psr->ver );
+ db_set_w(contact,PROTONAME,"Status", psr->stat );
+ db_set_w(contact,PROTONAME,"RemoteVersion", psr->ver );
}
return (int)contact;
@@ -597,7 +597,7 @@ void CMLan::SearchExt(TDataHolder* hold)
void CMLan::SendMessageExt(TDataHolder* hold)
{
Sleep(0);
- if (DBGetContactSettingWord((HANDLE)hold->hContact, PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE)
+ if (db_get_w((HANDLE)hold->hContact, PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE)
{
Sleep(20);
ProtoBroadcastAck(PROTONAME, hold->hContact, (hold->op==LEXT_SENDURL)?ACKTYPE_URL:ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)hold->id, 0);
@@ -884,11 +884,11 @@ void CMLan::LoadSettings()
else {
DBVARIANT dbv;
// Deleting old 'Name' value - using 'Nick' instead of it now
- if ( DBGetContactSettingString(NULL, PROTONAME, "Nick", &dbv)) {
- if (DBGetContactSettingString(NULL, PROTONAME, "Name", &dbv))
+ if ( db_get_s(NULL, PROTONAME, "Nick", &dbv)) {
+ if (db_get_s(NULL, PROTONAME, "Name", &dbv))
dbv.pszVal = "EmLan_User";
else
- DBDeleteContactSetting(NULL, PROTONAME, "Name");
+ db_unset(NULL, PROTONAME, "Name");
}
if (!dbv.pszVal[0])
dbv.pszVal = "EmLan_User";
@@ -913,9 +913,9 @@ void CMLan::LoadSettings()
void CMLan::SaveSettings()
{
- DBWriteContactSettingDword(NULL, PROTONAME, "ipaddr", m_RequiredIp);
- DBWriteContactSettingByte(NULL, PROTONAME, "UseHostName", m_UseHostName);
- DBWriteContactSettingString(NULL, PROTONAME, "Nick", m_name);
+ db_set_dw(NULL, PROTONAME, "ipaddr", m_RequiredIp);
+ db_set_b(NULL, PROTONAME, "UseHostName", m_UseHostName);
+ db_set_s(NULL, PROTONAME, "Nick", m_name);
}
//////////////////////////////////////////////////////////////////////////
@@ -1120,7 +1120,7 @@ void CMLan::RecvFile(CCSDATA* ccs)
PROTORECVEVENT *pre = (PROTORECVEVENT *)ccs->lParam;
char *szDesc, *szFile;
- DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
+ db_unset(ccs->hContact, "CList", "Hidden");
szFile = pre->szMessage + sizeof(DWORD);
szDesc = szFile + strlen(szFile) + 1;
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp
index bb9a883d78..e73c034968 100644
--- a/protocols/FacebookRM/src/avatars.cpp
+++ b/protocols/FacebookRM/src/avatars.cpp
@@ -25,9 +25,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *url)
{
DBVARIANT dbv;
- if (!DBGetContactSettingString(ai.hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv)) {
+ if (!db_get_s(ai.hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv)) {
std::string new_url = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (new_url.empty())
return false;
@@ -35,10 +35,10 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *
if (url)
*url = new_url;
- if (!DBGetContactSettingTString(ai.hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) {
+ if (!db_get_ts(ai.hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) {
std::string ext = new_url.substr(new_url.rfind('.'));
std::tstring filename = GetAvatarFolder() + L'\\' + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
ai.hContact = ai.hContact;
ai.format = ext_to_format(ext);
@@ -57,7 +57,7 @@ void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url)
if (image_url.empty())
return;
- bool big_avatars = (bool)DBGetContactSettingByte(NULL, m_szModuleName, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS);
+ bool big_avatars = (bool)db_get_b(NULL, m_szModuleName, FACEBOOK_KEY_BIG_AVATARS, DEFAULT_BIG_AVATARS);
// We've got url to avatar of default size 32x32px, let's change it to slightly bigger (50x50px) - looks like maximum size for square format
std::tstring::size_type pos = image_url.rfind( "/s32x32/" );
@@ -73,17 +73,17 @@ void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url)
DBVARIANT dbv;
bool update_required = true;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv))
+ if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, &dbv))
{
update_required = image_url != dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (update_required || !hContact)
{
- DBWriteContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, image_url.c_str());
+ db_set_s(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, image_url.c_str());
if (hContact)
{
- DBWriteContactSettingByte(hContact, "ContactPhoto", "NeedUpdate", 1);
+ db_set_b(hContact, "ContactPhoto", "NeedUpdate", 1);
ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
else
@@ -189,7 +189,7 @@ int FacebookProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
bool needLoad;
if (AI->hContact)
- needLoad = (wParam & GAIF_FORCE) && (!fileExist || DBGetContactSettingByte(AI->hContact, "ContactPhoto", "NeedUpdate", 0));
+ needLoad = (wParam & GAIF_FORCE) && (!fileExist || db_get_b(AI->hContact, "ContactPhoto", "NeedUpdate", 0));
else
needLoad = (wParam & GAIF_FORCE) || !fileExist;
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index ace8c0176d..d6dbd885d2 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -108,7 +108,7 @@ http::response facebook_client::flap( const int request_type, std::string* reque
// is compaired in all communication requests
}
- if (DBGetContactSettingByte( NULL, parent->m_szModuleName, FACEBOOK_KEY_VALIDATE_RESPONSE, 0 ) == 1)
+ if (db_get_b( NULL, parent->m_szModuleName, FACEBOOK_KEY_VALIDATE_RESPONSE, 0 ) == 1)
validate_response(&resp);
return resp;
@@ -122,7 +122,7 @@ bool facebook_client::validate_response( http::response* resp )
return false;
}
- if (DBGetContactSettingByte( NULL, parent->m_szModuleName, FACEBOOK_KEY_VALIDATE_RESPONSE, 0 ) == 2) {
+ if (db_get_b( NULL, parent->m_szModuleName, FACEBOOK_KEY_VALIDATE_RESPONSE, 0 ) == 2) {
return true;
}
@@ -192,7 +192,7 @@ bool facebook_client::handle_error( std::string method, bool force_disconnect )
if ( force_disconnect )
result = false;
- else if ( error_count_ <= (UINT)DBGetContactSettingByte(NULL,parent->m_szModuleName,FACEBOOK_KEY_TIMEOUTS_LIMIT,FACEBOOK_TIMEOUTS_LIMIT))
+ else if ( error_count_ <= (UINT)db_get_b(NULL,parent->m_szModuleName,FACEBOOK_KEY_TIMEOUTS_LIMIT,FACEBOOK_TIMEOUTS_LIMIT))
result = true;
else
result = false;
@@ -213,7 +213,7 @@ DWORD facebook_client::choose_security_level( int request_type )
if (this->https_)
{
if ( request_type != FACEBOOK_REQUEST_MESSAGES_RECEIVE
- || DBGetContactSettingByte( NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL ))
+ || db_get_b( NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL ))
return NLHRF_SSL;
}
@@ -523,7 +523,7 @@ NETLIBHTTPHEADER* facebook_client::get_request_headers( int request_type, int* h
std::string facebook_client::get_newsfeed_type( )
{
- BYTE feed_type = DBGetContactSettingByte(NULL, parent->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, 0);
+ BYTE feed_type = db_get_b(NULL, parent->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, 0);
if (feed_type < 0 || feed_type >= SIZEOF(feed_types))
feed_type = 0;
return feed_types[feed_type].id;
@@ -658,7 +658,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw
if ( resp.headers["Location"].find("https://") != std::string::npos )
{
client_notify(TranslateT("Your account requires HTTPS connection. Activating."));
- DBWriteContactSettingByte(NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS, 1);
+ db_set_b(NULL, parent->m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS, 1);
this->https_ = true;
}
}
@@ -667,7 +667,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw
// Check for Device ID
if ( cookies["datr"].length())
- DBWriteContactSettingString( NULL, parent->m_szModuleName, FACEBOOK_KEY_DEVICE_ID, cookies["datr"].c_str());
+ db_set_s( NULL, parent->m_szModuleName, FACEBOOK_KEY_DEVICE_ID, cookies["datr"].c_str());
switch ( resp.code )
{
@@ -715,7 +715,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw
if ( cookies.find("c_user") != cookies.end())
{
this->self_.user_id = cookies.find("c_user")->second;
- DBWriteContactSettingString(NULL,parent->m_szModuleName,FACEBOOK_KEY_ID,this->self_.user_id.c_str());
+ db_set_s(NULL,parent->m_szModuleName,FACEBOOK_KEY_ID,this->self_.user_id.c_str());
parent->Log(" Got self user id: %s", this->self_.user_id.c_str());
return handle_success( "login" );
} else {
@@ -728,7 +728,7 @@ bool facebook_client::login(const std::string &username,const std::string &passw
bool facebook_client::logout( )
{
- if ( DBGetContactSettingByte(NULL, parent->m_szModuleName, FACEBOOK_KEY_DISABLE_LOGOUT, 0))
+ if ( db_get_b(NULL, parent->m_szModuleName, FACEBOOK_KEY_DISABLE_LOGOUT, 0))
return true;
handle_entry( "logout" );
@@ -1125,7 +1125,7 @@ bool facebook_client::send_message( std::string message_recipient, std::string m
{
HANDLE hContact = parent->ContactIDToHContact( message_recipient );
if (hContact != NULL)
- DBWriteContactSettingWord(hContact,parent->m_szModuleName,"Status",ID_STATUS_OFFLINE);
+ db_set_w(hContact,parent->m_szModuleName,"Status",ID_STATUS_OFFLINE);
return false;
} break;
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index 33a168929f..799a66f50e 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -140,10 +140,10 @@ bool FacebookProto::NegotiateConnection( )
DBVARIANT dbv = {0};
error = true;
- if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_LOGIN,&dbv))
+ if ( !db_get_s(NULL,m_szModuleName,FACEBOOK_KEY_LOGIN,&dbv))
{
user = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
error = user.empty();
}
if (error)
@@ -153,12 +153,12 @@ bool FacebookProto::NegotiateConnection( )
}
error = true;
- if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_PASS,&dbv))
+ if ( !db_get_s(NULL,m_szModuleName,FACEBOOK_KEY_PASS,&dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,
reinterpret_cast<LPARAM>(dbv.pszVal));
pass = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
error = pass.empty();
}
if (error)
@@ -168,20 +168,20 @@ bool FacebookProto::NegotiateConnection( )
}
// Load machine name
- if ( !DBGetContactSettingString(NULL,m_szModuleName,FACEBOOK_KEY_DEVICE_ID,&dbv))
+ if ( !db_get_s(NULL,m_szModuleName,FACEBOOK_KEY_DEVICE_ID,&dbv))
{
facy.cookies["datr"] = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// Refresh last time of feeds update
facy.last_feeds_update_ = ::time(NULL);
// Get info about secured connection
- facy.https_ = DBGetContactSettingByte(NULL, m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS, DEFAULT_FORCE_HTTPS ) != 0;
+ facy.https_ = db_get_b(NULL, m_szModuleName, FACEBOOK_KEY_FORCE_HTTPS, DEFAULT_FORCE_HTTPS ) != 0;
// Create default group for new contacts
- if (!DBGetContactSettingTString(NULL, m_szModuleName, FACEBOOK_KEY_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0)
+ if (!db_get_ts(NULL, m_szModuleName, FACEBOOK_KEY_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0)
{
CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)dbv.ptszVal);
}
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index ba9107d79e..c54060a049 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -30,7 +30,7 @@ bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat)
if( include_chat )
return true;
else
- return DBGetContactSettingByte(hContact,m_szModuleName,"ChatRoom",0) == 0;
+ return db_get_b(hContact,m_szModuleName,"ChatRoom",0) == 0;
} else {
return false;
}
@@ -46,14 +46,14 @@ HANDLE FacebookProto::ChatIDToHContact(std::string chat_id)
continue;
DBVARIANT dbv;
- if( !DBGetContactSettingString(hContact,m_szModuleName,"ChatRoomID",&dbv))
+ if( !db_get_s(hContact,m_szModuleName,"ChatRoomID",&dbv))
{
if( strcmp(chat_id.c_str(),dbv.pszVal) == 0 )
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return hContact;
} else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -71,14 +71,14 @@ HANDLE FacebookProto::ContactIDToHContact(std::string user_id)
continue;
DBVARIANT dbv;
- if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
if( strcmp(user_id.c_str(),dbv.pszVal) == 0 )
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return hContact;
} else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -103,19 +103,19 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_
{
if( CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)m_szModuleName) == 0 )
{
- DBWriteContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,fbu->user_id.c_str());
+ db_set_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,fbu->user_id.c_str());
std::string homepage = FACEBOOK_URL_PROFILE + fbu->user_id;
- DBWriteContactSettingString(hContact, m_szModuleName,"Homepage", homepage.c_str());
- DBWriteContactSettingString(hContact, m_szModuleName, "MirVer", fbu->status_id == ID_STATUS_ONTHEPHONE ? FACEBOOK_MOBILE : FACEBOOK_NAME);
+ db_set_s(hContact, m_szModuleName,"Homepage", homepage.c_str());
+ db_set_s(hContact, m_szModuleName, "MirVer", fbu->status_id == ID_STATUS_ONTHEPHONE ? FACEBOOK_MOBILE : FACEBOOK_NAME);
- DBDeleteContactSetting(hContact, "CList", "MyHandle");
+ db_unset(hContact, "CList", "MyHandle");
DBVARIANT dbv;
- if( !DBGetContactSettingTString(NULL,m_szModuleName,FACEBOOK_KEY_DEF_GROUP,&dbv))
+ if( !db_get_ts(NULL,m_szModuleName,FACEBOOK_KEY_DEF_GROUP,&dbv))
{
- DBWriteContactSettingTString(hContact,"CList","Group",dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_set_ts(hContact,"CList","Group",dbv.ptszVal);
+ db_free(&dbv);
}
if (strlen(new_name) > 0)
@@ -124,7 +124,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_
DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, new_name);
}
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, type);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, type);
if (getByte(FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, 0))
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (LPARAM)IGNOREEVENT_USERONLINE);
@@ -149,17 +149,17 @@ void FacebookProto::SetAllContactStatuses(int status, bool reset_client)
if (reset_client) {
DBVARIANT dbv;
- if (!DBGetContactSettingTString(hContact,m_szModuleName,"MirVer",&dbv)) {
+ if (!db_get_ts(hContact,m_szModuleName,"MirVer",&dbv)) {
if (_tcscmp(dbv.ptszVal, _T(FACEBOOK_NAME)))
- DBWriteContactSettingTString(hContact,m_szModuleName,"MirVer", _T(FACEBOOK_NAME));
- DBFreeVariant(&dbv);
+ db_set_ts(hContact,m_szModuleName,"MirVer", _T(FACEBOOK_NAME));
+ db_free(&dbv);
}
/*std::tstring foldername = GetAvatarFolder() + L"\\smileys\\";
TCHAR *path = _tcsdup(foldername.c_str());
- if (DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS)) {
+ if (db_get_b(NULL,m_szModuleName,FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS)) {
SMADD_CONT cont;
cont.cbSize = sizeof(SMADD_CONT);
cont.hContact = hContact;
@@ -170,8 +170,8 @@ void FacebookProto::SetAllContactStatuses(int status, bool reset_client)
}*/
}
- if (DBGetContactSettingWord(hContact,m_szModuleName,"Status",ID_STATUS_OFFLINE) != status)
- DBWriteContactSettingWord(hContact,m_szModuleName,"Status",status);
+ if (db_get_w(hContact,m_szModuleName,"Status",ID_STATUS_OFFLINE) != status)
+ db_set_w(hContact,m_szModuleName,"Status",status);
}
}
@@ -209,9 +209,9 @@ void FacebookProto::DeleteContactFromServer(void *data)
// If contact wasn't deleted from database
if (hContact != NULL)
{
- DBWriteContactSettingWord(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE);
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
- DBWriteContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
+ db_set_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
+ db_set_dw(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
}
NotifyEvent(m_tszUserName, TranslateT("Contact was removed from your server list."), NULL, FACEBOOK_EVENT_OTHER, NULL);
@@ -251,7 +251,7 @@ void FacebookProto::AddContactToServer(void *data)
// If contact wasn't deleted from database
if (hContact != NULL)
{
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_REQUEST);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_REQUEST);
}
NotifyEvent(m_tszUserName, TranslateT("Request for friendship was sent."), NULL, FACEBOOK_EVENT_OTHER, NULL);
@@ -280,10 +280,10 @@ void FacebookProto::ApproveContactToServer(void *data)
std::string get_data = "id=";
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
+ if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
{
get_data += dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
http::response resp = facy.flap( FACEBOOK_REQUEST_APPROVE_FRIEND, &post_data, &get_data );
@@ -291,7 +291,7 @@ void FacebookProto::ApproveContactToServer(void *data)
// Process result data
facy.validate_response(&resp);
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
}
void FacebookProto::CancelFriendsRequest(void *data)
@@ -309,10 +309,10 @@ void FacebookProto::CancelFriendsRequest(void *data)
query += "&__user=" + facy.self_.user_id;
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
+ if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv))
{
query += "&friend=" + std::string(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// Get unread inbox threads
@@ -323,7 +323,7 @@ void FacebookProto::CancelFriendsRequest(void *data)
if (resp.data.find("\"payload\":null", 0) != std::string::npos)
{
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
NotifyEvent(m_tszUserName, TranslateT("Request for friendship was canceled."), NULL, FACEBOOK_EVENT_OTHER, NULL);
} else {
facy.client_notify( TranslateT("Error occured when canceling friendship request."));
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h
index 25d3356574..f7a3a560f3 100644
--- a/protocols/FacebookRM/src/db.h
+++ b/protocols/FacebookRM/src/db.h
@@ -23,19 +23,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
// DB macros
-#define getByte( setting, error ) DBGetContactSettingByte( NULL, m_szModuleName, setting, error )
-#define setByte( setting, value ) DBWriteContactSettingByte( NULL, m_szModuleName, setting, value )
-#define getWord( setting, error ) DBGetContactSettingWord( NULL, m_szModuleName, setting, error )
-#define setWord( setting, value ) DBWriteContactSettingWord( NULL, m_szModuleName, setting, value )
-#define getDword( setting, error ) DBGetContactSettingDword( NULL, m_szModuleName, setting, error )
-#define setDword( setting, value ) DBWriteContactSettingDword( NULL, m_szModuleName, setting, value )
-#define getString( setting, dest ) DBGetContactSettingString( NULL, m_szModuleName, setting, dest )
-#define setString( setting, value ) DBWriteContactSettingString( NULL, m_szModuleName, setting, value )
-#define getTString( setting, dest ) DBGetContactSettingTString( NULL, m_szModuleName, setting, dest )
-#define setTString( setting, value ) DBWriteContactSettingTString( NULL, m_szModuleName, setting, value )
+#define getByte( setting, error ) db_get_b( NULL, m_szModuleName, setting, error )
+#define setByte( setting, value ) db_set_b( NULL, m_szModuleName, setting, value )
+#define getWord( setting, error ) db_get_w( NULL, m_szModuleName, setting, error )
+#define setWord( setting, value ) db_set_w( NULL, m_szModuleName, setting, value )
+#define getDword( setting, error ) db_get_dw( NULL, m_szModuleName, setting, error )
+#define setDword( setting, value ) db_set_dw( NULL, m_szModuleName, setting, value )
+#define getString( setting, dest ) db_get_s( NULL, m_szModuleName, setting, dest )
+#define setString( setting, value ) db_set_s( NULL, m_szModuleName, setting, value )
+#define getTString( setting, dest ) db_get_ts( NULL, m_szModuleName, setting, dest )
+#define setTString( setting, value ) db_set_ts( NULL, m_szModuleName, setting, value )
#define getU8String( setting, dest ) DBGetContactSettingUTF8String( NULL, m_szModuleName, setting, dest )
#define setU8String( setting, value ) DBWriteContactSettingUTF8String( NULL, m_szModuleName, setting, value )
-#define deleteSetting( setting ) DBDeleteContactSetting( NULL, m_szModuleName, setting )
+#define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting )
// DB keys
#define FACEBOOK_KEY_LOGIN "Email"
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index f30122be5d..e5bbf76d8f 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static BOOL LoadDBCheckState(FacebookProto* ppro, HWND hwnd, int idCtrl, const char* szSetting, BYTE bDef)
{
- BOOL state = DBGetContactSettingByte(NULL, ppro->m_szModuleName, szSetting, bDef);
+ BOOL state = db_get_b(NULL, ppro->m_szModuleName, szSetting, bDef);
CheckDlgButton(hwnd, idCtrl, state);
return state;
}
@@ -32,7 +32,7 @@ static BOOL LoadDBCheckState(FacebookProto* ppro, HWND hwnd, int idCtrl, const c
static BOOL StoreDBCheckState(FacebookProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
BOOL state = IsDlgButtonChecked(hwnd, idCtrl);
- DBWriteContactSettingByte(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
+ db_set_b(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
return state;
}
@@ -50,18 +50,18 @@ INT_PTR CALLBACK FBAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l
SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv))
+ if ( !db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv))
{
SetDlgItemTextA(hwnd,IDC_UN,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
+ if ( !db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,
reinterpret_cast<LPARAM>(dbv.pszVal));
SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!proto->isOffline()) {
@@ -96,11 +96,11 @@ INT_PTR CALLBACK FBAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l
char str[128];
GetDlgItemTextA(hwnd,IDC_UN,str,sizeof(str));
- DBWriteContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
+ db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str));
CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
- DBWriteContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,str);
+ db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,str);
return TRUE;
}
@@ -128,10 +128,10 @@ INT_PTR CALLBACK FBMindProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lpar
DBVARIANT dbv = { DBVT_TCHAR };
- if (!DBGetContactSettingTString(NULL,proto->m_szModuleName,FACEBOOK_KEY_NAME,&dbv))
+ if (!db_get_ts(NULL,proto->m_szModuleName,FACEBOOK_KEY_NAME,&dbv))
{
SetWindowText( hwnd, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
}
@@ -196,17 +196,17 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l
SetWindowLongPtr(hwnd,GWLP_USERDATA,lparam);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv))
+ if ( !db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv))
{
SetDlgItemTextA(hwnd,IDC_UN,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
+ if ( !db_get_s(0,proto->ModuleName(),FACEBOOK_KEY_PASS,&dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,reinterpret_cast<LPARAM>(dbv.pszVal));
SetDlgItemTextA(hwnd,IDC_PW,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!proto->isOffline())
@@ -217,10 +217,10 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l
SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, FACEBOOK_GROUP_NAME_LIMIT, 0);
- if ( !DBGetContactSettingTString(0,proto->ModuleName(),FACEBOOK_KEY_DEF_GROUP,&dbv))
+ if ( !db_get_ts(0,proto->ModuleName(),FACEBOOK_KEY_DEF_GROUP,&dbv))
{
SetDlgItemText(hwnd,IDC_GROUP,dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
LoadDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY, DEFAULT_DISABLE_STATUS_NOTIFY);
@@ -255,20 +255,20 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l
char str[128]; TCHAR tstr[128];
GetDlgItemTextA(hwnd,IDC_UN,str,sizeof(str));
- DBWriteContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
+ db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str);
GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str));
CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
- DBWriteContactSettingString(NULL,proto->m_szModuleName,FACEBOOK_KEY_PASS,str);
+ db_set_s(NULL,proto->m_szModuleName,FACEBOOK_KEY_PASS,str);
GetDlgItemText(hwnd,IDC_GROUP,tstr,sizeof(tstr));
if ( lstrlen( tstr ) > 0 )
{
- DBWriteContactSettingTString(NULL,proto->m_szModuleName,FACEBOOK_KEY_DEF_GROUP,tstr);
+ db_set_ts(NULL,proto->m_szModuleName,FACEBOOK_KEY_DEF_GROUP,tstr);
CallService( MS_CLIST_GROUPCREATE, 0, (LPARAM)tstr );
}
else
- DBDeleteContactSetting(NULL,proto->m_szModuleName,FACEBOOK_KEY_DEF_GROUP);
+ db_unset(NULL,proto->m_szModuleName,FACEBOOK_KEY_DEF_GROUP);
StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY);
StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS);
@@ -334,10 +334,10 @@ INT_PTR CALLBACK FBOptionsAdvancedProc( HWND hwnd, UINT message, WPARAM wparam,
StoreDBCheckState(proto, hwnd, IDC_CUSTOM_SMILEYS, FACEBOOK_KEY_CUSTOM_SMILEYS);
BOOL setStatus = IsDlgButtonChecked(hwnd, IDC_SET_STATUS);
- BOOL setStatusOld = DBGetContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS);
+ BOOL setStatusOld = db_get_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_SET_MIRANDA_STATUS, DEFAULT_SET_MIRANDA_STATUS);
if (setStatus != setStatusOld)
{
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_SET_MIRANDA_STATUS, setStatus);
+ db_set_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_SET_MIRANDA_STATUS, setStatus);
if (setStatus && proto->isOnline())
{
ForkThread(&FacebookProto::SetAwayMsgWorker, proto, NULL);
@@ -373,7 +373,7 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
SendDlgItemMessageA(hwnd,IDC_FEED_TYPE,CB_INSERTSTRING,i,
reinterpret_cast<LPARAM>(Translate(feed_types[i].name)));
}
- SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_SETCURSEL, DBGetContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, 0), 0);
+ SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, 0), 0);
LoadDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY, DEFAULT_SYSTRAY_NOTIFY);
LoadDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_ENABLE, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE);
@@ -381,18 +381,18 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
LoadDBCheckState(proto, hwnd, IDC_CLIENT_ENABLE, FACEBOOK_KEY_EVENT_CLIENT_ENABLE, DEFAULT_EVENT_CLIENT_ENABLE);
LoadDBCheckState(proto, hwnd, IDC_OTHER_ENABLE, FACEBOOK_KEY_EVENT_OTHER_ENABLE, DEFAULT_EVENT_OTHER_ENABLE);
- SendDlgItemMessage(hwnd, IDC_COLBACK, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK,DEFAULT_EVENT_COLBACK));
- SendDlgItemMessage(hwnd, IDC_COLTEXT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT,DEFAULT_EVENT_COLTEXT));
- SetDlgItemInt(hwnd, IDC_TIMEOUT,DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, 0),TRUE);
- SendDlgItemMessage(hwnd, IDC_COLBACK2, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLBACK,DEFAULT_EVENT_COLBACK));
- SendDlgItemMessage(hwnd, IDC_COLTEXT2, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLTEXT,DEFAULT_EVENT_COLTEXT));
- SetDlgItemInt(hwnd, IDC_TIMEOUT2,DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, 0),TRUE);
- SendDlgItemMessage(hwnd, IDC_COLBACK3, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLBACK,DEFAULT_EVENT_COLBACK));
- SendDlgItemMessage(hwnd, IDC_COLTEXT3, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLTEXT,DEFAULT_EVENT_COLTEXT));
- SetDlgItemInt(hwnd, IDC_TIMEOUT3,DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_TIMEOUT, 0),TRUE);
- SendDlgItemMessage(hwnd, IDC_COLBACK4, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLBACK,DEFAULT_EVENT_COLBACK));
- SendDlgItemMessage(hwnd, IDC_COLTEXT4, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLTEXT,DEFAULT_EVENT_COLTEXT));
- SetDlgItemInt(hwnd, IDC_TIMEOUT4,DBGetContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_TIMEOUT, 0),TRUE);
+ SendDlgItemMessage(hwnd, IDC_COLBACK, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK,DEFAULT_EVENT_COLBACK));
+ SendDlgItemMessage(hwnd, IDC_COLTEXT, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT,DEFAULT_EVENT_COLTEXT));
+ SetDlgItemInt(hwnd, IDC_TIMEOUT,db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, 0),TRUE);
+ SendDlgItemMessage(hwnd, IDC_COLBACK2, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLBACK,DEFAULT_EVENT_COLBACK));
+ SendDlgItemMessage(hwnd, IDC_COLTEXT2, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLTEXT,DEFAULT_EVENT_COLTEXT));
+ SetDlgItemInt(hwnd, IDC_TIMEOUT2,db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, 0),TRUE);
+ SendDlgItemMessage(hwnd, IDC_COLBACK3, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLBACK,DEFAULT_EVENT_COLBACK));
+ SendDlgItemMessage(hwnd, IDC_COLTEXT3, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLTEXT,DEFAULT_EVENT_COLTEXT));
+ SetDlgItemInt(hwnd, IDC_TIMEOUT3,db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_TIMEOUT, 0),TRUE);
+ SendDlgItemMessage(hwnd, IDC_COLBACK4, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLBACK,DEFAULT_EVENT_COLBACK));
+ SendDlgItemMessage(hwnd, IDC_COLTEXT4, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLTEXT,DEFAULT_EVENT_COLTEXT));
+ SetDlgItemInt(hwnd, IDC_TIMEOUT4,db_get_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_TIMEOUT, 0),TRUE);
LoadDBCheckState(proto, hwnd, IDC_NOTIFICATIONS_DEFAULT, FACEBOOK_KEY_EVENT_NOTIFICATIONS_DEFAULT, 0);
LoadDBCheckState(proto, hwnd, IDC_FEEDS_DEFAULT, FACEBOOK_KEY_EVENT_FEEDS_DEFAULT, 0);
@@ -446,7 +446,7 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
{
if ( reinterpret_cast<NMHDR*>(lparam)->code == PSN_APPLY )
{
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_FEED_TYPE, SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_GETCURSEL, 0, 0));
StoreDBCheckState(proto, hwnd, IDC_SYSTRAY_NOTIFY, FACEBOOK_KEY_SYSTRAY_NOTIFY);
@@ -460,21 +460,21 @@ INT_PTR CALLBACK FBEventsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
StoreDBCheckState(proto, hwnd, IDC_OTHER_DEFAULT, FACEBOOK_KEY_EVENT_OTHER_DEFAULT);
StoreDBCheckState(proto, hwnd, IDC_CLIENT_DEFAULT, FACEBOOK_KEY_EVENT_CLIENT_DEFAULT);
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT,NULL,TRUE));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT,NULL,TRUE));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK2,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT2,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT2,NULL,TRUE));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK2,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT2,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_FEEDS_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT2,NULL,TRUE));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK3,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT3,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT3,NULL,TRUE));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK3,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT3,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_OTHER_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT3,NULL,TRUE));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK4,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT4,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT4,NULL,TRUE));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLBACK, SendDlgItemMessage(hwnd,IDC_COLBACK4,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_COLTEXT, SendDlgItemMessage(hwnd,IDC_COLTEXT4,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_CLIENT_TIMEOUT, GetDlgItemInt(hwnd,IDC_TIMEOUT4,NULL,TRUE));
}
}
return TRUE;
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index f12740a111..89e2359dfa 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -433,7 +433,7 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess
}
else if ( type.Value() == "notification_json" ) // event notification
{
- if (!DBGetContactSettingByte(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE))
+ if (!db_get_b(NULL, proto->m_szModuleName, FACEBOOK_KEY_EVENT_NOTIFICATIONS_ENABLE, DEFAULT_EVENT_NOTIFICATIONS_ENABLE))
continue;
const Array& notificationsArray = objMember["nodes"];
@@ -470,8 +470,8 @@ int facebook_json_parser::parse_messages( void* data, std::vector< facebook_mess
HANDLE hContact = proto->AddToContactList(&fbu, FACEBOOK_CONTACT_FRIEND);
- if ( DBGetContactSettingWord(hContact,proto->m_szModuleName,"Status", 0) == ID_STATUS_OFFLINE )
- DBWriteContactSettingWord(hContact,proto->m_szModuleName,"Status",ID_STATUS_ONLINE);
+ if ( db_get_w(hContact,proto->m_szModuleName,"Status", 0) == ID_STATUS_OFFLINE )
+ db_set_w(hContact,proto->m_szModuleName,"Status",ID_STATUS_ONLINE);
const Number& state = objMember["st"];
if (state.Value() == 1)
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index 85a9f3c17a..52faf83b0d 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -26,10 +26,10 @@ int FacebookProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if ( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
ForkThread( &FacebookProto::MessagingWorker, this, new send_messaging(dbv.pszVal, FACEBOOK_RECV_MESSAGE ));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
@@ -52,7 +52,7 @@ void FacebookProto::SendMsgWorker(void *p)
{
ProtoBroadcastAck(m_szModuleName, data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, data->msgid, (LPARAM)Translate("You cannot send messages when you are offline."));
}
- else if ( !DBGetContactSettingString(data->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ else if ( !db_get_s(data->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
//parseSmileys(data->msg, data->hContact);
@@ -70,7 +70,7 @@ void FacebookProto::SendMsgWorker(void *p)
char *err = mir_utf8decodeA(error_text.c_str());
ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, data->msgid,(LPARAM)err);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
delete data;
@@ -88,9 +88,9 @@ void FacebookProto::SendChatMsgWorker(void *p)
if (hContact) {
std::string tid;
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_TID, &dbv)) {
+ if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_TID, &dbv)) {
tid = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
std::string post_data = "threads[group_ids][0]=" + data->chat_id;
post_data += "&fb_dtsg=" + (facy.dtsg_.length() ? facy.dtsg_ : "0");
@@ -101,7 +101,7 @@ void FacebookProto::SendChatMsgWorker(void *p)
facy.validate_response(&resp);
tid = utils::text::source_get_value(&resp.data, 2, "\"thread_id\":\"", "\"");
- DBWriteContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_TID, tid.c_str());
+ db_set_s(hContact, m_szModuleName, FACEBOOK_KEY_TID, tid.c_str());
Log(" Got thread info: %s = %s", data->chat_id.c_str(), tid.c_str());
}
@@ -139,8 +139,8 @@ void FacebookProto::SendTypingWorker(void *p)
send_typing *typing = static_cast<send_typing*>(p);
// Dont send typing notifications to contacts, that are offline or not friends
- if ( DBGetContactSettingWord(typing->hContact,m_szModuleName,"Status", 0) == ID_STATUS_OFFLINE
- || DBGetContactSettingByte(typing->hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND)
+ if ( db_get_w(typing->hContact,m_szModuleName,"Status", 0) == ID_STATUS_OFFLINE
+ || db_get_b(typing->hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND)
return;
// TODO RM: maybe better send typing optimalization
@@ -154,7 +154,7 @@ void FacebookProto::SendTypingWorker(void *p)
}
DBVARIANT dbv;
- if ( !DBGetContactSettingString(typing->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if ( !db_get_s(typing->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
std::string data = "&source=mercury-chat";
data += (typing->status == PROTOTYPE_SELFTYPING_ON ? "&typ=1" : "&typ=0"); // PROTOTYPE_SELFTYPING_OFF
@@ -164,7 +164,7 @@ void FacebookProto::SendTypingWorker(void *p)
http::response resp = facy.flap( FACEBOOK_REQUEST_TYPING_SEND, &data );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
delete typing;
@@ -185,7 +185,7 @@ void FacebookProto::MessagingWorker(void *p)
void FacebookProto::parseSmileys(std::string message, HANDLE hContact)
{
- if (!DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS))
+ if (!db_get_b(NULL,m_szModuleName,FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS))
return;
HANDLE nlc = NULL;
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index a89862a2f4..c1e4dcea1f 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -42,7 +42,7 @@ void FacebookProto::ProcessBuddyList( void* data )
p->parse_buddy_list( data, &facy.buddies );
delete p;
- bool use_mobile_status = DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_LOAD_MOBILE, DEFAULT_LOAD_MOBILE) != 0;
+ bool use_mobile_status = db_get_b(NULL,m_szModuleName,FACEBOOK_KEY_LOAD_MOBILE, DEFAULT_LOAD_MOBILE) != 0;
for ( List::Item< facebook_user >* i = facy.buddies.begin( ); i != NULL; )
{
@@ -73,19 +73,19 @@ void FacebookProto::ProcessBuddyList( void* data )
DBVARIANT dbv;
TCHAR* client = on_mobile ? _T(FACEBOOK_MOBILE) : _T(FACEBOOK_NAME);
- if (!DBGetContactSettingTString(hContact,m_szModuleName,"MirVer",&dbv)) {
+ if (!db_get_ts(hContact,m_szModuleName,"MirVer",&dbv)) {
if (_tcscmp(dbv.ptszVal, client))
- DBWriteContactSettingTString(hContact,m_szModuleName,"MirVer",client);
- DBFreeVariant(&dbv);
+ db_set_ts(hContact,m_szModuleName,"MirVer",client);
+ db_free(&dbv);
} else {
- DBWriteContactSettingTString(hContact,m_szModuleName,"MirVer",client);
+ db_set_ts(hContact,m_szModuleName,"MirVer",client);
}
}
if (fbu->status_id == ID_STATUS_OFFLINE || fbu->deleted)
{
if (fbu->handle)
- DBWriteContactSettingWord(fbu->handle, m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ db_set_w(fbu->handle, m_szModuleName, "Status", ID_STATUS_OFFLINE);
std::string to_delete( i->key );
i = i->next;
@@ -102,18 +102,18 @@ void FacebookProto::ProcessBuddyList( void* data )
}
}
- if (DBGetContactSettingWord(fbu->handle,m_szModuleName,"Status", 0) != fbu->status_id ) {
- DBWriteContactSettingWord(fbu->handle,m_szModuleName,"Status", fbu->status_id );
+ if (db_get_w(fbu->handle,m_szModuleName,"Status", 0) != fbu->status_id ) {
+ db_set_w(fbu->handle,m_szModuleName,"Status", fbu->status_id );
}
- if (DBGetContactSettingByte(fbu->handle, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
- DBWriteContactSettingByte(fbu->handle, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
+ if (db_get_b(fbu->handle, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
+ db_set_b(fbu->handle, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
// TODO: remove that popup and use "Contact added you" event?
}
// Wasn't contact removed from "server-list" someday?
- if ( DBGetContactSettingDword(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) {
- DBDeleteContactSetting(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED);
+ if ( db_get_dw(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) {
+ db_unset(fbu->handle, m_szModuleName, FACEBOOK_KEY_DELETED);
std::string url = FACEBOOK_URL_PROFILE + fbu->user_id;
@@ -169,9 +169,9 @@ void FacebookProto::ProcessFriendList( void* data )
DBVARIANT dbv;
facebook_user *fbu;
- if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) {
+ if ( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) {
std::string id = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
std::map< std::string, facebook_user* >::iterator iter;
@@ -185,14 +185,14 @@ void FacebookProto::ProcessFriendList( void* data )
// TODO RM: remove, because contacts cant change it, so its only for "first run"
// - but what with contacts, that was added after logon?
// Update gender
- if ( DBGetContactSettingByte(hContact, m_szModuleName, "Gender", 0) != fbu->gender )
- DBWriteContactSettingByte(hContact, m_szModuleName, "Gender", fbu->gender);
+ if ( db_get_b(hContact, m_szModuleName, "Gender", 0) != fbu->gender )
+ db_set_b(hContact, m_szModuleName, "Gender", fbu->gender);
// Update real name
if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv))
{
update_required = strcmp( dbv.pszVal, fbu->real_name.c_str()) != 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( update_required )
{
@@ -200,14 +200,14 @@ void FacebookProto::ProcessFriendList( void* data )
DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
}
- if (DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
+ if (db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND) {
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_FRIEND);
// TODO: remove that popup and use "Contact added you" event?
}
// Wasn't contact removed from "server-list" someday?
- if ( DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) {
- DBDeleteContactSetting(hContact, m_szModuleName, FACEBOOK_KEY_DELETED);
+ if ( db_get_dw(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)) {
+ db_unset(hContact, m_szModuleName, FACEBOOK_KEY_DELETED);
std::string url = FACEBOOK_URL_PROFILE + fbu->user_id;
@@ -227,17 +227,17 @@ void FacebookProto::ProcessFriendList( void* data )
// Contact was removed from "server-list", notify it
// Wasnt we already been notified about this contact? And was this real friend?
- if (!DBGetContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)
- && DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) == FACEBOOK_CONTACT_FRIEND)
+ if (!db_get_dw(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, 0)
+ && db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) == FACEBOOK_CONTACT_FRIEND)
{
- DBWriteContactSettingDword(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
+ db_set_dw(hContact, m_szModuleName, FACEBOOK_KEY_DELETED, ::time(NULL));
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_NONE);
std::string contactname = id;
if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) {
contactname = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
std::string url = FACEBOOK_URL_PROFILE + id;
@@ -259,11 +259,11 @@ void FacebookProto::ProcessFriendList( void* data )
HANDLE hContact = AddToContactList(fbu, FACEBOOK_CONTACT_FRIEND, true); // This contact is surely new
- DBWriteContactSettingByte(hContact, m_szModuleName, "Gender", fbu->gender );
+ db_set_b(hContact, m_szModuleName, "Gender", fbu->gender );
DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, fbu->real_name.c_str());
DBWriteContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NICK, fbu->real_name.c_str());
- DBWriteContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, fbu->image_url.c_str());
-// DBWriteContactSettingWord(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE );
+ db_set_s(hContact, m_szModuleName, FACEBOOK_KEY_AV_URL, fbu->image_url.c_str());
+// db_set_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE );
}
LOG("***** Friend list processed");
@@ -595,19 +595,19 @@ void FacebookProto::ProcessFriendRequests( void* )
if (fbu->user_id.length() && fbu->real_name.length())
{
HANDLE hContact = AddToContactList(fbu, FACEBOOK_CONTACT_APPROVE, false, fbu->real_name.c_str());
- DBWriteContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_APPROVE);
+ db_set_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, FACEBOOK_CONTACT_APPROVE);
bool seen = false;
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, m_szModuleName, "RequestTime", &dbv)) {
+ if (!db_get_s(hContact, m_szModuleName, "RequestTime", &dbv)) {
seen = !strcmp(dbv.pszVal, time.c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!seen) {
// This is new request
- DBWriteContactSettingString(hContact, m_szModuleName, "RequestTime", time.c_str());
+ db_set_s(hContact, m_szModuleName, "RequestTime", time.c_str());
//blob is: uin( DWORD ), hContact( HANDLE ), nick( ASCIIZ ), first( ASCIIZ ), last( ASCIIZ ), email( ASCIIZ ), reason( ASCIIZ )
//blob is: 0( DWORD ), hContact( HANDLE ), nick( ASCIIZ ), ""( ASCIIZ ), ""( ASCIIZ ), ""( ASCIIZ ), ""( ASCIIZ )
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 5b88516ffe..3dbaebea54 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -156,7 +156,7 @@ int FacebookProto::SetStatus( int new_status )
case ID_STATUS_IDLE:
default:
m_iDesiredStatus = ID_STATUS_INVISIBLE;
- if (DBGetContactSettingByte(NULL,m_szModuleName,FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES))
+ if (db_get_b(NULL,m_szModuleName,FACEBOOK_KEY_MAP_STATUSES, DEFAULT_MAP_STATUSES))
break;
case ID_STATUS_ONLINE:
case ID_STATUS_FREECHAT:
@@ -247,13 +247,13 @@ HANDLE FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
if (hContact) {
if (flags & PALF_TEMPORARY)
{
- DBWriteContactSettingByte(hContact, "Clist", "Hidden", 1);
- DBWriteContactSettingByte(hContact, "Clist", "NotOnList", 1);
+ db_set_b(hContact, "Clist", "Hidden", 1);
+ db_set_b(hContact, "Clist", "NotOnList", 1);
}
- else if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ else if (db_get_b(hContact, "CList", "NotOnList", 0))
{
- DBDeleteContactSetting(hContact, "CList", "Hidden");
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "NotOnList");
}
}
@@ -294,7 +294,7 @@ int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason)
// TODO: hide from facebook requests list
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if (db_get_b(hContact, "CList", "NotOnList", 0))
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
return 0;
@@ -312,7 +312,7 @@ int FacebookProto::GetMyAwayMsg( WPARAM wParam, LPARAM lParam )
if ( !getTString( "StatusMsg", &dbv ) && lstrlen( dbv.ptszVal ) != 0 )
{
int res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(dbv.ptszVal) : (INT_PTR)mir_t2a(dbv.ptszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return res;
} else {
return 0;
@@ -470,15 +470,15 @@ int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam)
// TODO: why isn't wParam == 0 when is status menu moved to main menu?
if (wParam != 0 && IsMyContact(hContact)) {
- if (!DBGetContactSettingString(hContact, m_szModuleName, "Homepage", &dbv)) {
+ if (!db_get_s(hContact, m_szModuleName, "Homepage", &dbv)) {
// Homepage link already present, get it
url = dbv.pszVal;
- DBFreeVariant(&dbv);
- } else if (!DBGetContactSettingString(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) {
+ db_free(&dbv);
+ } else if (!db_get_s(hContact, m_szModuleName, FACEBOOK_KEY_ID, &dbv)) {
// No homepage link, create and save it
url += dbv.pszVal;
- DBWriteContactSettingString(hContact, m_szModuleName, "Homepage", url.c_str());
- DBFreeVariant(&dbv);
+ db_set_s(hContact, m_szModuleName, "Homepage", url.c_str());
+ db_free(&dbv);
}
}
@@ -497,24 +497,24 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam)
HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
// Ignore groupchats and, if deleting, also not-friends
- if (DBGetContactSettingByte(hContact, m_szModuleName, "ChatRoom", 0)
- || (deleting && DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND))
+ if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0)
+ || (deleting && db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0) != FACEBOOK_CONTACT_FRIEND))
return 0;
DBVARIANT dbv;
TCHAR tstr[256];
- if ( !DBGetContactSettingTString(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) {
+ if ( !db_get_ts(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv)) {
mir_sntprintf(tstr,SIZEOF(tstr),TranslateT("Do you want to cancel your friendship with '%s'?"), dbv.ptszVal);
- DBFreeVariant(&dbv);
- } else if ( !DBGetContactSettingTString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) {
+ db_free(&dbv);
+ } else if ( !db_get_ts(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv)) {
mir_sntprintf(tstr,SIZEOF(tstr),TranslateT("Do you want to cancel your friendship with '%s'?"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (MessageBox( 0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) {
- if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if ( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
std::string* id = new std::string(dbv.pszVal);
@@ -526,7 +526,7 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam)
}
ForkThread( &FacebookProto::DeleteContactFromServer, this, ( void* )id );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -542,11 +542,11 @@ int FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam)
HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
+ if ( !db_get_s(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv))
{
std::string* id = new std::string(dbv.pszVal);
ForkThread( &FacebookProto::AddContactToServer, this, ( void* )id );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index c71e8df0bc..f2b14ce3bf 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -63,9 +63,7 @@ char *GetIconDescription(const char* name)
}
// Contact List menu stuff
-HANDLE hHookPreBuildMenu;
-HANDLE g_hContactMenuItems[CMITEMS_COUNT];
-HANDLE g_hContactMenuSvc[CMITEMS_COUNT];
+HGENMENU g_hContactMenuItems[CMITEMS_COUNT];
// Helper functions
static FacebookProto * GetInstanceByHContact(HANDLE hContact)
@@ -91,9 +89,7 @@ INT_PTR GlobalService(WPARAM wParam,LPARAM lParam)
static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
for (size_t i=0; i<SIZEOF(g_hContactMenuItems); i++)
- {
- EnableMenuItem(g_hContactMenuItems[i], false);
- }
+ Menu_ShowItem(g_hContactMenuItems[i], false);
FacebookProto *proto = GetInstanceByHContact(reinterpret_cast<HANDLE>(wParam));
return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0;
@@ -101,7 +97,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam)
void InitContactMenus()
{
- hHookPreBuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,PrebuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU,PrebuildContactMenu);
CLISTMENUITEM mi = {sizeof(mi)};
mi.flags = CMIF_ICONFROMICOLIB;
@@ -110,35 +106,35 @@ void InitContactMenus()
mi.icolibItem = GetIconHandle("homepage");
mi.pszName = GetIconDescription("homepage");
mi.pszService = "FacebookProto/VisitProfile";
- g_hContactMenuSvc[CMI_VISIT_PROFILE] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::VisitProfile>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::VisitProfile>);
g_hContactMenuItems[CMI_VISIT_PROFILE] = Menu_AddContactMenuItem(&mi);
mi.position=-2000006001;
mi.icolibItem = GetIconHandle("authRevoke");
mi.pszName = GetIconDescription("authRevoke");
mi.pszService = "FacebookProto/CancelFriendship";
- g_hContactMenuSvc[CMI_AUTH_REVOKE] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::CancelFriendship>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::CancelFriendship>);
g_hContactMenuItems[CMI_AUTH_REVOKE] = Menu_AddContactMenuItem(&mi);
mi.position=-2000006001;
mi.icolibItem = GetIconHandle("authRevokeReq");
mi.pszName = GetIconDescription("authRevokeReq");
mi.pszService = "FacebookProto/CancelFriendshipRequest";
- g_hContactMenuSvc[CMI_AUTH_CANCEL] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::OnCancelFriendshipRequest>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::OnCancelFriendshipRequest>);
g_hContactMenuItems[CMI_AUTH_CANCEL] = Menu_AddContactMenuItem(&mi);
mi.position=-2000006002;
mi.icolibItem = GetIconHandle("authAsk");
mi.pszName = GetIconDescription("authAsk");
mi.pszService = "FacebookProto/RequestFriendship";
- g_hContactMenuSvc[CMI_AUTH_ASK] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::RequestFriendship>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::RequestFriendship>);
g_hContactMenuItems[CMI_AUTH_ASK] = Menu_AddContactMenuItem(&mi);
mi.position=-2000006003;
mi.icolibItem = GetIconHandle("authGrant");
mi.pszName = GetIconDescription("authGrant");
mi.pszService = "FacebookProto/ApproveFriendship";
- g_hContactMenuSvc[CMI_AUTH_GRANT] = CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::ApproveFriendship>);
+ CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::ApproveFriendship>);
g_hContactMenuItems[CMI_AUTH_GRANT] = Menu_AddContactMenuItem(&mi);
}
@@ -146,39 +142,24 @@ void UninitContactMenus()
{
for(size_t i=0; i<SIZEOF(g_hContactMenuItems); i++)
CallService(MS_CLIST_REMOVECONTACTMENUITEM,(WPARAM)g_hContactMenuItems[i],0);
-
- for(size_t i=0; i<SIZEOF(g_hContactMenuSvc); i++)
- DestroyServiceFunction(g_hContactMenuSvc[i]);
-
- UnhookEvent(hHookPreBuildMenu);
-}
-
-void EnableMenuItem(HANDLE hMenuItem, bool enable)
-{
- CLISTMENUITEM clmi = { sizeof(clmi) };
- clmi.flags = CMIM_FLAGS;
- if (!enable)
- clmi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi);
}
int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam)
{
HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
- EnableMenuItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true);
+ Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true);
- if (!isOffline() && !DBGetContactSettingByte(hContact, m_szModuleName, "ChatRoom", 0))
+ if (!isOffline() && !db_get_b(hContact, m_szModuleName, "ChatRoom", 0))
{
bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
- BYTE type = DBGetContactSettingByte(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0);
+ BYTE type = db_get_b(hContact, m_szModuleName, FACEBOOK_KEY_CONTACT_TYPE, 0);
- EnableMenuItem(g_hContactMenuItems[CMI_AUTH_ASK], ctrlPressed || type == FACEBOOK_CONTACT_NONE || !type);
- EnableMenuItem(g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || type == FACEBOOK_CONTACT_APPROVE);
- EnableMenuItem(g_hContactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || type == FACEBOOK_CONTACT_FRIEND);
- EnableMenuItem(g_hContactMenuItems[CMI_AUTH_CANCEL], ctrlPressed || type == FACEBOOK_CONTACT_REQUEST);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_ASK], ctrlPressed || type == FACEBOOK_CONTACT_NONE || !type);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || type == FACEBOOK_CONTACT_APPROVE);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || type == FACEBOOK_CONTACT_FRIEND);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_CANCEL], ctrlPressed || type == FACEBOOK_CONTACT_REQUEST);
}
return 0;
diff --git a/protocols/FacebookRM/src/theme.h b/protocols/FacebookRM/src/theme.h
index 9f130958f6..e86bfa995b 100644
--- a/protocols/FacebookRM/src/theme.h
+++ b/protocols/FacebookRM/src/theme.h
@@ -27,7 +27,6 @@ HANDLE GetIconHandle(const char *name);
void InitContactMenus(void);
void UninitContactMenus(void);
-void EnableMenuItem(HANDLE hMenuItem, bool enable);
/* Contact menu item indexes */
#define CMI_VISIT_PROFILE 0
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp
index 77772175d9..ea1518f841 100644
--- a/protocols/FacebookRM/src/utils.cpp
+++ b/protocols/FacebookRM/src/utils.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
std::string utils::url::encode(const std::string &s)
{
- return mir_ptr<char>( mir_urlEncode( s.c_str()));
+ return (char*)mir_ptr<char>( mir_urlEncode( s.c_str()));
}
std::string utils::url::decode(std::string data)
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp
index e1dd02b925..fecfe82523 100644
--- a/protocols/GTalkExt/src/handlers.cpp
+++ b/protocols/GTalkExt/src/handlers.cpp
@@ -360,7 +360,7 @@ IJabberInterface* IsGoogleAccount(LPCSTR szModuleName)
if (!japi) return NULL;
DBVARIANT dbv;
- if ( DBGetContactSettingString(NULL, szModuleName, "ManualHost", &dbv))
+ if ( db_get_s(NULL, szModuleName, "ManualHost", &dbv))
return NULL;
bool res = !strcmp(dbv.pszVal, "talk.google.com");
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp
index bb699e365c..d325a90819 100644
--- a/protocols/GTalkExt/src/inbox.cpp
+++ b/protocols/GTalkExt/src/inbox.cpp
@@ -241,7 +241,7 @@ void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url)
void OpenContactInbox(LPCSTR acc)
{
DBVARIANT dbv;
- if ( DBGetContactSettingTString(0, acc, "jid", &dbv))
+ if ( db_get_ts(0, acc, "jid", &dbv))
return;
LPTSTR host = _tcschr(dbv.ptszVal, '@');
@@ -256,5 +256,5 @@ void OpenContactInbox(LPCSTR acc)
mir_sntprintf(buf, SIZEOF(buf), INBOX_URL_FORMAT, _T(""), _T("mail")); // common
OpenUrl(acc, dbv.ptszVal, buf);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp
index 995848e0e4..343112cca9 100644
--- a/protocols/GTalkExt/src/notifications.cpp
+++ b/protocols/GTalkExt/src/notifications.cpp
@@ -53,12 +53,12 @@ LPCSTR GetJidAcc(LPCTSTR jid)
DBVARIANT dbv;
for (int i=0; i < count; i++)
if (getJabberApi(protos[i]->szModuleName))
- if (!DBGetContactSettingTString(0, protos[i]->szModuleName, "jid", &dbv))
+ if (!db_get_ts(0, protos[i]->szModuleName, "jid", &dbv))
__try {
if (!lstrcmpi(jid, dbv.ptszVal)) return protos[i]->szModuleName;
}
__finally {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return NULL;
@@ -144,9 +144,9 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP
extern HICON g_hPopupIcon;
data->lchIcon = g_hPopupIcon;
- data->iSeconds = (int)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0);
- data->colorBack = (COLORREF)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0);
- data->colorText = (COLORREF)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0);
+ data->iSeconds = (int)db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0);
+ data->colorBack = (COLORREF)db_get_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0);
+ data->colorText = (COLORREF)db_get_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0);
if (data->colorBack == data->colorText) {
data->colorBack = 0;
data->colorText = 0;
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp
index 37191383f8..1d2fb700d3 100644
--- a/protocols/GTalkExt/src/options.cpp
+++ b/protocols/GTalkExt/src/options.cpp
@@ -66,7 +66,7 @@ BOOL ReadCheckbox(HWND wnd, int id, DWORD controls)
DWORD ReadCheckboxes(HWND wnd, LPCSTR mod)
{
- DWORD controls = DBGetContactSettingDword(0, NOTIFY_SETTINGS_FROM_MOD_NAME, mod, 0);
+ DWORD controls = db_get_dw(0, NOTIFY_SETTINGS_FROM_MOD_NAME, mod, 0);
ReadCheckbox(wnd, IDC_POPUPSENABLED, controls);
ReadCheckbox(wnd, IDC_POPUPSINFULLSCREEN, controls);
ReadCheckbox(wnd, IDC_AUTHONMAILBOX, controls);
@@ -171,13 +171,13 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM
case WM_INITDIALOG:
TranslateDialogDefault(wnd);
SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_SETCOLOUR, 0,
- (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0));
+ (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0));
SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_SETCOLOUR, 0,
- (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0));
+ (LPARAM)db_get_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0));
{
LPTSTR timeout = (LPTSTR)malloc(11 * sizeof(TCHAR));
__try {
- wsprintf(timeout, _T("%d"), DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0));
+ wsprintf(timeout, _T("%d"), db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0));
SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_SETTEXT, 0, (LPARAM)timeout);
}
__finally {
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp
index cacdf5878e..8acb72ce60 100644
--- a/protocols/GTalkExt/src/tipper_items.cpp
+++ b/protocols/GTalkExt/src/tipper_items.cpp
@@ -57,7 +57,7 @@ void ShiftTipperSettings(LPSTR buff, int count, LPSTR format)
if (CallService(MS_DB_CONTACT_GETSETTING, 0, (LPARAM)&cgs)) break;
__try {
if (DBVT_ASCIIZ == cws.value.type) {
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
cws.value.type = DBVT_WCHAR;
if (CallService(MS_DB_CONTACT_GETSETTING_STR, 0, (LPARAM)&cgs)) break;
}
@@ -70,7 +70,7 @@ void ShiftTipperSettings(LPSTR buff, int count, LPSTR format)
CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
}
__finally {
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
}
}
}
@@ -80,10 +80,10 @@ void SetLabelProp(int index, LPSTR setting)
sprintf(setting, LABEL_SETTING_PROP, index);
DBVARIANT dbv1 = {0};
- if (!DBGetContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv1))
+ if (!db_get_ts(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv1))
__try {
DBVARIANT dbv2 = {0};
- if (!DBGetContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, &dbv2))
+ if (!db_get_ts(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, &dbv2))
__try {
if (!lstrcmp(dbv1.ptszVal, dbv2.ptszVal)) {
LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
@@ -92,17 +92,17 @@ void SetLabelProp(int index, LPSTR setting)
}
}
__finally {
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
}
__finally {
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
}
void AddTipperItem()
{
- unsigned short itemCount = DBGetContactSettingWord(0, TIPPER_ITEMS_MOD_NAME,
+ unsigned short itemCount = db_get_w(0, TIPPER_ITEMS_MOD_NAME,
TIPPER_ITEM_COUNT_SETTING , unsigned short(-1));
if (unsigned short(-1) == itemCount) return;
@@ -116,7 +116,7 @@ void AddTipperItem()
sprintf(setting, VALUE_SETTING_PROP, i);
DBVARIANT dbv = {0};
- if (!DBGetContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv))
+ if (!db_get_ts(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv))
__try {
if (!lstrcmp(UNREAD_THREADS_RAW, dbv.ptszVal)) {
SetLabelProp(i, setting);
@@ -124,7 +124,7 @@ void AddTipperItem()
}
}
__finally {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -152,6 +152,6 @@ void AddTipperItem()
free(setting);
}
- DBWriteContactSettingWord(0, TIPPER_ITEMS_MOD_NAME,
+ db_set_w(0, TIPPER_ITEMS_MOD_NAME,
TIPPER_ITEM_COUNT_SETTING, itemCount + 1);
} \ No newline at end of file
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index f3d2b87807..674a2e37ed 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -63,7 +63,7 @@ void GGPROTO::getAvatarFilename(HANDLE hContact, TCHAR *pszDest, int cbLen)
TCHAR* avatarHashT = mir_a2t(dbv.pszVal);
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s.%s"), avatarHashT, avatartype);
mir_free(avatarHashT);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else {
mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s avatar.%s"), m_tszUserName, avatartype);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 7fb2b52aea..6d3b91fe28 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -72,7 +72,7 @@ void GGPROTO::disconnect()
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_ONLINE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case ID_STATUS_AWAY:
@@ -82,7 +82,7 @@ void GGPROTO::disconnect()
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_AWAY, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case ID_STATUS_DND:
@@ -92,7 +92,7 @@ void GGPROTO::disconnect()
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_DND, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case ID_STATUS_FREECHAT:
@@ -102,7 +102,7 @@ void GGPROTO::disconnect()
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
case ID_STATUS_INVISIBLE:
@@ -112,7 +112,7 @@ void GGPROTO::disconnect()
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_INVISIBLE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
szMsg = mir_utf8encodeT(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
default:
@@ -311,7 +311,7 @@ void __cdecl GGPROTO::mainthread(void *)
if (!db_get_s(NULL, m_szModuleName, GG_KEY_SERVERHOSTS, &dbv, DBVT_ASCIIZ))
{
hostcount = gg_decodehosts(dbv.pszVal, hosts, 64);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -320,7 +320,7 @@ void __cdecl GGPROTO::mainthread(void *)
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
p.password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -381,7 +381,7 @@ void __cdecl GGPROTO::mainthread(void *)
else
netlog("mainthread() (%x): Loading forwarding host %s and port %d.", dbv.pszVal, p.external_port, this);
if (p.external_addr) p.external_port = db_get_w(NULL, m_szModuleName, GG_KEY_FORWARDPORT, GG_KEYDEF_FORWARDPORT);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
// Setup client port
@@ -924,7 +924,7 @@ retry:
TCHAR* nickT;
if (!db_get_s(NULL, m_szModuleName, GG_KEY_NICK, &dbv, DBVT_TCHAR)){
nickT = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
nickT = mir_tstrdup(TranslateT("Me"));
}
@@ -1325,7 +1325,7 @@ int GGPROTO::contactdeleted(WPARAM wParam, LPARAM lParam)
CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gcevent);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -1402,7 +1402,7 @@ int GGPROTO::dbsettingchanged(WPARAM wParam, LPARAM lParam)
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
/* FIXME */ cascade = 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
// Change contact name on all chats
gc_changenick(hContact, ptszVal);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index 97afdbcb89..3f8a29053c 100644
--- a/protocols/Gadu-Gadu/src/dialogs.cpp
+++ b/protocols/Gadu-Gadu/src/dialogs.cpp
@@ -145,7 +145,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule,
if (!unspecified)
SetDlgItemText(hwndDlg, idCtrl, ptstr);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
////////////////////////////////////////////////////////////////////////////////
@@ -193,7 +193,7 @@ void GGPROTO::checknewuser(uin_t uin, const char* passwd)
if (!db_get_s(NULL, m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ))
{
if (dbv.pszVal) strcpy(oldpasswd, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (uin > 0 && strlen(passwd) > 0 && (uin != olduin || strcmp(oldpasswd, passwd)))
@@ -256,11 +256,11 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
{
@@ -419,14 +419,14 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_PASSWORD, "");
// Update e-mail
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_EMAIL, "");
@@ -618,7 +618,7 @@ static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
TranslateDialogDefault(hwndDlg);
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_SERVERHOSTS, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_HOST, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_HOST, GG_KEYDEF_SERVERHOSTS);
@@ -638,7 +638,7 @@ static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
CheckDlgButton(hwndDlg, IDC_FORWARDING, db_get_b(NULL, gg->m_szModuleName, GG_KEY_FORWARDING, GG_KEYDEF_FORWARDING));
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_FORWARDHOST, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (num = db_get_w(NULL, gg->m_szModuleName, GG_KEY_FORWARDPORT, GG_KEYDEF_FORWARDPORT))
SetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, ditoa(num));
@@ -983,11 +983,11 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
break;
}
@@ -1026,14 +1026,14 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_PASSWORD, "");
// Update e-mail
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv, DBVT_ASCIIZ)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else SetDlgItemTextA(hwndDlg, IDC_EMAIL, "");
}
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 1c6caf192a..133c38469f 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -688,7 +688,7 @@ void __cdecl GGPROTO::getawaymsgthread(void *hContact)
{
ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) dbv.ptszVal);
netlog("getawaymsgthread(): Reading away msg <%S>.", dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) NULL);
}
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index a0768e238f..ff8e0bfccd 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -151,7 +151,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam)
{
if (dbv.ptszVal && !_tcscmp(gch->pDest->ptszID, dbv.ptszVal))
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
hContact = db_find_next(hContact);
}
@@ -177,7 +177,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam)
TCHAR* nickT;
if (!db_get_s(NULL, m_szModuleName, GG_KEY_NICK, &dbv, DBVT_TCHAR)){
nickT = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
nickT = mir_tstrdup(TranslateT("Me"));
}
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index c0ee96e5e9..0cbded18f8 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -34,10 +34,10 @@ int GroupNameExists(const char *name)
_itoa(i, idstr, 10);
if (db_get_s(NULL, "CListGroups", idstr, &dbv, DBVT_ASCIIZ)) break;
if (!strcmp(dbv.pszVal + 1, name)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -86,7 +86,7 @@ char *CreateGroup(char *groupName)
_itoa(groupId, groupIdStr,10);
if (db_get_s(NULL, "CListGroups", groupIdStr, &dbv, DBVT_ASCIIZ))
break;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
groupName2[0] = 1|GROUPF_EXPANDED; // 1 is required so we never get '\0'
@@ -115,7 +115,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
char* pszValA = mir_t2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
string_append_c(s, ';');
// Readup LastName
@@ -124,7 +124,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
char* pszValA = mir_t2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
string_append_c(s, ';');
@@ -138,14 +138,14 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
char* pszValA = mir_t2a(dbv2.ptszVal);
string_append(s, pszValA);
mir_free(pszValA);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
} else {
string_append(s, dbvA);
}
string_append_c(s, ';');
string_append(s, dbvA);
mir_free(dbvA);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
string_append_c(s, ';');
@@ -159,14 +159,14 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
if (sms) *sms = 0;
string_append(s, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
string_append_c(s, ';');
// Readup Group
if (!db_get_s(hContact, "CList", "Group", &dbv, DBVT_ASCIIZ))
{
string_append(s, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
string_append_c(s, ';');
// Readup Uin
@@ -176,7 +176,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr)
if (!db_get_s(hContact, "UserInfo", "Mye-mail0", &dbv, DBVT_ASCIIZ))
{
string_append(s, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (cr)
string_append(s, ";0;;0;\r\n");
@@ -349,7 +349,7 @@ INT_PTR GGPROTO::import_server(WPARAM wParam, LPARAM lParam)
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
password = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else return 0;
@@ -396,7 +396,7 @@ INT_PTR GGPROTO::remove_server(WPARAM wParam, LPARAM lParam)
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
password = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else return 0;
@@ -577,7 +577,7 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam)
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
password = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else return 0;
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index a7e5ebac80..6773b61cf6 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -365,16 +365,16 @@ char* GGPROTO::oauth_header(const char *httpmethod, const char *url)
if (!db_get_s(NULL, m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, m_szModuleName, GG_KEY_TOKEN, &dbv, DBVT_ASCIIZ)) {
token = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, m_szModuleName, GG_KEY_TOKENSECRET, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
token_secret = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
res = oauth_auth_header(httpmethod, url, HMACSHA1, uin, password, token, token_secret);
@@ -399,7 +399,7 @@ int GGPROTO::oauth_receivetoken()
if (!db_get_s(NULL, m_szModuleName, GG_KEY_PASSWORD, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// 1. Obtaining an Unauthorized Request Token
@@ -562,12 +562,12 @@ int GGPROTO::oauth_checktoken(int force)
if (!db_get_s(NULL, m_szModuleName, GG_KEY_TOKEN, &dbv, DBVT_ASCIIZ)) {
token = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(NULL, m_szModuleName, GG_KEY_TOKENSECRET, &dbv, DBVT_ASCIIZ)) {
CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
token_secret = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (token == NULL || token_secret == NULL) {
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp
index 09067b1ff0..93be5e73f3 100644
--- a/protocols/Gadu-Gadu/src/services.cpp
+++ b/protocols/Gadu-Gadu/src/services.cpp
@@ -233,10 +233,10 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
netlog("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
_tcscpy_s(pai->filename, SIZEOF(pai->filename) ,dbv.ptszVal);
pai->format = GetImageFormat(pai->filename);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_SUCCESS;
} else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -257,11 +257,11 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
if (!db_get_s(pai->hContact, m_szModuleName, GG_KEY_AVATARURL, &dbv, DBVT_ASCIIZ)) {
AvatarURL = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!db_get_s(pai->hContact, m_szModuleName, GG_KEY_AVATARTS, &dbv, DBVT_ASCIIZ)) {
AvatarTs = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (AvatarURL != NULL && strlen(AvatarURL) > 0 && AvatarTs != NULL && strlen(AvatarTs) > 0) {
char *AvatarName = strrchr(AvatarURL, '/');
@@ -273,7 +273,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
if (!db_get_s(pai->hContact, m_szModuleName, GG_KEY_AVATARHASH, &dbv, DBVT_ASCIIZ)) {
AvatarSavedHash = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (AvatarHash != NULL && AvatarSavedHash != NULL) {
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp
index e92188fe59..c00d615ad1 100644
--- a/protocols/Gadu-Gadu/src/userutils.cpp
+++ b/protocols/Gadu-Gadu/src/userutils.cpp
@@ -135,7 +135,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass)
if (!db_get_s(NULL, gg->m_szModuleName, GG_KEY_EMAIL, &dbv_email, DBVT_ASCIIZ))
{
strncpy(email, dbv_email.pszVal, sizeof(email));
- DBFreeVariant(&dbv_email);
+ db_free(&dbv_email);
}
// Load token
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp
index e2b0454a35..d3f4aed5de 100644
--- a/protocols/IRCG/src/clist.cpp
+++ b/protocols/IRCG/src/clist.cpp
@@ -32,8 +32,8 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask,
CONTACT usertemp = { (TCHAR*)name.c_str(), NULL, NULL, false, false, true};
hc = CList_FindContact( &usertemp );
- if ( hc && DBGetContactSettingByte( hc, "CList", "NotOnList", 0) == 0
- && DBGetContactSettingByte(hc,"CList", "Hidden", 0) == 0)
+ if ( hc && db_get_b( hc, "CList", "NotOnList", 0) == 0
+ && db_get_b(hc,"CList", "Hidden", 0) == 0)
{
bFlag = true;
}
@@ -93,9 +93,9 @@ HANDLE CIrcProto::CList_AddContact(CONTACT * user, bool InList, bool SetOnline)
HANDLE hContact = CList_FindContact(user);
if ( hContact ) {
if ( InList )
- DBDeleteContactSetting( hContact, "CList", "NotOnList" );
+ db_unset( hContact, "CList", "NotOnList" );
setTString(hContact, "Nick", user->name);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
if (SetOnline && getWord(hContact, "Status", ID_STATUS_OFFLINE)== ID_STATUS_OFFLINE)
setWord(hContact, "Status", ID_STATUS_ONLINE);
return hContact;
@@ -107,10 +107,10 @@ HANDLE CIrcProto::CList_AddContact(CONTACT * user, bool InList, bool SetOnline)
CallService( MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM)m_szModuleName );
if ( InList )
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
else
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ db_unset(hContact, "CList", "Hidden");
setTString(hContact, "Nick", user->name);
setTString(hContact, "Default", user->name);
setWord(hContact, "Status", SetOnline ? ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
@@ -131,7 +131,7 @@ HANDLE CIrcProto::CList_SetOffline(struct CONTACT * user)
setString(hContact, "Host", "");
setTString(hContact, "Nick", dbv.ptszVal);
setWord(hContact, "Status", ID_STATUS_OFFLINE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return hContact;
} }
@@ -156,9 +156,9 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo)
else if ( !getTString( hContact, "Default", &dbv )) {
setTString( hContact, "Nick", dbv.ptszVal);
setWord( hContact, "Status", ID_STATUS_OFFLINE );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
- DBDeleteContactSetting( hContact, m_szModuleName, "IP" );
+ db_unset( hContact, m_szModuleName, "IP" );
setString( hContact, "User", "" );
setString( hContact, "Host", "" );
} }
@@ -227,11 +227,11 @@ HANDLE CIrcProto::CList_FindContact (CONTACT* user)
hContact_temp = hContact;
} }
- if ( DBDefault ) DBFreeVariant(&dbv1);
- if ( DBNick ) DBFreeVariant(&dbv2);
- if ( DBWildcard ) DBFreeVariant(&dbv3);
- if ( DBUser ) DBFreeVariant(&dbv4);
- if ( DBHost ) DBFreeVariant(&dbv5);
+ if ( DBDefault ) db_free(&dbv1);
+ if ( DBNick ) db_free(&dbv2);
+ if ( DBWildcard ) db_free(&dbv3);
+ if ( DBUser ) db_free(&dbv4);
+ if ( DBHost ) db_free(&dbv5);
if ( hContact_temp != NULL ) {
mir_free(lowercasename);
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index bd6021e292..752e764ccf 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -148,19 +148,19 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
BYTE bRoom = ppro->getByte(hContact, "ChatRoom", 0);
if ( bRoom == 0 ) {
BYTE bDCC = ppro->getByte(hContact, "DCC", 0);
- BYTE bHidden = DBGetContactSettingByte(hContact,"CList", "Hidden", 0);
+ BYTE bHidden = db_get_b(hContact,"CList", "Hidden", 0);
if ( bDCC == 0 && bHidden == 0 ) {
if ( !ppro->getTString( hContact, "Default", &dbv )) {
BYTE bAdvanced = ppro->getByte(hContact, "AdvancedMode", 0) ;
if ( !bAdvanced ) {
- DBFreeVariant( &dbv );
+ db_free( &dbv );
if ( !ppro->getTString( hContact, "Nick", &dbv )) {
ppro->m_namesToUserhost += CMString(dbv.ptszVal) + _T(" ");
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
}
else {
- DBFreeVariant( &dbv );
+ db_free( &dbv );
DBVARIANT dbv2;
TCHAR* DBNick = NULL;
@@ -175,8 +175,8 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
else if ( DBWildcard )
ppro->m_namesToWho += CMString(DBWildcard) + _T(" ");
- if ( DBNick ) DBFreeVariant(&dbv);
- if ( DBWildcard ) DBFreeVariant(&dbv2);
+ if ( DBNick ) db_free(&dbv);
+ if ( DBWildcard ) db_free(&dbv2);
} } } } }
hContact = db_find_next(hContact);
@@ -714,7 +714,7 @@ bool CIrcProto::OnIrc_PRIVMSG( const CIrcMessage* pmsg )
if (( m_ignore && IsIgnored( pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'q' ))) {
HANDLE hContact = CList_FindContact( &user );
- if ( !hContact || ( hContact && DBGetContactSettingByte( hContact,"CList", "Hidden", 0) == 1 ))
+ if ( !hContact || ( hContact && db_get_b( hContact,"CList", "Hidden", 0) == 1 ))
return true;
}
@@ -1082,8 +1082,8 @@ bool CIrcProto::IsCTCP( const CIrcMessage* pmsg )
// check if it should be ignored
if ( m_DCCChatIgnore == 1 ||
m_DCCChatIgnore == 2 && hContact &&
- DBGetContactSettingByte(hContact,"CList", "NotOnList", 0) == 0 &&
- DBGetContactSettingByte(hContact,"CList", "Hidden", 0) == 0)
+ db_get_b(hContact,"CList", "NotOnList", 0) == 0 &&
+ db_get_b(hContact,"CList", "Hidden", 0) == 0)
{
CMString host = pmsg->prefix.sUser + _T("@") + pmsg->prefix.sHost;
CList_AddDCCChat(pmsg->prefix.sNick, host, dwAdr, iPort); // add a CHAT event to the clist
@@ -1431,10 +1431,10 @@ bool CIrcProto::OnIrc_ENDNAMES( const CIrcMessage* pmsg )
else CallChatEvent( SESSION_INITDONE, (LPARAM)&gce);
if ( save.IsEmpty())
- DBDeleteContactSetting(NULL, m_szModuleName, "JTemp");
+ db_unset(NULL, m_szModuleName, "JTemp");
else
setTString("JTemp", save.c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else CallChatEvent( SESSION_INITDONE, (LPARAM)&gce);
@@ -1791,13 +1791,13 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER( const CIrcMessage* pmsg )
else {
if ( !getTString( hContact, "UWildcard", &dbv2 )) {
DoUserhostWithReason(2, ((CMString)_T("S") + dbv2.ptszVal).c_str(), true, dbv2.ptszVal );
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
else DoUserhostWithReason(2, ((CMString)_T("S") + dbv.ptszVal).c_str(), true, dbv.ptszVal );
}
setString(hContact, "User", "");
setString(hContact, "Host", "");
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} } }
ShowMessage( pmsg );
@@ -1855,10 +1855,10 @@ bool CIrcProto::OnIrc_JOINERROR( const CIrcMessage* pmsg )
save += command + _T(" ");
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ( save.IsEmpty())
- DBDeleteContactSetting( NULL, m_szModuleName, "JTemp" );
+ db_unset( NULL, m_szModuleName, "JTemp" );
else
setTString( "JTemp", save.c_str());
} }
@@ -2018,13 +2018,13 @@ bool CIrcProto::OnIrc_WHO_END( const CIrcMessage* pmsg )
setString(hContact, "Host", "");
}
LBL_Exit:
- if ( DBDefault ) DBFreeVariant(&dbv1);
- if ( DBNick ) DBFreeVariant(&dbv2);
- if ( DBWildcard ) DBFreeVariant(&dbv3);
- if ( DBUser ) DBFreeVariant(&dbv4);
- if ( DBHost ) DBFreeVariant(&dbv5);
- if ( DBManUser ) DBFreeVariant(&dbv6);
- if ( DBManHost ) DBFreeVariant(&dbv7);
+ if ( DBDefault ) db_free(&dbv1);
+ if ( DBNick ) db_free(&dbv2);
+ if ( DBWildcard ) db_free(&dbv3);
+ if ( DBUser ) db_free(&dbv4);
+ if ( DBHost ) db_free(&dbv5);
+ if ( DBManUser ) db_free(&dbv6);
+ if ( DBManHost ) db_free(&dbv7);
}
mir_free( UserList );
}
@@ -2291,7 +2291,7 @@ void CIrcProto::OnIrcDefault( const CIrcMessage* pmsg )
void CIrcProto::OnIrcDisconnected()
{
m_statusMessage = _T("");
- DBDeleteContactSetting(NULL, m_szModuleName, "JTemp");
+ db_unset(NULL, m_szModuleName, "JTemp");
bTempDisableCheck = false;
bTempForceCheck = false;
m_iTempCheckTime = 0;
@@ -2432,7 +2432,7 @@ int CIrcProto::DoPerform( const char* event )
PostIrcMessageWnd( NULL, NULL, dbv.ptszVal );
else
mir_forkthread( AwayWarningThread, NULL );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return 1;
}
return 0;
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index eafeae75fb..2f87cb1409 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -52,7 +52,7 @@ void CIrcProto::FormatMsg(CMString& text)
DBVARIANT dbv;
if ( !getTString( "PNick", &dbv )) {
sNick4Perform = dbv.ptszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
ReplaceString( sNewNick, NICKSUBSTITUTE, sNick4Perform.c_str());
@@ -579,7 +579,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac
CMString S = _T("S");
S += dbv1.ptszVal;
DoUserhostWithReason(2, S.c_str(), true, dbv1.ptszVal);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
else {
CMString S = _T("S");
@@ -653,7 +653,7 @@ BOOL CIrcProto::DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContac
if ( !getTString( hContact, "UWildcard", &dbv1 )) {
S += dbv1.ptszVal;
DoUserhostWithReason(2, S.c_str(), true, dbv1.ptszVal );
- DBFreeVariant( &dbv1 );
+ db_free( &dbv1 );
}
else {
S += two;
@@ -825,7 +825,7 @@ bool CIrcProto::PostIrcMessageWnd( TCHAR* window, HANDLE hContact, const TCHAR*
if ( hContact && !getTString( hContact, "Nick", &dbv )) {
lstrcpyn( windowname, dbv.ptszVal, 255);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else if ( window )
lstrcpyn( windowname, window, 255 );
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index e6fd017765..0ebc2d4da0 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -552,11 +552,11 @@ CDccSession* CIrcProto::FindDCCRecvByPortAndName(int iPort, const TCHAR* szName)
DBVARIANT dbv;
if ( !getTString(p->di->hContact, "Nick", &dbv)) {
if ( p->di->iType == DCC_SEND && !p->di->bSender && !lstrcmpi( szName, dbv.ptszVal) && iPort == p->di->iPort ) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
LeaveCriticalSection(&m_dcc);
return p;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 95df8741a2..55566a75c0 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -196,7 +196,7 @@ int CIrcProto::OnModulesLoaded( WPARAM, LPARAM )
NETLIBUSER nlu = {0};
TCHAR name[128];
- DBDeleteContactSetting( NULL, m_szModuleName, "JTemp" );
+ db_unset( NULL, m_szModuleName, "JTemp" );
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING|NUF_INCOMING|NUF_HTTPCONNS|NUF_TCHAR;
@@ -305,10 +305,10 @@ int CIrcProto::OnModulesLoaded( WPARAM, LPARAM )
String s = performToConvert[i];
DBVARIANT dbv;
if ( !getTString( s, &dbv )) {
- DBDeleteContactSetting( NULL, m_szModuleName, s );
+ db_unset( NULL, m_szModuleName, s );
s.MakeUpper();
setTString( s, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
setByte( "PerformConversionDone", 1 );
@@ -362,7 +362,7 @@ HANDLE __cdecl CIrcProto::AddToList( int, PROTOSEARCHRESULT* psr )
if ( !getTString(hContact, "UWildcard", &dbv1 )) {
S += dbv1.ptszVal;
DoUserhostWithReason(2, S, true, dbv1.ptszVal);
- DBFreeVariant( &dbv1 );
+ db_free( &dbv1 );
}
else {
S += user.name;
@@ -787,7 +787,7 @@ HANDLE __cdecl CIrcProto::SendFile( HANDLE hContact, const TCHAR*, TCHAR** ppszF
index++;
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
if (dci)
@@ -953,14 +953,14 @@ HANDLE __cdecl CIrcProto::GetAwayMsg( HANDLE hContact )
if ( hContact && !getTString( hContact, "Nick", &dbv)) {
int i = getWord( hContact, "Status", ID_STATUS_OFFLINE );
if ( i != ID_STATUS_AWAY) {
- DBFreeVariant( &dbv);
+ db_free( &dbv);
return 0;
}
CMString S = _T("WHOIS ");
S += dbv.ptszVal;
if (IsConnected())
SendIrcMessage( S.c_str(), false);
- DBFreeVariant( &dbv);
+ db_free( &dbv);
} }
return (HANDLE)1;
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index d05b07df1a..a0103154d7 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -52,7 +52,7 @@ void CIrcProto::ReadSettings( TDbSetting* sets, int count )
ptr[len] = 0;
}
else *( char** )ptr = mir_strdup( dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else {
if ( p->size != -1 )
@@ -69,7 +69,7 @@ void CIrcProto::ReadSettings( TDbSetting* sets, int count )
*( TCHAR* )&ptr[len*sizeof(TCHAR)] = 0;
}
else *( TCHAR** )ptr = mir_tstrdup( dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else {
if ( p->size != -1 ) {
@@ -115,7 +115,7 @@ void CIrcProto::WriteSettings( TDbSetting* sets, int count )
static int sttServerEnum( const char* szSetting, LPARAM )
{
DBVARIANT dbv;
- if ( DBGetContactSettingString( NULL, SERVERSMODULE, szSetting, &dbv ))
+ if ( db_get_s( NULL, SERVERSMODULE, szSetting, &dbv ))
return 0;
SERVER_INFO* pData = new SERVER_INFO;
@@ -159,7 +159,7 @@ static int sttServerEnum( const char* szSetting, LPARAM )
lstrcpynA( pData->m_group, p1, p2-p1+1 );
g_servers.insert( pData );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return 0;
}
@@ -814,7 +814,7 @@ void CConnectPrefsDlg::OnApply()
mir_snprintf(TextLine, sizeof(TextLine), "SERVER:SSL%u%s:%d-%dGROUP:%s", pData->m_iSSL, pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
else
mir_snprintf(TextLine, sizeof(TextLine), "SERVER:%s:%d-%dGROUP:%s", pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
- DBWriteContactSettingString( NULL, SERVERSMODULE, pData->m_name, TextLine );
+ db_set_s( NULL, SERVERSMODULE, pData->m_name, TextLine );
// combobox might contain new items
if ( g_servers.find( pData ) == NULL )
@@ -1211,7 +1211,7 @@ void COtherPrefsDlg::OnApply()
if ( !pPerf->mText.IsEmpty())
m_proto->setTString( pPerf->mSetting.c_str(), pPerf->mText.c_str());
else
- DBDeleteContactSetting( NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
+ db_unset( NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
} }
m_proto->WriteSettings( OtherSettings, SIZEOF( OtherSettings ));
}
@@ -1225,7 +1225,7 @@ void COtherPrefsDlg::addPerformComboValue( int idx, const char* szValueName )
DBVARIANT dbv;
if ( !m_proto->getTString( sSetting.c_str(), &dbv )) {
pPref = new PERFORM_INFO( sSetting.c_str(), dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else pPref = new PERFORM_INFO( sSetting.c_str(), _T(""));
m_performCombo.SetItemData( idx, ( LPARAM )pPref );
@@ -1407,7 +1407,7 @@ void CIrcProto::InitIgnore( void )
CMString flags = GetWord( dbv.ptszVal, 1 );
CMString network = GetWord( dbv.ptszVal, 2 );
m_ignoreItems.insert( new CIrcIgnoreItem( mask.c_str(), flags.c_str(), network.c_str()));
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
void CIrcProto::RewriteIgnoreSettings( void )
@@ -1417,7 +1417,7 @@ void CIrcProto::RewriteIgnoreSettings( void )
int i=0;
for ( ;; ) {
mir_snprintf( settingName, sizeof(settingName), "IGNORE:%d", i++ );
- if ( DBDeleteContactSetting( NULL, m_szModuleName, settingName ))
+ if ( db_unset( NULL, m_szModuleName, settingName ))
break;
}
@@ -1733,11 +1733,11 @@ void CIrcProto::InitPrefs(void)
int x = getDword( "SizeOfListBottom", -1 );
if ( x != -1 ) {
- DBDeleteContactSetting( NULL, m_szModuleName, "SizeOfListBottom" );
+ db_unset( NULL, m_szModuleName, "SizeOfListBottom" );
setDword( "channelList_height", x );
}
if (( x = getDword( "SizeOfListWidth", -1 )) != -1 ) {
- DBDeleteContactSetting( NULL, m_szModuleName, "SizeOfListWidth" );
+ db_unset( NULL, m_szModuleName, "SizeOfListWidth" );
setDword( "channelList_width", x );
}
@@ -1892,7 +1892,7 @@ static void sttImportIni( const TCHAR* szIniFile )
memcpy( buf2, p, int(p1-p));
buf2[ int(p1-p) ] = 0;
- DBWriteContactSettingString( NULL, SERVERSMODULE, buf2, p1 );
+ db_set_s( NULL, SERVERSMODULE, buf2, p1 );
}
fclose( serverFile );
::_tremove( szIniFile );
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index c8204ac5d6..31706f1858 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -248,7 +248,7 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM)
dcc->Disconnect();
} }
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -262,7 +262,7 @@ INT_PTR __cdecl CIrcProto::OnJoinChat(WPARAM wp, LPARAM)
if ( !getTString(( HANDLE )wp, "Nick", &dbv)) {
if ( getByte(( HANDLE )wp, "ChatRoom", 0) == GCW_CHATROOM)
PostIrcMessage( _T("/JOIN %s"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -288,7 +288,7 @@ INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM)
gcd.ptszID = ( TCHAR* )S.c_str();
CallChatEvent( SESSION_TERMINATE, (LPARAM)&gce);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -302,7 +302,7 @@ INT_PTR __cdecl CIrcProto::OnMenuChanSettings(WPARAM wp, LPARAM)
DBVARIANT dbv;
if ( !getTString( hContact, "Nick", &dbv )) {
PostIrcMessageWnd(dbv.ptszVal, NULL, _T("/CHANNELMANAGER"));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -316,7 +316,7 @@ INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM)
if ( !getTString(( HANDLE )wp, "Nick", &dbv)) {
PostIrcMessage( _T("/WHOIS %s %s"), dbv.ptszVal, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -352,10 +352,10 @@ INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM)
PostIrcMessage( _T("/IGNORE %%question=\"%s\",\"%s\",\"*!*@%S\" %s"),
TranslateT("Please enter the hostmask (nick!user@host) \nNOTE! Contacts on your contact list are never ignored"),
TranslateT("Ignore"), host, S.c_str());
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -649,7 +649,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
if ( !getTString( "Nick", &dbv )) {
PostIrcMessage( _T("/nickserv SENDPASS %s"), dbv.ptszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
break;
case 10: // nickserv set new password
@@ -940,7 +940,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
gcmi->nItems = SIZEOF(nickItems);
gcmi->Item = nickItems;
- BOOL bIsInList = (hContact && DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 0);
+ BOOL bIsInList = (hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0);
gcmi->Item[gcmi->nItems-1].bDisabled = bIsInList;
unsigned long ulAdr = 0;
@@ -1033,12 +1033,12 @@ int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM)
if ( !getString( hContact, "Host", &dbv3)) {
if (dbv3.pszVal[0] == 0)
bEnabled = false;
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
}
Menu_ShowItem(hUMenuIgnore, bEnabled);
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
}
@@ -1063,7 +1063,7 @@ int __cdecl CIrcProto::OnDbSettingChanged(WPARAM wParam, LPARAM lParam)
if ( !getTString( hContact, "Nick", &dbv )) {
if ( getByte( "MirVerAutoRequest", 1))
PostIrcMessage( _T("/PRIVMSG %s \001VERSION\001"), dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} }
return 0;
}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index a665eb205c..a656313cc2 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -25,83 +25,83 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Standard functions
int CIrcProto::getByte( const char* name, BYTE defaultValue )
-{ return DBGetContactSettingByte( NULL, m_szModuleName, name, defaultValue );
+{ return db_get_b( NULL, m_szModuleName, name, defaultValue );
}
int CIrcProto::getByte( HANDLE hContact, const char* name, BYTE defaultValue )
-{ return DBGetContactSettingByte(hContact, m_szModuleName, name, defaultValue );
+{ return db_get_b(hContact, m_szModuleName, name, defaultValue );
}
int CIrcProto::getDword( const char* name, DWORD defaultValue )
-{ return DBGetContactSettingDword( NULL, m_szModuleName, name, defaultValue );
+{ return db_get_dw( NULL, m_szModuleName, name, defaultValue );
}
int CIrcProto::getDword( HANDLE hContact, const char* name, DWORD defaultValue )
-{ return DBGetContactSettingDword(hContact, m_szModuleName, name, defaultValue );
+{ return db_get_dw(hContact, m_szModuleName, name, defaultValue );
}
int CIrcProto::getString( const char* name, DBVARIANT* result )
-{ return DBGetContactSettingString( NULL, m_szModuleName, name, result );
+{ return db_get_s( NULL, m_szModuleName, name, result );
}
int CIrcProto::getString( HANDLE hContact, const char* name, DBVARIANT* result )
-{ return DBGetContactSettingString( hContact, m_szModuleName, name, result );
+{ return db_get_s( hContact, m_szModuleName, name, result );
}
int CIrcProto::getTString( const char* name, DBVARIANT* result )
-{ return DBGetContactSettingTString( NULL, m_szModuleName, name, result );
+{ return db_get_ts( NULL, m_szModuleName, name, result );
}
int CIrcProto::getTString( HANDLE hContact, const char* name, DBVARIANT* result )
-{ return DBGetContactSettingTString( hContact, m_szModuleName, name, result );
+{ return db_get_ts( hContact, m_szModuleName, name, result );
}
int CIrcProto::getWord( const char* name, WORD defaultValue )
-{ return DBGetContactSettingWord( NULL, m_szModuleName, name, defaultValue );
+{ return db_get_w( NULL, m_szModuleName, name, defaultValue );
}
int CIrcProto::getWord( HANDLE hContact, const char* name, WORD defaultValue )
-{ return DBGetContactSettingWord(hContact, m_szModuleName, name, defaultValue );
+{ return db_get_w(hContact, m_szModuleName, name, defaultValue );
}
void CIrcProto::setByte( const char* name, BYTE value )
-{ DBWriteContactSettingByte(NULL, m_szModuleName, name, value );
+{ db_set_b(NULL, m_szModuleName, name, value );
}
void CIrcProto::setByte( HANDLE hContact, const char* name, BYTE value )
-{ DBWriteContactSettingByte(hContact, m_szModuleName, name, value );
+{ db_set_b(hContact, m_szModuleName, name, value );
}
void CIrcProto::setDword( const char* name, DWORD value )
-{ DBWriteContactSettingDword(NULL, m_szModuleName, name, value );
+{ db_set_dw(NULL, m_szModuleName, name, value );
}
void CIrcProto::setDword( HANDLE hContact, const char* name, DWORD value )
-{ DBWriteContactSettingDword(hContact, m_szModuleName, name, value );
+{ db_set_dw(hContact, m_szModuleName, name, value );
}
void CIrcProto::setString( const char* name, const char* value )
-{ DBWriteContactSettingString(NULL, m_szModuleName, name, value );
+{ db_set_s(NULL, m_szModuleName, name, value );
}
void CIrcProto::setString( HANDLE hContact, const char* name, const char* value )
-{ DBWriteContactSettingString(hContact, m_szModuleName, name, value );
+{ db_set_s(hContact, m_szModuleName, name, value );
}
void CIrcProto::setTString( const char* name, const TCHAR* value )
-{ DBWriteContactSettingTString(NULL, m_szModuleName, name, value );
+{ db_set_ts(NULL, m_szModuleName, name, value );
}
void CIrcProto::setTString( HANDLE hContact, const char* name, const TCHAR* value )
-{ DBWriteContactSettingTString(hContact, m_szModuleName, name, value );
+{ db_set_ts(hContact, m_szModuleName, name, value );
}
void CIrcProto::setWord( const char* name, int value )
-{ DBWriteContactSettingWord(NULL, m_szModuleName, name, value );
+{ db_set_w(NULL, m_szModuleName, name, value );
}
void CIrcProto::setWord( HANDLE hContact, const char* name, int value )
-{ DBWriteContactSettingWord(hContact, m_szModuleName, name, value );
+{ db_set_w(hContact, m_szModuleName, name, value );
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -126,7 +126,7 @@ void CIrcProto::AddToJTemp(TCHAR op, CMString& sCommand)
DBVARIANT dbv;
if ( !getTString( "JTemp", &dbv )) {
res = CMString(dbv.ptszVal) + _T(" ") + res;
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
setTString("JTemp", res.c_str());
diff --git a/protocols/IRCG/src/ui_utils.cpp b/protocols/IRCG/src/ui_utils.cpp
index c1cf19309f..b86263dbfd 100644
--- a/protocols/IRCG/src/ui_utils.cpp
+++ b/protocols/IRCG/src/ui_utils.cpp
@@ -1757,15 +1757,15 @@ CDbLink::~CDbLink()
mir_free(m_szSetting);
mir_free(m_szDefault);
if (dbv.type != DBVT_DELETED)
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
DWORD CDbLink::LoadInt()
{
switch (m_type) {
- case DBVT_BYTE: return DBGetContactSettingByte(NULL, m_szModule, m_szSetting, m_iDefault);
- case DBVT_WORD: return DBGetContactSettingWord(NULL, m_szModule, m_szSetting, m_iDefault);
- case DBVT_DWORD: return DBGetContactSettingDword(NULL, m_szModule, m_szSetting, m_iDefault);
+ case DBVT_BYTE: return db_get_b(NULL, m_szModule, m_szSetting, m_iDefault);
+ case DBVT_WORD: return db_get_w(NULL, m_szModule, m_szSetting, m_iDefault);
+ case DBVT_DWORD: return db_get_dw(NULL, m_szModule, m_szSetting, m_iDefault);
default: return m_iDefault;
}
}
@@ -1773,16 +1773,16 @@ DWORD CDbLink::LoadInt()
void CDbLink::SaveInt(DWORD value)
{
switch (m_type) {
- case DBVT_BYTE: DBWriteContactSettingByte(NULL, m_szModule, m_szSetting, (BYTE)value); break;
- case DBVT_WORD: DBWriteContactSettingWord(NULL, m_szModule, m_szSetting, (WORD)value); break;
- case DBVT_DWORD: DBWriteContactSettingDword(NULL, m_szModule, m_szSetting, value); break;
+ case DBVT_BYTE: db_set_b(NULL, m_szModule, m_szSetting, (BYTE)value); break;
+ case DBVT_WORD: db_set_w(NULL, m_szModule, m_szSetting, (WORD)value); break;
+ case DBVT_DWORD: db_set_dw(NULL, m_szModule, m_szSetting, value); break;
}
}
TCHAR* CDbLink::LoadText()
{
- if (dbv.type != DBVT_DELETED) DBFreeVariant(&dbv);
- if (!DBGetContactSettingTString(NULL, m_szModule, m_szSetting, &dbv))
+ if (dbv.type != DBVT_DELETED) db_free(&dbv);
+ if (!db_get_ts(NULL, m_szModule, m_szSetting, &dbv))
{
if (dbv.type == DBVT_TCHAR)
return dbv.ptszVal;
@@ -1795,7 +1795,7 @@ TCHAR* CDbLink::LoadText()
void CDbLink::SaveText(TCHAR *value)
{
- DBWriteContactSettingTString(NULL, m_szModule, m_szSetting, value);
+ db_set_ts(NULL, m_szModule, m_szSetting, value);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index 35a23f3ca1..ef79488499 100644
--- a/protocols/IRCG/src/userinfo.cpp
+++ b/protocols/IRCG/src/userinfo.cpp
@@ -66,24 +66,24 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_BASIC));
if ( !p->ppro->getTString( p->hContact, "Default", &dbv)) {
SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else {
SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
if ( !p->ppro->getTString( p->hContact, "UWildcard", &dbv)) {
SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
if ( !p->ppro->getTString( p->hContact, "UUser", &dbv)) {
SetDlgItemText( m_hwnd, IDC_USER, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !p->ppro->getTString( p->hContact, "UHost", &dbv)) {
SetDlgItemText( m_hwnd, IDC_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
ProtoBroadcastAck(p->ppro->m_szModuleName, p->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
}
@@ -119,17 +119,17 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
S += _T(")");
if (( lstrlen(temp) < 4 && lstrlen(temp)) || !WCCmp(CharLower(temp), CharLower(dbv.ptszVal))) {
MessageBox( NULL, TranslateTS( S.c_str()), TranslateT( "IRC error" ), MB_OK | MB_ICONERROR );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return FALSE;
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
GetDlgItemText( m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
if ( lstrlen( GetWord(temp, 0).c_str()))
p->ppro->setTString( p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UWildcard");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UWildcard");
}
p->ppro->setByte( p->hContact, "AdvancedMode", bAdvanced);
@@ -138,13 +138,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
if (lstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString( p->hContact, "UUser", GetWord(temp, 0).c_str());
else
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UUser");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UUser");
GetDlgItemText( m_hwnd, IDC_HOST, temp, SIZEOF(temp));
if (lstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString( p->hContact, "UHost", GetWord(temp, 0).c_str());
else
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UHost");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UHost");
EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON), FALSE);
}
@@ -154,9 +154,9 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
SetDlgItemTextA( m_hwnd, IDC_WILDCARD, "");
SetDlgItemTextA( m_hwnd, IDC_HOST, "" );
SetDlgItemTextA( m_hwnd, IDC_USER, "" );
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UWildcard");
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UUser");
- DBDeleteContactSetting( p->hContact, p->ppro->m_szModuleName, "UHost");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UWildcard");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UUser");
+ db_unset( p->hContact, p->ppro->m_szModuleName, "UHost");
EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON), FALSE );
EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON2), FALSE );
}
@@ -167,7 +167,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
DBVARIANT dbv;
if ( !p->ppro->getTString( p->hContact, "Default", &dbv )) {
SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
EnableWindow(GetDlgItem( m_hwnd, IDC_WILDCARD), FALSE );
}
@@ -177,7 +177,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
SetDlgItemText( m_hwnd, IDC_DEFAULT, TranslateT(STR_ADVANCED));
if ( !p->ppro->getTString( p->hContact, "UWildcard", &dbv )) {
SetDlgItemText( m_hwnd, IDC_WILDCARD, dbv.ptszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
EnableWindow(GetDlgItem( m_hwnd, IDC_WILDCARD), true);
}
@@ -202,10 +202,10 @@ int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam)
DBVARIANT dbv;
if ( !getTString( hContact, "Default", &dbv )) {
if ( IsChannel( dbv.ptszVal )) {
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
OPTIONSDIALOGPAGE odp = { 0 };
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index c20ceebc1c..354f8aec0e 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -220,7 +220,7 @@ void CNickDlg::OnInitDialog()
if ( !GetWord( dbv.ptszVal, i).IsEmpty())
SendDlgItemMessage( m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)GetWord(dbv.ptszVal, i).c_str());
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
void CNickDlg::OnDestroy()
@@ -243,7 +243,7 @@ void CNickDlg::OnOk( CCtrlButton* )
if ( !s.IsEmpty() && s != szTemp)
S += _T(" ") + s;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
m_proto->setTString( "RecentNicks", S.c_str());
}
@@ -517,7 +517,7 @@ void CJoinDlg::OnInitDialog()
ReplaceString( S, _T("%newl"), _T(" "));
SendDlgItemMessage( m_hwnd, IDC_ENICK, CB_ADDSTRING, 0, (LPARAM)S.c_str());
} }
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} }
void CJoinDlg::OnDestroy()
@@ -546,7 +546,7 @@ void CJoinDlg::OnOk( CCtrlButton* )
if ( !W.IsEmpty() && W != SL)
S += _T(" ") + W;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
m_proto->setTString("RecentChannels", S.c_str());
}
@@ -582,19 +582,19 @@ void CQuickDlg::OnInitDialog()
DBVARIANT dbv;
if ( !m_proto->getString( "ServerName", &dbv )) {
m_si->m_address = mir_strdup( dbv.pszVal );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else m_si->m_address = mir_strdup( Translate("Type new server address here"));
if ( !m_proto->getString( "PortStart", &dbv )) {
m_si->m_portStart = atoi( dbv.pszVal );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else m_si->m_portStart = 6667;
if ( !m_proto->getString( "PortEnd", &dbv )) {
m_si->m_portEnd = atoi( dbv.pszVal );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else m_si->m_portEnd = 6667;
@@ -1287,7 +1287,7 @@ void CManagerDlg::InitManager( int mode, const TCHAR* window )
#endif
m_topic.SendMsg( CB_ADDSTRING, 0, (LPARAM)S.c_str());
} }
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
mir_free(p);
}
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index 2f795f0872..0ef10c220d 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -155,7 +155,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
if (m_options.BsProxyManual) {
proxyJid = NULL;
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "BsProxyServer", &dbv)) {
+ if ( !db_get_s(NULL, m_szModuleName, "BsProxyServer", &dbv)) {
proxyJid = mir_a2t(dbv.pszVal);
db_free(&dbv);
}
@@ -199,7 +199,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
if (bDirect) {
if (m_options.BsDirectManual) {
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "BsDirectAddr", &dbv))
+ if ( !db_get_s(NULL, m_szModuleName, "BsDirectAddr", &dbv))
localAddr = dbv.pszVal;
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 4182cccb23..36a4dbcf40 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -145,7 +145,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM* item)
DBVARIANT dbv;
if (JABBER_LIST_ITEM* bookmark = ListGetItemPtr(LIST_BOOKMARK, item->jid))
if (bookmark->name) {
- if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbv))
+ if ( !db_get_ts(hContact, "CList", "MyHandle", &dbv))
db_free(&dbv);
else
db_set_ts(hContact, "CList", "MyHandle", bookmark->name);
@@ -380,7 +380,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM* item, int code, HXML reason)
CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, (LPARAM)&gce);
DBVARIANT dbvMessage;
- if ( !DBGetContactSettingTString(NULL, m_szModuleName, "GcMsgQuit", &dbvMessage)) {
+ if ( !db_get_ts(NULL, m_szModuleName, "GcMsgQuit", &dbvMessage)) {
szMessage = NEWTSTR_ALLOCA(dbvMessage.ptszVal);
db_free(&dbvMessage);
}
@@ -1079,7 +1079,7 @@ static void sttNickListHook(CJabberProto* ppro, JABBER_LIST_ITEM* item, GCHOOK*
{
if (ppro->m_bJabberOnline) {
DBVARIANT dbv = {0};
- TCHAR *szMessage = DBGetContactSettingTString(NULL, ppro->m_szModuleName, "GcMsgSlap", &dbv) ?
+ TCHAR *szMessage = db_get_ts(NULL, ppro->m_szModuleName, "GcMsgSlap", &dbv) ?
NEWTSTR_ALLOCA(TranslateTS(JABBER_GC_MSG_SLAP)) : dbv.ptszVal;
TCHAR buf[256];
diff --git a/protocols/JabberG/src/jabber_db_utils.h b/protocols/JabberG/src/jabber_db_utils.h
index d5a74d22b0..9695fe2380 100644
--- a/protocols/JabberG/src/jabber_db_utils.h
+++ b/protocols/JabberG/src/jabber_db_utils.h
@@ -143,7 +143,7 @@ public:
{
CMString result;
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, m_szSetting, &dbv))
+ if ( !db_get_ts(NULL, m_proto->m_szModuleName, m_szSetting, &dbv))
{
result = dbv.ptszVal;
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 4baa572ed0..cfd0bdc946 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -96,7 +96,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hCon
return;
TCHAR* nick;
- if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "MyHandle", &dbv)) {
nick = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -164,7 +164,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDL
TCHAR *nick;
Log("Add %S permanently to list", jid.pszVal);
- if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "MyHandle", &dbv)) {
nick = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -178,7 +178,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDL
return;
}
- if ( !DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "Group", &dbv)) {
AddContactToRoster(jid.ptszVal, nick, dbv.ptszVal);
db_free(&dbv);
}
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index 3a0c5cdb06..3ade62cdd2 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -307,7 +307,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
char *myAddr = NULL;
DBVARIANT dbv;
if (m_options.BsDirect && m_options.BsDirectManual) {
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "BsDirectAddr", &dbv))
+ if ( !db_get_s(NULL, m_szModuleName, "BsDirectAddr", &dbv))
myAddr = dbv.pszVal;
}
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 56f181e658..9d3bb562cf 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -503,7 +503,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo* pInfo)
// Don't set group again if already correct, or Miranda may show wrong group count in some case
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(hContact, "CList", "Group", &dbv)) {
+ if ( !db_get_ts(hContact, "CList", "Group", &dbv)) {
if (lstrcmp(dbv.ptszVal, item->group))
db_set_ts(hContact, "CList", "Group", item->group);
db_free(&dbv);
@@ -1116,7 +1116,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode)
else {
char text[ 100 ];
sprintf(text, "e-mail%d", nEmail-1);
- if ( DBGetContactSettingString(hContact, m_szModuleName, text, &dbv)) break;
+ if ( db_get_s(hContact, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(hContact, text);
}
@@ -1127,7 +1127,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode)
while (true) {
char text[ 100 ];
sprintf(text, "e-mail%d", nEmail);
- if ( DBGetContactSettingString(NULL, m_szModuleName, text, &dbv)) break;
+ if ( db_get_s(NULL, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(NULL, text);
sprintf(text, "e-mailFlag%d", nEmail);
@@ -1160,7 +1160,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode)
while (true) {
char text[ 100 ];
sprintf(text, "Phone%d", nPhone);
- if ( DBGetContactSettingString(NULL, m_szModuleName, text, &dbv)) break;
+ if ( db_get_s(NULL, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
JDeleteSetting(NULL, text);
sprintf(text, "PhoneFlag%d", nPhone);
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index f6f404c4e0..c0348c53a3 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -518,7 +518,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM)
if (ListGetItemPtr(LIST_ROSTER, roomID) == NULL) {
TCHAR *nick = 0;
TCHAR *group = 0;
- if ( !DBGetContactSettingTString((HANDLE)wParam, "CList", "Group", &dbv)) {
+ if ( !db_get_ts((HANDLE)wParam, "CList", "Group", &dbv)) {
group = NEWTSTR_ALLOCA(dbv.ptszVal);
db_free(&dbv);
}
@@ -1065,10 +1065,10 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
DBVARIANT dbv;
BOOL bSupportTyping = FALSE;
- if ( !DBGetContactSetting(event->hContact, "SRMsg", "SupportTyping", &dbv)) {
+ if ( !db_get(event->hContact, "SRMsg", "SupportTyping", &dbv)) {
bSupportTyping = dbv.bVal == 1;
db_free(&dbv);
- } else if ( !DBGetContactSetting(NULL, "SRMsg", "DefaultTyping", &dbv)) {
+ } else if ( !db_get(NULL, "SRMsg", "DefaultTyping", &dbv)) {
bSupportTyping = dbv.bVal == 1;
db_free(&dbv);
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index da614d2e33..9e42b13f53 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -75,7 +75,7 @@ static void JabberContactListCreateClistGroup(TCHAR* groupName)
for (i=0;;i++) {
_itoa(i, str, 10);
- if ( DBGetContactSettingTString(NULL, "CListGroups", str, &dbv))
+ if ( db_get_ts(NULL, "CListGroups", str, &dbv))
break;
TCHAR* name = dbv.ptszVal;
if (name[0]!='\0' && !_tcscmp(name+1, groupName)) {
@@ -299,8 +299,8 @@ void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbL
}
else {
DBVARIANT dbv1, dbv2;
- BOOL res1 = DBGetContactSettingString(NULL, m_szModuleName, "LoginName", &dbv1);
- BOOL res2 = DBGetContactSettingString(NULL, m_szModuleName, "LoginServer", &dbv2);
+ BOOL res1 = db_get_s(NULL, m_szModuleName, "LoginName", &dbv1);
+ BOOL res2 = db_get_s(NULL, m_szModuleName, "LoginServer", &dbv2);
mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%S@%S avatar.%S"),
res1 ? "noname" : dbv1.pszVal,
res2 ? m_szModuleName : dbv2.pszVal,
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 64c09c4966..614baef47f 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -470,7 +470,7 @@ protected:
if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
- if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, "Resource", &dbv))
+ if ( !db_get_ts(NULL, m_proto->m_szModuleName, "Resource", &dbv))
{
if (CB_ERR == m_cbResource.FindString(dbv.ptszVal, -1, true))
m_cbResource.AddString(dbv.ptszVal);
@@ -1079,11 +1079,11 @@ void CJabberProto::_RosterHandleGetRequest(HXML node)
TCHAR *name = NULL;
TCHAR *group = NULL;
DBVARIANT dbvtemp;
- if ( !DBGetContactSettingTString(hContact, "CList", "MyHandle", &dbvtemp)) {
+ if ( !db_get_ts(hContact, "CList", "MyHandle", &dbvtemp)) {
name = mir_tstrdup(dbvtemp.ptszVal);
db_free(&dbvtemp);
}
- if ( !DBGetContactSettingTString(hContact, "CList", "Group", &dbvtemp)) {
+ if ( !db_get_ts(hContact, "CList", "Group", &dbvtemp)) {
group = mir_tstrdup(dbvtemp.ptszVal);
db_free(&dbvtemp);
}
@@ -1702,7 +1702,7 @@ protected:
if (GetComputerName(szCompName, &dwCompNameLength))
m_cbResource.AddString(szCompName);
- if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, "Resource", &dbv))
+ if ( !db_get_ts(NULL, m_proto->m_szModuleName, "Resource", &dbv))
{
if (CB_ERR == m_cbResource.FindString(dbv.ptszVal, -1, true))
m_cbResource.AddString(dbv.ptszVal);
@@ -1725,7 +1725,7 @@ protected:
m_cbType.AddString(TranslateT("S.ms"), ACC_SMS);
m_cbServer.GetTextA(server, SIZEOF(server));
- if ( !DBGetContactSettingString(NULL, m_proto->m_szModuleName, "ManualHost", &dbv))
+ if ( !db_get_s(NULL, m_proto->m_szModuleName, "ManualHost", &dbv))
{
lstrcpynA(manualServer, dbv.pszVal, SIZEOF(manualServer));
db_free(&dbv);
@@ -1780,7 +1780,7 @@ protected:
m_txtManualHost.Enable();
m_txtPort.Enable();
- if ( !DBGetContactSettingTString(NULL, m_proto->m_szModuleName, "ManualHost", &dbv))
+ if ( !db_get_ts(NULL, m_proto->m_szModuleName, "ManualHost", &dbv))
{
m_txtManualHost.SetText(dbv.ptszVal);
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index 4581325496..04289ee5d8 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -480,7 +480,7 @@ public:
for (int i = 0; ; i++)
{
mir_snprintf(buf, 20, "%d", i);
- if ( DBGetContactSettingTString(NULL, "CListGroups", buf, &dbv))
+ if ( db_get_ts(NULL, "CListGroups", buf, &dbv))
break;
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, (LPARAM)&dbv.ptszVal[1]);
@@ -1382,7 +1382,7 @@ bool CJabberDlgPrivacyLists::CListIsGroup(HANDLE hGroup)
_i64toa((INT_PTR)hGroup-1, idstr, 10);
DBVARIANT dbv;
- bool result = DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv) == 0;
+ bool result = db_get_ts(NULL, "CListGroups", idstr, &dbv) == 0;
if (result)
db_free(&dbv);
@@ -1400,7 +1400,7 @@ HANDLE CJabberDlgPrivacyLists::CListFindGroupByName(TCHAR *name)
{
_itoa(i, idstr, 10);
- if ( DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if ( db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
if ( !_tcscmp(dbv.ptszVal + 1, name))
@@ -1607,7 +1607,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList)
char idstr[33];
_itoa(iGroup-1, idstr, 10);
DBVARIANT dbv = {0};
- if ( DBGetContactSettingTString(NULL, "CListGroups", idstr, &dbv))
+ if ( db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
hItem = m_clcClist.FindGroup((HANDLE)iGroup);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index b4083314e9..4986c7f401 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -195,7 +195,7 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) :
}
else m_tszSelectedLang = mir_tstrdup(_T("en"));
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "Password", &dbv)) {
+ if ( !db_get_s(NULL, m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, lstrlenA(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
TCHAR *pssw = mir_a2t(dbv.pszVal);
JSetStringCrypt(NULL, "LoginPassword", pssw);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp
index 9d4ae894fd..373c0681f7 100644
--- a/protocols/JabberG/src/jabber_std.cpp
+++ b/protocols/JabberG/src/jabber_std.cpp
@@ -110,12 +110,12 @@ int CJabberProto::JGetStaticString(const char* valueName, HANDLE hContact, char*
int CJabberProto::JGetStringUtf(HANDLE hContact, char* valueName, DBVARIANT* dbv)
{
- return DBGetContactSettingStringUtf(hContact, m_szModuleName, valueName, dbv);
+ return db_get_utf(hContact, m_szModuleName, valueName, dbv);
}
int CJabberProto::JGetStringT(HANDLE hContact, char* valueName, DBVARIANT* dbv)
{
- return DBGetContactSettingTString(hContact, m_szModuleName, valueName, dbv);
+ return db_get_ts(hContact, m_szModuleName, valueName, dbv);
}
TCHAR *CJabberProto::JGetStringT(HANDLE hContact, char* valueName)
@@ -214,7 +214,7 @@ void __forceinline sttCryptString(char *str)
TCHAR* CJabberProto::JGetStringCrypt(HANDLE hContact, char *valueName)
{
DBVARIANT dbv;
- if ( DBGetContactSettingString(hContact, m_szModuleName, valueName, &dbv))
+ if ( db_get_s(hContact, m_szModuleName, valueName, &dbv))
return NULL;
sttCryptString(dbv.pszVal);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index e38dbf1c67..3660fbce04 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -259,7 +259,7 @@ void CJabberProto::ServerThread(ThreadData* info)
info->auth = NULL;
if (m_options.ManualConnect == TRUE) {
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "ManualHost", &dbv)) {
+ if ( !db_get_s(NULL, m_szModuleName, "ManualHost", &dbv)) {
strncpy(info->manualHost, dbv.pszVal, SIZEOF(info->manualHost));
info->manualHost[SIZEOF(info->manualHost)-1] = '\0';
db_free(&dbv);
@@ -315,7 +315,7 @@ LBL_FatalError:
goto LBL_Exit;
}
- if ( !DBGetContactSettingString(NULL, m_szModuleName, "LoginServer", &dbv)) {
+ if ( !db_get_s(NULL, m_szModuleName, "LoginServer", &dbv)) {
strncpy(info->server, dbv.pszVal, SIZEOF(info->server)-1);
db_free(&dbv);
}
@@ -923,7 +923,7 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData* info)
}
Log("Success: Logged-in.");
- if ( DBGetContactSettingString(NULL, m_szModuleName, "Nick", &dbv))
+ if ( db_get_s(NULL, m_szModuleName, "Nick", &dbv))
JSetStringT(NULL, "Nick", info->username);
else
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index ed7adff6f9..fd036db767 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -51,7 +51,7 @@ static void SetDialogField(CJabberProto* ppro, HWND hwndDlg, int nDlgItem, char*
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, key, &dbv)) {
+ if ( !db_get_ts(NULL, ppro->m_szModuleName, key, &dbv)) {
SetDlgItemText(hwndDlg, nDlgItem, (bTranslate) ? TranslateTS(dbv.ptszVal) : dbv.ptszVal);
db_free(&dbv);
}
@@ -566,7 +566,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
SetWindowText(hwndDlg, TranslateT("Jabber vCard: Edit Email Address"));
wsprintfA(idstr, "e-mail%d", dat->id);
- if ( !DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) {
+ if ( !db_get_s(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
db_free(&dbv);
wsprintfA(idstr, "e-mailFlag%d", lParam);
@@ -590,7 +590,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
if (dat->id < 0) {
for (dat->id=0;;dat->id++) {
mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", dat->id);
- if ( DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_s(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
} }
GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text));
@@ -632,7 +632,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
SetWindowText(hwndDlg, TranslateT("Jabber vCard: Edit Phone Number"));
wsprintfA(idstr, "Phone%d", dat->id);
- if ( !DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) {
+ if ( !db_get_s(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_PHONE, dbv.pszVal);
db_free(&dbv);
wsprintfA(idstr, "PhoneFlag%d", dat->id);
@@ -664,7 +664,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
if (dat->id < 0) {
for (dat->id=0;;dat->id++) {
wsprintfA(idstr, "Phone%d", dat->id);
- if ( DBGetContactSettingString(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_s(NULL, dat->ppro->m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
}
}
@@ -747,7 +747,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
lvi.iItem = 0;
for (i=0;;i++) {
wsprintfA(idstr, "e-mail%d", i);
- if ( DBGetContactSettingTString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_ts(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
@@ -766,7 +766,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
lvi.iItem = 0;
for (i=0;;i++) {
wsprintfA(idstr, "Phone%d", i);
- if ( DBGetContactSettingTString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_ts(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintf(number, _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
@@ -873,7 +873,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP
WORD nFlag;
wsprintfA(idstr, szIdTemplate, i+1);
- if ( DBGetContactSettingString(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_s(NULL, ppro->m_szModuleName, idstr, &dbv)) break;
wsprintfA(idstr,szIdTemplate,i);
ppro->JSetString(NULL, idstr, dbv.pszVal);
wsprintfA(idstr, szFlagTemplate, i+1);
@@ -1021,7 +1021,7 @@ void CJabberProto::AppendVcardFromDB(HXML n, char* tag, char* key)
return;
DBVARIANT dbv;
- if ( DBGetContactSettingTString(NULL, m_szModuleName, key, &dbv))
+ if ( db_get_ts(NULL, m_szModuleName, key, &dbv))
n << XCHILD(_A2T(tag));
else {
n << XCHILD(_A2T(tag), dbv.ptszVal);
@@ -1058,7 +1058,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName)
for (i=0;;i++) {
wsprintfA(idstr, "e-mail%d", i);
- if ( DBGetContactSettingTString(NULL, m_szModuleName, idstr, &dbv))
+ if ( db_get_ts(NULL, m_szModuleName, idstr, &dbv))
break;
HXML e = v << XCHILD(_T("EMAIL"), dbv.ptszVal);
@@ -1106,7 +1106,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName)
for (i=0;;i++) {
wsprintfA(idstr, "Phone%d", i);
- if ( DBGetContactSettingTString(NULL, m_szModuleName, idstr, &dbv)) break;
+ if ( db_get_ts(NULL, m_szModuleName, idstr, &dbv)) break;
db_free(&dbv);
n = v << XCHILD(_T("TEL"));
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 5427401826..306527b920 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -1513,7 +1513,7 @@ char *CJabberProto::ReadAdvStatusA(HANDLE hContact, const char *pszSlot, const c
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", m_szModuleName, pszSlot, pszValue);
DBVARIANT dbv;
- if ( DBGetContactSettingString(hContact, "AdvStatus", szSetting, &dbv))
+ if ( db_get_s(hContact, "AdvStatus", szSetting, &dbv))
return NULL;
char *res = mir_strdup(dbv.pszVal);
@@ -1527,7 +1527,7 @@ TCHAR *CJabberProto::ReadAdvStatusT(HANDLE hContact, const char *pszSlot, const
mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", m_szModuleName, pszSlot, pszValue);
DBVARIANT dbv;
- if ( DBGetContactSettingTString(hContact, "AdvStatus", szSetting, &dbv))
+ if ( db_get_ts(hContact, "AdvStatus", szSetting, &dbv))
return NULL;
TCHAR *res = mir_tstrdup(dbv.ptszVal);
diff --git a/protocols/JabberG/src/ui_utils.cpp b/protocols/JabberG/src/ui_utils.cpp
index 584c3cf081..2e51880d81 100644
--- a/protocols/JabberG/src/ui_utils.cpp
+++ b/protocols/JabberG/src/ui_utils.cpp
@@ -2431,7 +2431,7 @@ void CDbLink::SaveInt(DWORD value)
TCHAR* CDbLink::LoadText()
{
if (dbv.type != DBVT_DELETED) db_free(&dbv);
- if ( !DBGetContactSettingTString(NULL, m_szModule, m_szSetting, &dbv))
+ if ( !db_get_ts(NULL, m_szModule, m_szSetting, &dbv))
{
if (dbv.type == DBVT_TCHAR)
return dbv.ptszVal;
diff --git a/protocols/MRA/src/MraAntiSpam.cpp b/protocols/MRA/src/MraAntiSpam.cpp
index 8b60ade855..0650dfe833 100644
--- a/protocols/MRA/src/MraAntiSpam.cpp
+++ b/protocols/MRA/src/MraAntiSpam.cpp
@@ -52,7 +52,7 @@ size_t MraAntiSpamLoadBadWordsW()
CharLowerBuffW(pmabwBadWords[i].lpwszBadWord, DWORD(dwValueSize));
pmabwBadWords[i].dwBadWordLen = DWORD(dwValueSize);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (pmabwBadWords[i].lpwszBadWord == NULL)
break;
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index a4612ab56d..9ca0b135e5 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -94,7 +94,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
InterlockedExchange((volatile LONG*)&pmraaqAvatarsQueue->bIsRunning, TRUE);
pmraaqAvatarsQueue->hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- pmraaqAvatarsQueue->iThreadsCount = DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "WorkThreadsCount", MRA_AVT_DEFAULT_WRK_THREAD_COUNTS);
+ pmraaqAvatarsQueue->iThreadsCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "WorkThreadsCount", MRA_AVT_DEFAULT_WRK_THREAD_COUNTS);
if (pmraaqAvatarsQueue->iThreadsCount == 0)
pmraaqAvatarsQueue->iThreadsCount = 1;
if (pmraaqAvatarsQueue->iThreadsCount > MAXIMUM_WAIT_OBJECTS)
@@ -207,7 +207,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
bDefaultAvt = FALSE;
if (DB_GetStaticStringA(NULL, MRA_AVT_SECT_NAME, "Server", szServer, SIZEOF(szServer), NULL) == FALSE) memmove(szServer, MRA_AVT_DEFAULT_SERVER, sizeof(MRA_AVT_DEFAULT_SERVER));
- dwServerPort = DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT);
+ dwServerPort = db_get_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT);
bUseKeepAliveConn = db_get_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", MRA_AVT_DEFAULT_USE_KEEPALIVE_CONN);
if ( mraGetStaticStringA(pmraaqiAvatarsQueueItem->hContact, "e-mail", szEMail, SIZEOF(szEMail), &dwEMailSize)) {
@@ -288,7 +288,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
if (hFile != INVALID_HANDLE_VALUE) {
DWORD dwWritten = 0;
bContinue = TRUE;
- nls.dwTimeout = (1000*DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "TimeOutReceive", MRA_AVT_DEFAULT_TIMEOUT_RECV));
+ nls.dwTimeout = (1000*db_get_dw(NULL, MRA_AVT_SECT_NAME, "TimeOutReceive", MRA_AVT_DEFAULT_TIMEOUT_RECV));
nls.hReadConns[0] = hConnection;
while ( bContinue ) {
@@ -381,11 +381,11 @@ HANDLE MraAvatarsHttpConnect(HANDLE hNetlibUser, LPSTR lpszHost, DWORD dwPort)
nloc.flags = (NLOCF_HTTP|NLOCF_V2);
nloc.szHost = lpszHost;
nloc.wPort = ( IsHTTPSProxyUsed(hNetlibUser)) ? MRA_SERVER_PORT_HTTPS : dwPort;
- nloc.timeout = DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "TimeOutConnect", MRA_AVT_DEFAULT_TIMEOUT_CONN);
+ nloc.timeout = db_get_dw(NULL, MRA_AVT_SECT_NAME, "TimeOutConnect", MRA_AVT_DEFAULT_TIMEOUT_CONN);
if (nloc.timeout<MRA_TIMEOUT_CONN_MIN) nloc.timeout = MRA_TIMEOUT_CONN_MIN;
if (nloc.timeout>MRA_TIMEOUT_CONN_ÌÀÕ) nloc.timeout = MRA_TIMEOUT_CONN_ÌÀÕ;
- DWORD dwConnectReTryCount = DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "ConnectReTryCount", MRA_AVT_DEFAULT_CONN_RETRY_COUNT);
+ DWORD dwConnectReTryCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "ConnectReTryCount", MRA_AVT_DEFAULT_CONN_RETRY_COUNT);
DWORD dwCurConnectReTryCount = dwConnectReTryCount;
HANDLE hConnection;
do {
@@ -602,7 +602,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl
GetSystemTimeAsFileTime(&ftCurrentTime);
SystemTimeToFileTime(&stAvatarLastCheckTime, &ftExpireTime);
- (*((DWORDLONG*)&ftExpireTime)) += (FILETIME_MINUTE*(DWORDLONG)DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL));
+ (*((DWORDLONG*)&ftExpireTime)) += (FILETIME_MINUTE*(DWORDLONG)db_get_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL));
if ((*((DWORDLONG*)&ftExpireTime))>(*((DWORDLONG*)&ftCurrentTime)))
if ( MraAvatarsGetFileName(hAvatarsQueueHandle, hContact, GetContactAvatarFormat(hContact, PA_FORMAT_DEFAULT), wszFileName, SIZEOF(wszFileName), &dwPathSize) == NO_ERROR)
@@ -679,9 +679,9 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara
else
SET_DLG_ITEM_TEXTA(hWndDlg, IDC_SERVER, MRA_AVT_DEFAULT_SERVER);
- SetDlgItemInt(hWndDlg, IDC_SERVERPORT, DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT), FALSE);
+ SetDlgItemInt(hWndDlg, IDC_SERVERPORT, db_get_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", MRA_AVT_DEFAULT_SERVER_PORT), FALSE);
CHECK_DLG_BUTTON(hWndDlg, IDC_USE_KEEPALIVE_CONN, db_get_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", MRA_AVT_DEFAULT_USE_KEEPALIVE_CONN));
- SetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, DBGetContactSettingDword(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL), FALSE);
+ SetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, db_get_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", MRA_AVT_DEFAULT_CHK_INTERVAL), FALSE);
CHECK_DLG_BUTTON(hWndDlg, IDC_RETURN_ABC_PATH, db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH));
CHECK_DLG_BUTTON(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE, db_get_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", MRA_DELETE_AVT_ON_CONTACT_DELETE));
@@ -708,12 +708,12 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara
{
WCHAR szServer[MAX_PATH];
- DBWriteContactSettingByte(NULL, MRA_AVT_SECT_NAME, "Enable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE));
- DBWriteContactSettingByte(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE));
- DBWriteContactSettingByte(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_RETURN_ABC_PATH));
- DBWriteContactSettingDword(NULL, MRA_AVT_SECT_NAME, "CheckInterval", GetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, NULL, FALSE));
- DBWriteContactSettingByte(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_USE_KEEPALIVE_CONN));
- DBWriteContactSettingDword(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
+ db_set_b(NULL, MRA_AVT_SECT_NAME, "Enable", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_ENABLE));
+ db_set_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE));
+ db_set_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_RETURN_ABC_PATH));
+ db_set_dw(NULL, MRA_AVT_SECT_NAME, "CheckInterval", GetDlgItemInt(hWndDlg, IDC_UPD_CHECK_INTERVAL, NULL, FALSE));
+ db_set_b(NULL, MRA_AVT_SECT_NAME, "UseKeepAliveConn", IS_DLG_BUTTON_CHECKED(hWndDlg, IDC_USE_KEEPALIVE_CONN));
+ db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
GET_DLG_ITEM_TEXT(hWndDlg, IDC_SERVER, szServer, SIZEOF(szServer));
db_set_ws(NULL, MRA_AVT_SECT_NAME, "Server", szServer);
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp
index 7eb0edc10b..1d052f8029 100644
--- a/protocols/MRA/src/MraChat.cpp
+++ b/protocols/MRA/src/MraChat.cpp
@@ -278,7 +278,7 @@ void CMraProto::MraChatSendPrivateMessage(LPWSTR lpwszEMail)
BOOL bAdded;
HANDLE hContact = MraHContactFromEmail(szEMail, dwEMailSize, TRUE, TRUE, &bAdded);
if (bAdded)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, IGNOREEVENT_ALL);
CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp
index df74806fc0..2165803c22 100644
--- a/protocols/MRA/src/MraIcons.cpp
+++ b/protocols/MRA/src/MraIcons.cpp
@@ -152,7 +152,7 @@ void CMraProto::InitContactMenu()
CListCreateMenu(2000060000, -500050000, NULL, NULL, FALSE, gdiContactMenuItems, SIZEOF(gdiContactMenuItems), hContactMenuItems);
}
-void CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsMain, const GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HANDLE *hResult)
+void CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsMain, const GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HGENMENU *hResult)
{
if (!pgdiItems || !dwCount || !hResult)
return;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index e28eded3af..bc36693813 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -204,9 +204,9 @@ HANDLE CMraProto::AddToListByEmail(LPCTSTR plpsEMail, LPCTSTR plpsNick, LPCTSTR
mraSetStringW(hContact, "LastName", plpsLastName);
if (dwFlags & PALF_TEMPORARY)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
else
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
if (bAdded)
MraUpdateContactInfo(hContact);
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index e98a02f0fe..9af64edb8c 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -127,7 +127,7 @@ struct CMraProto : public PROTO_INTERFACE
__forceinline BOOL mraSetStringA(HANDLE Contact, const char *valueName, const char *parValue) {
return DB_SetStringExA(Contact, m_szModuleName, valueName, parValue, lstrlenA(parValue)); }
__forceinline BOOL mraSetStringW(HANDLE Contact, const char *valueName, const WCHAR *parValue) {
- return DBWriteContactSettingWString(Contact, m_szModuleName, valueName, parValue); }
+ return db_set_ws(Contact, m_szModuleName, valueName, parValue); }
__forceinline BOOL mraSetLPSStringA(HANDLE Contact, const char *valueName, MRA_LPS *parValue) {
return DB_SetStringExA(Contact, m_szModuleName, valueName, parValue->lpszData, parValue->dwSize); }
@@ -210,16 +210,16 @@ struct CMraProto : public PROTO_INTERFACE
HANDLE hAvatarsQueueHandle;
- HANDLE hMainMenuItems[MAIN_MENU_ITEMS_COUNT+4];
- HANDLE hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+4];
+ HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+4];
+ HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+4];
- HWND hWndEMailPopupStatus;
- DWORD dwEmailMessagesTotal, dwEmailMessagesUnread;
+ HWND hWndEMailPopupStatus;
+ DWORD dwEmailMessagesTotal, dwEmailMessagesUnread;
- BOOL bHideXStatusUI;
- HANDLE hXStatusMenuItems[MRA_XSTATUS_COUNT+4];
- HANDLE hExtraXstatusIcon;
- HANDLE hExtraInfo;
+ BOOL bHideXStatusUI;
+ HGENMENU hXStatusMenuItems[MRA_XSTATUS_COUNT+4];
+ HANDLE hExtraXstatusIcon;
+ HANDLE hExtraInfo;
char szNewMailSound[MAX_PATH];
@@ -299,8 +299,7 @@ struct CMraProto : public PROTO_INTERFACE
void InitMainMenu();
void InitContactMenu();
- void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HANDLE *hResult);
- void CListShowMenuItem(HANDLE hMenuItem, BOOL bShow);
+ void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HGENMENU *hResult);
DWORD ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam, size_t paramSize = 0);
DWORD CreateBlobFromContact(HANDLE hContact, LPWSTR lpwszRequestReason, size_t dwRequestReasonSize, LPBYTE lpbBuff, size_t dwBuffSize, size_t *pdwBuffSizeRet);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 7d645b10c8..5d07eab6cc 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -234,7 +234,7 @@ BOOL DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam
}
if (pdwRetBuffSize) (*pdwRetBuffSize) = dwRetBuffSizeLocal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}else {
if (lpszRetBuff && dwRetBuffSize >= sizeof(WORD)) (*((WORD*)lpszRetBuff)) = 0;
if (pdwRetBuffSize) (*pdwRetBuffSize) = 0;
@@ -267,7 +267,7 @@ BOOL DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam
}
if (pdwRetBuffSize) (*pdwRetBuffSize) = dwReadedStringLen;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}else {
if (lpwszRetBuff && dwRetBuffSize >= sizeof(WCHAR)) (*((WCHAR*)lpwszRetBuff)) = 0;
if (pdwRetBuffSize) (*pdwRetBuffSize) = 0;
@@ -303,7 +303,7 @@ BOOL DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L
}
else {
bRet = TRUE;
- DBDeleteContactSetting(hContact, lpszModule, lpszValueName);
+ db_unset(hContact, lpszModule, lpszValueName);
}
return bRet;
}
@@ -330,7 +330,7 @@ BOOL DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, L
}
else {
bRet = TRUE;
- DBDeleteContactSetting(hContact, lpszModule, lpszValueName);
+ db_unset(hContact, lpszModule, lpszValueName);
}
return bRet;
}
@@ -367,7 +367,7 @@ BOOL DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszVal
}
if (pdwRetBuffSize) (*pdwRetBuffSize) = dbv.cpbVal;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
if (pdwRetBuffSize) (*pdwRetBuffSize) = 0;
@@ -421,9 +421,9 @@ DWORD CMraProto::SetContactFlags(HANDLE hContact, DWORD dwContactFlag)
mraSetDword(hContact, "ContactFlags", dwContactFlag);
if (dwContactFlag&CONTACT_FLAG_SHADOW)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
else
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
switch (dwContactFlag&(CONTACT_FLAG_INVISIBLE|CONTACT_FLAG_VISIBLE)) {
case CONTACT_FLAG_INVISIBLE:
@@ -577,7 +577,7 @@ HANDLE CMraProto::MraHContactFromEmail(LPSTR lpszEMail, size_t dwEMailSize, BOOL
if (mraGetStaticStringA(hContact, "e-mail", szEMailLocal, SIZEOF(szEMailLocal), &dwEMailLocalSize))
if (CompareStringA( MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, szEMailLocal, dwEMailLocalSize, lpszEMail, dwEMailSize) == CSTR_EQUAL)
{
- if (bTemporary == FALSE) DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ if (bTemporary == FALSE) db_unset(hContact, "CList", "NotOnList");
bFound = TRUE;
break;
}
@@ -623,7 +623,7 @@ HANDLE CMraProto::MraHContactFromEmail(LPSTR lpszEMail, size_t dwEMailSize, BOOL
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS|SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_ONLINE, lpszEMail, dwEMailSize, NULL, 0, NULL, 0);
else {
if (bTemporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
mraSetStringExA(hContact, "MirVer", MIRVER_UNKNOWN, (sizeof(MIRVER_UNKNOWN)-1));
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS|SCBIF_EMAIL), -1, -1, 0, CONTACT_INTFLAG_NOT_AUTHORIZED, ID_STATUS_OFFLINE, lpszEMail, dwEMailSize, NULL, 0, NULL, 0);
}
@@ -1144,16 +1144,6 @@ DWORD CMraProto::CreateBlobFromContact(HANDLE hContact, LPWSTR lpwszRequestReaso
return dwRetErrorCode;
}
-void CMraProto::CListShowMenuItem(HANDLE hMenuItem, BOOL bShow)
-{
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
- if (bShow == FALSE)
- mi.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi);
-}
-
size_t CopyNumber(LPCVOID lpcOutBuff, LPCVOID lpcBuff, size_t dwLen)
{
BYTE btChar;
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index 162dd9686c..e927d2dd0f 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -676,7 +676,7 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd
dwTemp &= ~CONTACT_INTFLAG_NOT_AUTHORIZED;
SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, SCBIF_SERVER_FLAG, 0, 0, 0, dwTemp, 0, NULL, 0, NULL, 0, NULL, 0);
mraSetDword(hContact, "HooksLocked", TRUE);
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
mraSetDword(hContact, "HooksLocked", FALSE);
}
break;
@@ -1520,8 +1520,8 @@ DWORD CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader, DWORD *pd
if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, szEMail, SIZEOF(szEMail), &dwEMailSize, NULL, 0, NULL, NULL, 0, NULL) == NO_ERROR)
if (dwID == -1) {
if (IsEMailChatAgent(szEMail, dwEMailSize)) {// ÷àò: åù¸ ðàç çàïðîñèì àâòîðèçàöèþ, ïîìåòèì êàê âèäèìûé â ñïèñêå, ïîñòîÿííûé
- DBDeleteContactSetting(hContact, "CList", "Hidden");
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "NotOnList");
SetExtraIcons(hContact);
MraSetContactStatus(hContact, ID_STATUS_ONLINE);
@@ -1998,7 +1998,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
}
if (bAdded)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
if (bAutoGrantAuth) { // auto grant auth
DBEVENTINFO dbei = { sizeof(dbei) };
@@ -2018,7 +2018,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *pl
}
}
else {
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
if (dwFlags & MESSAGE_FLAG_CONTACT) { // contacts received
LPBYTE lpbBuffer, lpbBufferCurPos;
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp
index 9cbc06c9b3..4c5ebe50c0 100644
--- a/protocols/MRA/src/Mra_svcs.cpp
+++ b/protocols/MRA/src/Mra_svcs.cpp
@@ -529,7 +529,7 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam)
dwAuthMessageSize = lstrlenW(wszAuthMessage);
}
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
GetContactBasicInfoW(hContact, NULL, &dwGroupID, &dwContactFlag, NULL, NULL, szEMail, SIZEOF(szEMail), &dwEMailSize, wszNick, SIZEOF(wszNick), &dwNickSize, szPhones, SIZEOF(szPhones), &dwPhonesSize);
MraAddContactW(hContact, dwContactFlag, dwGroupID, szEMail, dwEMailSize, wszNick, dwNickSize, szPhones, dwPhonesSize, wszAuthMessage, dwAuthMessageSize, 0);
}
@@ -604,34 +604,34 @@ int CMraProto::MraRebuildContactMenu(WPARAM wParam, LPARAM lParam)
else bHasEMail = bHasEMailMR = bChatAgent = FALSE;
//"Request authorization"
- CListShowMenuItem(hContactMenuItems[0], (m_bLoggedIn && bIsContactMRA));// && (dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED)
+ Menu_ShowItem(hContactMenuItems[0], (m_bLoggedIn && bIsContactMRA));// && (dwContactSeverFlags&CONTACT_INTFLAG_NOT_AUTHORIZED)
//"Grant authorization"
- CListShowMenuItem(hContactMenuItems[1], (m_bLoggedIn && bIsContactMRA && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[1], (m_bLoggedIn && bIsContactMRA && bChatAgent == FALSE));
//"&Send postcard"
- CListShowMenuItem(hContactMenuItems[2], (m_bLoggedIn && bHasEMail && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[2], (m_bLoggedIn && bHasEMail && bChatAgent == FALSE));
//"&View Album"
- CListShowMenuItem(hContactMenuItems[3], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[3], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"&Read Blog"
- CListShowMenuItem(hContactMenuItems[4], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[4], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"Reply Blog Status"
- CListShowMenuItem(hContactMenuItems[5], (m_bLoggedIn && dwBlogStatusMsgSize && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[5], (m_bLoggedIn && dwBlogStatusMsgSize && bChatAgent == FALSE));
//"View Video"
- CListShowMenuItem(hContactMenuItems[6], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[6], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"Answers"
- CListShowMenuItem(hContactMenuItems[7], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[7], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"World"
- CListShowMenuItem(hContactMenuItems[8], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
+ Menu_ShowItem(hContactMenuItems[8], (m_bLoggedIn && bHasEMailMR && bChatAgent == FALSE));
//"Send &Nudge"
- CListShowMenuItem(hContactMenuItems[9], (!heNudgeReceived) ? (m_bLoggedIn && bIsContactMRA) : 0);
+ Menu_ShowItem(hContactMenuItems[9], (!heNudgeReceived) ? (m_bLoggedIn && bIsContactMRA) : 0);
return 0;
}
@@ -860,7 +860,7 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM wParam, LPARAM lParam)
if (pData->flags & CSSF_DISABLE_UI) {
bHideXStatusUI = (*pData->wParam)? FALSE:TRUE;
for (DWORD i = 0; i < MRA_XSTATUS_COUNT; i++)
- CListShowMenuItem(hXStatusMenuItems[i], !bHideXStatusUI);
+ Menu_ShowItem(hXStatusMenuItems[i], !bHideXStatusUI);
}
}
return iRet;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index c86c1779f8..0d161f53cb 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -683,7 +683,7 @@ void CMsnProto::sttProcessYFind(char* buf, size_t len)
MSN_AddUser(hContact, szEmail, netId, LIST_PL + LIST_REMOVE);
MSN_AddUser(hContact, szEmail, netId, LIST_BL + LIST_REMOVE);
MSN_AddUser(hContact, szEmail, netId, LIST_AL);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
}
MSN_SetContactDb(hContact, szEmail);
}
@@ -822,9 +822,9 @@ void CMsnProto::sttProcessStatusMessage(char* buf, unsigned len, const char* wli
{
stripBBCode((char*)szStatMsg);
stripColorCode((char*)szStatMsg);
- DBWriteContactSettingStringUtf(hContact, "CList", "StatusMsg", szStatMsg);
+ db_set_utf(hContact, "CList", "StatusMsg", szStatMsg);
}
- else DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ else db_unset(hContact, "CList", "StatusMsg");
{
mir_ptr<TCHAR> tszStatus( mir_utf8decodeT(szStatMsg));
@@ -1365,7 +1365,7 @@ LBL_InvalidCommand:
setStringUtf(hContact, "Nick", data.userNick);
lastStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
if (lastStatus == ID_STATUS_OFFLINE || lastStatus == ID_STATUS_INVISIBLE)
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ db_unset(hContact, "CList", "StatusMsg");
int newStatus = MSNStatusToMiranda(params);
setWord(hContact, "Status", newStatus != ID_STATUS_IDLE ? newStatus : ID_STATUS_AWAY);
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp
index d860b1d8e5..f1848a738e 100644
--- a/protocols/MSN/src/msn_contact.cpp
+++ b/protocols/MSN/src/msn_contact.cpp
@@ -40,7 +40,7 @@ HANDLE CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick,
setString(hContact, "e-mail", szEmail);
setStringUtf(hContact, "Nick", msnNick ? msnNick : wlid);
if (temporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
Lists_Add(0, NETID_MSN, wlid, hContact);
}
@@ -56,10 +56,10 @@ void CMsnProto::MSN_SetContactDb(HANDLE hContact, const char *szEmail)
if (listId & LIST_FL)
{
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1)
+ if (db_get_b(hContact, "CList", "NotOnList", 0) == 1)
{
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "Hidden");
}
if (listId & (LIST_BL | LIST_AL))
@@ -185,7 +185,7 @@ bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int f
if (res)
{
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, "CList", "Group", &dbv))
+ if (!db_get_utf(hContact, "CList", "Group", &dbv))
{
MSN_MoveContactToGroup(hContact, dbv.pszVal);
MSN_FreeVariant(&dbv);
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp
index 0c36aa4c65..fa11d889eb 100644
--- a/protocols/MSN/src/msn_mail.cpp
+++ b/protocols/MSN/src/msn_mail.cpp
@@ -420,6 +420,6 @@ void CMsnProto::displayEmailCount(HANDLE hContact)
getByte("DisableHotmailJunk", 0) ? _T("%s [%d]") : _T("%s [%d][%d]"), name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;
- DBWriteContactSettingTString(hContact, "CList", "MyHandle", szNick);
+ db_set_ts(hContact, "CList", "MyHandle", szNick);
nickChg = false;
}
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index f39fe781c0..9e110b8fd0 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -435,7 +435,7 @@ void CMsnProto::MSN_GetCustomSmileyFileName(HANDLE hContact, TCHAR* pszDest, si
}
tPathLen += mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, _T("\\%s"), dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
TCHAR *tszModuleName = mir_a2t(m_szModuleName);
@@ -520,7 +520,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha
char* p;
DBVARIANT dbv;
- if (!DBGetContactSettingString(NULL, "SRMsg", "Font0", &dbv)) {
+ if (!db_get_s(NULL, "SRMsg", "Font0", &dbv)) {
for (p = dbv.pszVal; *p; p++)
if (BYTE(*p) >= 128 || *p < 32)
break;
@@ -531,13 +531,13 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha
}
}
- int tStyle = DBGetContactSettingByte(NULL, "SRMsg", "Font0Sty", 0);
+ int tStyle = db_get_b(NULL, "SRMsg", "Font0Sty", 0);
p = tFontStyle;
if (tStyle & 1) *p++ = 'B';
if (tStyle & 2) *p++ = 'I';
*p = 0;
- tFontColor = DBGetContactSettingDword(NULL, "SRMsg", "Font0Col", 0);
+ tFontColor = db_get_dw(NULL, "SRMsg", "Font0Col", 0);
}
else {
tFontColor = 0;
@@ -849,7 +849,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus)
}
msnNsThread->sendPacket("CHG", "%s %u:%u %s", szStatusName, myFlags, myFlagsEx, msnObject.pszVal ? msnObject.pszVal : "0");
- DBFreeVariant(&msnObject);
+ db_free(&msnObject);
}
else msnNsThread->sendPacket("CHG", szStatusName);
}
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index 2acbb835b1..644fddaa6e 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -435,8 +435,8 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
proto->setByte("SlowSend", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SLOWSEND ));
if (proto->getByte("SlowSend", FALSE))
{
- if (DBGetContactSettingDword(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
- DBGetContactSettingDword(NULL, "SRMM", "MessageTimeout", 60000) < 60000)
+ if (db_get_dw(NULL, "SRMsg", "MessageTimeout", 60000) < 60000 ||
+ db_get_dw(NULL, "SRMM", "MessageTimeout", 60000) < 60000)
{
MessageBox(NULL, TranslateT("MSN Protocol requires message timeout to be not less then 60 sec. Correct the timeout value."),
TranslateT("MSN Protocol"), MB_OK|MB_ICONINFORMATION);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index 8df8e48531..04a079bfd3 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -114,10 +114,10 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
if (MyOptions.SlowSend)
{
- if (DBGetContactSettingDword(NULL, "SRMsg", "MessageTimeout", 10000) < 60000)
- DBWriteContactSettingDword(NULL, "SRMsg", "MessageTimeout", 60000);
- if (DBGetContactSettingDword(NULL, "SRMM", "MessageTimeout", 10000) < 60000)
- DBWriteContactSettingDword(NULL, "SRMM", "MessageTimeout", 60000);
+ if (db_get_dw(NULL, "SRMsg", "MessageTimeout", 10000) < 60000)
+ db_set_dw(NULL, "SRMsg", "MessageTimeout", 60000);
+ if (db_get_dw(NULL, "SRMM", "MessageTimeout", 10000) < 60000)
+ db_set_dw(NULL, "SRMM", "MessageTimeout", 60000);
}
mailsoundname = (char*)mir_alloc(64);
@@ -244,12 +244,12 @@ HANDLE CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD fl
if (flags & PALF_TEMPORARY)
{
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) == 1)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ if (db_get_b(hContact, "CList", "NotOnList", 0) == 1)
+ db_set_b(hContact, "CList", "Hidden", 1);
}
else
{
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
if (msnLoggedIn)
{
// int netId = Lists_GetNetId(email);
@@ -260,7 +260,7 @@ HANDLE CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD fl
MSN_AddUser(hContact, email, netId, LIST_PL + LIST_REMOVE);
MSN_AddUser(hContact, email, netId, LIST_BL + LIST_REMOVE);
MSN_AddUser(hContact, email, netId, LIST_AL);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
}
MSN_SetContactDb(hContact, email);
@@ -681,7 +681,7 @@ void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg)
AwayMsgInfo *inf = (AwayMsgInfo*)arg;
DBVARIANT dbv;
- if (!DBGetContactSettingTString(inf->hContact, "CList", "StatusMsg", &dbv)) {
+ if (!db_get_ts(inf->hContact, "CList", "StatusMsg", &dbv)) {
SendBroadcast(inf->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)inf->id, (LPARAM)dbv.ptszVal);
MSN_FreeVariant(&dbv);
}
@@ -771,7 +771,7 @@ int __cdecl CMsnProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre)
getStaticString(hContact, "e-mail", tEmail, sizeof(tEmail));
if (Lists_IsInList(LIST_FL, tEmail))
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
return Proto_RecvMessage(hContact, pre);
}
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp
index c3ec9f6020..d0e1e6b32c 100644
--- a/protocols/MSN/src/msn_soapab.cpp
+++ b/protocols/MSN/src/msn_soapab.cpp
@@ -834,7 +834,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
if (strcmp(ezxml_txt(ezxml_child(anot, "Name")), "AB.NickName") == 0)
{
szNick = ezxml_txt(ezxml_child(anot, "Value"));
- DBWriteContactSettingStringUtf(hContact, "CList", "MyHandle", szNick);
+ db_set_utf(hContact, "CList", "MyHandle", szNick);
}
if (strcmp(ezxml_txt(ezxml_child(anot, "Name")), "AB.JobTitle") == 0)
{
@@ -844,7 +844,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
anot = ezxml_next(anot);
}
if (szNick == NULL)
- DBDeleteContactSetting(hContact, "CList", "MyHandle");
+ db_unset(hContact, "CList", "MyHandle");
setString(hContact, "ID", szContId);
@@ -893,8 +893,8 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
}
szTmp = ezxml_txt(ezxml_child(contInf, "comment"));
- if (*szTmp) DBWriteContactSettingString(hContact, "UserInfo", "MyNotes", szTmp);
- // else DBDeleteContactSetting(hContact, "UserInfo", "MyNotes");
+ if (*szTmp) db_set_s(hContact, "UserInfo", "MyNotes", szTmp);
+ // else db_unset(hContact, "UserInfo", "MyNotes");
ezxml_t loc = ezxml_get(contInf, "locations", 0, "ContactLocation", -1);
while (loc != NULL)
diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp
index 0f75491617..cbff0068a8 100644
--- a/protocols/MSN/src/msn_srv.cpp
+++ b/protocols/MSN/src/msn_srv.cpp
@@ -238,7 +238,7 @@ void CMsnProto::MSN_UploadServerGroups(char* group)
if (msc == NULL) break;
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(msc->hContact, "CList", "Group", &dbv))
+ if (!db_get_utf(msc->hContact, "CList", "Group", &dbv))
{
char szGroupID[100];
if (group == NULL || (strcmp(group, dbv.pszVal) == 0 &&
@@ -263,12 +263,12 @@ void CMsnProto::MSN_SyncContactToServerGroup(HANDLE hContact, const char* szCont
const char* szGrpName = "";
DBVARIANT dbv;
- if (!DBGetContactSettingStringUtf(hContact, "CList", "Group", &dbv))
+ if (!db_get_utf(hContact, "CList", "Group", &dbv))
{
if (strcmp(dbv.pszVal, "MetaContacts Hidden Group") == 0)
{
MSN_FreeVariant(&dbv);
- if (!DBGetContactSettingStringUtf(hContact, "MetaContacts", "OldCListGroup", &dbv))
+ if (!db_get_utf(hContact, "MetaContacts", "OldCListGroup", &dbv))
{
szGrpName = NEWSTR_ALLOCA(dbv.pszVal);
MSN_FreeVariant(&dbv);
@@ -301,12 +301,12 @@ void CMsnProto::MSN_SyncContactToServerGroup(HANDLE hContact, const char* szCont
setString(hContact, "GroupID", szGrpIdF);
const char* szGrpNameById = MSN_GetGroupById(szGrpIdF);
if (strcmp(szGrpNameById, szGrpName))
- DBWriteContactSettingStringUtf(hContact, "CList", "Group", szGrpNameById);
+ db_set_utf(hContact, "CList", "Group", szGrpNameById);
}
else
{
if (szGrpName[0])
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
deleteSetting(hContact, "GroupID");
}
}
diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp
index d96e13d8fa..43532ec6a5 100644
--- a/protocols/MSN/src/msn_std.cpp
+++ b/protocols/MSN/src/msn_std.cpp
@@ -27,47 +27,47 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Standard functions
void CMsnProto::deleteSetting(HANDLE hContact, const char* valueName)
-{ DBDeleteContactSetting(hContact, m_szModuleName, valueName);
+{ db_unset(hContact, m_szModuleName, valueName);
}
int CMsnProto::getByte(const char* name, BYTE defaultValue)
-{ return DBGetContactSettingByte(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_b(NULL, m_szModuleName, name, defaultValue);
}
int CMsnProto::getByte(HANDLE hContact, const char* name, BYTE defaultValue)
-{ return DBGetContactSettingByte(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_b(hContact, m_szModuleName, name, defaultValue);
}
int CMsnProto::getDword(const char* name, DWORD defaultValue)
-{ return DBGetContactSettingDword(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_dw(NULL, m_szModuleName, name, defaultValue);
}
int CMsnProto::getDword(HANDLE hContact, const char* name, DWORD defaultValue)
-{ return DBGetContactSettingDword(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_dw(hContact, m_szModuleName, name, defaultValue);
}
int CMsnProto::getString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(NULL, m_szModuleName, name, result);
+{ return db_get_s(NULL, m_szModuleName, name, result);
}
int CMsnProto::getString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(hContact, m_szModuleName, name, result);
+{ return db_get_s(hContact, m_szModuleName, name, result);
}
int CMsnProto::getTString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingTString(NULL, m_szModuleName, name, result);
+{ return db_get_ts(NULL, m_szModuleName, name, result);
}
int CMsnProto::getTString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingTString(hContact, m_szModuleName, name, result);
+{ return db_get_ts(hContact, m_szModuleName, name, result);
}
int CMsnProto::getStringUtf(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingStringUtf(hContact, m_szModuleName, name, result);
+{ return db_get_utf(hContact, m_szModuleName, name, result);
}
int CMsnProto::getStringUtf(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingStringUtf(NULL, m_szModuleName, name, result);
+{ return db_get_utf(NULL, m_szModuleName, name, result);
}
int CMsnProto::getStaticString(HANDLE hContact, const char* valueName, char* dest, unsigned dest_len)
@@ -88,55 +88,55 @@ int CMsnProto::getStaticString(HANDLE hContact, const char* valueName, char* de
}
WORD CMsnProto::getWord(const char* name, WORD defaultValue)
-{ return DBGetContactSettingWord(NULL, m_szModuleName, name, defaultValue);
+{ return db_get_w(NULL, m_szModuleName, name, defaultValue);
}
WORD CMsnProto::getWord(HANDLE hContact, const char* name, WORD defaultValue)
-{ return DBGetContactSettingWord(hContact, m_szModuleName, name, defaultValue);
+{ return db_get_w(hContact, m_szModuleName, name, defaultValue);
}
void CMsnProto::setByte(const char* name, BYTE value)
-{ DBWriteContactSettingByte(NULL, m_szModuleName, name, value);
+{ db_set_b(NULL, m_szModuleName, name, value);
}
void CMsnProto::setByte(HANDLE hContact, const char* name, BYTE value)
-{ DBWriteContactSettingByte(hContact, m_szModuleName, name, value);
+{ db_set_b(hContact, m_szModuleName, name, value);
}
void CMsnProto::setDword(const char* name, DWORD value)
-{ DBWriteContactSettingDword(NULL, m_szModuleName, name, value);
+{ db_set_dw(NULL, m_szModuleName, name, value);
}
void CMsnProto::setDword(HANDLE hContact, const char* name, DWORD value)
-{ DBWriteContactSettingDword(hContact, m_szModuleName, name, value);
+{ db_set_dw(hContact, m_szModuleName, name, value);
}
void CMsnProto::setString(const char* name, const char* value)
-{ DBWriteContactSettingString(NULL, m_szModuleName, name, value);
+{ db_set_s(NULL, m_szModuleName, name, value);
}
void CMsnProto::setString(HANDLE hContact, const char* name, const char* value)
-{ DBWriteContactSettingString(hContact, m_szModuleName, name, value);
+{ db_set_s(hContact, m_szModuleName, name, value);
}
void CMsnProto::setStringUtf(HANDLE hContact, const char* name, const char* value)
-{ DBWriteContactSettingStringUtf(hContact, m_szModuleName, name, value);
+{ db_set_utf(hContact, m_szModuleName, name, value);
}
void CMsnProto::setTString(const char* name, const TCHAR* value)
-{ DBWriteContactSettingTString(NULL, m_szModuleName, name, value);
+{ db_set_ts(NULL, m_szModuleName, name, value);
}
void CMsnProto::setTString(HANDLE hContact, const char* name, const TCHAR* value)
-{ DBWriteContactSettingTString(hContact, m_szModuleName, name, value);
+{ db_set_ts(hContact, m_szModuleName, name, value);
}
void CMsnProto::setWord(const char* name, WORD value)
-{ DBWriteContactSettingWord(NULL, m_szModuleName, name, value);
+{ db_set_w(NULL, m_szModuleName, name, value);
}
void CMsnProto::setWord(HANDLE hContact, const char* name, WORD value)
-{ DBWriteContactSettingWord(hContact, m_szModuleName, name, value);
+{ db_set_w(hContact, m_szModuleName, name, value);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -206,7 +206,7 @@ TCHAR* CMsnProto::GetContactNameT(HANDLE hContact)
void MSN_FreeVariant(DBVARIANT* dbv)
{
- DBFreeVariant(dbv);
+ db_free(dbv);
}
char* MSN_Translate(const char* str)
diff --git a/protocols/MSN/src/msn_useropts.cpp b/protocols/MSN/src/msn_useropts.cpp
index 24b04705e0..ee7856fe9b 100644
--- a/protocols/MSN/src/msn_useropts.cpp
+++ b/protocols/MSN/src/msn_useropts.cpp
@@ -36,8 +36,8 @@ INT_PTR CALLBACK MsnDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
const HANDLE hContact = (HANDLE)lParam;
- SetDlgItemInt(hwndDlg, IDC_MOBILE, DBGetContactSettingByte(hContact, m_szModuleName, "MobileAllowed", 0), 0);
- SetDlgItemInt(hwndDlg, IDC_MSN_MOBILE, DBGetContactSettingByte(hContact, m_szModuleName, "MobileEnabled", 0), 0);
+ SetDlgItemInt(hwndDlg, IDC_MOBILE, db_get_b(hContact, m_szModuleName, "MobileAllowed", 0), 0);
+ SetDlgItemInt(hwndDlg, IDC_MSN_MOBILE, db_get_b(hContact, m_szModuleName, "MobileEnabled", 0), 0);
DWORD dwFlagBits = setDword(hContact, "FlagBits", 0);
SetDlgItemTextA(hwndDlg, IDC_WEBMESSENGER, (dwFlagBits & 0x200) ? "Y" : "N");
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index 7b16ccdfc3..647f012b40 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -108,7 +108,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
if ( !getU8String( OMEGLE_KEY_LAST_QUESTION,&dbv )) {
params = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (params.empty()) {
@@ -139,7 +139,7 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
if ( !getU8String( OMEGLE_KEY_ASL,&dbv )) {
text = dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
UpdateChat(NULL, TranslateT("Your '/asl' setting is empty."), false);
break;
@@ -367,13 +367,13 @@ void OmegleProto::SetChatStatus(int status)
// Load actual name from database
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, m_szModuleName, OMEGLE_KEY_NAME, &dbv))
+ if ( !db_get_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, &dbv))
{
facy.nick_ = mir_tstrdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
facy.nick_ = mir_tstrdup(TranslateT("You"));
- DBWriteContactSettingTString(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_);
+ db_set_ts(NULL, m_szModuleName, OMEGLE_KEY_NAME, facy.nick_);
}
// Add self contact
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index 047e6177a3..ea4604b167 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -117,7 +117,7 @@ bool Omegle_client::handle_error( std::string method, bool force_disconnect )
if ( force_disconnect )
result = false;
- else if ( error_count_ <= (UINT)DBGetContactSettingByte(NULL,parent->m_szModuleName,OMEGLE_KEY_TIMEOUTS_LIMIT,OMEGLE_TIMEOUTS_LIMIT))
+ else if ( error_count_ <= (UINT)db_get_b(NULL,parent->m_szModuleName,OMEGLE_KEY_TIMEOUTS_LIMIT,OMEGLE_TIMEOUTS_LIMIT))
result = true;
else
result = false;
@@ -138,7 +138,7 @@ std::string Omegle_client::get_server( bool not_last )
{
BYTE q = not_last ? 1 : 0;
- BYTE server = DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
+ BYTE server = db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
if (server < 0 || server >= (SIZEOF(servers)-q))
server = 0;
@@ -327,10 +327,10 @@ bool Omegle_client::start()
} else {
data = "&ask=" + utils::url::encode(this->question_);
data += "&cansavequestion=";
- data += DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_REUSE_QUESTION, 0) ? "1" : "0";
+ data += db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_REUSE_QUESTION, 0) ? "1" : "0";
}
}
- else if ( DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0))
+ else if ( db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_MEET_COMMON, 0))
{
DBVARIANT dbv;
if (!DBGetContactSettingUTF8String(NULL, parent->m_szModuleName, OMEGLE_KEY_INTERESTS, &dbv))
@@ -338,7 +338,7 @@ bool Omegle_client::start()
std::string topics = dbv.pszVal;
std::string topic;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
std::string::size_type pos = 0;
std::string::size_type pos2 = 0;
@@ -376,7 +376,7 @@ bool Omegle_client::start()
}
}
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER_INFO, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER_INFO, 0))
{
std::string count = get_page( OMEGLE_REQUEST_COUNT );
if (!count.empty()) {
@@ -608,7 +608,7 @@ bool Omegle_client::events( )
if ( resp.data.find( "[\"strangerDisconnected\"]" ) != std::string::npos ) {
// Stranger disconnected
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
{
SkinPlaySound( "StrangerChange" );
parent->NewChat();
@@ -633,7 +633,7 @@ bool Omegle_client::events( )
mir_free(msg);
// Stranger disconnected
- if (DBGetContactSettingByte(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
+ if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
{
SkinPlaySound( "StrangerChange" );
parent->NewChat();
@@ -670,11 +670,11 @@ bool Omegle_client::events( )
if (newStranger && state_ != STATE_SPY) {
// We got new stranger in this event, lets say him "Hi message" if enabled
- if ( DBGetContactSettingByte( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 )) {
+ if ( db_get_b( NULL, parent->m_szModuleName, OMEGLE_KEY_HI_ENABLED, 0 )) {
DBVARIANT dbv;
if ( !DBGetContactSettingUTF8String( NULL, parent->m_szModuleName, OMEGLE_KEY_HI, &dbv )) {
std::string *message = new std::string(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
parent->Log("**Chat - saying Hi! message");
ForkThread(&OmegleProto::SendMsgWorker, parent, (void*)message);
diff --git a/protocols/Omegle/src/db.h b/protocols/Omegle/src/db.h
index ea80a53d48..6543b9f2d8 100644
--- a/protocols/Omegle/src/db.h
+++ b/protocols/Omegle/src/db.h
@@ -23,19 +23,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
// DB macros
-#define getByte( setting, error ) DBGetContactSettingByte( NULL, m_szModuleName, setting, error )
-#define setByte( setting, value ) DBWriteContactSettingByte( NULL, m_szModuleName, setting, value )
-#define getWord( setting, error ) DBGetContactSettingWord( NULL, m_szModuleName, setting, error )
-#define setWord( setting, value ) DBWriteContactSettingWord( NULL, m_szModuleName, setting, value )
-#define getDword( setting, error ) DBGetContactSettingDword( NULL, m_szModuleName, setting, error )
-#define setDword( setting, value ) DBWriteContactSettingDword( NULL, m_szModuleName, setting, value )
-#define getString( setting, dest ) DBGetContactSettingString( NULL, m_szModuleName, setting, dest )
-#define setString( setting, value ) DBWriteContactSettingString( NULL, m_szModuleName, setting, value )
-#define getTString( setting, dest ) DBGetContactSettingTString( NULL, m_szModuleName, setting, dest )
-#define setTString( setting, value ) DBWriteContactSettingTString( NULL, m_szModuleName, setting, value )
+#define getByte( setting, error ) db_get_b( NULL, m_szModuleName, setting, error )
+#define setByte( setting, value ) db_set_b( NULL, m_szModuleName, setting, value )
+#define getWord( setting, error ) db_get_w( NULL, m_szModuleName, setting, error )
+#define setWord( setting, value ) db_set_w( NULL, m_szModuleName, setting, value )
+#define getDword( setting, error ) db_get_dw( NULL, m_szModuleName, setting, error )
+#define setDword( setting, value ) db_set_dw( NULL, m_szModuleName, setting, value )
+#define getString( setting, dest ) db_get_s( NULL, m_szModuleName, setting, dest )
+#define setString( setting, value ) db_set_s( NULL, m_szModuleName, setting, value )
+#define getTString( setting, dest ) db_get_ts( NULL, m_szModuleName, setting, dest )
+#define setTString( setting, value ) db_set_ts( NULL, m_szModuleName, setting, value )
#define getU8String( setting, dest ) DBGetContactSettingUTF8String( NULL, m_szModuleName, setting, dest )
#define setU8String( setting, value ) DBWriteContactSettingUTF8String( NULL, m_szModuleName, setting, value )
-#define deleteSetting( setting ) DBDeleteContactSetting( NULL, m_szModuleName, setting )
+#define deleteSetting( setting ) db_unset( NULL, m_szModuleName, setting )
// DB settings
#define OMEGLE_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN]
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp
index 19f9fde011..a3dff58abc 100644
--- a/protocols/Omegle/src/dialogs.cpp
+++ b/protocols/Omegle/src/dialogs.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static BOOL LoadDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting, BYTE bDef = 0)
{
- BOOL state = DBGetContactSettingByte(NULL, ppro->m_szModuleName, szSetting, bDef);
+ BOOL state = db_get_b(NULL, ppro->m_szModuleName, szSetting, bDef);
CheckDlgButton(hwnd, idCtrl, state);
return state;
}
@@ -32,17 +32,17 @@ static BOOL LoadDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const cha
static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
BOOL state = IsDlgButtonChecked(hwnd, idCtrl);
- DBWriteContactSettingByte(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
+ db_set_b(NULL, ppro->m_szModuleName, szSetting, (BYTE)state);
return state;
}
static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting)
{
DBVARIANT dbv;
- if ( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, szSetting, &dbv))
+ if ( !db_get_ts(NULL, ppro->m_szModuleName, szSetting, &dbv))
{
SetDlgItemText(hwnd, idCtrl, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -52,9 +52,9 @@ static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* sz
GetDlgItemText(hwnd, idCtrl, tstr, sizeof(tstr));
if ( _tcsclen( tstr ) > 0 ) {
- DBWriteContactSettingTString(NULL, ppro->m_szModuleName, szSetting, tstr);
+ db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr);
} else {
- DBDeleteContactSetting(NULL, ppro->m_szModuleName, szSetting);
+ db_unset(NULL, ppro->m_szModuleName, szSetting);
}
}
@@ -80,7 +80,7 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
{
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
}
- SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, DBGetContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
+ SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
LoadDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -114,7 +114,7 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
{
proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
StoreDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
StoreDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -152,7 +152,7 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
{
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
}
- SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, DBGetContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
+ SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
LoadDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
LoadDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
@@ -208,7 +208,7 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR
{
proto = reinterpret_cast<OmegleProto*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, SendDlgItemMessage(hwnd, IDC_SERVER, CB_GETCURSEL, 0, 0));
StoreDBText(proto, hwnd, IDC_NAME, OMEGLE_KEY_NAME);
StoreDBText(proto, hwnd, IDC_INTERESTS, OMEGLE_KEY_INTERESTS);
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp
index 2380eb48ec..ad5229f13d 100644
--- a/protocols/Omegle/src/proto.cpp
+++ b/protocols/Omegle/src/proto.cpp
@@ -236,7 +236,7 @@ int OmegleProto::OnContactDeleted(WPARAM wparam,LPARAM)
if ( include_chat )
return true;
else
- return DBGetContactSettingByte(hContact,m_szModuleName,"ChatRoom",0) == 0;
+ return db_get_b(hContact,m_szModuleName,"ChatRoom",0) == 0;
} else {
return false;
}
diff --git a/protocols/Omegle/src/utils.cpp b/protocols/Omegle/src/utils.cpp
index 09b6eed036..b259fa5933 100644
--- a/protocols/Omegle/src/utils.cpp
+++ b/protocols/Omegle/src/utils.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
std::string utils::url::encode(const std::string &s)
{
- return mir_ptr<char>( mir_urlEncode( s.c_str()));
+ return (char*)mir_ptr<char>( mir_urlEncode( s.c_str()));
}
void utils::text::replace_first( std::string* data, std::string from, std::string to )
diff --git a/protocols/Tlen/src/jabber.h b/protocols/Tlen/src/jabber.h
index 954e3b4069..2b3899cc3a 100644
--- a/protocols/Tlen/src/jabber.h
+++ b/protocols/Tlen/src/jabber.h
@@ -283,14 +283,14 @@ struct TlenProtocol : public PROTO_INTERFACE
struct ThreadDataStruct *threadData;
HANDLE hTlenNudge;
- HANDLE hMenuMUC;
- HANDLE hMenuChats;
- HANDLE hMenuInbox;
- HANDLE hMenuContactMUC;
- HANDLE hMenuContactVoice;
- HANDLE hMenuContactGrantAuth;
- HANDLE hMenuContactRequestAuth;
- HANDLE hMenuPicture;
+ HGENMENU hMenuMUC;
+ HGENMENU hMenuChats;
+ HGENMENU hMenuInbox;
+ HGENMENU hMenuContactMUC;
+ HGENMENU hMenuContactVoice;
+ HGENMENU hMenuContactGrantAuth;
+ HGENMENU hMenuContactRequestAuth;
+ HGENMENU hMenuPicture;
HANDLE* hServices;
unsigned serviceNum;
diff --git a/protocols/Tlen/src/jabber_iqid.cpp b/protocols/Tlen/src/jabber_iqid.cpp
index 3cf0e0f2ae..ef5a6844dc 100644
--- a/protocols/Tlen/src/jabber_iqid.cpp
+++ b/protocols/Tlen/src/jabber_iqid.cpp
@@ -38,10 +38,10 @@ void JabberIqResultAuth(TlenProtocol *proto, XmlNode *iqNode)
if (!strcmp(type, "result")) {
DBVARIANT dbv;
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Nick", &dbv))
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Nick", proto->threadData->username);
+ if (db_get(NULL, proto->m_szModuleName, "Nick", &dbv))
+ db_set_s(NULL, proto->m_szModuleName, "Nick", proto->threadData->username);
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
// iqId = JabberSerialNext();
// JabberIqAdd(iqId, IQ_PROC_NONE, JabberIqResultGetRoster);
// JabberSend(info, "<iq type='get' id='"JABBER_IQID"%d'><query xmlns='jabber:iq:roster'/></iq>", iqId);
@@ -77,8 +77,8 @@ void JabberResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
str = JabberXmlGetAttrValue(itemNode, "subscription");
if (!strcmp(str, "remove")) {
if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
- if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
JabberListRemove(proto, LIST_ROSTER, jid);
} else {
@@ -103,21 +103,21 @@ void JabberResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) {
// Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if (strcmp(dbv.pszVal, item->group))
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, "CList", "Group", item->group);
+ db_free(&dbv);
} else
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
} else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
}
}
@@ -175,37 +175,37 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
// Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
// Don't set group again if already correct, or Miranda may show wrong group count in some case
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if (strcmp(dbv.pszVal, item->group))
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
- DBFreeVariant(&dbv);
+ db_set_s(hContact, "CList", "Group", item->group);
+ db_free(&dbv);
}
else
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
}
else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "AvatarHash", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "AvatarHash", &dbv)) {
if (item->avatarHash) mir_free(item->avatarHash);
item->avatarHash = mir_strdup(dbv.pszVal);
JabberLog(proto, "Setting hash [%s] = %s", nick, item->avatarHash);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- item->avatarFormat = DBGetContactSettingDword(hContact, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ item->avatarFormat = db_get_dw(hContact, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
}
}
}
}
// Delete orphaned contacts (if roster sync is enabled)
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "RosterSync", FALSE) == TRUE) {
HANDLE *list;
int listSize, listAllocSize;
@@ -215,7 +215,7 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
while (hContact != NULL) {
str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, proto->m_szModuleName)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if (!JabberListExist(proto, LIST_ROSTER, dbv.pszVal)) {
JabberLog(proto, "Syncing roster: preparing to delete %s (hContact=0x%x)", dbv.pszVal, hContact);
if (listSize >= listAllocSize) {
@@ -227,7 +227,7 @@ void JabberIqResultRoster(TlenProtocol *proto, XmlNode *iqNode)
}
list[listSize++] = hContact;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hContact = db_find_next(hContact);
@@ -279,20 +279,20 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
if ((itemNode=JabberXmlGetChild(queryNode, "item")) == NULL) return;
if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
+ if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
if (strchr(jid, '@') != NULL) {
sprintf(text, "%s", jid);
} else {
sprintf(text, "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ((hContact=JabberHContactFromJID(proto, text)) == NULL) {
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv)) return;
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) return;
if (strcmp(dbv.pszVal, jid)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else {
hContact = NULL;
@@ -305,7 +305,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
if (n->text != NULL) {
hasFirst = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "FirstName", nText);
+ db_set_s(hContact, proto->m_szModuleName, "FirstName", nText);
mir_free(nText);
}
}
@@ -313,7 +313,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
if (n->text != NULL) {
hasLast = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "LastName", nText);
+ db_set_s(hContact, proto->m_szModuleName, "LastName", nText);
mir_free(nText);
}
}
@@ -321,7 +321,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
if (n->text != NULL) {
hasNick = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nText);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nText);
mir_free(nText);
}
}
@@ -329,7 +329,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
if (n->text != NULL) {
hasEmail = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "e-mail", nText);
+ db_set_s(hContact, proto->m_szModuleName, "e-mail", nText);
mir_free(nText);
}
}
@@ -337,7 +337,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
if (n->text != NULL) {
hasCity = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "City", nText);
+ db_set_s(hContact, proto->m_szModuleName, "City", nText);
mir_free(nText);
}
}
@@ -346,20 +346,20 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
WORD nAge;
hasAge = TRUE;
nAge = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Age", nAge);
+ db_set_w(hContact, proto->m_szModuleName, "Age", nAge);
}
}
else if (!strcmp(n->name, "s")) {
if (n->text != NULL && n->text[1] == '\0' && (n->text[0] == '1' || n->text[0] == '2')) {
hasGender = TRUE;
- DBWriteContactSettingByte(hContact, proto->m_szModuleName, "Gender", (BYTE) (n->text[0] == '1'?'M':'F'));
+ db_set_b(hContact, proto->m_szModuleName, "Gender", (BYTE) (n->text[0] == '1'?'M':'F'));
}
}
else if (!strcmp(n->name, "e")) {
if (n->text != NULL) {
hasSchool = TRUE;
nText = JabberTextDecode(n->text);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "School", nText);
+ db_set_s(hContact, proto->m_szModuleName, "School", nText);
mir_free(nText);
}
}
@@ -368,7 +368,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
WORD nOccupation;
hasOccupation = TRUE;
nOccupation = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Occupation", nOccupation);
+ db_set_w(hContact, proto->m_szModuleName, "Occupation", nOccupation);
}
}
else if (!strcmp(n->name, "r")) {
@@ -376,45 +376,45 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode)
WORD nLookFor;
hasLookFor = TRUE;
nLookFor = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "LookingFor", nLookFor);
+ db_set_w(hContact, proto->m_szModuleName, "LookingFor", nLookFor);
}
}
else if (!strcmp(n->name, "g")) { // voice chat enabled
if (n->text != NULL) {
BYTE bVoice;
bVoice = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "VoiceChat", bVoice);
+ db_set_w(hContact, proto->m_szModuleName, "VoiceChat", bVoice);
}
}
else if (!strcmp(n->name, "v")) { // status visibility
if (n->text != NULL) {
BYTE bPublic;
bPublic = atoi(n->text);
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "PublicStatus", bPublic);
+ db_set_w(hContact, proto->m_szModuleName, "PublicStatus", bPublic);
}
}
}
if (!hasFirst)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "FirstName");
+ db_unset(hContact, proto->m_szModuleName, "FirstName");
if (!hasLast)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "LastName");
+ db_unset(hContact, proto->m_szModuleName, "LastName");
// We are not removing "Nick"
// if (!hasNick)
-// DBDeleteContactSetting(hContact, m_szModuleName, "Nick");
+// db_unset(hContact, m_szModuleName, "Nick");
if (!hasEmail)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "e-mail");
+ db_unset(hContact, proto->m_szModuleName, "e-mail");
if (!hasCity)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "City");
+ db_unset(hContact, proto->m_szModuleName, "City");
if (!hasAge)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Age");
+ db_unset(hContact, proto->m_szModuleName, "Age");
if (!hasGender)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Gender");
+ db_unset(hContact, proto->m_szModuleName, "Gender");
if (!hasSchool)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "School");
+ db_unset(hContact, proto->m_szModuleName, "School");
if (!hasOccupation)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Occupation");
+ db_unset(hContact, proto->m_szModuleName, "Occupation");
if (!hasLookFor)
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "LookingFor");
+ db_unset(hContact, proto->m_szModuleName, "LookingFor");
ProtoBroadcastAck(proto->m_szModuleName, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
}
}
@@ -435,7 +435,7 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
if (!strcmp(type, "result")) {
if ((queryNode=JabberXmlGetChild(iqNode, "query")) == NULL) return;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT);
jsr.hdr.flags = PSR_TCHAR;
for (i=0; i<queryNode->numChild; i++) {
@@ -510,7 +510,7 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode)
mir_free(proto->searchJID);
proto->searchJID = NULL;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
found = 0;
if (queryNode->numChild == TLEN_MAX_SEARCH_RESULTS_PER_PAGE) {
@@ -604,9 +604,9 @@ void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode)
item->system = NULL;
if (( hContact=JabberHContactFromJID(proto, item->jid )) != NULL ) {
if (item->software != NULL) {
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "MirVer", item->software);
+ db_set_s(hContact, proto->m_szModuleName, "MirVer", item->software);
} else {
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "MirVer");
+ db_unset(hContact, proto->m_szModuleName, "MirVer");
}
}
}
@@ -629,7 +629,7 @@ void TlenIqResultInfo(TlenProtocol *proto, XmlNode *iqNode)
if (item->software == NULL) {
char str[128];
mir_snprintf(str, sizeof(str), "Tlen Protocol %s", item->protocolVersion);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "MirVer", str);
+ db_set_s(hContact, proto->m_szModuleName, "MirVer", str);
}
}
}
diff --git a/protocols/Tlen/src/jabber_misc.cpp b/protocols/Tlen/src/jabber_misc.cpp
index fccf376f72..30ec49b67d 100644
--- a/protocols/Tlen/src/jabber_misc.cpp
+++ b/protocols/Tlen/src/jabber_misc.cpp
@@ -50,13 +50,13 @@ void JabberDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick)
// strip resource if present
s = JabberLoginFromJID(jid);
_strlwr(s);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", s);
+ db_set_s(hContact, proto->m_szModuleName, "jid", s);
mir_free(s);
}
else {
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "Hidden");
+ db_unset(hContact, proto->m_szModuleName, "Hidden");
}
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nick);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
JabberLog(proto, "auth request: %s, %s", jid, nick);
//blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
@@ -76,9 +76,9 @@ char *JabberJIDFromHContact(TlenProtocol *proto, HANDLE hContact)
{
char *p = NULL;
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
p = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return p;
}
@@ -95,15 +95,15 @@ HANDLE JabberHContactFromJID(TlenProtocol *proto, const char *jid)
while (hContact != NULL) {
szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(proto->m_szModuleName, szProto)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if ((p=dbv.pszVal) != NULL) {
if (!stricmp(p, jid)) { // exact match (node@domain/resource)
hContactMatched = hContact;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hContact = db_find_next(hContact);
@@ -123,11 +123,11 @@ HANDLE JabberDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL te
if ((hContact=JabberHContactFromJID(proto, jid)) == NULL) {
hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", jid);
+ db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if (nick != NULL && nick[0] != '\0')
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "Nick", nick);
+ db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
if (temporary)
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
}
return hContact;
}
@@ -141,22 +141,22 @@ static void JabberContactListCreateClistGroup(char *groupName)
for (i=0;;i++) {
itoa(i, str, 10);
- if (DBGetContactSetting(NULL, "CListGroups", str, &dbv))
+ if (db_get(NULL, "CListGroups", str, &dbv))
break;
name = dbv.pszVal;
if (name[0] != '\0' && !strcmp(name+1, groupName)) {
// Already exist, no need to create
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// Create new group with id = i (str is the text representation of i)
newName[0] = 1 | GROUPF_EXPANDED;
strncpy(newName+1, groupName, sizeof(newName)-1);
newName[sizeof(newName)-1] = '\0';
- DBWriteContactSettingString(NULL, "CListGroups", str, newName);
+ db_set_s(NULL, "CListGroups", str, newName);
CallService(MS_CLUI_GROUPADDED, i+1, 0);
}
diff --git a/protocols/Tlen/src/jabber_opt.cpp b/protocols/Tlen/src/jabber_opt.cpp
index 594bbe0ade..fb0e68de1d 100644
--- a/protocols/Tlen/src/jabber_opt.cpp
+++ b/protocols/Tlen/src/jabber_opt.cpp
@@ -47,23 +47,23 @@ static TabDef tabPages[] = {
void TlenLoadOptions(TlenProtocol *proto)
{
- proto->tlenOptions.savePassword = DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE);
- proto->tlenOptions.useEncryption = DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE);
- proto->tlenOptions.reconnect = DBGetContactSettingByte(NULL, proto->m_szModuleName, "Reconnect", TRUE);
- proto->tlenOptions.alertPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "AlertPolicy", TLEN_ALERTS_IGNORE_NIR);
- proto->tlenOptions.rosterSync = DBGetContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", FALSE);
- proto->tlenOptions.offlineAsInvisible = DBGetContactSettingByte(NULL, proto->m_szModuleName, "OfflineAsInvisible", FALSE);
- proto->tlenOptions.leaveOfflineMessage = DBGetContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", TRUE);
- proto->tlenOptions.offlineMessageOption = DBGetContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", 0);
- proto->tlenOptions.ignoreAdvertisements = DBGetContactSettingByte(NULL, proto->m_szModuleName, "IgnoreAdvertisements", TRUE);
- proto->tlenOptions.groupChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", TLEN_MUC_ASK);
- proto->tlenOptions.voiceChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", TLEN_MUC_ASK);
- proto->tlenOptions.imagePolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "ImagePolicy",TLEN_IMAGES_IGNORE_NIR);
- proto->tlenOptions.enableAvatars = DBGetContactSettingByte(NULL, proto->m_szModuleName, "EnableAvatars", TRUE);
- proto->tlenOptions.enableVersion = DBGetContactSettingByte(NULL, proto->m_szModuleName, "EnableVersion", TRUE);
- proto->tlenOptions.useNudge = DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseNudge", FALSE);
- proto->tlenOptions.logAlerts = DBGetContactSettingByte(NULL, proto->m_szModuleName, "LogAlerts", TRUE);
- proto->tlenOptions.sendKeepAlive = DBGetContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", TRUE);
+ proto->tlenOptions.savePassword = db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE);
+ proto->tlenOptions.useEncryption = db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE);
+ proto->tlenOptions.reconnect = db_get_b(NULL, proto->m_szModuleName, "Reconnect", TRUE);
+ proto->tlenOptions.alertPolicy = db_get_w(NULL, proto->m_szModuleName, "AlertPolicy", TLEN_ALERTS_IGNORE_NIR);
+ proto->tlenOptions.rosterSync = db_get_b(NULL, proto->m_szModuleName, "RosterSync", FALSE);
+ proto->tlenOptions.offlineAsInvisible = db_get_b(NULL, proto->m_szModuleName, "OfflineAsInvisible", FALSE);
+ proto->tlenOptions.leaveOfflineMessage = db_get_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", TRUE);
+ proto->tlenOptions.offlineMessageOption = db_get_w(NULL, proto->m_szModuleName, "OfflineMessageOption", 0);
+ proto->tlenOptions.ignoreAdvertisements = db_get_b(NULL, proto->m_szModuleName, "IgnoreAdvertisements", TRUE);
+ proto->tlenOptions.groupChatPolicy = db_get_w(NULL, proto->m_szModuleName, "GroupChatPolicy", TLEN_MUC_ASK);
+ proto->tlenOptions.voiceChatPolicy = db_get_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", TLEN_MUC_ASK);
+ proto->tlenOptions.imagePolicy = db_get_w(NULL, proto->m_szModuleName, "ImagePolicy",TLEN_IMAGES_IGNORE_NIR);
+ proto->tlenOptions.enableAvatars = db_get_b(NULL, proto->m_szModuleName, "EnableAvatars", TRUE);
+ proto->tlenOptions.enableVersion = db_get_b(NULL, proto->m_szModuleName, "EnableVersion", TRUE);
+ proto->tlenOptions.useNudge = db_get_b(NULL, proto->m_szModuleName, "UseNudge", FALSE);
+ proto->tlenOptions.logAlerts = db_get_b(NULL, proto->m_szModuleName, "LogAlerts", TRUE);
+ proto->tlenOptions.sendKeepAlive = db_get_b(NULL, proto->m_szModuleName, "KeepAlive", TRUE);
proto->tlenOptions.useNewP2P = TRUE;
}
@@ -126,16 +126,16 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE));
+ CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE));
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EDIT_USERNAME), JabberValidateUsernameWndProc);
}
@@ -164,23 +164,23 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Password", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "Password", text);
}
else
- DBDeleteContactSetting(NULL, proto->m_szModuleName, "Password");
+ db_unset(NULL, proto->m_szModuleName, "Password");
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
+ db_set_b(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
TlenLoadOptions(proto);
@@ -205,16 +205,16 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_USERNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE));
+ CheckDlgButton(hwndDlg, IDC_SAVEPASSWORD, db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE));
CheckDlgButton(hwndDlg, IDC_RECONNECT, proto->tlenOptions.reconnect);
CheckDlgButton(hwndDlg, IDC_ROSTER_SYNC, proto->tlenOptions.rosterSync);
@@ -304,36 +304,36 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text));
if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) {
GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "Password", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "Password", text);
}
else
- DBDeleteContactSetting(NULL, proto->m_szModuleName, "Password");
-
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "Reconnect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RECONNECT));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "RosterSync", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ROSTER_SYNC));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "OfflineAsInvisible", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOW_OFFLINE));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "IgnoreAdvertisements", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORE_ADVERTISEMENTS));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_OFFLINE_MESSAGE));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", (WORD) SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "AlertPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "ImagePolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "EnableAvatars", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARS));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "EnableVersion", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VERSIONINFO));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseNudge", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NUDGE_SUPPORT));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "LogAlerts", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LOG_ALERTS));
+ db_unset(NULL, proto->m_szModuleName, "Password");
+
+ db_set_b(NULL, proto->m_szModuleName, "SavePassword", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD));
+ db_set_b(NULL, proto->m_szModuleName, "Reconnect", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RECONNECT));
+ db_set_b(NULL, proto->m_szModuleName, "RosterSync", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ROSTER_SYNC));
+ db_set_b(NULL, proto->m_szModuleName, "OfflineAsInvisible", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOW_OFFLINE));
+ db_set_b(NULL, proto->m_szModuleName, "IgnoreAdvertisements", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_IGNORE_ADVERTISEMENTS));
+ db_set_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_OFFLINE_MESSAGE));
+ db_set_w(NULL, proto->m_szModuleName, "OfflineMessageOption", (WORD) SendDlgItemMessage(hwndDlg, IDC_OFFLINE_MESSAGE_OPTION, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "AlertPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_ALERT_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "GroupChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_MUC_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "ImagePolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_IMAGE_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, "EnableAvatars", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARS));
+ db_set_b(NULL, proto->m_szModuleName, "EnableVersion", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VERSIONINFO));
+ db_set_b(NULL, proto->m_szModuleName, "UseNudge", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NUDGE_SUPPORT));
+ db_set_b(NULL, proto->m_szModuleName, "LogAlerts", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LOG_ALERTS));
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
ApplyChanges(proto, 1);
@@ -377,9 +377,9 @@ static INT_PTR CALLBACK TlenVoiceOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
switch (((LPNMHDR) lParam)->code) {
case PSN_APPLY:
{
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceIn", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_IN, CB_GETCURSEL, 0, 0));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceOut", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_OUT, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_POLICY, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceDeviceIn", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_IN, CB_GETCURSEL, 0, 0));
+ db_set_w(NULL, proto->m_szModuleName, "VoiceDeviceOut", (WORD) SendDlgItemMessage(hwndDlg, IDC_VOICE_DEVICE_OUT, CB_GETCURSEL, 0, 0));
ApplyChanges(proto, 2);
return TRUE;
}
@@ -403,9 +403,9 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
SetDlgItemText(hwndDlg, IDC_EDIT_LOGIN_SERVER, _T("tlen.pl"));
}
@@ -413,21 +413,21 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(GetDlgItem(hwndDlg, IDC_HOST), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_HOSTPORT), TRUE);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "ManualHost", &dbv)) {
+ if (!db_get_ts(NULL, proto->m_szModuleName, "ManualHost", &dbv)) {
SetDlgItemText(hwndDlg, IDC_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
SetDlgItemText(hwndDlg, IDC_HOST, _T("s1.tlen.pl"));
- SetDlgItemInt(hwndDlg, IDC_HOSTPORT, DBGetContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_HOSTPORT, db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT), FALSE);
- CheckDlgButton(hwndDlg, IDC_KEEPALIVE, DBGetContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", TRUE));
+ CheckDlgButton(hwndDlg, IDC_KEEPALIVE, db_get_b(NULL, proto->m_szModuleName, "KeepAlive", TRUE));
- CheckDlgButton(hwndDlg, IDC_USE_SSL, DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE));
+ CheckDlgButton(hwndDlg, IDC_USE_SSL, db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE));
- CheckDlgButton(hwndDlg, IDC_VISIBILITY_SUPPORT, DBGetContactSettingByte(NULL, proto->m_szModuleName, "VisibilitySupport", FALSE));
+ CheckDlgButton(hwndDlg, IDC_VISIBILITY_SUPPORT, db_get_b(NULL, proto->m_szModuleName, "VisibilitySupport", FALSE));
// File transfer options
bChecked = FALSE;
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "UseFileProxy", FALSE) == TRUE) {
bChecked = TRUE;
CheckDlgButton(hwndDlg, IDC_FILE_USE_PROXY, TRUE);
}
@@ -438,7 +438,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT_LABEL), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_PORT), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILE_PROXY_USE_AUTH), bChecked);
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE) {
+ if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE) == TRUE) {
CheckDlgButton(hwndDlg, IDC_FILE_PROXY_USE_AUTH, TRUE);
} else {
bChecked = FALSE;
@@ -451,20 +451,20 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Forwarding"));
SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("SOCKS4"));
SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateT("SOCKS5"));
- SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", 0), 0);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
+ SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_SETCURSEL, db_get_w(NULL, proto->m_szModuleName, "FileProxyType", 0), 0);
+ if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FILE_PROXY_HOST, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", 0), FALSE);
- if (!DBGetContactSettingTString(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
+ SetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, db_get_w(NULL, proto->m_szModuleName, "FileProxyPort", 0), FALSE);
+ if (!db_get_ts(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FILE_PROXY_USER, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
@@ -520,43 +520,43 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
BOOL reconnectRequired = FALSE;
DBVARIANT dbv;
GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text));
GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text));
- if (DBGetContactSetting(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
+ if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv) || strcmp(text, dbv.pszVal))
reconnectRequired = TRUE;
- if (dbv.pszVal != NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "ManualHost", text);
+ if (dbv.pszVal != NULL) db_free(&dbv);
+ db_set_s(NULL, proto->m_szModuleName, "ManualHost", text);
port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE);
- if (DBGetContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
+ if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port)
reconnectRequired = TRUE;
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "ManualPort", port);
+ db_set_w(NULL, proto->m_szModuleName, "ManualPort", port);
proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE);
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
+ db_set_b(NULL, proto->m_szModuleName, "KeepAlive", (BYTE) proto->tlenOptions.sendKeepAlive);
useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL);
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption)
+ if (db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption)
reconnectRequired = TRUE;
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption);
+ db_set_b(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption);
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
+ db_set_b(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT));
// File transfer options
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
+ db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY));
+ db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0));
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text));
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyHost", text);
- DBWriteContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text);
+ db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE));
+ db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH));
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text));
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyUsername", text);
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text);
GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(text), (LPARAM) text);
- DBWriteContactSettingString(NULL, proto->m_szModuleName, "FileProxyPassword", text);
+ db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text);
if (reconnectRequired && proto->isConnected)
MessageBox(hwndDlg, TranslateT("These changes will take effect the next time you connect to the Tlen network."), TranslateT("Tlen Protocol Option"), MB_OK|MB_SETFOREGROUND);
ApplyChanges(proto, 4);
@@ -600,11 +600,11 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
proto = (TlenProtocol *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)proto);
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE));
- SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", POPUP_DEFAULT_COLORBKG));
- SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", POPUP_DEFAULT_COLORTXT));
- SetDlgItemInt(hwndDlg, IDC_DELAY, DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", 4), FALSE);
- delayMode = DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
+ CheckDlgButton(hwndDlg, IDC_ENABLEPOPUP, db_get_b(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE));
+ SendDlgItemMessage(hwndDlg, IDC_COLORBKG, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", POPUP_DEFAULT_COLORBKG));
+ SendDlgItemMessage(hwndDlg, IDC_COLORTXT, CPM_SETCOLOUR, 0, db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", POPUP_DEFAULT_COLORTXT));
+ SetDlgItemInt(hwndDlg, IDC_DELAY, db_get_dw(NULL, proto->m_szModuleName, "MailPopupDelay", 4), FALSE);
+ delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
if (delayMode == 1) {
CheckDlgButton(hwndDlg, IDC_DELAY_CUSTOM, TRUE);
} else if (delayMode == 2) {
@@ -653,10 +653,10 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
case PSN_APPLY:
{
BYTE delayMode;
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0));
- DBWriteContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
+ db_set_b(NULL, proto->m_szModuleName, "MailPopupEnabled", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ENABLEPOPUP));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupBack", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupText", (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, proto->m_szModuleName, "MailPopupDelay", (DWORD) GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
delayMode=0;
if (IsDlgButtonChecked(hwndDlg, IDC_DELAY_CUSTOM)) {
delayMode=1;
@@ -664,7 +664,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
delayMode=2;
}
- DBWriteContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", delayMode);
+ db_set_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", delayMode);
ApplyChanges(proto, 8);
return TRUE;
}
diff --git a/protocols/Tlen/src/jabber_svc.cpp b/protocols/Tlen/src/jabber_svc.cpp
index 30e4764e4f..db39892f83 100644
--- a/protocols/Tlen/src/jabber_svc.cpp
+++ b/protocols/Tlen/src/jabber_svc.cpp
@@ -193,10 +193,10 @@ static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flag
jid = mir_strdup(newJid); _strlwr(jid);
hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName);
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "jid", jid);
+ db_set_s(hContact, proto->m_szModuleName, "jid", jid);
if ((nick=JabberNickFromJID(newJid)) == NULL)
nick = mir_strdup(newJid);
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
mir_free(nick);
mir_free(jid);
@@ -208,15 +208,15 @@ static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flag
// PS_ADDTOLIST is called but before the add dialog issue deletion of
// "NotOnList".
// If temporary add, "NotOnList" won't be deleted, and that's expected.
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
if (flags & PALF_TEMPORARY)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
}
else {
// already exist
// Set up a dummy "NotOnList" when adding permanently only
if (!(flags&PALF_TEMPORARY))
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "NotOnList", 1);
}
return hContact;
@@ -301,7 +301,7 @@ int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent)
JabberSend(this, "<presence to='%s' type='subscribed'/>", jid);
// Automatically add this user to my roster if option is enabled
- if (DBGetContactSettingByte(NULL, m_szModuleName, "AutoAdd", TRUE) == TRUE) {
+ if (db_get_b(NULL, m_szModuleName, "AutoAdd", TRUE) == TRUE) {
HANDLE hContact;
JABBER_LIST_ITEM *item;
@@ -310,7 +310,7 @@ int __cdecl TlenProtocol::Authorize(HANDLE hDbEvent)
if ((hContact=AddToListByJID(this, jid, 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and JabberDbSettingChanged().
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
}
}
}
@@ -495,7 +495,7 @@ int __cdecl TlenProtocol::GetInfo(HANDLE hContact, int infoType)
JabberIqAdd(this, iqId, IQ_PROC_NONE, TlenIqResultVcard);
JabberSend(this, "<iq type='get' id='"JABBER_IQID"%d' to='tuba'><query xmlns='jabber:iq:register'></query></iq>", iqId);
} else {
- if (DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) return 1;
+ if (db_get(hContact, m_szModuleName, "jid", &dbv)) return 1;
if ((nick=JabberNickFromJID(dbv.pszVal)) != NULL) {
if ((pNick=JabberTextEncode(nick)) != NULL) {
iqId = JabberSerialNext(this);
@@ -505,7 +505,7 @@ int __cdecl TlenProtocol::GetInfo(HANDLE hContact, int infoType)
}
mir_free(nick);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -517,12 +517,12 @@ int __cdecl TlenProtocol::SetApparentMode(HANDLE hContact, int mode)
char *jid;
if (!isOnline) return 0;
- if (!DBGetContactSettingByte(NULL, m_szModuleName, "VisibilitySupport", FALSE)) return 0;
+ if (!db_get_b(NULL, m_szModuleName, "VisibilitySupport", FALSE)) return 0;
if (mode != 0 && mode != ID_STATUS_ONLINE && mode != ID_STATUS_OFFLINE) return 1;
- oldMode = DBGetContactSettingWord(hContact, m_szModuleName, "ApparentMode", 0);
+ oldMode = db_get_w(hContact, m_szModuleName, "ApparentMode", 0);
if ((int) mode == oldMode) return 1;
- DBWriteContactSettingWord(hContact, m_szModuleName, "ApparentMode", (WORD) mode);
- if (!DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ db_set_w(hContact, m_szModuleName, "ApparentMode", (WORD) mode);
+ if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
jid = dbv.pszVal;
switch (mode) {
case ID_STATUS_ONLINE:
@@ -540,7 +540,7 @@ int __cdecl TlenProtocol::SetApparentMode(HANDLE hContact, int mode)
JabberSend(this, "<presence to='%s'><show>available</show></presence>", jid);
break;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -571,16 +571,16 @@ static void __cdecl TlenGetAwayMsgThread(void *ptr)
DBVARIANT dbv;
JABBER_LIST_ITEM *item;
SENDACKTHREADDATA *data = (SENDACKTHREADDATA *)ptr;
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(data->proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (item->statusMessage != NULL) {
ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) item->statusMessage);
return;
}
}
else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
ProtoBroadcastAck(data->proto->m_szModuleName, data->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) "");
@@ -592,10 +592,10 @@ INT_PTR TlenSendAlert(void *ptr, LPARAM wParam, LPARAM lParam)
HANDLE hContact = ( HANDLE )wParam;
DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
- if (proto->isOnline && !DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (proto->isOnline && !db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<m tp='a' to='%s'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -608,7 +608,7 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg)
int id;
char msgType[16];
- if (!isOnline || DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ if (!isOnline || db_get(hContact, m_szModuleName, "jid", &dbv)) {
SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
tdata->proto = this;
tdata->hContact = hContact;
@@ -632,12 +632,12 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg)
if ((msgEnc=JabberTextEncode(msg)) != NULL) {
if (JabberListExist(this, LIST_CHATROOM, dbv.pszVal) && strchr(dbv.pszVal, '/') == NULL) {
strcpy(msgType, "groupchat");
- } else if (DBGetContactSettingByte(hContact, m_szModuleName, "bChat", FALSE)) {
+ } else if (db_get_b(hContact, m_szModuleName, "bChat", FALSE)) {
strcpy(msgType, "privchat");
} else {
strcpy(msgType, "chat");
}
- if (!strcmp(msgType, "groupchat") || DBGetContactSettingByte(NULL, m_szModuleName, "MsgAck", FALSE) == FALSE) {
+ if (!strcmp(msgType, "groupchat") || db_get_b(NULL, m_szModuleName, "MsgAck", FALSE) == FALSE) {
SENDACKTHREADDATA *tdata = (SENDACKTHREADDATA*) mir_alloc(sizeof(SENDACKTHREADDATA));
tdata->proto = this;
tdata->hContact = hContact;
@@ -660,7 +660,7 @@ int __cdecl TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msg)
}
mir_free(msgEnc);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
@@ -678,9 +678,9 @@ static INT_PTR TlenGetAvatarInfo(void *ptr, LPARAM wParam, LPARAM lParam)
if (!proto->tlenOptions.enableAvatars) return GAIR_NOAVATAR;
if (AI->hContact != NULL) {
- if (!DBGetContactSetting(AI->hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(AI->hContact, proto->m_szModuleName, "jid", &dbv)) {
item = JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (item != NULL) {
downloadingAvatar = item->newAvatarDownloading;
avatarHash = item->avatarHash;
@@ -801,8 +801,8 @@ HANDLE __cdecl TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescri
int id;
if (!isOnline) return 0;
-// if (DBGetContactSettingWord(ccs->hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0;
- if (DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) return 0;
+// if (db_get_w(ccs->hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0;
+ if (db_get(hContact, m_szModuleName, "jid", &dbv)) return 0;
ft = TlenFileCreateFT(this, dbv.pszVal);
for (ft->fileCount=0; ppszFiles[ft->fileCount]; ft->fileCount++);
ft->files = (char **) mir_alloc(sizeof(char *) * ft->fileCount);
@@ -823,7 +823,7 @@ HANDLE __cdecl TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescri
ft->szDescription = mir_t2a(szDescription);
ft->hContact = hContact;
ft->currentFile = 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
id = JabberSerialNext(this);
_snprintf(idStr, sizeof(idStr), "%d", id);
@@ -908,18 +908,18 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam)
hContact = (HANDLE) wParam;
szProto = GetContactProto(hContact);
if (szProto == NULL || strcmp(szProto, proto->m_szModuleName)) return 0;
-// if (DBGetContactSettingByte(hContact, proto->m_szModuleName, "ChatRoom", 0) != 0) return 0;
+// if (db_get_b(hContact, proto->m_szModuleName, "ChatRoom", 0) != 0) return 0;
// A contact's group is changed
if (!strcmp(cws->szSetting, "Group")) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- DBFreeVariant(&dbv);
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
+ db_free(&dbv);
+ if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
nick = JabberTextEncode(dbv.pszVal);
- DBFreeVariant(&dbv);
- } else if (!DBGetContactSetting(hContact, proto->m_szModuleName, "Nick", &dbv)) {
+ db_free(&dbv);
+ } else if (!db_get(hContact, proto->m_szModuleName, "Nick", &dbv)) {
nick = JabberTextEncode(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
nick = JabberNickFromJID(item->jid);
}
@@ -943,7 +943,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam)
}
}
else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -955,7 +955,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam)
// szProto = GetContactProto(hContact);
// if (szProto == NULL || strcmp(szProto, proto->m_szModuleName)) return 0;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
jid = dbv.pszVal;
if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
if (cws->value.type == DBVT_DELETED) {
@@ -980,7 +980,7 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam)
}
if (newNick != NULL) mir_free(newNick);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
// A temporary contact has been added permanently
@@ -988,33 +988,33 @@ int JabberDbSettingChanged(void *ptr, WPARAM wParam, LPARAM lParam)
char *jid, *nick, *pGroup;
if (cws->value.type==DBVT_DELETED || (cws->value.type==DBVT_BYTE && cws->value.bVal==0)) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
jid = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
JabberLog(proto, "Add %s permanently to list", jid);
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
+ if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
nick = JabberTextEncode(dbv.pszVal); //Utf8Encode
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
nick = JabberNickFromJID(jid);
}
if (nick != NULL) {
JabberLog(proto, "jid=%s nick=%s", jid, nick);
- if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
+ if (!db_get(hContact, "CList", "Group", &dbv)) {
if ((pGroup=TlenGroupEncode(dbv.pszVal)) != NULL) {
JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, jid, pGroup);
JabberSend(proto, "<presence to='%s' type='subscribe'/>", jid);
mir_free(pGroup);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'/></query></iq>", nick, jid);
JabberSend(proto, "<presence to='%s' type='subscribe'/>", jid);
}
mir_free(nick);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
}
mir_free(jid);
}
@@ -1036,7 +1036,7 @@ int JabberContactDeleted(void *ptr, WPARAM wParam, LPARAM lParam)
szProto = GetContactProto((HANDLE)wParam);
if (szProto == NULL || strcmp(szProto, proto->m_szModuleName))
return 0;
- if (!DBGetContactSetting((HANDLE) wParam, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get((HANDLE) wParam, proto->m_szModuleName, "jid", &dbv)) {
char *jid, *p, *q;
jid = dbv.pszVal;
@@ -1049,7 +1049,7 @@ int JabberContactDeleted(void *ptr, WPARAM wParam, LPARAM lParam)
JabberSend(proto, "<iq type='set'><query xmlns='jabber:iq:roster'><item jid='%s' subscription='remove'/></query></iq>", jid);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -1060,7 +1060,7 @@ int __cdecl TlenProtocol::UserIsTyping(HANDLE hContact, int type)
JABBER_LIST_ITEM *item;
if (!isOnline) return 0;
- if (!DBGetContactSetting(hContact, m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
if ((item=JabberListGetItemPtr(this, LIST_ROSTER, dbv.pszVal)) != NULL /*&& item->wantComposingEvent == TRUE*/) {
switch (type) {
case PROTOTYPE_SELFTYPING_OFF:
@@ -1071,7 +1071,7 @@ int __cdecl TlenProtocol::UserIsTyping(HANDLE hContact, int type)
break;
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -1282,15 +1282,15 @@ TlenProtocol::TlenProtocol( const char* aProtoName, const TCHAR* aUserName )
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, m_szModuleName, "LoginServer", &dbv)) {
- DBFreeVariant(&dbv);
+ if (!db_get(NULL, m_szModuleName, "LoginServer", &dbv)) {
+ db_free(&dbv);
} else {
- DBWriteContactSettingString(NULL, m_szModuleName, "LoginServer", "tlen.pl");
+ db_set_s(NULL, m_szModuleName, "LoginServer", "tlen.pl");
}
- if (!DBGetContactSetting(NULL, m_szModuleName, "ManualHost", &dbv)) {
- DBFreeVariant(&dbv);
+ if (!db_get(NULL, m_szModuleName, "ManualHost", &dbv)) {
+ db_free(&dbv);
} else {
- DBWriteContactSettingString(NULL, m_szModuleName, "ManualHost", "s1.tlen.pl");
+ db_set_s(NULL, m_szModuleName, "ManualHost", "s1.tlen.pl");
}
TlenLoadOptions(this);
diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp
index 3b93aa51d5..31fb47a10f 100644
--- a/protocols/Tlen/src/jabber_thread.cpp
+++ b/protocols/Tlen/src/jabber_thread.cpp
@@ -133,12 +133,12 @@ void __cdecl JabberServerThread(ThreadData *info)
info->proto->threadData = info;
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
strncpy(info->username, dbv.pszVal, sizeof(info->username));
info->username[sizeof(info->username)-1] = '\0';
_strlwr(info->username);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "LoginName", info->username);
- DBFreeVariant(&dbv);
+ db_set_s(NULL, info->proto->m_szModuleName, "LoginName", info->username);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, login name is not configured");
@@ -146,12 +146,12 @@ void __cdecl JabberServerThread(ThreadData *info)
}
if (loginErr == 0) {
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) {
strncpy(info->server, dbv.pszVal, sizeof(info->server));
info->server[sizeof(info->server)-1] = '\0';
_strlwr(info->server);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
- DBFreeVariant(&dbv);
+ db_set_s(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, login server is not configured");
loginErr = LOGINERR_NONETWORK;
@@ -178,11 +178,11 @@ void __cdecl JabberServerThread(ThreadData *info)
loginErr = LOGINERR_BADUSERID;
}
} else {
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
strncpy(info->password, dbv.pszVal, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
JabberLog(info->proto, "Thread ended, password is not configured");
loginErr = LOGINERR_BADUSERID;
@@ -207,14 +207,14 @@ void __cdecl JabberServerThread(ThreadData *info)
}
_snprintf(jidStr, sizeof(jidStr), "%s@%s", info->username, info->server);
- DBWriteContactSettingString(NULL, info->proto->m_szModuleName, "jid", jidStr);
+ db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost));
info->manualHost[sizeof(info->manualHost)-1] = '\0';
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- info->port = DBGetContactSettingWord(NULL, info->proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT);
+ info->port = db_get_w(NULL, info->proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT);
info->useEncryption = info->proto->tlenOptions.useEncryption;
if (info->manualHost[0])
@@ -225,11 +225,11 @@ void __cdecl JabberServerThread(ThreadData *info)
JabberLog(info->proto, "Thread server='%s' port='%d'", connectHost, info->port);
- if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
+ if (!db_get(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
strcpy(info->proto->threadData->avatarHash, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- info->avatarFormat = DBGetContactSettingDword(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ info->avatarFormat = db_get_dw(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
reconnectMaxTime = 10;
@@ -367,8 +367,8 @@ void __cdecl JabberServerThread(ThreadData *info)
while (hContact != NULL) {
str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, info->proto->m_szModuleName)) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
hContact = db_find_next(hContact);
@@ -810,20 +810,20 @@ static void JabberProcessIq(XmlNode *node, ThreadData *info)
// Add the jid (with empty resource) to Miranda contact list.
hContact = JabberDBCreateContact(info->proto, jid, nick, FALSE);
}
- DBWriteContactSettingString(hContact, "CList", "MyHandle", nick);
+ db_set_s(hContact, "CList", "MyHandle", nick);
if (item->group) mir_free(item->group);
if ((groupNode=JabberXmlGetChild(itemNode, "group")) != NULL && groupNode->text != NULL) {
item->group = TlenGroupDecode(groupNode->text);
JabberContactListCreateGroup(item->group);
- DBWriteContactSettingString(hContact, "CList", "Group", item->group);
+ db_set_s(hContact, "CList", "Group", item->group);
}
else {
item->group = NULL;
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
if (!strcmp(str, "none") || (!strcmp(str, "from") && strchr(jid, '@') != NULL)) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
else {
@@ -842,8 +842,8 @@ static void JabberProcessIq(XmlNode *node, ThreadData *info)
// remove, so that history will be retained.
if (!strcmp(str, "remove")) {
if ((hContact=JabberHContactFromJID(info->proto, jid)) != NULL) {
- if (DBGetContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
- DBWriteContactSettingWord(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE)
+ db_set_w(hContact, info->proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
JabberListRemove(info->proto, LIST_ROSTER, jid);
}
}
@@ -1087,7 +1087,7 @@ static void TlenProcessM(XmlNode *node, ThreadData *info)
/* MUC private message */
str = JabberResourceFromJID(f);
hContact = JabberDBCreateContact(info->proto, f, str, TRUE);
- DBWriteContactSettingByte(hContact, info->proto->m_szModuleName, "bChat", TRUE);
+ db_set_b(hContact, info->proto->m_szModuleName, "bChat", TRUE);
mir_free(str);
localMessage = JabberTextDecode(bNode->text);
recv.flags = 0;
@@ -1146,18 +1146,18 @@ static void TlenMailPopup(TlenProtocol *proto, char *title, char *emailInfo)
{
if ( !ServiceExists(MS_POPUP_ADDPOPUP))
return;
- if (!DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE))
+ if (!db_get_b(NULL, proto->m_szModuleName, "MailPopupEnabled", TRUE))
return;
POPUPDATA ppd = { 0 };
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIL));
strcpy(ppd.lpzContactName, title);
strcpy(ppd.lpzText, emailInfo);
- ppd.colorBack = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupBack", 0);
- ppd.colorText = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupText", 0);
- BYTE delayMode = DBGetContactSettingByte(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
+ ppd.colorBack = db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", 0);
+ ppd.colorText = db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", 0);
+ BYTE delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0);
if (delayMode == 1)
- ppd.iSeconds = DBGetContactSettingDword(NULL, proto->m_szModuleName, "MailPopupDelay", 4);
+ ppd.iSeconds = db_get_dw(NULL, proto->m_szModuleName, "MailPopupDelay", 4);
else if (delayMode == 2)
ppd.iSeconds = -1;
PUAddPopUp(&ppd);
@@ -1281,12 +1281,12 @@ static void TlenProcessP(XmlNode *node, ThreadData *info)
n = mir_strdup(Translate("Private conference"));// JabberNickFromJID(f);
}
sprintf(jid, "%s/%s", f, info->username);
-// if (!DBGetContactSetting(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
+// if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
// always real username
// sprintf(jid, "%s/%s", f, dbv.pszVal);
TlenMUCCreateWindow(info->proto, f, n, 0, NULL, id);
TlenMUCRecvPresence(info->proto, jid, ID_STATUS_ONLINE, flags, k);
-// DBFreeVariant(&dbv);
+// db_free(&dbv);
// }
mir_free(n);
}
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp
index 4b392137e0..495a89a0ee 100644
--- a/protocols/Tlen/src/tlen.cpp
+++ b/protocols/Tlen/src/tlen.cpp
@@ -119,55 +119,28 @@ static void TlenRegisterIcons()
int TlenPrebuildContactMenu(void *ptr, WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact;
- DBVARIANT dbv;
- CLISTMENUITEM clmi = { sizeof(clmi) };
- JABBER_LIST_ITEM *item;
+ HANDLE hContact = (HANDLE)wParam;
TlenProtocol *proto = (TlenProtocol *)ptr;
- if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
- if ((item=JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal)) != NULL) {
- if (item->subscription == SUB_NONE || item->subscription == SUB_FROM)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
-
- if (item->subscription == SUB_NONE || item->subscription == SUB_TO)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE && !TlenVoiceIsInUse(proto))
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
-
- if (item->status != ID_STATUS_OFFLINE)
- clmi.flags = CMIM_FLAGS;
- else
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuPicture, (LPARAM) &clmi);
-
- DBFreeVariant(&dbv);
+ if (hContact != NULL && proto->isOnline) {
+ DBVARIANT dbv;
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ JABBER_LIST_ITEM *item = JabberListGetItemPtr(proto, LIST_ROSTER, dbv.pszVal);
+ db_free(&dbv);
+ if (item != NULL) {
+ Menu_ShowItem(proto->hMenuContactRequestAuth, item->subscription == SUB_NONE || item->subscription == SUB_FROM);
+ Menu_ShowItem(proto->hMenuContactGrantAuth, item->subscription == SUB_NONE || item->subscription == SUB_TO);
+ Menu_ShowItem(proto->hMenuContactMUC, item->status != ID_STATUS_OFFLINE);
+ Menu_ShowItem(proto->hMenuContactVoice, item->status != ID_STATUS_OFFLINE && !TlenVoiceIsInUse(proto));
+ Menu_ShowItem(proto->hMenuPicture, item->status != ID_STATUS_OFFLINE);
return 0;
}
- DBFreeVariant(&dbv);
}
}
- clmi.flags = CMIM_FLAGS|CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactMUC, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactVoice, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactRequestAuth, (LPARAM) &clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto->hMenuContactGrantAuth, (LPARAM) &clmi);
+
+ Menu_ShowItem(proto->hMenuContactMUC, false);
+ Menu_ShowItem(proto->hMenuContactVoice, false);
+ Menu_ShowItem(proto->hMenuContactRequestAuth, false);
+ Menu_ShowItem(proto->hMenuContactGrantAuth, false);
return 0;
}
@@ -177,9 +150,9 @@ INT_PTR TlenContactMenuHandleRequestAuth(void *ptr, LPARAM wParam, LPARAM lParam
DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<presence to='%s' type='subscribe'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -191,9 +164,9 @@ INT_PTR TlenContactMenuHandleGrantAuth(void *ptr, LPARAM wParam, LPARAM lParam)
DBVARIANT dbv;
TlenProtocol *proto = (TlenProtocol *)ptr;
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
JabberSend(proto, "<presence to='%s' type='subscribed'/>", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -220,15 +193,15 @@ INT_PTR TlenMenuHandleInbox(void *ptr, LPARAM wParam, LPARAM lParam)
char form[1024];
char cookie[1024];
TlenProtocol *proto = (TlenProtocol *)ptr;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) {
login = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "SavePassword", TRUE) == TRUE) {
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "Password", &dbv)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "SavePassword", TRUE) == TRUE) {
+ if (!db_get(NULL, proto->m_szModuleName, "Password", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
password = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
} else if (proto->threadData != NULL && strlen(proto->threadData->password) > 0) {
password = mir_strdup(proto->threadData->password);
@@ -287,8 +260,8 @@ int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam)
while (hContact != NULL) {
char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, proto->m_szModuleName)) {
- if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
+ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
}
}
hContact = db_find_next(hContact);
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp
index f6460e905b..1df8c8836d 100644
--- a/protocols/Tlen/src/tlen_avatar.cpp
+++ b/protocols/Tlen/src/tlen_avatar.cpp
@@ -50,7 +50,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, JABBER_LIST_ITEM *item, TCHAR* p
} else if (proto->threadData != NULL) {
format = proto->threadData->avatarFormat;
} else {
- format = DBGetContactSettingDword(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
+ format = db_get_dw(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
}
tszFileType = TEXT("png");
switch(format) {
@@ -81,9 +81,9 @@ static void RemoveAvatar(TlenProtocol *proto, HANDLE hContact) {
}
TlenGetAvatarFileName( proto, NULL, tFileName, sizeof tFileName );
DeleteFile(tFileName);
- DBDeleteContactSetting(hContact, "ContactPhoto", "File");
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "AvatarHash");
- DBDeleteContactSetting(hContact, proto->m_szModuleName, "AvatarFormat");
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, proto->m_szModuleName, "AvatarHash");
+ db_unset(hContact, proto->m_szModuleName, "AvatarFormat");
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
@@ -118,9 +118,9 @@ static void SetAvatar(TlenProtocol *proto, HANDLE hContact, JABBER_LIST_ITEM *it
if ( out != NULL ) {
fwrite( data, len, 1, out );
fclose( out );
- DBWriteContactSettingTString(hContact, "ContactPhoto", "File", filename );
- DBWriteContactSettingString(hContact, proto->m_szModuleName, "AvatarHash", md5);
- DBWriteContactSettingDword(hContact, proto->m_szModuleName, "AvatarFormat", format);
+ db_set_ts(hContact, "ContactPhoto", "File", filename );
+ db_set_s(hContact, proto->m_szModuleName, "AvatarHash", md5);
+ db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format);
}
ProtoBroadcastAck( proto->m_szModuleName, hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL , 0);
}
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp
index d28c4ed37b..c43ee11edd 100644
--- a/protocols/Tlen/src/tlen_muc.cpp
+++ b/protocols/Tlen/src/tlen_muc.cpp
@@ -72,9 +72,9 @@ static char *getDisplayName(TlenProtocol *proto, const char *id)
char jid[256];
HANDLE hContact;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (((hContact=JabberHContactFromJID(proto, jid)) != NULL) || !strcmp(id, proto->threadData->username)) {
ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);
@@ -250,14 +250,14 @@ static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam)
char str[256];
sprintf(str, "%s/%s", mucce->pszID, nick);
hContact = JabberDBCreateContact(proto, str, nick, TRUE); //(char *)mucce->pszUID
- DBWriteContactSettingByte(hContact, proto->m_szModuleName, "bChat", TRUE);
+ db_set_b(hContact, proto->m_szModuleName, "bChat", TRUE);
CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
} else {
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
char str[512];
_snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
hContact = JabberDBCreateContact(proto, str, nick, TRUE);
CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
}
@@ -277,7 +277,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r
char *nick;
int ignore, ask, groupChatPolicy;
if (roomId == NULL) return 1;
- groupChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "GroupChatPolicy", 0);
+ groupChatPolicy = db_get_w(NULL, proto->m_szModuleName, "GroupChatPolicy", 0);
ask = TRUE;
ignore = FALSE;
if (groupChatPolicy == TLEN_MUC_ASK) {
@@ -288,9 +288,9 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r
} else if (groupChatPolicy == TLEN_MUC_IGNORE_NIR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -300,9 +300,9 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r
char jid[256];
JABBER_LIST_ITEM *item;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -961,12 +961,12 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr)
while (hContact != NULL) {
char *str = GetContactProto(hContact);
if (str != NULL && !strcmp(str, threadData->proto->m_szModuleName)) {
- if (!DBGetContactSettingByte(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
- if (!DBGetContactSetting(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get_b(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
+ if (!db_get(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
queryResult.iItemsNum++;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -979,14 +979,14 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr)
while (hContact != NULL) {
char *baseProto = GetContactProto(hContact);
if (baseProto != NULL && !strcmp(baseProto, threadData->proto->m_szModuleName)) {
- if (!DBGetContactSettingByte(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
- if (!DBGetContactSetting(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get_b(hContact, threadData->proto->m_szModuleName, "bChat", FALSE)) {
+ if (!db_get(hContact, threadData->proto->m_szModuleName, "jid", &dbv)) {
if (strcmp(dbv.pszVal, "b73@tlen.pl")) {
queryResult.pItems[queryResult.iItemsNum].pszID = mir_strdup(dbv.pszVal);
queryResult.pItems[queryResult.iItemsNum].pszName = mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
queryResult.iItemsNum++;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -1056,13 +1056,13 @@ INT_PTR TlenMUCContactMenuHandleMUC(void *ptr, LPARAM wParam, LPARAM lParam)
return 1;
}
if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char serialId[32];
sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
item = JabberListAdd(proto, LIST_INVITATIONS, serialId);
item->nick = mir_strdup(dbv.pszVal);
JabberSend(proto, "<p to='c' tp='c' id='%s'/>", serialId);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp
index 7c1f706d49..308079097c 100644
--- a/protocols/Tlen/src/tlen_p2p_old.cpp
+++ b/protocols/Tlen/src/tlen_p2p_old.cpp
@@ -466,27 +466,27 @@ JABBER_SOCKET TlenP2PListen(TLEN_FILE_TRANSFER *ft)
if (ft->localName != NULL) mir_free(ft->localName);
ft->localName = NULL;
ft->wPort = 0;
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "UseFileProxy", FALSE)) {
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "UseFileProxy", FALSE)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyHost", &dbv)) {
strcpy(sb.szHost, dbv.pszVal);
- DBFreeVariant(&dbv);
- sb.wPort = DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyPort", 0);
+ db_free(&dbv);
+ sb.wPort = db_get_w(NULL, proto->m_szModuleName, "FileProxyPort", 0);
sb.useAuth = FALSE;
strcpy(sb.szUser, "");
strcpy(sb.szPassword, "");
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
+ if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
sb.useAuth = TRUE;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
strcpy(sb.szUser, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal)+1, (LPARAM) dbv.pszVal);
strcpy(sb.szPassword, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- switch (DBGetContactSettingWord(NULL, proto->m_szModuleName, "FileProxyType", 0)) {
+ switch (db_get_w(NULL, proto->m_szModuleName, "FileProxyType", 0)) {
case 0: // forwarding
useProxy = 1;
break;
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp
index d61842d8dd..c0233ee233 100644
--- a/protocols/Tlen/src/tlen_picture.cpp
+++ b/protocols/Tlen/src/tlen_picture.cpp
@@ -256,7 +256,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) {
BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) {
DBVARIANT dbv;
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char *jid = dbv.pszVal;
char szFilter[512];
char *szFileName = (char*) mir_alloc(_MAX_PATH);
@@ -314,7 +314,7 @@ BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) {
fclose(fp);
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return FALSE;
}
diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp
index 7dc15f41f6..1207857241 100644
--- a/protocols/Tlen/src/tlen_presence.cpp
+++ b/protocols/Tlen/src/tlen_presence.cpp
@@ -73,19 +73,19 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto)
p = NULL;
JabberListAddResource(proto, LIST_ROSTER, from, status, statusNode?p:NULL);
if (p) {
- DBWriteContactSettingString(hContact, "CList", "StatusMsg", p);
+ db_set_s(hContact, "CList", "StatusMsg", p);
mir_free(p);
} else {
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ db_unset(hContact, "CList", "StatusMsg");
}
// Determine status to show for the contact and request version information
if (item != NULL) {
laststatus = item->status;
item->status = status;
}
- if (strchr(from, '@') != NULL || DBGetContactSettingByte(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) {
- if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status)
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", (WORD) status);
+ if (strchr(from, '@') != NULL || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) {
+ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status)
+ db_set_w(hContact, proto->m_szModuleName, "Status", (WORD) status);
}
if (item != NULL) {
if (!item->infoRequested) {
@@ -122,9 +122,9 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto)
JabberListAddResource(proto, LIST_ROSTER, from, status, p);
if ((hContact=JabberHContactFromJID(proto, from)) != NULL) {
if (p) {
- DBWriteContactSettingString(hContact, "CList", "StatusMsg", p);
+ db_set_s(hContact, "CList", "StatusMsg", p);
} else {
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ db_unset(hContact, "CList", "StatusMsg");
}
}
if (p) mir_free(p);
@@ -136,9 +136,9 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto)
item->infoRequested = FALSE;
}
if ((hContact=JabberHContactFromJID(proto, from)) != NULL) {
- if (strchr(from, '@') != NULL || DBGetContactSettingByte(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) {
- if (DBGetContactSettingWord(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status)
- DBWriteContactSettingWord(hContact, proto->m_szModuleName, "Status", (WORD) status);
+ if (strchr(from, '@') != NULL || db_get_b(NULL, proto->m_szModuleName, "ShowTransport", TRUE) == TRUE) {
+ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status)
+ db_set_w(hContact, proto->m_szModuleName, "Status", (WORD) status);
}
if (item != NULL && item->isTyping) {
item->isTyping = FALSE;
@@ -214,8 +214,8 @@ static void JabberSendPresenceTo(TlenProtocol *proto, int status, char *to)
break;
case ID_STATUS_OFFLINE:
presenceType = "unavailable";
- if (DBGetContactSettingByte(NULL, proto->m_szModuleName, "LeaveOfflineMessage", FALSE)) {
- int offlineMessageOption = DBGetContactSettingWord(NULL, proto->m_szModuleName, "OfflineMessageOption", 0);
+ if (db_get_b(NULL, proto->m_szModuleName, "LeaveOfflineMessage", FALSE)) {
+ int offlineMessageOption = db_get_w(NULL, proto->m_szModuleName, "OfflineMessageOption", 0);
if (offlineMessageOption == 0) {
switch (proto->m_iStatus) {
case ID_STATUS_ONLINE:
@@ -245,11 +245,11 @@ static void JabberSendPresenceTo(TlenProtocol *proto, int status, char *to)
} else if (offlineMessageOption < 7) {
DBVARIANT dbv;
const char *statusNames[] = {"OnDefault", "AwayDefault", "NaDefault", "DndDefault", "FreeChatDefault", "InvDefault"};
- if (!DBGetContactSetting(NULL, "SRAway", statusNames[offlineMessageOption-1], &dbv)) {
+ if (!db_get(NULL, "SRAway", statusNames[offlineMessageOption-1], &dbv)) {
int i;
char substituteStr[128];
ptr = mir_strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
for (i=0;ptr[i];i++) {
if (ptr[i] != '%') continue;
if (!_strnicmp(ptr+i,"%time%",6))
diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp
index 25f2858d8a..933841fd3f 100644
--- a/protocols/Tlen/src/tlen_userinfo.cpp
+++ b/protocols/Tlen/src/tlen_userinfo.cpp
@@ -191,35 +191,35 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, _T(""));
SetFocus(GetDlgItem(hwndDlg, IDC_STATIC));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "FirstName", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "FirstName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FIRSTNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_FIRSTNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "LastName", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "LastName", &dbv)) {
SetDlgItemText(hwndDlg, IDC_LASTNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_LASTNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "Nick", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "Nick", &dbv)) {
SetDlgItemText(hwndDlg, IDC_NICKNAME, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_NICKNAME, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "e-mail", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "e-mail", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EMAIL, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_EMAIL, _T(""));
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "Age", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "Age", &dbv)) {
SetDlgItemInt(hwndDlg, IDC_AGE, dbv.wVal, FALSE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_AGE, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "City", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "City", &dbv)) {
SetDlgItemText(hwndDlg, IDC_CITY, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_CITY, _T(""));
- if (!DBGetContactSettingTString(data->hContact, data->proto->m_szModuleName, "School", &dbv)) {
+ if (!db_get_ts(data->hContact, data->proto->m_szModuleName, "School", &dbv)) {
SetDlgItemText(hwndDlg, IDC_SCHOOL, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else SetDlgItemText(hwndDlg, IDC_SCHOOL, _T(""));
- switch (DBGetContactSettingByte(data->hContact, data->proto->m_szModuleName, "Gender", '?')) {
+ switch (db_get_b(data->hContact, data->proto->m_szModuleName, "Gender", '?')) {
case 'M':
SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_SETCURSEL, 1, 0);
SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, TranslateTS(tlenFieldGender[0].name));
@@ -233,7 +233,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
SetDlgItemText(hwndDlg, IDC_GENDER_TEXT, _T(""));
break;
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "Occupation", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "Occupation", 0);
if (i>0 && i<13) {
SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, TranslateTS(tlenFieldOccupation[i-1].name));
SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, i, 0);
@@ -241,7 +241,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
SetDlgItemText(hwndDlg, IDC_OCCUPATION_TEXT, _T(""));
SendDlgItemMessage(hwndDlg, IDC_OCCUPATION, CB_SETCURSEL, 0, 0);
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "LookingFor", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "LookingFor", 0);
if (i>0 && i<6) {
SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, TranslateTS(tlenFieldLookfor[i-1].name));
SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, i, 0);
@@ -249,11 +249,11 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
SetDlgItemText(hwndDlg, IDC_LOOKFOR_TEXT, _T(""));
SendDlgItemMessage(hwndDlg, IDC_LOOKFOR, CB_SETCURSEL, 0, 0);
}
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "VoiceChat", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "VoiceChat", 0);
CheckDlgButton(hwndDlg, IDC_VOICECONVERSATIONS, i);
- i = DBGetContactSettingWord(data->hContact, data->proto->m_szModuleName, "PublicStatus", 0);
+ i = db_get_w(data->hContact, data->proto->m_szModuleName, "PublicStatus", 0);
CheckDlgButton(hwndDlg, IDC_PUBLICSTATUS, i);
- if (!DBGetContactSetting(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(data->hContact, data->proto->m_szModuleName, "jid", &dbv)) {
jid = JabberTextDecode(dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_INFO_JID, jid);
mir_free(jid);
@@ -281,7 +281,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara
SetDlgItemText(hwndDlg, IDC_SUBSCRIPTION, TranslateT("not on roster"));
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
break;
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp
index c476d55116..cd8b7dda3b 100644
--- a/protocols/Tlen/src/tlen_voice.cpp
+++ b/protocols/Tlen/src/tlen_voice.cpp
@@ -131,7 +131,7 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control)
control->waveHeadersPos = 0;
control->waveHeadersNum = FRAMES_AVAILABLE_MAX_LIMIT + 2;
- j = DBGetContactSettingWord(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0);
+ j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0);
iSelDev = WAVE_MAPPER;
if (j != 0) {
iNumDevs = waveOutGetNumDevs();
@@ -198,7 +198,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control)
SetThreadPriority(control->hThread, THREAD_PRIORITY_ABOVE_NORMAL);
- j = DBGetContactSettingWord(NULL, control->proto->m_szModuleName, "VoiceDeviceIn", 0);
+ j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceIn", 0);
iSelDev = WAVE_MAPPER;
if (j != 0) {
iNumDevs = waveInGetNumDevs();
@@ -708,7 +708,7 @@ INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, LPARAM wParam, LPARAM lParam)
return 1;
}
if ((hContact=(HANDLE) wParam) != NULL) {
- if (!DBGetContactSetting(hContact, proto->m_szModuleName, "jid", &dbv)) {
+ if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char serialId[32];
sprintf(serialId, "%d", JabberSerialNext(proto));
if ((item = JabberListAdd(proto, LIST_VOICE, serialId)) != NULL) {
@@ -720,7 +720,7 @@ INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, LPARAM wParam, LPARAM lParam)
TlenVoiceStart(ft, 2);
JabberSend(ft->proto, "<v t='%s' e='1' i='%s' v='1'/>", ft->jid, serialId);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
@@ -953,9 +953,9 @@ static char *getDisplayName(TlenProtocol *proto, const char *id)
char jid[256];
HANDLE hContact;
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
return mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
}
@@ -1025,7 +1025,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from)
int ask, ignore, voiceChatPolicy;
ask = TRUE;
ignore = FALSE;
- voiceChatPolicy = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceChatPolicy", 0);
+ voiceChatPolicy = db_get_w(NULL, proto->m_szModuleName, "VoiceChatPolicy", 0);
if (voiceChatPolicy == TLEN_MUC_ASK) {
ignore = FALSE;
ask = TRUE;
@@ -1034,9 +1034,9 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from)
} else if (voiceChatPolicy == TLEN_MUC_IGNORE_NIR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -1045,9 +1045,9 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from)
} else if (voiceChatPolicy == TLEN_MUC_ACCEPT_IR) {
char jid[256];
DBVARIANT dbv;
- if (!DBGetContactSetting(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
+ if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
strcpy(jid, from);
}
@@ -1095,7 +1095,7 @@ int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd)
}
}
}
- i = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceIn", 0);
+ i = db_get_w(NULL, proto->m_szModuleName, "VoiceDeviceIn", 0);
if (i>j) i = 0;
SendMessage(hWnd, CB_SETCURSEL, i, 0);
return 0;
@@ -1114,7 +1114,7 @@ int TlenVoiceBuildOutDeviceList(TlenProtocol *proto, HWND hWnd)
}
}
}
- i = DBGetContactSettingWord(NULL, proto->m_szModuleName, "VoiceDeviceOut", 0);
+ i = db_get_w(NULL, proto->m_szModuleName, "VoiceDeviceOut", 0);
if (i>j) i = 0;
SendMessage(hWnd, CB_SETCURSEL, i, 0);
return 0;
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp
index 5d866160aa..7c55bfaa98 100644
--- a/protocols/Twitter/src/theme.cpp
+++ b/protocols/Twitter/src/theme.cpp
@@ -48,7 +48,7 @@ HANDLE GetIconHandle(const char* name)
}
// Contact List menu stuff
-static HANDLE g_hMenuItems[2];
+static HGENMENU g_hMenuItems[2];
static HANDLE g_hMenuEvts[3];
// Helper functions
@@ -115,12 +115,5 @@ void UninitContactMenus()
void ShowContactMenus(bool show)
{
for(size_t i=0; i<SIZEOF(g_hMenuItems); i++)
- {
- CLISTMENUITEM item = { sizeof(item) };
- item.flags = CMIM_FLAGS | CMIF_NOTOFFLINE;
- if(!show)
- item.flags |= CMIF_HIDDEN;
-
- CallService(MS_CLIST_MODIFYMENUITEM,reinterpret_cast<WPARAM>(g_hMenuItems[i]),reinterpret_cast<LPARAM>(&item));
- }
+ Menu_ShowItem(g_hMenuItems[i], show);
} \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp
index a3354d88f1..6b2e6c43d7 100644
--- a/protocols/Xfire/src/Xfire_base.cpp
+++ b/protocols/Xfire/src/Xfire_base.cpp
@@ -101,12 +101,12 @@ void Xfire_base::readStringfromDB(char*name,unsigned int dbid,char**to)
//wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- if(!DBGetContactSettingString(NULL, protocolname, temp,&dbv))
+ if(!db_get_s(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
//dbval wieder freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -119,12 +119,12 @@ void Xfire_base::readStringfromDB(char*name,unsigned int dbid,int id,char**to)
//wert aus der dblesen
sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
- if(!DBGetContactSettingString(NULL, protocolname, temp,&dbv))
+ if(!db_get_s(NULL, protocolname, temp,&dbv))
{
//string setzen
setString(dbv.pszVal,to);
//dbval wieder freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -142,7 +142,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,char**to)
//string setzen
setString(dbv.pszVal,to);
//dbval wieder freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -160,7 +160,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,int id,char**t
//string setzen
setString(dbv.pszVal,to);
//dbval wieder freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -174,7 +174,7 @@ void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,int id,char*val)
//wert aus der dblesen
sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
- DBWriteContactSettingString(NULL, protocolname, temp,val);
+ db_set_s(NULL, protocolname, temp,val);
}
//schreibt einen stringval in die db welche unterid hat
@@ -186,7 +186,7 @@ void Xfire_base::writeStringtoDB(char*name,unsigned int dbid,char*val)
//wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- DBWriteContactSettingString(NULL, protocolname, temp,val);
+ db_set_s(NULL, protocolname, temp,val);
}
//schreibt einen stringval in die db welche unterid hat
@@ -223,7 +223,7 @@ void Xfire_base::writeBytetoDB(char*name,unsigned int dbid,int val)
//wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- DBWriteContactSettingByte(NULL, protocolname, temp, val);
+ db_set_b(NULL, protocolname, temp, val);
}
//schreibt einen wordwert in die db
@@ -235,7 +235,7 @@ void Xfire_base::writeWordtoDB(char*name,unsigned int dbid,int val)
//wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- DBWriteContactSettingWord(NULL, protocolname, temp, val);
+ db_set_w(NULL, protocolname, temp, val);
}
@@ -248,7 +248,7 @@ unsigned char Xfire_base::readBytefromDB(char*name,unsigned int dbid,int default
//wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- return DBGetContactSettingByte(NULL, protocolname, temp, defaultval);
+ return db_get_b(NULL, protocolname, temp, defaultval);
}
//liest einen wordval aus der db und gibt es zurück
@@ -260,7 +260,7 @@ unsigned int Xfire_base::readWordfromDB(char*name,unsigned int dbid,int defaultv
//wert aus der dblesen
sprintf_s(temp,128,"%s_%i",name,dbid);
- return DBGetContactSettingWord(NULL, protocolname, temp, defaultval);
+ return db_get_w(NULL, protocolname, temp, defaultval);
}
//entfernt einen dbeintrag
@@ -274,10 +274,10 @@ BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid)
sprintf_s(temp,128,"%s_%i",name,dbid);
//eintrag entfernen
- if(!DBGetContactSetting(NULL, protocolname, temp,&dbv))
+ if(!db_get(NULL, protocolname, temp,&dbv))
{
- DBFreeVariant(&dbv);
- DBDeleteContactSetting(NULL, protocolname, temp);
+ db_free(&dbv);
+ db_unset(NULL, protocolname, temp);
return TRUE;
}
@@ -295,10 +295,10 @@ BOOL Xfire_base::removeDBEntry(char*name,unsigned int dbid,int id)
sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
//eintrag entfernen
- if(!DBGetContactSetting(NULL, protocolname, temp,&dbv))
+ if(!db_get(NULL, protocolname, temp,&dbv))
{
- DBFreeVariant(&dbv);
- DBDeleteContactSetting(NULL, protocolname, temp);
+ db_free(&dbv);
+ db_unset(NULL, protocolname, temp);
return TRUE;
}
@@ -507,9 +507,9 @@ BOOL Xfire_base::getGamename(unsigned int gameid,char* out,int outsize){
DBVARIANT dbv;
char dbstr[80]="";
sprintf_s(dbstr,XFIRE_MAXSIZEOFGAMENAME,"customgamename_%d",gameid);
- if(!DBGetContactSetting(NULL,protocolname,dbstr,&dbv)) {
+ if(!db_get(NULL,protocolname,dbstr,&dbv)) {
sprintf_s(out,outsize,"%s",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return TRUE;
}
else
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp
index 196584b580..bd8e2b0e2a 100644
--- a/protocols/Xfire/src/Xfire_game.cpp
+++ b/protocols/Xfire/src/Xfire_game.cpp
@@ -471,14 +471,6 @@ void Xfire_game::remoteMenuitem()
//aktualisiert menüpunkt ob hidden
void Xfire_game::refreshMenuitem()
{
- if(menuhandle!=NULL)
- {
- CLISTMENUITEM mi = { sizeof(mi) };
- mi.flags = CMIM_FLAGS;
-
- if(this->notinstartmenu)
- mi.flags|= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )menuhandle, ( LPARAM )&mi );
- }
+ if(menuhandle != NULL)
+ Menu_ShowItem(menuhandle, !this->notinstartmenu);
} \ No newline at end of file
diff --git a/protocols/Xfire/src/Xfire_game.h b/protocols/Xfire/src/Xfire_game.h
index 56a0e6e6e7..8fa5c7f5a2 100644
--- a/protocols/Xfire/src/Xfire_game.h
+++ b/protocols/Xfire/src/Xfire_game.h
@@ -44,7 +44,7 @@ public:
//id des spiels
unsigned int id;
//handle des menuitems
- HANDLE menuhandle;
+ HGENMENU menuhandle;
//spiel soll bei der detection übersprungen werden
BOOL skip;
//voicehat?
diff --git a/protocols/Xfire/src/Xfire_gamelist.cpp b/protocols/Xfire/src/Xfire_gamelist.cpp
index c4fb12ee20..eca9f00b13 100644
--- a/protocols/Xfire/src/Xfire_gamelist.cpp
+++ b/protocols/Xfire/src/Xfire_gamelist.cpp
@@ -191,7 +191,7 @@ void Xfire_gamelist::writeDatabase()
}
//anzahl aktualisieren
- DBWriteContactSettingWord(NULL, protocolname, "foundgames", gamelist.size());
+ db_set_w(NULL, protocolname, "foundgames", gamelist.size());
}
//prüft ob ein game schon in der liste is
diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp
index f5612e8e56..0a583a6998 100644
--- a/protocols/Xfire/src/Xfire_icon_mng.cpp
+++ b/protocols/Xfire/src/Xfire_icon_mng.cpp
@@ -177,7 +177,7 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) {
//icon vom xfire server laden
HICON Xfire_icon_mng::downloadIcon(char* shortname) {
//nur vom internetladen, wenn die option aktiv ist
- if(!DBGetContactSettingByte(NULL,protocolname,"xfiresitegameico",0))
+ if(!db_get_b(NULL,protocolname,"xfiresitegameico",0))
return NULL;
//keinen namen angegeben?
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp
index a1c6483b00..d14ae6f9d5 100644
--- a/protocols/Xfire/src/Xfire_voicechat.cpp
+++ b/protocols/Xfire/src/Xfire_voicechat.cpp
@@ -159,27 +159,27 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) {
if(packet==NULL || packet->gameid==XFIREVOICECHAT_NOVOICE) {
//einträge aus der db entfernen
- DBDeleteContactSetting(NULL,protocolname, "VServerIP");
- DBDeleteContactSetting(NULL,protocolname, "currentvoicename");
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "currentvoicename");
//zurück
return;
}
//ip speichern
sprintf_s(temp,32,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "VServerIP", temp);
+ db_set_s(NULL, protocolname, "VServerIP", temp);
//namen jeh nach id schreiben
switch(packet->gameid) {
case XFIREVOICECHAT_TS3:
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Teamspeak 3");
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak 3");
break;
case XFIREVOICECHAT_TS2:
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Teamspeak 2");
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak 2");
break;
case XFIREVOICECHAT_MUMBLE:
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Mumble");
+ db_set_s(NULL, protocolname, "currentvoicename", "Mumble");
break;
case XFIREVOICECHAT_VENTRILO:
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Ventrilo");
+ db_set_s(NULL, protocolname, "currentvoicename", "Ventrilo");
break;
};
}
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp
index 7063507879..b033b4e3bb 100644
--- a/protocols/Xfire/src/all_statusmsg.cpp
+++ b/protocols/Xfire/src/all_statusmsg.cpp
@@ -26,7 +26,7 @@ int statustype;
BOOL BackupStatusMsg() {
DBVARIANT dbv;
- statustype=DBGetContactSettingByte(NULL,protocolname,"statuschgtype",0);
+ statustype=db_get_b(NULL,protocolname,"statuschgtype",0);
XFireLog("Backup Status Message ...");
@@ -67,7 +67,7 @@ BOOL BackupStatusMsg() {
sprintf_s(ttemp,128,"%s%s",temp[i]->szModuleName,PS_SETAWAYMSG);
//xfire wird geskipped, offline prots und invs prots auch, und locked status prots auch
- if(!temp[i]->bIsEnabled||statusid==ID_STATUS_INVISIBLE||statusid==ID_STATUS_OFFLINE||!lstrcmpiA( temp[i]->szModuleName, protocolname )||!ServiceExists(ttemp)||DBGetContactSettingByte(NULL,temp[i]->szModuleName,"LockMainStatus",0)==1)
+ if(!temp[i]->bIsEnabled||statusid==ID_STATUS_INVISIBLE||statusid==ID_STATUS_OFFLINE||!lstrcmpiA( temp[i]->szModuleName, protocolname )||!ServiceExists(ttemp)||db_get_b(NULL,temp[i]->szModuleName,"LockMainStatus",0)==1)
{
XFireLog("-> Skip %s.",temp[i]->szModuleName);
@@ -87,7 +87,7 @@ BOOL BackupStatusMsg() {
int caps=CallProtoService(temp[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0);
//normale statusreihenfolge
- if(DBGetContactSettingByte(NULL,protocolname,"dndfirst",0)==0)
+ if(db_get_b(NULL,protocolname,"dndfirst",0)==0)
{
if(caps&PF2_LIGHTDND)
{
@@ -149,35 +149,35 @@ BOOL BackupStatusMsg() {
switch(statusid)
{
case ID_STATUS_ONLINE:
- if(DBGetContactSetting(NULL,"SRAway","OnMsg",&dbv))
+ if(db_get(NULL,"SRAway","OnMsg",&dbv))
olstatusmsg->push_back(Translate("Yep, I'm here."));
break;
case ID_STATUS_AWAY:
- if(DBGetContactSetting(NULL,"SRAway","AwayMsg",&dbv))
+ if(db_get(NULL,"SRAway","AwayMsg",&dbv))
olstatusmsg->push_back(Translate("I've been away since %time%."));
break;
case ID_STATUS_NA:
- if(DBGetContactSetting(NULL,"SRAway","NaMsg",&dbv))
+ if(db_get(NULL,"SRAway","NaMsg",&dbv))
olstatusmsg->push_back(Translate("Give it up, I'm not in!"));
break;
case ID_STATUS_OCCUPIED:
- if(DBGetContactSetting(NULL,"SRAway","OccupiedMsg",&dbv))
+ if(db_get(NULL,"SRAway","OccupiedMsg",&dbv))
olstatusmsg->push_back(Translate("Not right now."));
break;
case ID_STATUS_DND:
- if(DBGetContactSetting(NULL,"SRAway","DndMsg",&dbv))
+ if(db_get(NULL,"SRAway","DndMsg",&dbv))
olstatusmsg->push_back(Translate("Give a guy some peace, would ya?"));
break;
case ID_STATUS_FREECHAT:
- if(DBGetContactSetting(NULL,"SRAway","FreeChatMsg",&dbv))
+ if(db_get(NULL,"SRAway","FreeChatMsg",&dbv))
olstatusmsg->push_back(Translate("Well, I would talk to you if Miranda ICQ supported chat"));
break;
case ID_STATUS_ONTHEPHONE:
- if(DBGetContactSetting(NULL,"SRAway","OtpMsg",&dbv))
+ if(db_get(NULL,"SRAway","OtpMsg",&dbv))
olstatusmsg->push_back(Translate("That'll be the phone."));
break;
case ID_STATUS_OUTTOLUNCH:
- if(DBGetContactSetting(NULL,"SRAway","OtlMsg",&dbv))
+ if(db_get(NULL,"SRAway","OtlMsg",&dbv))
olstatusmsg->push_back(Translate("Mmm...food."));
break;
default:
@@ -195,7 +195,7 @@ BOOL BackupStatusMsg() {
olstatusmsg->push_back(string(dbv.pszVal));
protoname->push_back(temp[i]->szModuleName);
//freigeben
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
protoname->push_back(temp[i]->szModuleName);
@@ -216,23 +216,23 @@ BOOL SetGameStatusMsg()
if (ServiceExists(MS_VARS_FORMATSTRING))
{
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,"setstatusmsg",&dbv)) {
+ if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) {
//direkte funktionen verwenden
statusmsg = variables_parse(dbv.pszVal,NULL,0);
if (statusmsg == NULL)
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return FALSE;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
else
{
//alternativ zweig ohne variables
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,"setstatusmsg",&dbv)) {
+ if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) {
DBVARIANT dbv3;
@@ -242,37 +242,37 @@ BOOL SetGameStatusMsg()
//mit den vars ersetzen beginnen
//derzeitiges spiel
- if(!DBGetContactSetting(NULL,protocolname, "currentgamename",&dbv3))
+ if(!db_get(NULL,protocolname, "currentgamename",&dbv3))
{
xgamelist.strreplace("%myxfiregame%",dbv3.pszVal,&statusmsg);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
else
xgamelist.strreplace("%myxfiregame%","",&statusmsg);
//derzeitiges voiceprogram
- if(!DBGetContactSetting(NULL,protocolname, "currentvoicename",&dbv3))
+ if(!db_get(NULL,protocolname, "currentvoicename",&dbv3))
{
xgamelist.strreplace("%myxfirevoice%",dbv3.pszVal,&statusmsg);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
else
xgamelist.strreplace("%myxfirevoice%","",&statusmsg);
//derzeitige voiceip
- if(!DBGetContactSetting(NULL,protocolname, "VServerIP",&dbv3))
+ if(!db_get(NULL,protocolname, "VServerIP",&dbv3))
{
xgamelist.strreplace("%myxfirevoiceip%",dbv3.pszVal,&statusmsg);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
else
xgamelist.strreplace("%myxfirevoiceip%","",&statusmsg);
//derzeitige gameip
- if(!DBGetContactSetting(NULL,protocolname, "ServerIP",&dbv3))
+ if(!db_get(NULL,protocolname, "ServerIP",&dbv3))
{
xgamelist.strreplace("%myxfireserverip%",dbv3.pszVal,&statusmsg);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
else
xgamelist.strreplace("%myxfireserverip%","",&statusmsg);
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp
index b26d07266a..d2ae949d7a 100644
--- a/protocols/Xfire/src/buddylist.cpp
+++ b/protocols/Xfire/src/buddylist.cpp
@@ -148,10 +148,10 @@ namespace xfirelib {
char * dummy;
sprintf_s(temp,255,"Clan_%d",entry->clanid);
- DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,temp,&dbv))
- {
- dummy=dbv.pszVal;
+ DBVARIANT dbv;
+ if(!db_get(NULL,protocolname,temp,&dbv))
+ {
+ dummy=dbv.pszVal;
}
else
dummy=NULL;
diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp
index 4ccf320b9b..cc835332a4 100644
--- a/protocols/Xfire/src/iniupdater.cpp
+++ b/protocols/Xfire/src/iniupdater.cpp
@@ -65,7 +65,7 @@ void UpdateMyXFireIni(LPVOID dummy) {
if(CheckWWWContent(request))
{
- if(DBGetContactSettingByte(NULL,protocolname,"dontaskforupdate",0)==1||DialogBox(hinstance,MAKEINTRESOURCE(IDD_UPDATE),NULL,DlgUpdateDialogProc)==IDOK)
+ if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||DialogBox(hinstance,MAKEINTRESOURCE(IDD_UPDATE),NULL,DlgUpdateDialogProc)==IDOK)
{
if(GetWWWContent2(request,file,FALSE))
{
@@ -74,12 +74,12 @@ void UpdateMyXFireIni(LPVOID dummy) {
//derzeitige ini und sichern
rename(file2,file3);
//lösche .old, wenn aktiv
- if(DBGetContactSettingByte(NULL,protocolname,"nobackupini",0))
+ if(db_get_b(NULL,protocolname,"nobackupini",0))
remove(file3);
//neue aktiv schalten
rename(file,file2);
- if(DBGetContactSettingByte(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The xfire_games.ini was updated."));
+ if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The xfire_games.ini was updated."));
}
else
MSGBOX(Translate("Error during xfire_games Update."));
@@ -105,7 +105,7 @@ void UpdateMyIcons(LPVOID dummy) {
if(CheckWWWContent(request))
{
- if(DBGetContactSettingByte(NULL,protocolname,"dontaskforupdate",0)==1||MessageBox(NULL,Translate("There is a new Icons.dll online, do you want to update now?"),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
+ if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==1||MessageBox(NULL,Translate("There is a new Icons.dll online, do you want to update now?"),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
{
if(GetWWWContent2(request,file,FALSE)) {
//altes backup löschen
@@ -113,12 +113,12 @@ void UpdateMyIcons(LPVOID dummy) {
//derzeitige ini und sichern
rename(file2,file3);
//lösche .old, wenn aktiv
- if(DBGetContactSettingByte(NULL,protocolname,"nobackupini",0))
+ if(db_get_b(NULL,protocolname,"nobackupini",0))
remove(file3);
//neue aktiv schalten
rename(file,file2);
- if(DBGetContactSettingByte(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The Icons.dll was updated."));
+ if(db_get_b(NULL,protocolname,"dontaskforupdate",0)==0) MSGBOX(Translate("The Icons.dll was updated."));
}
else
MSGBOX(Translate("Error during Icons.dll Update."));
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index ae7fcc07e3..0c0a76ce4b 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -98,7 +98,7 @@ HINSTANCE hinstance = NULL;
int hLangpack;
HANDLE hExtraIcon1, hExtraIcon2;
HANDLE heventXStatusIconChanged;
-HANDLE copyipport,gotoclansite,vipport,joingame,startthisgame,removefriend,blockfriend;
+HGENMENU copyipport,gotoclansite,vipport,joingame,startthisgame,removefriend,blockfriend;
int foundgames=0;
Gdiplus::GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
@@ -250,10 +250,10 @@ void XFireClient::CheckAvatar(BuddyListEntry* entry) {
return;
//keine avatars?
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)==0)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==0)
{
//avatar gelocked?
- if(DBGetContactSettingByte(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
+ if(db_get_b(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
{
//avatar lade auftrag übergeben
this->avatarloader->loadAvatar(entry->hcontact,(char*)entry->username.c_str(),entry->userid);
@@ -382,7 +382,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
{
temp=0;
}
- DBWriteContactSettingByte(NULL,protocolname,xfireconfigitems[i].dbentry,temp);
+ db_set_b(NULL,protocolname,xfireconfigitems[i].dbentry,temp);
}
}
break;
@@ -494,7 +494,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
sprintf(temp,"Clan_%d",clan->clanid);
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,temp,&dbv))
+ if(!db_get(NULL,protocolname,temp,&dbv))
{
dummy=dbv.pszVal;
}
@@ -517,17 +517,17 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
char fofname[128]=LPGEN("Friends of Friends Playing");
DBVARIANT dbv;
//gruppennamen überladen
- if(!DBGetContactSetting(NULL,protocolname,"overload_fofgroupname",&dbv))
+ if(!db_get(NULL,protocolname,"overload_fofgroupname",&dbv))
{
strcpy_s(fofname,128,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
CreateGroup(Translate(fofname),"fofgroup");
HANDLE hc=handlingBuddys(entry,-1,Translate(fofname));
if(hc)
{
CheckAvatar(entry);
- DBWriteContactSettingByte(hc,protocolname,"friendoffriend",1);
+ db_set_b(hc,protocolname,"friendoffriend",1);
}
}
}
@@ -579,17 +579,10 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
}
else
{
- if(entry->game==0&&
- entry->hcontact!=0&&
- DBGetContactSettingByte(entry->hcontact,protocolname,"friendoffriend",0)==1)
- {
- DBWriteContactSettingWord(entry->hcontact,protocolname,"Status",ID_STATUS_OFFLINE);
- //CallService( MS_DB_CONTACT_DELETE, (WPARAM) entry->hcontact, 0);
- }
+ if(entry->game == 0 && entry->hcontact != 0 && db_get_b(entry->hcontact,protocolname,"friendoffriend",0)==1)
+ db_set_w(entry->hcontact,protocolname,"Status",ID_STATUS_OFFLINE);
else
- {
- handlingBuddys(entry,0,NULL);
- }
+ handlingBuddys(entry,0,NULL);
}
}
}
@@ -617,7 +610,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
InviteRequestPacket *invite = (InviteRequestPacket*)content;
//nur nich blockierte buddy's durchlassen
- if(!DBGetContactSettingByte(NULL,"XFireBlock",(char*)invite->name.c_str(),0))
+ if(!db_get_b(NULL,"XFireBlock",(char*)invite->name.c_str(),0))
{
XFireContact xfire_newc;
xfire_newc.username=(char*)invite->name.c_str();
@@ -656,12 +649,12 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
for(int i=0;i<clan->count;i++)
{
sprintf(temp,"Clan_%d",clan->clanid[i]);
- DBWriteContactSettingString(NULL, protocolname, temp, (char*)clan->name[i].c_str());
+ db_set_s(NULL, protocolname, temp, (char*)clan->name[i].c_str());
sprintf(temp,"ClanUrl_%d",clan->clanid[i]);
- DBWriteContactSettingString(NULL, protocolname, temp, (char*)clan->url[i].c_str());
+ db_set_s(NULL, protocolname, temp, (char*)clan->url[i].c_str());
- if(!DBGetContactSettingByte(NULL,protocolname,"noclangroups",0)) {
+ if(!db_get_b(NULL,protocolname,"noclangroups",0)) {
CreateGroup((char*)clan->name[i].c_str(),"mainclangroup");
}
}
@@ -676,9 +669,9 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
LoginSuccessPacket *login = (LoginSuccessPacket*)content;
char * temp = mir_utf8decode((char*)login->nick.c_str(),NULL);
//nick speichern
- DBWriteContactSettingString(NULL,protocolname,"Nick",temp);
+ db_set_s(NULL,protocolname,"Nick",temp);
//uid speichern
- DBWriteContactSettingDword(NULL,protocolname,"myuid",login->myuid);
+ db_set_dw(NULL,protocolname,"myuid",login->myuid);
this->myuid=login->myuid;
//avatar auslesen
GetBuddyInfo* buddyinfo=new GetBuddyInfo();
@@ -694,9 +687,9 @@ void XFireClient::sendmsg(char*usr,char*cmsg) {
if((unsigned int)client->protocolVersion<(unsigned int)version->newversion)
{
- DBWriteContactSettingByte(NULL,protocolname,"protover",version->newversion);
+ db_set_b(NULL,protocolname,"protover",version->newversion);
//recprotoverchg
- if(DBGetContactSettingWord(NULL,protocolname,"recprotoverchg",0)==0)
+ if(db_get_w(NULL,protocolname,"recprotoverchg",0)==0)
{
sprintf_s(temp,255,Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."),client->protocolVersion,version->newversion);
MSGBOXE(temp);
@@ -824,9 +817,9 @@ void StartIniUpdateAndDetection(LPVOID dummy)
EnterCriticalSection(&connectingMutex);
//ini/ico updater, nur wenn aktiv
- if(DBGetContactSettingByte(NULL,protocolname,"autoiniupdate",0))
+ if(db_get_b(NULL,protocolname,"autoiniupdate",0))
UpdateMyXFireIni(NULL);
- if(DBGetContactSettingByte(NULL,protocolname,"autoicodllupdate",0))
+ if(db_get_b(NULL,protocolname,"autoicodllupdate",0))
UpdateMyIcons(NULL);
#ifndef NO_PTHREAD
@@ -996,7 +989,7 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam)
SkinAddNewSoundEx("xfirebstartgame",protocolname,LPGEN("Buddy start a game"));
//hook für mbot einfügen, nur wenn mbot option aktiv
- if(DBGetContactSettingByte(NULL,protocolname,"mbotsupport",0))
+ if(db_get_b(NULL,protocolname,"mbotsupport",0))
HookEvent(XFIRE_INGAMESTATUSHOOK, mBotNotify);
//init der extraicons wenn service vorhanden
@@ -1043,9 +1036,9 @@ int ExtraImageApply(WPARAM wparam, LPARAM lparam)
HANDLE hContact=(HANDLE)wparam;
// TODO: maybe need to fix extra icons
char *szProto = GetContactProto(hContact);
- if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ) && DBGetContactSettingWord(hContact, protocolname, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
- int gameid=DBGetContactSettingWord(hContact, protocolname, "GameId", 0);
- int gameid2=DBGetContactSettingWord(hContact, protocolname, "VoiceId", 0);
+ if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ) && db_get_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) {
+ int gameid=db_get_w(hContact, protocolname, "GameId", 0);
+ int gameid2=db_get_w(hContact, protocolname, "VoiceId", 0);
if(gameid!=0)
{
@@ -1074,20 +1067,20 @@ extern "C" __declspec(dllexport) int Load(void)
//void* init = GetProcAddress(LoadLibrary("atl"),"AtlAxWinInit"); _asm call init;
//keine protoversion in der db, dann wohl der erste start von xfire
- if(DBGetContactSettingByte(NULL,protocolname,"protover",0)==0)
+ if(db_get_b(NULL,protocolname,"protover",0)==0)
{
- DBWriteContactSettingByte(NULL,protocolname,"protover",0x84);
- DBWriteContactSettingWord(NULL,protocolname,"avatarloadlatency",1000);
- DBWriteContactSettingByte(NULL,protocolname,"gameico",0);
- DBWriteContactSettingByte(NULL,protocolname,"voiceico",1);
- DBWriteContactSettingByte(NULL,protocolname,"specialavatarload",1);
- DBWriteContactSettingByte(NULL,protocolname,"xfiresitegameico",1);
- DBWriteContactSettingByte(NULL,protocolname,"recprotoverchg",1);
+ db_set_b(NULL,protocolname,"protover",0x84);
+ db_set_w(NULL,protocolname,"avatarloadlatency",1000);
+ db_set_b(NULL,protocolname,"gameico",0);
+ db_set_b(NULL,protocolname,"voiceico",1);
+ db_set_b(NULL,protocolname,"specialavatarload",1);
+ db_set_b(NULL,protocolname,"xfiresitegameico",1);
+ db_set_b(NULL,protocolname,"recprotoverchg",1);
if(MessageBoxA(NULL,Translate("It seems that is the first time you use this plugin. Do you want to automatically download the latest available xfire_games.ini and icons.dll?\r\nWithout the ini xfire can't detect any games on your computer."),"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
{
- DBWriteContactSettingByte(NULL,protocolname,"autoiniupdate",1);
- DBWriteContactSettingByte(NULL,protocolname,"autoicodllupdate",1);
+ db_set_b(NULL,protocolname,"autoiniupdate",1);
+ db_set_b(NULL,protocolname,"autoicodllupdate",1);
}
}
@@ -1348,10 +1341,10 @@ extern "C" __declspec(dllexport) int Load(void)
//lade GetExtendedUdpTable Funktion
HMODULE hmod=LoadLibraryA("IpHlpApi.dll");
_GetExtendedUdpTable=(pGetExtendedUdpTable)GetProcAddress(hmod,"GetExtendedUdpTable");
- if(_GetExtendedUdpTable==NULL&&DBGetContactSettingByte(NULL,protocolname,"ipportdetec",0))
+ if(_GetExtendedUdpTable==NULL&&db_get_b(NULL,protocolname,"ipportdetec",0))
{
//MessageBoxA(0,"GetExtendedUdpTable not found. ServerIP/Port detection feature will be disabled.","Miranda XFire Protocol Plugin",MB_OK|MB_ICONINFORMATION);
- DBWriteContactSettingByte(NULL,protocolname,"ipportdetec",0);
+ db_set_b(NULL,protocolname,"ipportdetec",0);
XFireLog("Wasn't able to get GetExtendedUdpTable function");
}
@@ -1381,7 +1374,7 @@ INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam) {
INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam)
{
CCSDATA *ccs = ( CCSDATA* )lParam;
- DBDeleteContactSetting(ccs->hContact, "CList", "Hidden");
+ db_unset(ccs->hContact, "CList", "Hidden");
char *szProto = GetContactProto(ccs->hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ))
@@ -1424,16 +1417,16 @@ static INT_PTR UserIsTyping(WPARAM wParam, LPARAM lParam)
if(lParam==PROTOTYPE_SELFTYPING_ON)
{
- if(DBGetContactSettingByte(NULL,protocolname,"sendtyping",1)==1)
+ if(db_get_b(NULL,protocolname,"sendtyping",1)==1)
{
if(myClient!=NULL)
if(myClient->client->connected)
- if(!DBGetContactSettingString(hContact, protocolname, "Username",&dbv))
+ if(!db_get_s(hContact, protocolname, "Username",&dbv))
{
SendTypingPacket typing;
typing.init(myClient->client, dbv.pszVal);
myClient->client->send( &typing );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -1452,9 +1445,9 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam)
DBVARIANT dbv;
int sended=0;
- DBGetContactSettingString(ccs->hContact, protocolname, "Username",&dbv);
+ db_get_s(ccs->hContact, protocolname, "Username",&dbv);
if(myClient!=NULL)
- if(myClient->client->connected&&DBGetContactSettingWord(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE)
+ if(myClient->client->connected&&db_get_w(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE)
{
/*if(myClient->useutf8)
myClient->sendmsg(dbv.pszVal, ( char* )ccs->lParam);
@@ -1468,7 +1461,7 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam)
{
mir_forkthread(SendBadAck,ccs->hContact);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return sended;
}
@@ -1484,7 +1477,7 @@ INT_PTR GetCaps(WPARAM wParam,LPARAM lParam)
else if(wParam==PFLAGNUM_2)
return PF2_ONLINE|PF2_SHORTAWAY; // add the possible statuses here.
else if(wParam==PFLAGNUM_3)
- return PF2_ONLINE|(DBGetContactSettingByte(NULL,protocolname,"nocustomaway",0)==1?0:PF2_SHORTAWAY);
+ return PF2_ONLINE|(db_get_b(NULL,protocolname,"nocustomaway",0)==1?0:PF2_SHORTAWAY);
else if(wParam==PFLAGNUM_4)
return PF4_SUPPORTTYPING|PF4_AVATARS;
else if(wParam==PFLAG_UNIQUEIDTEXT)
@@ -1539,7 +1532,7 @@ static void ConnectingThread(LPVOID params)
}
else
{
- if(DBGetContactSettingWord(NULL,protocolname,"noconnectfailedbox",0)==0) MSGBOXE(Translate("Unable to connect to XFire."));
+ if(db_get_w(NULL,protocolname,"noconnectfailedbox",0)==0) MSGBOXE(Translate("Unable to connect to XFire."));
wParam =ID_STATUS_OFFLINE;
}
@@ -1565,7 +1558,7 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam)
return 0;
if(wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE&&wParam!=ID_STATUS_AWAY&&wParam!=ID_STATUS_RECONNECT)
- if(DBGetContactSettingByte(NULL,protocolname,"oninsteadafk",0)==0)
+ if(db_get_b(NULL,protocolname,"oninsteadafk",0)==0)
wParam=ID_STATUS_AWAY; //protokoll auf away schalten
else
wParam=ID_STATUS_ONLINE; //protokoll auf online schalten
@@ -1585,12 +1578,12 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
DBVARIANT dbv2;
- if(DBGetContactSetting(NULL,protocolname,"login",&dbv))
+ if(db_get(NULL,protocolname,"login",&dbv))
{
MSGBOXE(Translate("No Loginname is set!"));
wParam=ID_STATUS_OFFLINE;
}
- else if(DBGetContactSetting(NULL,protocolname,"password",&dbv2))
+ else if(db_get(NULL,protocolname,"password",&dbv2))
{
MSGBOXE(Translate("No Password is set!"));
wParam=ID_STATUS_OFFLINE;
@@ -1603,26 +1596,26 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam)
delete myClient;
//alter proxycode, entfernt da über netlib die proxysache geregelt wird
- /* if(DBGetContactSettingByte(NULL, protocolname, "useproxy" ,0))
+ /* if(db_get_b(NULL, protocolname, "useproxy" ,0))
{
//verbindung über proxy
DBVARIANT dbv3;
DBVARIANT dbv4;
- if(!DBGetContactSetting(NULL,protocolname,"proxyip",&dbv3))
+ if(!db_get(NULL,protocolname,"proxyip",&dbv3))
{
- if(!DBGetContactSetting(NULL,protocolname,"proxyport",&dbv4))
+ if(!db_get(NULL,protocolname,"proxyport",&dbv4))
{
- myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,DBGetContactSettingByte(NULL,protocolname,"protover",0),1,dbv3.pszVal,atoi(dbv4.pszVal));
- DBFreeVariant(&dbv4);
+ myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0),1,dbv3.pszVal,atoi(dbv4.pszVal));
+ db_free(&dbv4);
}
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
}
}
else */
- myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,DBGetContactSettingByte(NULL,protocolname,"protover",0));
+ myClient = new XFireClient(dbv.pszVal,dbv2.pszVal,db_get_b(NULL,protocolname,"protover",0));
//prüfe ob utf8 option aktiv, dann schlater auf true
- if(DBGetContactSettingByte(NULL,protocolname,"useutf8",0))
+ if(db_get_b(NULL,protocolname,"useutf8",0))
{
myClient->useutf8=TRUE;
}
@@ -1648,13 +1641,13 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam)
}
*/
//für die vars
- DBDeleteContactSetting(NULL,protocolname,"currentgamename");
- DBDeleteContactSetting(NULL,protocolname,"currentvoicename");
- DBDeleteContactSetting(NULL,protocolname,"VServerIP");
- DBDeleteContactSetting(NULL,protocolname,"ServerIP");
+ db_unset(NULL,protocolname,"currentgamename");
+ db_unset(NULL,protocolname,"currentvoicename");
+ db_unset(NULL,protocolname,"VServerIP");
+ db_unset(NULL,protocolname,"ServerIP");
- DBFreeVariant(&dbv);
- DBFreeVariant(&dbv2);
+ db_free(&dbv);
+ db_free(&dbv2);
return 0;
}
}
@@ -1667,7 +1660,7 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam)
else if(myClient!=NULL&&myClient->client->connected) // online --> afk
{
//setze bei aktivem nocustomaway die alte awaystatusmsg zurück, bugfix
- if(DBGetContactSettingByte(NULL,protocolname,"nocustomaway",0))
+ if(db_get_b(NULL,protocolname,"nocustomaway",0))
strcpy_s(statusmessage[1],1024,"(AFK) Away from Keyboard");
myClient->Status(statusmessage[1]);
@@ -1686,10 +1679,10 @@ INT_PTR SetStatus(WPARAM wParam,LPARAM lParam)
//teamspeak/ventrilo pid sowie gamepid auf NULL setzen, damit bei einem reconnect die neuerkannt werden
pid=NULL;
ts2pid=NULL;
- DBWriteContactSettingWord(NULL,protocolname,"currentgame",0);
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",0);
- DBDeleteContactSetting(NULL,protocolname, "VServerIP");
- DBDeleteContactSetting(NULL,protocolname, "ServerIP");
+ db_set_w(NULL,protocolname,"currentgame",0);
+ db_set_w(NULL,protocolname,"currentvoice",0);
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "ServerIP");
if(wParam == ID_STATUS_RECONNECT)
{
@@ -1737,34 +1730,34 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan)
CallService( MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM)protocolname );
if ( InList )
- DBDeleteContactSetting(hContact, "CList", "NotOnList");
+ db_unset(hContact, "CList", "NotOnList");
else
- DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1);
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ db_unset(hContact, "CList", "Hidden");
if(strlen(xfc.nick)>0)
{
if(myClient->useutf8)
DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", xfc.nick);
else
- DBWriteContactSettingString(hContact, protocolname, "Nick", mir_utf8decode(( char* )xfc.nick,NULL));
+ db_set_s(hContact, protocolname, "Nick", mir_utf8decode(( char* )xfc.nick,NULL));
}
else if(strlen(xfc.username)>0)
- DBWriteContactSettingString(hContact, protocolname, "Nick", xfc.username);
+ db_set_s(hContact, protocolname, "Nick", xfc.username);
- DBWriteContactSettingString(hContact, protocolname, "Username", xfc.username);
+ db_set_s(hContact, protocolname, "Username", xfc.username);
- //DBWriteContactSettingString(hContact, protocolname, "Screenname", xfc.nick);
- DBWriteContactSettingDword(hContact, protocolname, "UserId", xfc.id);
+ //db_set_s(hContact, protocolname, "Screenname", xfc.nick);
+ db_set_dw(hContact, protocolname, "UserId", xfc.id);
if(clan>0)
- DBWriteContactSettingDword(hContact, protocolname, "Clan", clan);
+ db_set_dw(hContact, protocolname, "Clan", clan);
- DBWriteContactSettingWord(hContact, protocolname, "Status", SetOnline ? ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
+ db_set_w(hContact, protocolname, "Status", SetOnline ? ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)==0)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==0)
{
- if(!DBGetContactSettingByte(NULL,protocolname,"specialavatarload",0))
+ if(!db_get_b(NULL,protocolname,"specialavatarload",0))
{
XFire_SetAvatar* xsa=new XFire_SetAvatar;
xsa->hContact=hContact;
@@ -1789,8 +1782,8 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan)
}
if (xfc.id==0) {
- DBWriteContactSettingByte( hContact, "CList", "NotOnList", 1 );
- DBWriteContactSettingByte( hContact, "CList", "Hidden", 1 );
+ db_set_b( hContact, "CList", "NotOnList", 1 );
+ db_set_b( hContact, "CList", "Hidden", 1 );
}
return hContact;
@@ -1813,7 +1806,7 @@ HANDLE CList_FindContact (int uid)
while (hContact) {
char *szProto = GetContactProto(hContact);
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
- if ( DBGetContactSettingDword(hContact, protocolname, "UserId",-1)==uid)
+ if ( db_get_dw(hContact, protocolname, "UserId",-1)==uid)
return hContact;
}
hContact = db_find_next(hContact);
@@ -1830,60 +1823,60 @@ void CList_MakeAllOffline()
if ( szProto != NULL && !lstrcmpiA( szProto, protocolname )) {
//freunde von freunden in eine seperate liste setzen
//nur wenn das nicht abgestellt wurde
- if(DBGetContactSettingByte(hContact,protocolname,"friendoffriend",0)==1&&
- DBGetContactSettingByte(NULL,protocolname,"fofdbremove",0)==1)
+ if(db_get_b(hContact,protocolname,"friendoffriend",0)==1&&
+ db_get_b(NULL,protocolname,"fofdbremove",0)==1)
{
fhandles.push_back(hContact);
}
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "ServerName");
- DBDeleteContactSetting(hContact, protocolname, "GameType");
- DBDeleteContactSetting(hContact, protocolname, "Map");
- DBDeleteContactSetting(hContact, protocolname, "Players");
- DBDeleteContactSetting(hContact, protocolname, "Passworded");
+ db_unset(hContact, "CList", "StatusMsg");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "ServerName");
+ db_unset(hContact, protocolname, "GameType");
+ db_unset(hContact, protocolname, "Map");
+ db_unset(hContact, protocolname, "Players");
+ db_unset(hContact, protocolname, "Passworded");
- DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- DBDeleteContactSetting(hContact, protocolname, "XStatusName");
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)==1)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==1)
{
- DBDeleteContactSetting(hContact, "ContactPhoto", "File");
- DBDeleteContactSetting(hContact, "ContactPhoto", "RFile");
- DBDeleteContactSetting(hContact, "ContactPhoto", "Backup");
- DBDeleteContactSetting(hContact, "ContactPhoto", "Format");
- DBDeleteContactSetting(hContact, "ContactPhoto", "ImageHash");
- DBDeleteContactSetting(hContact, "ContactPhoto", "XFireAvatarId");
- DBDeleteContactSetting(hContact, "ContactPhoto", "XFireAvatarMode");
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, "ContactPhoto", "RFile");
+ db_unset(hContact, "ContactPhoto", "Backup");
+ db_unset(hContact, "ContactPhoto", "Format");
+ db_unset(hContact, "ContactPhoto", "ImageHash");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarId");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
}
else
{
//prüf ob der avatar noch existiert
DBVARIANT dbv;
- if(!DBGetContactSettingString(hContact, "ContactPhoto", "File",&dbv))
+ if(!db_get_s(hContact, "ContactPhoto", "File",&dbv))
{
FILE*f=fopen(dbv.pszVal,"r");
if(f==NULL)
{
- DBDeleteContactSetting(hContact, "ContactPhoto", "File");
- DBDeleteContactSetting(hContact, "ContactPhoto", "RFile");
- DBDeleteContactSetting(hContact, "ContactPhoto", "Backup");
- DBDeleteContactSetting(hContact, "ContactPhoto", "Format");
- DBDeleteContactSetting(hContact, "ContactPhoto", "ImageHash");
- DBDeleteContactSetting(hContact, "ContactPhoto", "XFireAvatarId");
- DBDeleteContactSetting(hContact, "ContactPhoto", "XFireAvatarMode");
+ db_unset(hContact, "ContactPhoto", "File");
+ db_unset(hContact, "ContactPhoto", "RFile");
+ db_unset(hContact, "ContactPhoto", "Backup");
+ db_unset(hContact, "ContactPhoto", "Format");
+ db_unset(hContact, "ContactPhoto", "ImageHash");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarId");
+ db_unset(hContact, "ContactPhoto", "XFireAvatarMode");
}
else
{
fclose(f);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- DBWriteContactSettingWord(hContact,protocolname,"Status",ID_STATUS_OFFLINE);
+ db_set_w(hContact,protocolname,"Status",ID_STATUS_OFFLINE);
}
hContact = db_find_next(hContact);
}
@@ -1900,7 +1893,7 @@ void SetIcon(HANDLE hcontact,HANDLE hicon,int ctype)
void SetAvatar2(LPVOID lparam) {
static int lasttime=0;
- int sleep=DBGetContactSettingWord(NULL,protocolname,"avatarloadlatency",1000);
+ int sleep=db_get_w(NULL,protocolname,"avatarloadlatency",1000);
lasttime+=sleep;
if(mySleep(lasttime,hConnectionClose))
@@ -1925,7 +1918,7 @@ void SetAvatar(LPVOID lparam)
//EnterCriticalSection(&avatarMutex);
//WaitForSingleObject(hMutex, INFINITE);
static int lasttime=0;
- int sleep=DBGetContactSettingWord(NULL,protocolname,"avatarloadlatency",250);
+ int sleep=db_get_w(NULL,protocolname,"avatarloadlatency",250);
if(bpStatus==ID_STATUS_OFFLINE)
return;
@@ -2082,16 +2075,16 @@ static INT_PTR GetIPPort(WPARAM wParam,LPARAM lParam)
HGLOBAL clipbuffer;
char* buffer;
- if(DBGetContactSettingWord((HANDLE)wParam, protocolname, "Port", -1)==0)
+ if(db_get_w((HANDLE)wParam, protocolname, "Port", -1)==0)
return 0;
DBVARIANT dbv;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "ServerIP",&dbv))
+ if(db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,DBGetContactSettingWord((HANDLE)wParam, protocolname, "Port", -1));
+ sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, "Port", -1));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if(OpenClipboard(NULL))
{
@@ -2115,16 +2108,16 @@ static INT_PTR GetVIPPort(WPARAM wParam,LPARAM lParam)
HGLOBAL clipbuffer;
char* buffer;
- if(DBGetContactSettingWord((HANDLE)wParam, protocolname, "VPort", -1)==0)
+ if(db_get_w((HANDLE)wParam, protocolname, "VPort", -1)==0)
return 0;
DBVARIANT dbv;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "VServerIP",&dbv))
+ if(db_get_s((HANDLE)wParam, protocolname, "VServerIP",&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,DBGetContactSettingWord((HANDLE)wParam, protocolname, "VPort", -1));
+ sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, "VPort", -1));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if(OpenClipboard(NULL))
{
@@ -2147,12 +2140,12 @@ static INT_PTR GotoProfile(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
char temp[64]="";
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "Username",&dbv))
+ if(db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
return 0;
strcpy(temp,"http://xfire.com/profile/");
strcat_s(temp,64,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
CallService( MS_UTILS_OPENURL, 1, (LPARAM)temp );
@@ -2163,15 +2156,15 @@ static INT_PTR GotoXFireClanSite(WPARAM wParam,LPARAM lParam) {
DBVARIANT dbv;
char temp[64]="";
- int clanid=DBGetContactSettingDword((HANDLE)wParam, protocolname, "Clan",-1);
+ int clanid=db_get_dw((HANDLE)wParam, protocolname, "Clan",-1);
sprintf(temp,"ClanUrl_%d",clanid);
- if(DBGetContactSettingString(NULL, protocolname, temp,&dbv))
+ if(db_get_s(NULL, protocolname, temp,&dbv))
return 0;
strcpy(temp,"http://xfire.com/clans/");
strcat_s(temp,64,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
CallService( MS_UTILS_OPENURL, 1, (LPARAM)temp );
@@ -2183,12 +2176,12 @@ static INT_PTR GotoProfile2(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
char temp[64]="";
- if(DBGetContactSettingString(NULL, protocolname, "login",&dbv))
+ if(db_get_s(NULL, protocolname, "login",&dbv))
return 0;
strcpy(temp,"http://xfire.com/profile/");
strcat_s(temp,64,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
CallService( MS_UTILS_OPENURL, 1, (LPARAM)temp );
@@ -2205,12 +2198,12 @@ static INT_PTR GotoProfileAct(WPARAM wParam,LPARAM lParam)
DBVARIANT dbv;
char temp[64]="";
- if(DBGetContactSettingString(NULL, protocolname, "login",&dbv))
+ if(db_get_s(NULL, protocolname, "login",&dbv))
return 0;
strcpy(temp,"http://www.xfire.com/?username=");
strcat_s(temp,64,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
CallService( MS_UTILS_OPENURL, 1, (LPARAM)temp );
@@ -2224,107 +2217,60 @@ static INT_PTR GotoProfileAct(WPARAM wParam,LPARAM lParam)
int RebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
- // !!!!!!!! check it later
- CLISTMENUITEM clmi = { 0 };
- clmi.cbSize = sizeof( clmi );
- CLISTMENUITEM clmi2 = { 0 };
- clmi2.cbSize = sizeof( clmi2 );
- CLISTMENUITEM clmi3 = { 0 };
- clmi3.cbSize = sizeof( clmi3 );
- CLISTMENUITEM clmi4 = { 0 };
- clmi4.cbSize = sizeof( clmi4 );
- CLISTMENUITEM clmi5 = { 0 };
- clmi5.cbSize = sizeof( clmi5 );
- CLISTMENUITEM clmi6 = { 0 };
- clmi6.cbSize = sizeof( clmi6 );
- CLISTMENUITEM clmi7 = { 0 };
- clmi7.cbSize = sizeof( clmi7 );
- CLISTMENUITEM clmi8 = { 0 };
- clmi8.cbSize = sizeof( clmi8 );
-
- //kopieren von port und ip nur erlauben, wenn verfügbar
- clmi.flags = CMIM_FLAGS;
- clmi2.flags = CMIM_FLAGS;
- clmi3.flags = CMIM_FLAGS;
- clmi4.flags = CMIM_FLAGS;
- clmi5.flags = CMIM_FLAGS;
- clmi6.flags = CMIM_FLAGS;
- clmi7.flags = CMIM_FLAGS;
- clmi8.flags = CMIM_FLAGS;
+ HANDLE hContact = (HANDLE)wParam;
+ bool bEnabled = true, bEnabled2 = true;
DBVARIANT dbv;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "ServerIP",&dbv))
- clmi.flags|= CMIF_HIDDEN;
+ if (db_get_s(hContact, protocolname, "ServerIP", &dbv))
+ bEnabled = false;
else
- DBFreeVariant(&dbv);
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )copyipport, ( LPARAM )&clmi );
+ db_free(&dbv);
+ Menu_ShowItem(copyipport, bEnabled);
//kopieren von voice port und ip nur erlauben, wenn verfügbar
- DBVARIANT dbv2;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, "VServerIP",&dbv2))
- {
- clmi2.flags|= CMIF_HIDDEN;
- }
+ bEnabled = true;
+ if(db_get_s(hContact, protocolname, "VServerIP", &dbv))
+ bEnabled = false;
else
- DBFreeVariant(&dbv2);
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )vipport, ( LPARAM )&clmi2 );
+ db_free(&dbv);
+ Menu_ShowItem(vipport, bEnabled);
//clansite nur bei clanmembern anbieten
- if(DBGetContactSettingDword((HANDLE)wParam, protocolname, "Clan",0)==0)
- clmi3.flags|= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )gotoclansite, ( LPARAM )&clmi3 );
+ Menu_ShowItem(gotoclansite, db_get_dw(hContact, protocolname, "Clan",0) != 0);
//NotOnList
- if(DBGetContactSettingDword((HANDLE)wParam, "CList", "NotOnList",0)==0)
- clmi5.flags|= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )blockfriend, ( LPARAM )&clmi5 );
+ Menu_ShowItem(blockfriend, db_get_dw(hContact, "CList", "NotOnList",0) != 0);
//speichere gameid ab
- int gameid=DBGetContactSettingWord((HANDLE)wParam, protocolname, "GameId",0);
+ int gameid = db_get_w(hContact, protocolname, "GameId",0);
//spiel in xfirespieliste?
- if(!xgamelist.Gameinlist(gameid))
- {
+ bEnabled = bEnabled2 = true;
+ if(!xgamelist.Gameinlist(gameid)) {
//nein, dann start und join auf unsichbar schalten
- clmi7.flags|= CMIF_HIDDEN;
- clmi4.flags|= CMIF_HIDDEN;
+ bEnabled = bEnabled2 = false;
}
- else
- {
+ else {
//gameobject holen
Xfire_game* game=xgamelist.getGamebyGameid(gameid);
//hat das spiel netzwerkparameter?
- if(game)
- {
- if(game->networkparams)
- {
+ if(game) {
+ if(game->networkparams) {
//is beim buddy ein port hinterlegt, also spielt er im internet?
- if(!DBGetContactSettingDword((HANDLE)wParam, protocolname, "Port",0))
- {
+ if( !db_get_dw(hContact, protocolname, "Port",0)) {
//nein, dann join button auch ausblenden
- clmi4.flags|= CMIF_HIDDEN;
+ bEnabled = false;
}
}
- else
- clmi4.flags|= CMIF_HIDDEN;
+ else bEnabled = false;
}
- else
- clmi4.flags|= CMIF_HIDDEN;
+ else bEnabled = false;
}
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )joingame, ( LPARAM )&clmi4 );
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )startthisgame, ( LPARAM )&clmi7 );
-
+ Menu_ShowItem(joingame, bEnabled);
+ Menu_ShowItem(startthisgame, bEnabled2);
//remove freind nur bei noramlen buddies
- if(DBGetContactSettingByte((HANDLE)wParam, protocolname, "friendoffriend",0)==1)
- clmi8.flags|= CMIF_HIDDEN;
-
- CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )removefriend, ( LPARAM )&clmi8 );
-
+ Menu_ShowItem(removefriend, db_get_b(hContact, protocolname, "friendoffriend",0) != 1);
return 0;
}
@@ -2387,14 +2333,14 @@ void gamedetectiont(LPVOID lparam)
time_t t1;
- if(DBGetContactSettingByte(NULL,protocolname,"nogamedetect",0))
+ if(db_get_b(NULL,protocolname,"nogamedetect",0))
#ifndef NO_PTHREAD
return ptr;
#else
return;
#endif
- DWORD lowpids=DBGetContactSettingByte(NULL,protocolname,"skiplowpid",100);
+ DWORD lowpids=db_get_b(NULL,protocolname,"skiplowpid",100);
//XFireLog("XFire Gamedetectionthread started ...","");
@@ -2431,7 +2377,7 @@ void gamedetectiont(LPVOID lparam)
{
//erstmal nach TS2 suchen
//XFireLog("Teamspeak detection ...","");
- if(DBGetContactSettingByte(NULL,protocolname,"ts2detection",0))
+ if(db_get_b(NULL,protocolname,"ts2detection",0))
{
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
if(voicechat.checkVoicechat(packet)) {
@@ -2448,24 +2394,24 @@ void gamedetectiont(LPVOID lparam)
//if (hMapObject) {
//}
//wenn remote feature aktiviert, darüber ip erkennen
- /*if(DBGetContactSettingByte(NULL,protocolname,"ts2useremote",0))
+ /*if(db_get_b(NULL,protocolname,"ts2useremote",0))
{
//ipholen
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
if(TSSetupPacket(packet,&ts2pid,&ts2port))
{
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",packet->gameid);
+ db_set_w(NULL,protocolname,"currentvoice",packet->gameid);
if(packet->ip[3]!=0)
{
sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "VServerIP", temp);
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Teamspeak");
+ db_set_s(NULL, protocolname, "VServerIP", temp);
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
}
else
{
- DBDeleteContactSetting(NULL,protocolname, "VServerIP");
- DBDeleteContactSetting(NULL,protocolname, "currentvoicename");
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "currentvoicename");
}
if(myClient!=NULL)
@@ -2490,16 +2436,16 @@ void gamedetectiont(LPVOID lparam)
packet->gameid=vid;
if(vid==32)
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Teamspeak");
+ db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
else if(vid==33)
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Ventrilo");
+ db_set_s(NULL, protocolname, "currentvoicename", "Ventrilo");
else if(vid==34)
- DBWriteContactSettingString(NULL, protocolname, "currentvoicename", "Mumble");
+ db_set_s(NULL, protocolname, "currentvoicename", "Mumble");
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",vid);
+ db_set_w(NULL,protocolname,"currentvoice",vid);
sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "VServerIP", temp);
+ db_set_s(NULL, protocolname, "VServerIP", temp);
if(myClient!=NULL)
myClient->client->send( packet );
@@ -2518,9 +2464,9 @@ void gamedetectiont(LPVOID lparam)
{
SendGameStatus2Packet *packet = new SendGameStatus2Packet();
packet->gameid=0;
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",0);
- DBDeleteContactSetting(NULL,protocolname, "VServerIP");
- DBDeleteContactSetting(NULL,protocolname, "currentvoicename");
+ db_set_w(NULL,protocolname,"currentvoice",0);
+ db_unset(NULL,protocolname, "VServerIP");
+ db_unset(NULL,protocolname, "currentvoicename");
if(myClient!=NULL)
myClient->client->send( packet );
@@ -2536,10 +2482,10 @@ void gamedetectiont(LPVOID lparam)
if(packet->port!=0)
{
packet->gameid=vid;
- DBWriteContactSettingWord(NULL,protocolname,"currentvoice",vid);
+ db_set_w(NULL,protocolname,"currentvoice",vid);
sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "VServerIP", temp);
+ db_set_s(NULL, protocolname, "VServerIP", temp);
if(myClient!=NULL)
myClient->client->send( packet );
@@ -2573,7 +2519,7 @@ void gamedetectiont(LPVOID lparam)
//XFireLog("XFire Gamedetection - Game was closed ID: %i",currentgame);
SendGameStatusPacket *packet = new SendGameStatusPacket();
packet->gameid=0;
- if(DBGetContactSettingByte(NULL,protocolname,"sendgamestatus",1))
+ if(db_get_b(NULL,protocolname,"sendgamestatus",1))
if(myClient!=NULL)
myClient->client->send( packet );
@@ -2594,17 +2540,17 @@ void gamedetectiont(LPVOID lparam)
}
sprintf(temp,Translate("Last game: %s playtime: %.2d:%.2d:%.2d"),currentgame->name,mytm->tm_hour,mytm->tm_min,mytm->tm_sec);
- DBWriteContactSettingString(NULL, protocolname, "LastGame", temp);
+ db_set_s(NULL, protocolname, "LastGame", temp);
- if(currentgame->noicqstatus!=TRUE&&DBGetContactSettingByte(NULL,protocolname,"autosetstatusmsg",0))
+ if(currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
SetOldStatusMsg();
- DBWriteContactSettingWord(NULL,protocolname,"currentgame",0);
- DBDeleteContactSetting(NULL,protocolname,"currentgamename");
+ db_set_w(NULL,protocolname,"currentgame",0);
+ db_unset(NULL,protocolname,"currentgamename");
//popup wieder aktivieren, menuservice funk aufrufen, nur wenn popups vorher abgestellt wurden
if(disabledpopups)
- if(DBGetContactSettingByte(NULL,protocolname,"nopopups",0))
+ if(db_get_b(NULL,protocolname,"nopopups",0))
{
if(ServiceExists("PopUp/EnableDisableMenuCommand"))
{
@@ -2618,14 +2564,14 @@ void gamedetectiont(LPVOID lparam)
}
//sound wieder aktivieren, nur wenn es vorher abgestellt wurde
if(disabledsound)
- if(DBGetContactSettingByte(NULL,protocolname,"nosoundev",0))
+ if(db_get_b(NULL,protocolname,"nosoundev",0))
{
- DBWriteContactSettingByte(NULL,"Skin","UseSound",1);
+ db_set_b(NULL,"Skin","UseSound",1);
disabledsound=FALSE;
}
//bug beseitigt, wenn spiel beendet, alte ip entfernen
- DBDeleteContactSetting(NULL,protocolname, "ServerIP");
+ db_unset(NULL,protocolname, "ServerIP");
pid=NULL;
currentgame=NULL;
@@ -2639,7 +2585,7 @@ void gamedetectiont(LPVOID lparam)
{
//XFireLog("Spiel noch offen ...","");
//nur nwspiele nach ip/port scannen
- if(DBGetContactSettingByte(NULL,protocolname,"ipportdetec",0))
+ if(db_get_b(NULL,protocolname,"ipportdetec",0))
if(currentgame->networkparams!=NULL&&currentgame->send_gameid>0)
{
SendGameStatusPacket *packet = new SendGameStatusPacket();
@@ -2652,20 +2598,20 @@ void gamedetectiont(LPVOID lparam)
if(packet->ip[3]!=0)
{
sprintf(temp,"%d.%d.%d.%d:%d",(unsigned char)packet->ip[3],(unsigned char)packet->ip[2],(unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
- DBWriteContactSettingString(NULL, protocolname, "ServerIP", temp);
+ db_set_s(NULL, protocolname, "ServerIP", temp);
XFireLog("Got IPPort: %s",temp);
}
else {
- DBDeleteContactSetting(NULL,protocolname, "ServerIP");
+ db_unset(NULL,protocolname, "ServerIP");
XFireLog("NO IPPort","");
}
packet->gameid=currentgame->send_gameid;
- if(DBGetContactSettingByte(NULL,protocolname,"sendgamestatus",1))
+ if(db_get_b(NULL,protocolname,"sendgamestatus",1))
if(myClient!=NULL)
myClient->client->send( packet );
- if(currentgame->noicqstatus!=TRUE&&DBGetContactSettingByte(NULL,protocolname,"autosetstatusmsg",0))
+ if(currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
SetGameStatusMsg();
} else {
XFireLog("GetServerIPPort failed","");
@@ -2712,12 +2658,12 @@ void gamedetectiont(LPVOID lparam)
{
currentgame=nextgame;
pid=processInfo->th32ProcessID;
- DBWriteContactSettingWord(NULL,protocolname,"currentgame",currentgame->id);
- DBWriteContactSettingString(NULL,protocolname,"currentgamename",currentgame->name);
+ db_set_w(NULL,protocolname,"currentgame",currentgame->id);
+ db_set_s(NULL,protocolname,"currentgamename",currentgame->name);
packet->gameid=currentgame->send_gameid;
t1=time(NULL);
- if(DBGetContactSettingByte(NULL,protocolname,"sendgamestatus",1))
+ if(db_get_b(NULL,protocolname,"sendgamestatus",1))
{
XFireLog("XFire Gamedetection - Sendgame-ID: %i",currentgame->send_gameid);
if(currentgame->send_gameid>0)
@@ -2738,29 +2684,29 @@ void gamedetectiont(LPVOID lparam)
SetXFireGameStatusMsg(currentgame);
}
- if(currentgame->noicqstatus!=TRUE&&DBGetContactSettingByte(NULL,protocolname,"autosetstatusmsg",0))
+ if(currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
{
BackupStatusMsg();
SetGameStatusMsg();
}
//popup abschalten, menuservice funk aufrufen
- if(DBGetContactSettingByte(NULL,protocolname,"nopopups",0))
+ if(db_get_b(NULL,protocolname,"nopopups",0))
{
- if(ServiceExists("PopUp/EnableDisableMenuCommand")&&DBGetContactSettingByte(NULL,"PopUp","ModuleIsEnabled",0)==1) /**/
+ if(ServiceExists("PopUp/EnableDisableMenuCommand")&&db_get_b(NULL,"PopUp","ModuleIsEnabled",0)==1) /**/
{
disabledpopups=TRUE;
CallService("PopUp/EnableDisableMenuCommand",NULL,NULL);
}
- else if(ServiceExists("PopUp/ToggleEnabled")&&DBGetContactSettingByte(NULL,"YAPP","Enabled",0)==1)
+ else if(ServiceExists("PopUp/ToggleEnabled")&&db_get_b(NULL,"YAPP","Enabled",0)==1)
{
disabledpopups=TRUE;
CallService("PopUp/ToggleEnabled",NULL,NULL);
}
}
//sound abschalten
- if(DBGetContactSettingByte(NULL,protocolname,"nosoundev",0)&&DBGetContactSettingByte(NULL,"Skin","UseSound",0)==1)
+ if(db_get_b(NULL,protocolname,"nosoundev",0)&&db_get_b(NULL,"Skin","UseSound",0)==1)
{
- DBWriteContactSettingByte(NULL,"Skin","UseSound",0);
+ db_set_b(NULL,"Skin","UseSound",0);
disabledsound=TRUE;
}
}
@@ -2782,7 +2728,7 @@ void gamedetectiont(LPVOID lparam)
static INT_PTR ReScanMyGames(WPARAM wParam,LPARAM lParam)
{
- DBDeleteContactSetting(NULL, protocolname, "foundgames");
+ db_unset(NULL, protocolname, "foundgames");
mir_forkthread(Scan4Games,NULL);
@@ -2807,33 +2753,33 @@ void setBuddyStatusMsg(BuddyListEntry *entry)
{
ostringstream xstatus;
DBVARIANT dbv;
- if (!DBGetContactSettingString(entry->hcontact, protocolname, "RGame", &dbv))
+ if (!db_get_s(entry->hcontact, protocolname, "RGame", &dbv))
{
xstatus << dbv.pszVal << " ";
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!DBGetContactSettingByte(NULL, protocolname, "noipportinstatus", 0))
+ if (!db_get_b(NULL, protocolname, "noipportinstatus", 0))
{
- if (!DBGetContactSettingString(entry->hcontact, protocolname, "ServerName", &dbv))
+ if (!db_get_s(entry->hcontact, protocolname, "ServerName", &dbv))
{
xstatus << dbv.pszVal;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- else if (!DBGetContactSettingString(entry->hcontact,protocolname, "ServerIP",&dbv))
+ else if (!db_get_s(entry->hcontact,protocolname, "ServerIP",&dbv))
{
- xstatus << "(" << dbv.pszVal << ":" << DBGetContactSettingWord(entry->hcontact, protocolname, "Port", 0) << ")";
- DBFreeVariant(&dbv);
+ xstatus << "(" << dbv.pszVal << ":" << db_get_w(entry->hcontact, protocolname, "Port", 0) << ")";
+ db_free(&dbv);
}
}
DBWriteContactSettingUTF8String(entry->hcontact, protocolname, "XStatusMsg", xstatus.str().c_str());
}
else
{
- //DBWriteContactSettingByte(entry->hcontact, protocolname, "XStatusId", 1);
- DBDeleteContactSetting(entry->hcontact, protocolname, "XStatusId");
- DBDeleteContactSetting(entry->hcontact, protocolname, "XStatusName");
- DBDeleteContactSetting(entry->hcontact, protocolname, "XStatusMsg");
+ //db_set_b(entry->hcontact, protocolname, "XStatusId", 1);
+ db_unset(entry->hcontact, protocolname, "XStatusId");
+ db_unset(entry->hcontact, protocolname, "XStatusName");
+ db_unset(entry->hcontact, protocolname, "XStatusMsg");
}
/*//statusmsg umwandeln
@@ -2844,12 +2790,12 @@ void setBuddyStatusMsg(BuddyListEntry *entry)
string afk = entry->statusmsg.substr(0, 5);
int status_id = (afk == "(AFK)" || afk == "(ABS)") ? ID_STATUS_AWAY : ID_STATUS_ONLINE;
- DBWriteContactSettingWord(entry->hcontact, protocolname, "Status", status_id);
+ db_set_w(entry->hcontact, protocolname, "Status", status_id);
if (!entry->statusmsg.empty())
DBWriteContactSettingUTF8String(entry->hcontact, "CList", "StatusMsg", entry->statusmsg.c_str());
else
- DBDeleteContactSetting(entry->hcontact, "CList", "StatusMsg");
+ db_unset(entry->hcontact, "CList", "StatusMsg");
}
/*void CheckAvatar(void *ventry)
@@ -2858,13 +2804,13 @@ void setBuddyStatusMsg(BuddyListEntry *entry)
DBVARIANT dbv;
if(entry==NULL)
return;
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)==0)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)==0)
{
- if(DBGetContactSettingByte(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
+ if(db_get_b(entry->hcontact, "ContactPhoto", "Locked", -1)!=1)
{
- if(!DBGetContactSettingByte(NULL,protocolname,"specialavatarload",0))
+ if(!db_get_b(NULL,protocolname,"specialavatarload",0))
{
- if(DBGetContactSetting(entry->hcontact,"ContactPhoto", "File",&dbv))
+ if(db_get(entry->hcontact,"ContactPhoto", "File",&dbv))
{
XFire_SetAvatar* xsa=new XFire_SetAvatar;
xsa->hContact=entry->hcontact;
@@ -2907,8 +2853,8 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
entry->hcontact=CList_FindContact(entry->userid);
if(entry->hcontact&&clan==-1)
{
- DBWriteContactSettingWord(entry->hcontact, protocolname, "Status", ID_STATUS_ONLINE);
- DBWriteContactSettingString(entry->hcontact, protocolname, "MirVer", "xfire");
+ db_set_w(entry->hcontact, protocolname, "Status", ID_STATUS_ONLINE);
+ db_set_s(entry->hcontact, protocolname, "MirVer", "xfire");
}
}
@@ -2927,7 +2873,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
if (hContact!=0)
{
- if (!entry->nick.empty() && DBGetContactSettingByte(NULL, protocolname, "shownicks", 1)) {
+ if (!entry->nick.empty() && db_get_b(NULL, protocolname, "shownicks", 1)) {
char*nick=NULL;
if (myClient->useutf8)
@@ -2940,33 +2886,33 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
if(myClient->useutf8)
DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", nick);
else
- DBWriteContactSettingString(hContact, protocolname, "Nick", nick);
+ db_set_s(hContact, protocolname, "Nick", nick);
}
else
- DBWriteContactSettingString(hContact, protocolname, "Nick", entry->username.c_str());
+ db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
- //DBWriteContactSettingStringUtf(hContact, protocolname, "Nick", entry->nick.c_str());
+ //db_set_utf(hContact, protocolname, "Nick", entry->nick.c_str());
//DBWriteContactSettingUTF8String(hContact, protocolname, "Nick", ( char* )entry->nick.c_str());
} else
- DBWriteContactSettingString(hContact, protocolname, "Nick", entry->username.c_str());
+ db_set_s(hContact, protocolname, "Nick", entry->username.c_str());
if(!entry->isOnline())
{
- DBWriteContactSettingWord(hContact, protocolname, "Status", ID_STATUS_OFFLINE);
- DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- DBDeleteContactSetting(hContact, protocolname, "XStatusName");
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
+ db_set_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE);
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
+ db_unset(hContact, "CList", "StatusMsg");
//DBWriteContactSettingUTF8String(hContact, protocolname, "XStatusName", "");
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
- DBDeleteContactSetting(hContact, protocolname, "RVoice");
- DBDeleteContactSetting(hContact, protocolname, "RGame");
- DBDeleteContactSetting(hContact, protocolname, "GameId");
- DBDeleteContactSetting(hContact, protocolname, "VoiceId");
- DBDeleteContactSetting(hContact, protocolname, "GameInfo");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "RVoice");
+ db_unset(hContact, protocolname, "RGame");
+ db_unset(hContact, protocolname, "GameId");
+ db_unset(hContact, protocolname, "VoiceId");
+ db_unset(hContact, protocolname, "GameInfo");
}
else if(entry->game>0||entry->game2>0)
{
@@ -2976,7 +2922,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
DummyXFireGame *gameob;
if(strlen(entry->gameinfo.c_str())>0)
- DBWriteContactSettingString(hContact, protocolname, "GameInfo", entry->gameinfo.c_str());
+ db_set_s(hContact, protocolname, "GameInfo", entry->gameinfo.c_str());
//beim voicechat foglendes machn
if(entry->game2>0)
@@ -2985,33 +2931,33 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
xgamelist.getGamename(entry->game2,gname,255);
- DBWriteContactSettingString(hContact, protocolname, "RVoice", gname);
+ db_set_s(hContact, protocolname, "RVoice", gname);
if(gameob)
{
if((unsigned char)gameob->ip[3]!=0) // wenn ip, dann speichern
{
sprintf(temp,"%d.%d.%d.%d",(unsigned char)gameob->ip[3],(unsigned char)gameob->ip[2],(unsigned char)gameob->ip[1],(unsigned char)gameob->ip[0]);
- DBWriteContactSettingString(hContact, protocolname, "VServerIP", temp);
- DBWriteContactSettingWord(hContact, protocolname, "VPort", (unsigned long)gameob->port);
+ db_set_s(hContact, protocolname, "VServerIP", temp);
+ db_set_w(hContact, protocolname, "VPort", (unsigned long)gameob->port);
}
else
{
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
}
}
- DBWriteContactSettingWord(hContact, protocolname, "VoiceId", entry->game2);
+ db_set_w(hContact, protocolname, "VoiceId", entry->game2);
SetIcon(hContact,xgamelist.iconmngr.getGameIconHandle(entry->game2),2); //icon seperat setzen
}
else
{
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
- DBDeleteContactSetting(hContact, protocolname, "RVoice");
- DBDeleteContactSetting(hContact, protocolname, "VoiceId");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "RVoice");
+ db_unset(hContact, protocolname, "VoiceId");
SetIcon(hContact,(HANDLE)-1,2);
}
@@ -3022,13 +2968,13 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
xgamelist.getGamename(entry->game,gname,255);
- DBWriteContactSettingString(hContact, protocolname, "RGame", gname);
+ db_set_s(hContact, protocolname, "RGame", gname);
//beinhaltet ip und port
gameob=(DummyXFireGame*)entry->gameObj;
//popup, wenn jemand was spielt
- if(DBGetContactSettingByte(NULL,protocolname,"gamepopup",0)==1) {
+ if(db_get_b(NULL,protocolname,"gamepopup",0)==1) {
char temp[256]="";
sprintf(temp,Translate("%s is playing %s."),
@@ -3095,12 +3041,12 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
{
//ip und port in kontakt speichern
sprintf(temp,"%d.%d.%d.%d",(unsigned char)gameob->ip[3],(unsigned char)gameob->ip[2],(unsigned char)gameob->ip[1],(unsigned char)gameob->ip[0]);
- DBWriteContactSettingString(hContact, protocolname, "ServerIP", temp);
- DBWriteContactSettingWord(hContact, protocolname, "Port", (unsigned long)gameob->port);
+ db_set_s(hContact, protocolname, "ServerIP", temp);
+ db_set_w(hContact, protocolname, "Port", (unsigned long)gameob->port);
//lass das query arbeiten
if(dontscan==FALSE)
- if(ServiceExists("GameServerQuery/Query")&&DBGetContactSettingByte(NULL,protocolname,"gsqsupport",0))
+ if(ServiceExists("GameServerQuery/Query")&&db_get_b(NULL,protocolname,"gsqsupport",0))
{
GameServerQuery_query gsqq={0};
gsqq.port=gameob->port;
@@ -3111,36 +3057,36 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
}
else
{
- DBDeleteContactSetting(hContact, protocolname, "ServerName");
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "ServerName");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
}
}
SetIcon(hContact,xgamelist.iconmngr.getGameIconHandle(entry->game));
- //DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- DBWriteContactSettingWord(hContact, protocolname, "Status", ID_STATUS_ONLINE);
+ //db_unset(hContact, "CList", "StatusMsg");
+ db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
DBWriteContactSettingUTF8String(hContact, protocolname, "XStatusName", Translate("Playing"));
setBuddyStatusMsg(entry);
- DBWriteContactSettingByte(hContact, protocolname, "XStatusId", xgamelist.iconmngr.getGameIconId(entry->game)+2);
+ db_set_b(hContact, protocolname, "XStatusId", xgamelist.iconmngr.getGameIconId(entry->game)+2);
//buddy vorher ein spielgestartet, wenn nicht sound spielen?
- if(!DBGetContactSettingWord(hContact, protocolname, "GameId",0))
+ if(!db_get_w(hContact, protocolname, "GameId",0))
SkinPlaySound("xfirebstartgame");
- DBWriteContactSettingWord(hContact, protocolname, "GameId", entry->game);
+ db_set_w(hContact, protocolname, "GameId", entry->game);
}
else
{
SetIcon(hContact,(HANDLE)-1);
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- DBDeleteContactSetting(hContact, protocolname, "XStatusName");
- DBDeleteContactSetting(hContact, protocolname, "RGame");
- DBDeleteContactSetting(hContact, protocolname, "GameId");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
+ db_unset(hContact, protocolname, "RGame");
+ db_unset(hContact, protocolname, "GameId");
setBuddyStatusMsg(entry);
}
}
@@ -3150,20 +3096,20 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
SetIcon(hContact,(HANDLE)-1);
SetIcon(hContact,(HANDLE)-1,2);
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
- DBDeleteContactSetting(hContact, protocolname, "RVoice");
- DBDeleteContactSetting(hContact, protocolname, "RGame");
- DBDeleteContactSetting(hContact, protocolname, "GameId");
- DBDeleteContactSetting(hContact, protocolname, "VoiceId");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "RVoice");
+ db_unset(hContact, protocolname, "RGame");
+ db_unset(hContact, protocolname, "GameId");
+ db_unset(hContact, protocolname, "VoiceId");
}
else
{
- if(DBGetContactSettingWord(entry->hcontact, protocolname, "Status", -1)==ID_STATUS_OFFLINE)
+ if(db_get_w(entry->hcontact, protocolname, "Status", -1)==ID_STATUS_OFFLINE)
{
- if(DBGetContactSettingByte(NULL, protocolname, "noclanavatars", 0)==1&&clan>0)
+ if(db_get_b(NULL, protocolname, "noclanavatars", 0)==1&&clan>0)
;
else
if(myClient) myClient->CheckAvatar(entry);
@@ -3171,75 +3117,75 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
SetIcon(hContact,(HANDLE)-1);
SetIcon(hContact,(HANDLE)-1,2);
- DBWriteContactSettingWord(hContact, protocolname, "Status", ID_STATUS_ONLINE);
- DBWriteContactSettingString(entry->hcontact, protocolname, "MirVer", "xfire");
- if(clan>0) DBWriteContactSettingDword(hContact, protocolname, "Clan", clan);
+ db_set_w(hContact, protocolname, "Status", ID_STATUS_ONLINE);
+ db_set_s(entry->hcontact, protocolname, "MirVer", "xfire");
+ if(clan>0) db_set_dw(hContact, protocolname, "Clan", clan);
//DBWriteContactSettingUTF8String(hContact, "CList", "StatusMsg", "");
- DBDeleteContactSetting(hContact, protocolname, "XStatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "XStatusId");
- DBDeleteContactSetting(hContact, protocolname, "XStatusName");
- DBDeleteContactSetting(hContact, "CList", "StatusMsg");
- DBDeleteContactSetting(hContact, protocolname, "ServerIP");
- DBDeleteContactSetting(hContact, protocolname, "Port");
- DBDeleteContactSetting(hContact, protocolname, "VServerIP");
- DBDeleteContactSetting(hContact, protocolname, "VPort");
- DBDeleteContactSetting(hContact, protocolname, "RVoice");
- DBDeleteContactSetting(hContact, protocolname, "RGame");
- DBDeleteContactSetting(hContact, protocolname, "GameId");
- DBDeleteContactSetting(hContact, protocolname, "VoiceId");
+ db_unset(hContact, protocolname, "XStatusMsg");
+ db_unset(hContact, protocolname, "XStatusId");
+ db_unset(hContact, protocolname, "XStatusName");
+ db_unset(hContact, "CList", "StatusMsg");
+ db_unset(hContact, protocolname, "ServerIP");
+ db_unset(hContact, protocolname, "Port");
+ db_unset(hContact, protocolname, "VServerIP");
+ db_unset(hContact, protocolname, "VPort");
+ db_unset(hContact, protocolname, "RVoice");
+ db_unset(hContact, protocolname, "RGame");
+ db_unset(hContact, protocolname, "GameId");
+ db_unset(hContact, protocolname, "VoiceId");
}
}
if(group!=NULL)
{
- if(!DBGetContactSettingByte(NULL,protocolname,"noclangroups",0))
+ if(!db_get_b(NULL,protocolname,"noclangroups",0))
{
if(clan>0)
{
- int val=DBGetContactSettingByte(NULL,protocolname,"mainclangroup",0);
+ int val=db_get_b(NULL,protocolname,"mainclangroup",0);
- if( DBGetContactSettingByte(NULL,protocolname,"skipfriendsgroups",0)==0 ||
- (DBGetContactSettingByte(NULL,protocolname,"skipfriendsgroups",0)==1&&
- DBGetContactSettingByte(entry->hcontact, protocolname, "isfriend", 0)==0)
+ if( db_get_b(NULL,protocolname,"skipfriendsgroups",0)==0 ||
+ (db_get_b(NULL,protocolname,"skipfriendsgroups",0)==1&&
+ db_get_b(entry->hcontact, protocolname, "isfriend", 0)==0)
)
{
if(val==0)
{
- DBWriteContactSettingString(entry->hcontact, "CList", "Group", group);
+ db_set_s(entry->hcontact, "CList", "Group", group);
}
else
{
char temp[256];
DBVARIANT dbv;
sprintf_s(temp,256,"%d",val-1);
- DBGetContactSettingString(NULL,"CListGroups",temp,&dbv);
+ db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
sprintf_s(temp,256,"%s\\%s",&dbv.pszVal[1],group);
- DBWriteContactSettingString(entry->hcontact, "CList", "Group", temp);
- DBFreeVariant(&dbv);
+ db_set_s(entry->hcontact, "CList", "Group", temp);
+ db_free(&dbv);
}
}
}
}
else if(clan==-1)//hauptgruppe für fof
{
- int val=DBGetContactSettingByte(NULL,protocolname,"fofgroup",0);
+ int val=db_get_b(NULL,protocolname,"fofgroup",0);
if(val==0)
{
- DBWriteContactSettingString(entry->hcontact, "CList", "Group", group);
+ db_set_s(entry->hcontact, "CList", "Group", group);
}
else
{
char temp[256];
DBVARIANT dbv;
sprintf_s(temp,256,"%d",val-1);
- DBGetContactSettingString(NULL,"CListGroups",temp,&dbv);
+ db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
sprintf_s(temp,256,"%s\\%s",&dbv.pszVal[1],group);
- DBWriteContactSettingString(entry->hcontact, "CList", "Group", temp);
- DBFreeVariant(&dbv);
+ db_set_s(entry->hcontact, "CList", "Group", temp);
+ db_free(&dbv);
}
}
}
@@ -3247,7 +3193,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan)
}
else
{
- DBWriteContactSettingByte(entry->hcontact, protocolname, "isfriend", 1);
+ db_set_b(entry->hcontact, protocolname, "isfriend", 1);
}
return hContact;
@@ -3259,7 +3205,7 @@ INT_PTR AddtoList( WPARAM wParam, LPARAM lParam ) {
if (ccs->hContact)
{
DBVARIANT dbv2;
- if(!DBGetContactSetting(ccs->hContact,protocolname,"Username",&dbv2)) {
+ if(!db_get(ccs->hContact,protocolname,"Username",&dbv2)) {
if(myClient!=NULL)
if(myClient->client->connected)
@@ -3270,7 +3216,7 @@ INT_PTR AddtoList( WPARAM wParam, LPARAM lParam ) {
}
//temporären buddy entfernen, da eh ein neues packet kommt
- DBWriteContactSettingByte(ccs->hContact, protocolname, "DontSendDenyPacket", 1);
+ db_set_b(ccs->hContact, protocolname, "DontSendDenyPacket", 1);
CallService(MS_DB_CONTACT_DELETE, (WPARAM) ccs->hContact, 0);
}
}
@@ -3333,7 +3279,7 @@ void CreateGroup(char*grpn,char*field) {
DBVARIANT dbv;
char* grp[255];
- int val=DBGetContactSettingByte(NULL,protocolname,field,0);
+ int val=db_get_b(NULL,protocolname,field,0);
if(val==0)
{
@@ -3344,16 +3290,16 @@ void CreateGroup(char*grpn,char*field) {
char temp[255];
DBVARIANT dbv;
sprintf_s(temp,255,"%d",val-1);
- DBGetContactSettingString(NULL,"CListGroups",temp,&dbv);
+ db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
sprintf_s((char*)grp,255,"%s\\%s",&dbv.pszVal[1],(char*)grpn);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else //gruppe existiert nciht mehr, auf root alles legen
{
strcpy_s((char*)grp,255,grpn);
- DBWriteContactSettingByte(NULL,protocolname,field,0);
+ db_set_b(NULL,protocolname,field,0);
}
}
@@ -3364,22 +3310,22 @@ void CreateGroup(char*grpn,char*field) {
for (i = 0;; i++)
{
sprintf(temp,"%d",i);
- if (DBGetContactSettingString(NULL, "CListGroups", temp, &dbv))
+ if (db_get_s(NULL, "CListGroups", temp, &dbv))
{
i--;
break;
}
if (dbv.pszVal[0] != '\0' && !lstrcmp(dbv.pszVal + 1, (char*)grp)) {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
strcpy_s(group,255,"D");
strcat_s(group,255,(char*)grp);
group[0]= 1 | GROUPF_EXPANDED;
sprintf(temp,"%d",i+1);
- DBWriteContactSettingString(NULL, "CListGroups", temp, group);
+ db_set_s(NULL, "CListGroups", temp, group);
CallServiceSync(MS_CLUI_GROUPADDED, i + 1, 0);
}
@@ -3392,7 +3338,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) {
{
strcpy(statusmessage[0],"");
}
- else if((wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)/*&&DBGetContactSettingByte(NULL,protocolname,"nocustomaway",0)==0*/)
+ else if((wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)/*&&db_get_b(NULL,protocolname,"nocustomaway",0)==0*/)
{
strcpy(statusmessage[1],"(AFK) Away from Keyboard");
}
@@ -3403,7 +3349,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) {
{
strcpy(statusmessage[0],( char* )lParam);
}
- else if((wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)&&DBGetContactSettingByte(NULL,protocolname,"nocustomaway",0)==0&&strlen(( char* )lParam)>0)
+ else if((wParam!=ID_STATUS_ONLINE&&wParam!=ID_STATUS_OFFLINE)&&db_get_b(NULL,protocolname,"nocustomaway",0)==0&&strlen(( char* )lParam)>0)
{
sprintf(statusmessage[1], "(AFK) %s", (char*)lParam);
//strcpy(statusmessage[1],( char* )lParam);
@@ -3451,7 +3397,7 @@ INT_PTR SetNickName(WPARAM newnick, LPARAM lparam)
if(myClient->client->connected)
{
myClient->setNick((char*)newnick);
- DBWriteContactSettingString(NULL,protocolname,"Nick",(char*)newnick);
+ db_set_s(NULL,protocolname,"Nick",(char*)newnick);
return TRUE;
}
return FALSE;
@@ -3483,25 +3429,27 @@ INT_PTR GetAwayMsg(WPARAM /*wParam*/, LPARAM lParam)
return 1;
}
-int ContactDeleted(WPARAM wParam,LPARAM lParam) {
- if(!DBGetContactSettingByte((HANDLE)wParam, protocolname, "DontSendDenyPacket", 0))
- if(DBGetContactSettingByte((HANDLE)wParam,"CList","NotOnList",0))
+int ContactDeleted(WPARAM wParam,LPARAM lParam)
+{
+ if(!db_get_b((HANDLE)wParam, protocolname, "DontSendDenyPacket", 0))
+ if(db_get_b((HANDLE)wParam,"CList","NotOnList",0))
+ {
+ if(myClient!=NULL)
+ if(myClient->client->connected)
{
- if(myClient!=NULL)
- if(myClient->client->connected)
- {
- DBVARIANT dbv2;
- if(!DBGetContactSetting((HANDLE)wParam,protocolname,"Username",&dbv2)) {
- SendDenyInvitationPacket deny;
- deny.name = dbv2.pszVal;
- myClient->client->send( &deny );
- }
- }
- }
- return 0;
+ DBVARIANT dbv2;
+ if(!db_get((HANDLE)wParam,protocolname,"Username",&dbv2)) {
+ SendDenyInvitationPacket deny;
+ deny.name = dbv2.pszVal;
+ myClient->client->send( &deny );
+ }
+ }
+ }
+ return 0;
}
-INT_PTR StartGame(WPARAM wParam,LPARAM lParam,LPARAM fParam) {
+INT_PTR StartGame(WPARAM wParam,LPARAM lParam,LPARAM fParam)
+{
//gamelist blocken
xgamelist.Block(TRUE);
@@ -3522,7 +3470,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) {
char temp[256];
DBVARIANT dbv;
- if(!DBGetContactSettingString((HANDLE)wParam, protocolname, "Username",&dbv))
+ if(!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
{
sprintf(temp,Translate("Do you really want delete your friend %s?"),dbv.pszVal);
if(MessageBoxA(NULL,temp,Translate("Confirm Delete"),MB_YESNO|MB_ICONQUESTION)==IDYES)
@@ -3533,7 +3481,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) {
{
SendRemoveBuddyPacket removeBuddy;
- removeBuddy.userid=DBGetContactSettingDword((HANDLE)wParam,protocolname,"UserId",0);
+ removeBuddy.userid=db_get_dw((HANDLE)wParam,protocolname,"UserId",0);
if(removeBuddy.userid!=0)
{
@@ -3542,7 +3490,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) {
}
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -3550,7 +3498,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) {
INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam) {
DBVARIANT dbv;
- if(!DBGetContactSettingString((HANDLE)wParam, protocolname, "Username",&dbv))
+ if(!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
{
if(MessageBoxA(NULL,Translate("Block this user from ever contacting you again?"),Translate("Block Confirmation"),MB_YESNO|MB_ICONQUESTION)==IDYES)
{
@@ -3558,7 +3506,7 @@ INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam) {
{
if(myClient->client->connected)
{
- DBWriteContactSettingByte(NULL,"XFireBlock",dbv.pszVal,1);
+ db_set_b(NULL,"XFireBlock",dbv.pszVal,1);
SendDenyInvitationPacket deny;
deny.name = dbv.pszVal;
@@ -3567,7 +3515,7 @@ INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam) {
}
}
CallService( MS_DB_CONTACT_DELETE, (WPARAM) wParam, 1 );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -3577,7 +3525,7 @@ INT_PTR StartThisGame(WPARAM wParam,LPARAM lParam) {
xgamelist.Block(TRUE);
//hole die gameid des spiels
- int id=DBGetContactSettingWord((HANDLE)wParam, protocolname, "GameId",0);
+ int id=db_get_w((HANDLE)wParam, protocolname, "GameId",0);
//hole passendes spielobjekt
Xfire_game*game=xgamelist.getGamebyGameid(id);
@@ -3597,7 +3545,7 @@ INT_PTR JoinGame(WPARAM wParam,LPARAM lParam) {
xgamelist.Block(TRUE);
//hole die gameid des spiels
- int id=DBGetContactSettingWord((HANDLE)wParam, protocolname, "GameId",0);
+ int id=db_get_w((HANDLE)wParam, protocolname, "GameId",0);
//hole passendes spielobjekt
Xfire_game*game=xgamelist.getGamebyGameid(id);
@@ -3606,12 +3554,12 @@ INT_PTR JoinGame(WPARAM wParam,LPARAM lParam) {
if(game)
{
DBVARIANT dbv; //dbv.pszVal
- int port=DBGetContactSettingWord((HANDLE)wParam, protocolname, "Port",0);
- if(!DBGetContactSettingString((HANDLE)wParam, protocolname, "ServerIP",&dbv))
+ int port=db_get_w((HANDLE)wParam, protocolname, "Port",0);
+ if(!db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
{
//starte spiel mit netzwerk parametern
game->start_game(dbv.pszVal,port);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -3627,12 +3575,12 @@ int doneQuery( WPARAM wParam, LPARAM lParam ) {
char temp[256];
BuddyListEntry* bud=(BuddyListEntry*)wParam;
gServerstats* gameinfo = (gServerstats*)lParam;
- DBWriteContactSettingString(bud->hcontact, protocolname, "ServerName", gameinfo->name);
- DBWriteContactSettingString(bud->hcontact, protocolname, "GameType", gameinfo->gametype);
- DBWriteContactSettingString(bud->hcontact, protocolname, "Map", gameinfo->map);
+ db_set_s(bud->hcontact, protocolname, "ServerName", gameinfo->name);
+ db_set_s(bud->hcontact, protocolname, "GameType", gameinfo->gametype);
+ db_set_s(bud->hcontact, protocolname, "Map", gameinfo->map);
sprintf(temp,"(%d/%d)",gameinfo->players,gameinfo->maxplayers);
- DBWriteContactSettingString(bud->hcontact, protocolname, "Players", temp);
- DBWriteContactSettingByte(bud->hcontact, protocolname, "Passworded", gameinfo->password);
+ db_set_s(bud->hcontact, protocolname, "Players", temp);
+ db_set_b(bud->hcontact, protocolname, "Passworded", gameinfo->password);
if(myClient!=NULL)
handlingBuddys(bud,0,NULL,TRUE);
@@ -3668,18 +3616,18 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) {
INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) {
PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam;
- if(DBGetContactSettingByte(NULL,protocolname,"noavatars",-1)!=0)
+ if(db_get_b(NULL,protocolname,"noavatars",-1)!=0)
return GAIR_NOAVATAR;
- pai->format=DBGetContactSettingWord(pai->hContact,"ContactPhoto","Format",0);
+ pai->format=db_get_w(pai->hContact,"ContactPhoto","Format",0);
if(pai->format==0)
return GAIR_NOAVATAR;
DBVARIANT dbv;
- if(!DBGetContactSetting(pai->hContact,"ContactPhoto","File",&dbv))
+ if(!db_get(pai->hContact,"ContactPhoto","File",&dbv))
{
strcpy(pai->filename,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
return GAIR_NOAVATAR;
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp
index e5e9b1ee2e..f252282e40 100644
--- a/protocols/Xfire/src/options.cpp
+++ b/protocols/Xfire/src/options.cpp
@@ -169,30 +169,30 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
else
dllfound = FALSE;
- if(!DBGetContactSetting(NULL,protocolname,"login",&dbv)) {
+ if(!db_get(NULL,protocolname,"login",&dbv)) {
SetDlgItemText(hwndDlg,IDC_LOGIN,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(NULL,protocolname,"Nick",&dbv)) {
+ if(!db_get(NULL,protocolname,"Nick",&dbv)) {
SetDlgItemText(hwndDlg,IDC_NICK,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(NULL,protocolname,"password",&dbv)) {
+ if(!db_get(NULL,protocolname,"password",&dbv)) {
//bit of a security hole here, since it's easy to extract a password from an edit box
CallService(MS_DB_CRYPT_DECODESTRING,strlen(dbv.pszVal)+1,(LPARAM)dbv.pszVal);
SetDlgItemText(hwndDlg,IDC_PASSWORD,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
char temp[255]="";
- sprintf(temp,"%d",DBGetContactSettingByte(NULL,protocolname,"protover",0x5b));
+ sprintf(temp,"%d",db_get_b(NULL,protocolname,"protover",0x5b));
SetDlgItemText(hwndDlg,IDC_PVER,temp);
EnableWindow(GetDlgItem(hwndDlg,IDC_LASTGAME),FALSE);
- if(!DBGetContactSetting(NULL,protocolname,"LastGame",&dbv)) {
+ if(!db_get(NULL,protocolname,"LastGame",&dbv)) {
SetDlgItemText(hwndDlg,IDC_LASTGAME,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if(bpStatus==ID_STATUS_OFFLINE&&bpStatus!=ID_STATUS_CONNECTING) {
@@ -267,9 +267,9 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
GetDlgItemText(hwndDlg,IDC_LOGIN,login,sizeof(login));
dbv.pszVal=NULL;
- if(DBGetContactSetting(NULL,protocolname,"login",&dbv) || strcmp(login,dbv.pszVal))
+ if(db_get(NULL,protocolname,"login",&dbv) || strcmp(login,dbv.pszVal))
reconnectRequired=1;
- if(dbv.pszVal!=NULL) DBFreeVariant(&dbv);
+ if(dbv.pszVal!=NULL) db_free(&dbv);
//den login lowercasen
int size=strlen(login);
@@ -285,26 +285,26 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SetDlgItemText(hwndDlg,IDC_LOGIN,login);
}
- DBWriteContactSettingString(NULL,protocolname,"login",login);
- DBWriteContactSettingString(NULL,protocolname,"Username",login);
+ db_set_s(NULL,protocolname,"login",login);
+ db_set_s(NULL,protocolname,"Username",login);
//nur wenn der nick erfolgreich übertragen wurde
GetDlgItemText(hwndDlg,IDC_NICK,login,sizeof(login));
dbv.pszVal=NULL;
- if(DBGetContactSetting(NULL,protocolname,"Nick",&dbv) || strcmp(login,dbv.pszVal))
+ if(db_get(NULL,protocolname,"Nick",&dbv) || strcmp(login,dbv.pszVal))
{
if(CallService(XFIRE_SET_NICK,0,(WPARAM)login))
- DBWriteContactSettingString(NULL,protocolname,"Nick",login);
+ db_set_s(NULL,protocolname,"Nick",login);
}
- if(dbv.pszVal!=NULL) DBFreeVariant(&dbv);
+ if(dbv.pszVal!=NULL) db_free(&dbv);
GetDlgItemText(hwndDlg,IDC_PASSWORD,str,sizeof(str));
CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),(LPARAM)str);
dbv.pszVal=NULL;
- if(DBGetContactSetting(NULL,protocolname,"password",&dbv) || strcmp(str,dbv.pszVal))
+ if(db_get(NULL,protocolname,"password",&dbv) || strcmp(str,dbv.pszVal))
reconnectRequired=1;
- if(dbv.pszVal!=NULL) DBFreeVariant(&dbv);
- DBWriteContactSettingString(NULL,protocolname,"password",str);
+ if(dbv.pszVal!=NULL) db_free(&dbv);
+ db_set_s(NULL,protocolname,"password",str);
GetDlgItemText(hwndDlg,IDC_SERVER,str,sizeof(str));
//neue preferencen sichern
@@ -315,7 +315,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
if(!(BYTE)IsDlgButtonChecked(hwndDlg, xfireconfigitems[i].id))
{
- DBWriteContactSettingByte(NULL,protocolname,xfireconfigitems[i].dbentry,0);
+ db_set_b(NULL,protocolname,xfireconfigitems[i].dbentry,0);
xfireconfig[xfireconfigitems[i].xfireconfigid].wasset=1;
xfireconfig[xfireconfigitems[i].xfireconfigid].data[0]=1;
xfireconfig[xfireconfigitems[i].xfireconfigid].data[1]=1;
@@ -325,7 +325,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
else
{
xfireconfig[xfireconfigitems[i].xfireconfigid].wasset=0;
- DBWriteContactSettingByte(NULL,protocolname,xfireconfigitems[i].dbentry,1);
+ db_set_b(NULL,protocolname,xfireconfigitems[i].dbentry,1);
}
}
CallService(XFIRE_SEND_PREFS,0,0);
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
//protocolversion wird autoamtisch vergeben
//GetDlgItemText(hwndDlg,IDC_PVER,str,sizeof(str));
- //DBWriteContactSettingByte(NULL,protocolname,"protover",(char)atoi(str));
+ //db_set_b(NULL,protocolname,"protover",(char)atoi(str));
if(reconnectRequired) MessageBox(hwndDlg,Translate("The changes you have made require you to reconnect to the XFire network before they take effect"),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
return TRUE;
@@ -375,9 +375,9 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SendDlgItemMessage( hwndDlg, IDC_SCANUPDATECB, CB_ADDSTRING, 0, (LPARAM)TranslateT("On every start" ));
SendDlgItemMessage( hwndDlg, IDC_SCANUPDATECB, CB_ADDSTRING, 0, (LPARAM)TranslateT("Daily" ));
- SendDlgItemMessage( hwndDlg, IDC_SCANUPDATECB, CB_SETCURSEL, DBGetContactSettingByte(NULL,protocolname,"scanalways",0), 0);
+ SendDlgItemMessage( hwndDlg, IDC_SCANUPDATECB, CB_SETCURSEL, db_get_b(NULL,protocolname,"scanalways",0), 0);
- SendDlgItemMessage( hwndDlg, IDC_NOMSG, CB_SETCURSEL, nomsgboxsel[DBGetContactSettingByte(NULL,protocolname,"nomsgbox",0)], 0);
+ SendDlgItemMessage( hwndDlg, IDC_NOMSG, CB_SETCURSEL, nomsgboxsel[db_get_b(NULL,protocolname,"nomsgbox",0)], 0);
/* Gruppen raussuchen */
{
@@ -389,7 +389,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>" ));
sprintf_s(temp,8,"%d",gruppen_id);
- while(!DBGetContactSettingString(NULL,"CListGroups",temp,&dbv))
+ while(!db_get_s(NULL,"CListGroups",temp,&dbv))
{
gruppen_id++;
sprintf_s(temp,8,"%d",gruppen_id);
@@ -397,11 +397,11 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if(dbv.pszVal!=NULL) {
SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
- SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_SETCURSEL, DBGetContactSettingByte(NULL,protocolname,"mainclangroup",0), 0);
- SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_SETCURSEL, DBGetContactSettingByte(NULL,protocolname,"fofgroup",0), 0);
+ SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_SETCURSEL, db_get_b(NULL,protocolname,"mainclangroup",0), 0);
+ SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_SETCURSEL, db_get_b(NULL,protocolname,"fofgroup",0), 0);
}
@@ -445,7 +445,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
else
{
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(DBGetContactSettingByte(NULL,protocolname,mytree[i].dbentry,0)==1?2:1);
+ tvis.item.state = INDEXTOSTATEIMAGEMASK(db_get_b(NULL,protocolname,mytree[i].dbentry,0)==1?2:1);
tvis.item.lParam = 0;
tvis.item.pszText = Translate(mytree[i].name);
mytree[i].hitem=TreeView_InsertItem( hwndTree, &tvis );
@@ -542,24 +542,24 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
TreeView_GetItem(hwndTree, &tvic);
if ((( tvic.state & TVIS_STATEIMAGEMASK ) >> 12 == 2 ))
- DBWriteContactSettingByte(NULL,protocolname,mytree[i].dbentry,1);
+ db_set_b(NULL,protocolname,mytree[i].dbentry,1);
else
- DBWriteContactSettingByte(NULL,protocolname,mytree[i].dbentry,0);
+ db_set_b(NULL,protocolname,mytree[i].dbentry,0);
}
}
- DBWriteContactSettingByte(NULL,protocolname,"nomsgbox",(BYTE)nomsgboxsel[SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_GETCURSEL, 0, 0)]);
+ db_set_b(NULL,protocolname,"nomsgbox",(BYTE)nomsgboxsel[SendDlgItemMessage(hwndDlg, IDC_NOMSG, CB_GETCURSEL, 0, 0)]);
ccc=SendDlgItemMessage(hwndDlg, IDC_CLANGROUP, CB_GETCURSEL, 0, 0);
- DBWriteContactSettingByte(NULL,protocolname,"mainclangroup",(BYTE)ccc);
+ db_set_b(NULL,protocolname,"mainclangroup",(BYTE)ccc);
ccc=SendDlgItemMessage(hwndDlg, IDC_FOFGROUP, CB_GETCURSEL, 0, 0);
- DBWriteContactSettingByte(NULL,protocolname,"fofgroup",(BYTE)ccc);
+ db_set_b(NULL,protocolname,"fofgroup",(BYTE)ccc);
ccc=SendDlgItemMessage(hwndDlg, IDC_SCANUPDATECB, CB_GETCURSEL, 0, 0);
- DBWriteContactSettingByte(NULL,protocolname,"scanalways",(BYTE)ccc);
+ db_set_b(NULL,protocolname,"scanalways",(BYTE)ccc);
//protocolversion wird autoamtisch vergeben
//GetDlgItemText(hwndDlg,IDC_PVER,str,sizeof(str));
- //DBWriteContactSettingByte(NULL,protocolname,"protover",(char)atoi(str));
+ //db_set_b(NULL,protocolname,"protover",(char)atoi(str));
if(reconnectRequired) MessageBox(hwndDlg,Translate("The changes you have made require you to reconnect to the XFire network before they take effect"),Translate("XFire Options"),MB_OK|MB_ICONINFORMATION);
return TRUE;
@@ -651,7 +651,7 @@ static INT_PTR CALLBACK DlgProcOpts4(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETTEXT, sel, (LPARAM)temp);
SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_DELETESTRING, sel, 0);
- DBDeleteContactSetting(NULL,"XFireBlock",temp);
+ db_unset(NULL,"XFireBlock",temp);
if(SendDlgItemMessage(hwndDlg, IDC_BLOCKUSER, LB_GETCOUNT, 0, 0)==0)
EnableDlgItem(hwndDlg, IDC_REMUSER, FALSE);
}
@@ -689,12 +689,12 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg,IDC_ENABLESTSMSG,DBGetContactSettingByte(NULL,protocolname,"autosetstatusmsg",0));
- CheckDlgButton(hwndDlg,IDC_CHGSTATUS,DBGetContactSettingByte(NULL,protocolname,"statuschgtype",0));
- CheckDlgButton(hwndDlg,IDC_DNDFIRST,DBGetContactSettingByte(NULL,protocolname,"dndfirst",0));
- if(!DBGetContactSetting(NULL,protocolname,"setstatusmsg",&dbv)) {
+ CheckDlgButton(hwndDlg,IDC_ENABLESTSMSG,db_get_b(NULL,protocolname,"autosetstatusmsg",0));
+ CheckDlgButton(hwndDlg,IDC_CHGSTATUS,db_get_b(NULL,protocolname,"statuschgtype",0));
+ CheckDlgButton(hwndDlg,IDC_DNDFIRST,db_get_b(NULL,protocolname,"dndfirst",0));
+ if(!db_get(NULL,protocolname,"setstatusmsg",&dbv)) {
SetDlgItemText(hwndDlg,IDC_STATUSMSG,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if(!IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG))
{
@@ -740,11 +740,11 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
char str[512];
GetDlgItemText(hwndDlg,IDC_STATUSMSG,str,sizeof(str));
- DBWriteContactSettingString(NULL,protocolname,"setstatusmsg",str);
+ db_set_s(NULL,protocolname,"setstatusmsg",str);
- DBWriteContactSettingByte(NULL,protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG));
- DBWriteContactSettingByte(NULL,protocolname, "statuschgtype", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHGSTATUS));
- DBWriteContactSettingByte(NULL,protocolname, "dndfirst", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DNDFIRST));
+ db_set_b(NULL,protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG));
+ db_set_b(NULL,protocolname, "statuschgtype", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHGSTATUS));
+ db_set_b(NULL,protocolname, "dndfirst", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DNDFIRST));
return TRUE;
}
@@ -786,13 +786,13 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
//spielliste leeren
SendDlgItemMessage( (HWND)hwndDlg, IDC_LGAMELIST, LB_RESETCONTENT, 0, 0);
//spiele auslesen und in die liste einfügen
- int found=DBGetContactSettingWord(NULL,protocolname,"foundgames",0);
+ int found=db_get_w(NULL,protocolname,"foundgames",0);
char temp[XFIRE_MAXSIZEOFGAMENAME];
for(int i=0;i<found;i++)
{
//id auslesen
sprintf_s(temp,XFIRE_MAXSIZEOFGAMENAME,"gameid_%d",i);
- int gameid=DBGetContactSettingWord(NULL,protocolname,temp,0);
+ int gameid=db_get_w(NULL,protocolname,temp,0);
//spielnamen auslesen
xgamelist.getGamename(gameid,temp,XFIRE_MAXSIZEOFGAMENAME);
//eintrag einfügen
@@ -1001,11 +1001,11 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
//gameskip wert setzen
char temp[64]="";
sprintf_s(temp,64,"gameskip_%d",gameid);
- CheckDlgButton(hwndDlg,IDC_DONTDETECT,DBGetContactSettingByte(NULL,protocolname,temp,0));
+ CheckDlgButton(hwndDlg,IDC_DONTDETECT,db_get_b(NULL,protocolname,temp,0));
sprintf_s(temp,64,"gamenostatus_%d",gameid);
- CheckDlgButton(hwndDlg,IDC_NOSTATUSMSG,DBGetContactSettingByte(NULL,protocolname,temp,0));
+ CheckDlgButton(hwndDlg,IDC_NOSTATUSMSG,db_get_b(NULL,protocolname,temp,0));
sprintf_s(temp,64,"notinstartmenu_%d",gameid);
- CheckDlgButton(hwndDlg,IDC_NOTINSTARTMENU,DBGetContactSettingByte(NULL,protocolname,temp,0));
+ CheckDlgButton(hwndDlg,IDC_NOTINSTARTMENU,db_get_b(NULL,protocolname,temp,0));
//extra parameter auslesen, aber nur, wenn das spiel auch sowas unterstützt
if(xgtemp && xgtemp->haveExtraGameArgs())
@@ -1013,10 +1013,10 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE);
sprintf_s(temp,64,"gameextraparams_%d",gameid);
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,temp,&dbv))
+ if(!db_get(NULL,protocolname,temp,&dbv))
{
SetDlgItemText(hwndDlg,IDC_EXTRAPARAMS,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
SetDlgItemText(hwndDlg,IDC_EXTRAPARAMS,"");
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp
index 38f195b127..32ac9d9808 100644
--- a/protocols/Xfire/src/processbuddyinfo.cpp
+++ b/protocols/Xfire/src/processbuddyinfo.cpp
@@ -5,10 +5,10 @@
/*
-DBWriteContactSettingString(xsa->hContact, "ContactPhoto", "Backup", av.backup);
-DBWriteContactSettingString(xsa->hContact, "ContactPhoto", "File", av.file);
-DBWriteContactSettingString(xsa->hContact, "ContactPhoto", "RFile", av.rfile);
-DBWriteContactSettingWord(xsa->hContact, "ContactPhoto", "Format", av.type);
+db_set_s(xsa->hContact, "ContactPhoto", "Backup", av.backup);
+db_set_s(xsa->hContact, "ContactPhoto", "File", av.file);
+db_set_s(xsa->hContact, "ContactPhoto", "RFile", av.rfile);
+db_set_w(xsa->hContact, "ContactPhoto", "Format", av.type);
*/
extern HANDLE XFireAvatarFolder;
@@ -36,18 +36,18 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char*
//versuche doppeltes laden zuvermeiden
if(hcontact) //avatar von freunden
{
- if(DBGetContactSettingDword(hcontact, "ContactPhoto", "XFireAvatarId", 0)==buddyinfo->avatarid &&
- DBGetContactSettingByte(hcontact, "ContactPhoto", "XFireAvatarMode", 0)==buddyinfo->avatarmode)
+ if(db_get_dw(hcontact, "ContactPhoto", "XFireAvatarId", 0)==buddyinfo->avatarid &&
+ db_get_b(hcontact, "ContactPhoto", "XFireAvatarMode", 0)==buddyinfo->avatarmode)
return;
}
else //eigeneder avatar
{
- if(DBGetContactSettingDword(hcontact, protocolname, "XFireAvatarId", 0)==buddyinfo->avatarid &&
- DBGetContactSettingByte(hcontact, protocolname, "XFireAvatarMode", 0)==buddyinfo->avatarmode)
+ if(db_get_dw(hcontact, protocolname, "XFireAvatarId", 0)==buddyinfo->avatarid &&
+ db_get_b(hcontact, protocolname, "XFireAvatarMode", 0)==buddyinfo->avatarmode)
return;
//alten dateipfad des avatars löschen, wenn sichw as geändert hat
- DBDeleteContactSetting(NULL,protocolname, "MyAvatarFile");
+ db_unset(NULL,protocolname, "MyAvatarFile");
}
strcpy(filename, XFireGetFoldersPath ("Avatar"));
@@ -88,8 +88,8 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char*
{
if(hcontact) //buddyavatar setzen
{
- DBWriteContactSettingDword(hcontact, "ContactPhoto", "XFireAvatarId", buddyinfo->avatarid);
- DBWriteContactSettingByte(hcontact, "ContactPhoto", "XFireAvatarMode", buddyinfo->avatarmode);
+ db_set_dw(hcontact, "ContactPhoto", "XFireAvatarId", buddyinfo->avatarid);
+ db_set_b(hcontact, "ContactPhoto", "XFireAvatarMode", buddyinfo->avatarmode);
PROTO_AVATAR_INFORMATION AI;
AI.cbSize = sizeof(AI);
AI.format = type;
@@ -99,10 +99,10 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char*
}
else //eigenen avatar setzen
{
- DBWriteContactSettingDword(NULL, protocolname, "XFireAvatarId", buddyinfo->avatarid);
- DBWriteContactSettingByte(NULL, protocolname, "XFireAvatarMode", buddyinfo->avatarmode);
+ db_set_dw(NULL, protocolname, "XFireAvatarId", buddyinfo->avatarid);
+ db_set_b(NULL, protocolname, "XFireAvatarMode", buddyinfo->avatarmode);
//neuen avatarfilepath eintragen
- DBWriteContactSettingString(NULL,protocolname, "MyAvatarFile",filename);
+ db_set_s(NULL,protocolname, "MyAvatarFile",filename);
//beshceid geben, avatar hat sich geändert
CallService(MS_AV_REPORTMYAVATARCHANGED,(WPARAM)protocolname,0);
}
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp
index e7d1137c30..509dc28d0a 100644
--- a/protocols/Xfire/src/searching4games.cpp
+++ b/protocols/Xfire/src/searching4games.cpp
@@ -174,18 +174,18 @@ void Scan4Games( LPVOID lparam )
xgamelist.clearGamelist();
//prüfe ob schon gescannt wurde, dann das aus der db nehmen, beschleunigt den start
- foundgames=DBGetContactSettingWord(NULL, protocolname, "foundgames",-1);
+ foundgames=db_get_w(NULL, protocolname, "foundgames",-1);
//um bei einer neuen version einen rescan zuforcen, bei bestimmten wert found auf 0 resetten
- if(DBGetContactSettingWord(NULL, protocolname, "scanver",0)!=XFIRE_SCAN_VAL)
+ if(db_get_w(NULL, protocolname, "scanver",0)!=XFIRE_SCAN_VAL)
foundgames=-1;
BOOL loadgamesfromdb=FALSE;
- if(DBGetContactSettingByte(NULL,protocolname,"scanalways",0)==0)
+ if(db_get_b(NULL,protocolname,"scanalways",0)==0)
loadgamesfromdb=TRUE;
else
{
- if(DBGetContactSettingByte(NULL,protocolname,"scanalways",0)==2)
+ if(db_get_b(NULL,protocolname,"scanalways",0)==2)
{
time_t zeit;
struct tm *t;
@@ -194,9 +194,9 @@ void Scan4Games( LPVOID lparam )
if(t!=NULL)
{
- if(t->tm_yday!=DBGetContactSettingWord(NULL,protocolname,"scanalways_t",0))
+ if(t->tm_yday!=db_get_w(NULL,protocolname,"scanalways_t",0))
{
- DBWriteContactSettingWord(NULL,protocolname,"scanalways_t",t->tm_yday);
+ db_set_w(NULL,protocolname,"scanalways_t",t->tm_yday);
}
else
loadgamesfromdb=TRUE;
@@ -238,7 +238,7 @@ void Scan4Games( LPVOID lparam )
HWND hwnd=NULL;
//suche dialog anzeigen
- if(!DBGetContactSettingByte(NULL,protocolname,"dontdissstatus",0))
+ if(!db_get_b(NULL,protocolname,"dontdissstatus",0))
{
mir_forkthread(ShowSearchDialog,&hwnd);
}
@@ -717,11 +717,11 @@ void Scan4Games( LPVOID lparam )
xgamelist.writeDatabase();
//scanversion setzen, um ungewollten rescan zu vermeiden
- DBWriteContactSettingWord(NULL, protocolname, "scanver", XFIRE_SCAN_VAL);
+ db_set_w(NULL, protocolname, "scanver", XFIRE_SCAN_VAL);
EndDialog(hwnd,0);
- if(!DBGetContactSettingByte(NULL,protocolname,"dontdisresults",0))
+ if(!db_get_b(NULL,protocolname,"dontdisresults",0))
{
int p=strlen(gamelist)-2;
if(p>-1)
diff --git a/protocols/Xfire/src/services.cpp b/protocols/Xfire/src/services.cpp
index 54059eef17..e6147b6009 100644
--- a/protocols/Xfire/src/services.cpp
+++ b/protocols/Xfire/src/services.cpp
@@ -1,21 +1,21 @@
/*
* Plugin of miranda IM(ICQ) for Communicating with users of the XFire Network.
*
- * Copyright (C) 2010 by
- * dufte <dufte@justmail.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * Copyright (C) 2010 by
+ * dufte <dufte@justmail.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Based on J. Lawler - BaseProtocol
@@ -34,17 +34,17 @@ BOOL IsContactMySelf(std::string buddyusername) {
DBVARIANT dbv;
//nur wenn option aktiv, sonst immer FALSE
- if(!DBGetContactSettingByte(NULL,protocolname,"skipmyself",0))
+ if(!db_get_b(NULL,protocolname,"skipmyself",0))
return FALSE;
- if(!DBGetContactSetting(NULL,protocolname,"login",&dbv))
+ if(!db_get(NULL,protocolname,"login",&dbv))
{
if(!lstrcmpiA( dbv.pszVal, buddyusername.c_str() ))
{
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return TRUE;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
return FALSE;
@@ -56,10 +56,10 @@ BOOL IsContactMySelf(std::string buddyusername) {
INT_PTR GetMyAvatar(WPARAM wparam,LPARAM lparam) {
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,"MyAvatarFile",&dbv))
+ if(!db_get(NULL,protocolname,"MyAvatarFile",&dbv))
{
strncpy((char*)wparam, dbv.pszVal, (int)lparam);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp
index f2e1863970..c6908755d6 100644
--- a/protocols/Xfire/src/setnickname.cpp
+++ b/protocols/Xfire/src/setnickname.cpp
@@ -13,9 +13,9 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
SendMessage(hwndDlg,WM_SETICON, (WPARAM)false, (LPARAM)LoadIcon(hinstance, MAKEINTRESOURCE(IDI_TM)));
DBVARIANT dbv;
- if(!DBGetContactSetting(NULL,protocolname,"Nick",&dbv)) {
+ if(!db_get(NULL,protocolname,"Nick",&dbv)) {
SetDlgItemText(hwndDlg,IDC_NICKNAME,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return TRUE;
}
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp
index 8d16127d26..9dff6e4d61 100644
--- a/protocols/Xfire/src/tools.cpp
+++ b/protocols/Xfire/src/tools.cpp
@@ -157,7 +157,7 @@ char*menuitemtext(char*mtext)
void Message(LPVOID msg)
{
- switch(DBGetContactSettingByte(NULL,protocolname,"nomsgbox",0))
+ switch(db_get_b(NULL,protocolname,"nomsgbox",0))
{
case 1:
return;
@@ -184,7 +184,7 @@ void Message(LPVOID msg)
void MessageE(LPVOID msg)
{
static BOOL already=FALSE;
- switch(DBGetContactSettingByte(NULL,protocolname,"nomsgbox",0))
+ switch(db_get_b(NULL,protocolname,"nomsgbox",0))
{
case 0:
if(!already)
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp
index 13b7548d75..e571dedc6a 100644
--- a/protocols/Xfire/src/userdetails.cpp
+++ b/protocols/Xfire/src/userdetails.cpp
@@ -64,7 +64,7 @@ void LoadProfilStatus(LPVOID lparam) {
void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HANDLE hcontact,int type)
{
DBVARIANT dbv;
- if(!DBGetContactSetting(hcontact,protocolname,feld,&dbv)) {
+ if(!db_get(hcontact,protocolname,feld,&dbv)) {
if(type==1)
{
char temp[255];
@@ -75,7 +75,7 @@ void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HANDLE hcontact,int type)
{
SetDlgItemText(hwndDlg,feldid,dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
EnableDlgItem(hwndDlg,feldid,TRUE);
}
else
@@ -91,16 +91,16 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2)
HGLOBAL clipbuffer;
char* buffer;
- if(DBGetContactSettingWord((HANDLE)wParam, protocolname, feld2, -1)==0)
+ if(db_get_w((HANDLE)wParam, protocolname, feld2, -1)==0)
return 0;
DBVARIANT dbv;
- if(DBGetContactSettingString((HANDLE)wParam, protocolname, feld1,&dbv))
+ if(db_get_s((HANDLE)wParam, protocolname, feld1,&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,DBGetContactSettingWord((HANDLE)wParam, protocolname, feld2, -1));
+ sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, feld2, -1));
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if(OpenClipboard(NULL))
{
@@ -121,7 +121,7 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2)
void addToList(HWND listbox,HANDLE hContact,char*key,char*val)
{
DBVARIANT dbv;
- if(!DBGetContactSetting(hContact,protocolname,val,&dbv))
+ if(!db_get(hContact,protocolname,val,&dbv))
{
LVITEM lvitem;
memset(&lvitem,0,sizeof(lvitem));
@@ -134,7 +134,7 @@ void addToList(HWND listbox,HANDLE hContact,char*key,char*val)
lvitem.iSubItem++;
lvitem.pszText=dbv.pszVal;
SendMessageA(listbox,LVM_SETITEM,0,(LPARAM)&lvitem);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -262,7 +262,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam
if (hContact)
{
DBVARIANT dbv;
- if(!DBGetContactSetting(hContact,protocolname,"Username",&dbv))
+ if(!db_get(hContact,protocolname,"Username",&dbv))
{
int usernamesize=strlen(dbv.pszVal)+1;
char* username=new char[usernamesize];
@@ -272,13 +272,13 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam
mir_forkthread(LoadProfilStatus,(LPVOID)username);
}
//LoadProfilStatus
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"GameInfo",&dbv))
+ if(!db_get(hContact,protocolname,"GameInfo",&dbv))
{
setGameInfo(listbox,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
addToList(listbox,hContact,"Servername","ServerName");
@@ -301,26 +301,26 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam
{
DBVARIANT dbv;
- if(!DBGetContactSetting(hContact,protocolname,"GameId",&dbv))
+ if(!db_get(hContact,protocolname,"GameId",&dbv))
{
SendMessage(GetDlgItem(hwndDlg,IDC_GAMEICO),STM_SETICON,(WPARAM)xgamelist.iconmngr.getGameIcon(dbv.wVal),0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"VoiceId",&dbv))
+ if(!db_get(hContact,protocolname,"VoiceId",&dbv))
{
SendMessage(GetDlgItem(hwndDlg,IDC_VOICEICO),STM_SETICON,(WPARAM)xgamelist.iconmngr.getGameIcon(dbv.wVal),0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(DBGetContactSetting(hContact,protocolname,"ServerIP",&dbv))
+ if(db_get(hContact,protocolname,"ServerIP",&dbv))
{
EnableWindow(GetDlgItem(hwndDlg,IDC_COPYGAME),FALSE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(DBGetContactSetting(hContact,protocolname,"VServerIP",&dbv))
+ if(db_get(hContact,protocolname,"VServerIP",&dbv))
{
EnableWindow(GetDlgItem(hwndDlg,IDC_COPYVOICE),FALSE);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//ShowWindow(GetDlgItem(hwndDlg,IDC_VOICEICO),FALSE)
@@ -388,30 +388,30 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam
char nick[256]="";
char status[256]="";
char game[512]="";
- if(!DBGetContactSetting(hContact,"ContactPhoto","File",&dbv))
+ if(!db_get(hContact,"ContactPhoto","File",&dbv))
{
snprintf(img,256,"<img src=\"%s\">",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"Username",&dbv))
+ if(!db_get(hContact,protocolname,"Username",&dbv))
{
snprintf(username,256,"<b>Username:</b> %s<br>",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"Nick",&dbv))
+ if(!db_get(hContact,protocolname,"Nick",&dbv))
{
snprintf(nick,256,"<b>Nick:</b> %s<br>",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"XStatusMsg",&dbv))
+ if(!db_get(hContact,protocolname,"XStatusMsg",&dbv))
{
snprintf(status,256,"<b>Status:</b> %s<br>",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if(!DBGetContactSetting(hContact,protocolname,"RGame",&dbv))
+ if(!db_get(hContact,protocolname,"RGame",&dbv))
{
snprintf(game,512,"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
snprintf(profil,2056,"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
HWND hWnd = ::CreateWindow("AtlAxWin", profil,
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp
index d1e0d64df0..34c1dec6f2 100644
--- a/protocols/Xfire/src/variables.cpp
+++ b/protocols/Xfire/src/variables.cpp
@@ -21,10 +21,10 @@ char* Varxfiregame(ARGUMENTSINFO *ai)
{
char temp[256];
DBVARIANT dbv3;
- if(!DBGetContactSetting(ai->fi->hContact,protocolname, "RGame",&dbv3))
+ if(!db_get(ai->fi->hContact,protocolname, "RGame",&dbv3))
{
strncpy(temp,dbv3.pszVal,255);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return mir_strdup(temp);
}
}
@@ -39,10 +39,10 @@ char* Varmyxfiregame(ARGUMENTSINFO *ai)
return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(NULL,protocolname, "currentgamename",&dbv3))
+ if(!db_get(NULL,protocolname, "currentgamename",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
ai->flags = AIF_FALSE;
@@ -55,10 +55,10 @@ char* Varxfirevoice(ARGUMENTSINFO *ai)
return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(ai->fi->hContact,protocolname, "RVoice",&dbv3))
+ if(!db_get(ai->fi->hContact,protocolname, "RVoice",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
@@ -72,10 +72,10 @@ char* Varmyxfirevoiceip(ARGUMENTSINFO *ai) {
return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(NULL,protocolname, "VServerIP",&dbv3))
+ if(!db_get(NULL,protocolname, "VServerIP",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
@@ -88,10 +88,10 @@ char* Varmyxfireserverip(ARGUMENTSINFO *ai) {
return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(NULL,protocolname, "ServerIP",&dbv3))
+ if(!db_get(NULL,protocolname, "ServerIP",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
@@ -112,10 +112,10 @@ char* Varxfireserverip(ARGUMENTSINFO *ai) {
{
char temp[24];
DBVARIANT dbv3;
- if(!DBGetContactSetting(ai->fi->hContact,protocolname, "ServerIP",&dbv3))
+ if(!db_get(ai->fi->hContact,protocolname, "ServerIP",&dbv3))
{
- sprintf(temp,"%s:%d",dbv3.pszVal,DBGetContactSettingWord(ai->fi->hContact,protocolname, "Port",0));
- DBFreeVariant(&dbv3);
+ sprintf(temp,"%s:%d",dbv3.pszVal,db_get_w(ai->fi->hContact,protocolname, "Port",0));
+ db_free(&dbv3);
return mir_strdup(temp);
}
ai->flags = AIF_FALSE;
@@ -139,10 +139,10 @@ char* Varxfirevoiceip(ARGUMENTSINFO *ai) {
{
char temp[24];
DBVARIANT dbv3;
- if(!DBGetContactSetting(ai->fi->hContact,protocolname, "VServerIP",&dbv3))
+ if(!db_get(ai->fi->hContact,protocolname, "VServerIP",&dbv3))
{
- sprintf(temp,"%s:%d",dbv3.pszVal,DBGetContactSettingWord(ai->fi->hContact,protocolname, "VPort",0));
- DBFreeVariant(&dbv3);
+ sprintf(temp,"%s:%d",dbv3.pszVal,db_get_w(ai->fi->hContact,protocolname, "VPort",0));
+ db_free(&dbv3);
return mir_strdup(temp);
}
ai->flags = AIF_FALSE;
@@ -159,10 +159,10 @@ char* Varmyxfirevoice(ARGUMENTSINFO *ai)
return NULL;
DBVARIANT dbv3;
- if(!DBGetContactSetting(NULL,protocolname, "currentvoicename",&dbv3))
+ if(!db_get(NULL,protocolname, "currentvoicename",&dbv3))
{
char* ret=mir_strdup(dbv3.pszVal);
- DBFreeVariant(&dbv3);
+ db_free(&dbv3);
return ret;
}
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp
index d9d32221e7..856e04b282 100644
--- a/protocols/Yahoo/src/avatar.cpp
+++ b/protocols/Yahoo/src/avatar.cpp
@@ -291,7 +291,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p
LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", dbv.pszVal, cksum, who));
//void yahoo_send_picture_info(int id, const char *me, const char *who, const char *pic_url, int cksum)
yahoo_send_picture_info(m_id, who, 2, dbv.pszVal, cksum);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
} else
LOG(("No AvatarURL???"));
@@ -301,7 +301,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p
*/
if (GetByte("AvatarUL", 0) != 1) {
// NO avatar URL??
- if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv)) {
+ if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) {
struct _stat statbuf;
if (_tstat( dbv.ptszVal, &statbuf ) != 0) {
@@ -311,7 +311,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p
SendAvatar(dbv.ptszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
LOG(("[ext_yahoo_got_picture] No Local Avatar File??? "));
}
@@ -415,7 +415,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p
LOG(("[ext_yahoo_got_picture] We just reuploaded! Stop screwing with Yahoo FT. "));
// don't leak stuff
- DBFreeVariant(&dbv);
+ db_free(&dbv);
break;
}*/
@@ -423,10 +423,10 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p
LOG(("[ext_yahoo_got_picture] Buddy: %s told us this is bad??Expired??. Re-uploading", who));
db_unset(NULL, m_szModuleName, "AvatarURL");
- if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv2)) {
+ if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv2)) {
db_set_s(NULL, m_szModuleName, "AvatarInv", who);
SendAvatar(dbv2.ptszVal);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
} else {
LOG(("[ext_yahoo_got_picture] No Local Avatar File??? "));
}
@@ -435,7 +435,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p
yahoo_send_picture_info(m_id, who, 2, dbv.pszVal, mcksum);
}
// don't leak stuff
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
LOG(("[ext_yahoo_got_picture] no AvatarURL?"));
}
@@ -562,7 +562,7 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne
yahoo_send_picture_info(m_id, dbv.pszVal, 2, url, cksum);
db_unset(NULL, m_szModuleName, "AvatarInv");
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -667,7 +667,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam)
if (!GetString(AI->hContact, YAHOO_LOGINID, &dbv)) {
DebugLog("[YAHOO_GETAVATARINFO] For: %s", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}else {
DebugLog("[YAHOO_GETAVATARINFO]");
}
@@ -711,7 +711,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam)
DebugLog("[YAHOO_GETAVATARINFO] Requesting avatar!");
request_avatar(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return GAIR_WAITFOR;
} else {
@@ -799,14 +799,14 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
int ret = -3;
if (GetDword("AvatarHash", 0)) {
- if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv)) {
+ if (!db_get_ts(NULL, m_szModuleName, "AvatarFile", &dbv)) {
if (_taccess(dbv.ptszVal, 0) == 0) {
lstrcpyn(buffer, dbv.ptszVal, size-1);
buffer[size-1] = '\0';
ret = 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp
index 2b5aa75c21..46acda427b 100644
--- a/protocols/Yahoo/src/file_transfer.cpp
+++ b/protocols/Yahoo/src/file_transfer.cpp
@@ -753,7 +753,7 @@ HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescri
sf = new_ft(this, m_id, hContact, dbv.pszVal, ( char* )szDescription,
NULL, NULL, 0, fs, 1 /* sending */);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
if (sf == NULL) {
DebugLog("SF IS NULL!!!");
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp
index 607221d2c9..4892832ed0 100644
--- a/protocols/Yahoo/src/im.cpp
+++ b/protocols/Yahoo/src/im.cpp
@@ -210,7 +210,7 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc
YForkThread( &CYahooProto::im_sendacksuccess, hContact );
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 1;
}
@@ -252,7 +252,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam)
DBVARIANT dbv;
if (!GetString(hContact, YAHOO_LOGINID, &dbv)) {
send_msg(dbv.pszVal, GetWord(hContact, "yprotoid", 0), "<ding>", 0);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
YForkThread( &CYahooProto::im_sendacksuccess, hContact );
return 1;
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp
index 08b5cbcfda..cc3e96913e 100644
--- a/protocols/Yahoo/src/options.cpp
+++ b/protocols/Yahoo/src/options.cpp
@@ -38,19 +38,19 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if ( !ppro->GetString( YAHOO_LOGINID, &dbv )) {
SetDlgItemTextA(hwndDlg,IDC_HANDLE,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !ppro->GetString("Nick", &dbv )) {
SetDlgItemTextA(hwndDlg,IDC_NICK,dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !ppro->GetString( YAHOO_PASSWORD, &dbv )) {
//bit of a security hole here, since it's easy to extract a password from an edit box
CallService( MS_DB_CRYPT_DECODESTRING, strlen( dbv.pszVal )+1, (LPARAM)dbv.pszVal );
SetDlgItemTextA( hwndDlg, IDC_PASSWORD, dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
//SetButtonCheck( hwndDlg, IDC_DISABLE_UTF8, ppro->GetByte("DisableUTF8", 0));
@@ -105,7 +105,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
ppro->SetString( YAHOO_LOGINID, str );
@@ -115,7 +115,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
if ( ppro->GetString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal ))
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
ppro->SetString( YAHOO_PASSWORD, str );
GetDlgItemTextA( hwndDlg, IDC_NICK, str, sizeof( str ));
@@ -171,7 +171,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar
if ( !ppro->GetString( YAHOO_LOGINSERVER, &dbv )) {
SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER,
ppro->GetByte("YahooJapan", 0)
@@ -225,7 +225,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
ppro->SetString( YAHOO_LOGINSERVER, str );
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp
index 245a1fbd1f..e24666ef02 100644
--- a/protocols/Yahoo/src/proto.cpp
+++ b/protocols/Yahoo/src/proto.cpp
@@ -459,7 +459,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus )
lstrcpynA(m_yahoo_id, dbv.pszVal, 255);
} else
err++;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
ProtoBroadcastAck(m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_BADUSERID);
err++;
@@ -475,7 +475,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus )
} else
err++;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
ProtoBroadcastAck(m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
err++;
@@ -502,7 +502,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus )
m_pw_token = strdup(dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
//db_get_w(NULL, m_szModuleName, "StartupStatus", status);
@@ -546,14 +546,14 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact)
if (!GetString(hContact, "YGMsg", &dbv)) {
gm = strdup(dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
- if (! DBGetContactSettingString(hContact, "CList", "StatusMsg", &dbv )) {
+ if (! db_get_s(hContact, "CList", "StatusMsg", &dbv )) {
if (lstrlenA(dbv.pszVal) >= 1)
sm = strdup(dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
WORD status = GetWord(hContact, "YStatus", YAHOO_STATUS_OFFLINE);
sm = yahoo_status_code( yahoo_status( status ));
@@ -704,7 +704,7 @@ int __cdecl CYahooProto::UserIsTyping( HANDLE hContact, int type )
if (type == PROTOTYPE_SELFTYPING_OFF || type == PROTOTYPE_SELFTYPING_ON) {
sendtyping(dbv.pszVal, GetWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON?1:0);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
@@ -756,14 +756,14 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if ( !ppro->GetString(YAHOO_LOGINID, &dbv))
{
SetDlgItemTextA(hwndDlg, IDC_HANDLE, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if ( !ppro->GetString(YAHOO_PASSWORD, &dbv))
{
CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM) dbv.pszVal);
SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
SetButtonCheck( hwndDlg, IDC_YAHOO_JAPAN, ppro->GetByte("YahooJapan", 0));
@@ -808,7 +808,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
ppro->SetString(YAHOO_LOGINID, str);
GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str));
@@ -817,7 +817,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if ( ppro->GetString( YAHOO_PASSWORD, &dbv ) || lstrcmpA( str, dbv.pszVal ))
reconnectRequired = TRUE;
if ( dbv.pszVal != NULL)
- DBFreeVariant( &dbv );
+ db_free( &dbv );
if (reconnectRequired ) {
db_unset(NULL, ppro->m_szModuleName, YAHOO_PWTOKEN);
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp
index 6aed26d1a0..1ad0249b06 100644
--- a/protocols/Yahoo/src/services.cpp
+++ b/protocols/Yahoo/src/services.cpp
@@ -109,7 +109,7 @@ int __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam )
DebugLog("[YahooContactDeleted] Removing %s", dbv.pszVal);
remove_buddy(dbv.pszVal, GetWord(hContact, "yprotoid", 0));
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
DebugLog("[YahooContactDeleted] Can't retrieve contact Yahoo ID");
}
@@ -133,11 +133,11 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam
SendMessage( hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)ppro->LoadIconEx("yahoo", true ));
SendMessage( hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)ppro->LoadIconEx("yahoo"));
- if ( !DBGetContactSettingString( NULL, ppro->m_szModuleName, YAHOO_CUSTSTATDB, &dbv )) {
+ if ( !db_get_s( NULL, ppro->m_szModuleName, YAHOO_CUSTSTATDB, &dbv )) {
SetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, dbv. pszVal );
EnableWindow( GetDlgItem( hwndDlg, IDOK ), lstrlenA(dbv.pszVal) > 0);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else {
SetDlgItemTextA( hwndDlg, IDC_CUSTSTAT, "");
@@ -269,7 +269,7 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand( WPARAM wParam, LPARAM lParam
return 0;
_snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
OpenURL(tUrl, 0);
return 0;
@@ -295,7 +295,7 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand( WPARAM wParam, LPARAM lPara
char tUrl[ 4096 ];
_snprintf( tUrl, sizeof( tUrl ), "http://profiles.yahoo.com/%s", dbv.pszVal );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
OpenURL(tUrl, 0);
return 0;
diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp
index 26c8e484c9..05def506b0 100644
--- a/protocols/Yahoo/src/user_info.cpp
+++ b/protocols/Yahoo/src/user_info.cpp
@@ -64,7 +64,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa
if (ppro->GetString( hContact, YAHOO_LOGINID, &dbv ) == 0) {
strcpy(z, dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
strcpy(z, "???");
}
@@ -73,7 +73,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa
if (ppro->GetString( hContact, "Transport", &dbv ) == 0) {
strcpy(z, dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
strcpy(z, "Yahoo");
}
@@ -82,7 +82,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa
if (ppro->GetString( hContact, "MirVer", &dbv ) == 0) {
strcpy(z, dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
} else {
strcpy(z, "???");
}
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp
index 864fedd128..0a02e6b498 100644
--- a/protocols/Yahoo/src/util.cpp
+++ b/protocols/Yahoo/src/util.cpp
@@ -166,15 +166,15 @@ int CYahooProto::SendBroadcast( HANDLE hContact, int type, int result, HANDLE hP
}
int CYahooProto::GetString(const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(NULL, m_szModuleName, name, result);
+{ return db_get_s(NULL, m_szModuleName, name, result);
}
int CYahooProto::GetString(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingString(hContact, m_szModuleName, name, result);
+{ return db_get_s(hContact, m_szModuleName, name, result);
}
int CYahooProto::GetStringUtf(HANDLE hContact, const char* name, DBVARIANT* result)
-{ return DBGetContactSettingStringUtf(hContact, m_szModuleName, name, result);
+{ return db_get_utf(hContact, m_szModuleName, name, result);
}
void CYahooProto::SetString(const char* name, const char* value)
@@ -291,7 +291,7 @@ int __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam)
if (!GetString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) {
int iAdd = (ID_STATUS_OFFLINE == GetWord((HANDLE) wParam, "ApparentMode", 0));
stealth(dbv.pszVal, iAdd);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
return 0;
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index ada93c72db..f7cce7d094 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -196,7 +196,7 @@ void CYahooProto::remove_buddy(const char *who, int protocol)
}
yahoo_remove_buddy(m_id, who, protocol, dbv.pszVal);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
void CYahooProto::sendtyping(const char *who, int protocol, int stat)
@@ -244,7 +244,7 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg)
if (!GetString(hContact, YAHOO_LOGINID, &dbv))
{
who = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else
return;
@@ -255,19 +255,19 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg)
if (!GetString(hContact, "MyIdentity", &dbv))
{
ident = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!GetStringUtf(NULL, "FirstName", &dbv))
{
fname = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (!GetStringUtf(NULL, "LastName", &dbv))
{
lname = strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
SetStringUtf(hContact, "YGroup", group);
@@ -298,7 +298,7 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id)
{
int tCompareResult = lstrcmpiA( dbv.pszVal, yahoo_id );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
if ( tCompareResult )
continue;
}
@@ -359,7 +359,7 @@ const char* CYahooProto::find_buddy( const char *yahoo_id)
return NULL;
strncpy(nick, dbv.pszVal, 128);
- DBFreeVariant( &dbv );
+ db_free( &dbv );
return nick;
}
@@ -647,7 +647,7 @@ void CYahooProto::ext_got_stealth(char *stealthlist)
db_unset(hContact, m_szModuleName, "ApparentMode");
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
}
}
@@ -1563,7 +1563,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode)
if (host[0] == '\0') {
if (!GetString(YAHOO_LOGINSERVER, &dbv)) {
mir_snprintf(host, sizeof(host), "%s", dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
snprintf(host, sizeof(host), "%s",