diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-04-04 14:27:04 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-04-04 14:27:04 +0000 |
commit | c7181615b01d42717df5a4cc557995fe8970e555 (patch) | |
tree | 829b619062f5630b15701a5faaaf16019b893ae6 /plugins/!NotAdopted | |
parent | e08dd78ccf05f9d5d768e5436fcfc5e8126356fe (diff) |
Partial adopttion of VypressChat and WinPopup plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@8849 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/!NotAdopted')
-rw-r--r-- | plugins/!NotAdopted/VypressChat/contacts.c | 10 | ||||
-rw-r--r-- | plugins/!NotAdopted/VypressChat/contrib/m_chat.h | 2 | ||||
-rw-r--r-- | plugins/!NotAdopted/VypressChat/options.c | 8 | ||||
-rw-r--r-- | plugins/!NotAdopted/VypressChat/pthread.c | 4 | ||||
-rw-r--r-- | plugins/!NotAdopted/VypressChat/service.c | 4 | ||||
-rw-r--r-- | plugins/!NotAdopted/VypressChat/util.c | 2 | ||||
-rw-r--r-- | plugins/!NotAdopted/WinPopup/src/chat.cpp | 6 | ||||
-rw-r--r-- | plugins/!NotAdopted/WinPopup/src/netbios.cpp | 8 | ||||
-rw-r--r-- | plugins/!NotAdopted/WinPopup/src/options.cpp | 24 | ||||
-rw-r--r-- | plugins/!NotAdopted/WinPopup/src/scanner.cpp | 6 | ||||
-rw-r--r-- | plugins/!NotAdopted/WinPopup/src/services.cpp | 24 | ||||
-rw-r--r-- | plugins/!NotAdopted/WinPopup/src/user_info.cpp | 10 | ||||
-rw-r--r-- | plugins/!NotAdopted/WinPopup/src/winpopup_proto.cpp | 74 |
13 files changed, 91 insertions, 91 deletions
diff --git a/plugins/!NotAdopted/VypressChat/contacts.c b/plugins/!NotAdopted/VypressChat/contacts.c index 5274900624..1a0cf2ee40 100644 --- a/plugins/!NotAdopted/VypressChat/contacts.c +++ b/plugins/!NotAdopted/VypressChat/contacts.c @@ -91,7 +91,7 @@ static int contacts_add_queued_message( CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
free(new_data);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return 0;
}
@@ -137,7 +137,7 @@ static char * contacts_fetch_queued_message( CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return text;
}
@@ -350,7 +350,7 @@ char * contacts_get_contact_property( if(dbv.type == DBVT_ASCIIZ) {
value = strdup(dbv.pszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if(value == NULL)
value = strdup("(unknown)");
@@ -448,7 +448,7 @@ char * contacts_get_nickname(HANDLE hContact) db_get(hContact, VQCHAT_PROTO, "Nick", &dbv);
nickname = util_loc2utf(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
nickname = strdup("(null)");
}
@@ -679,7 +679,7 @@ int contacts_is_user_contact(HANDLE hContact) /* check that the contact has Nick set */
if(db_get(hContact, VQCHAT_PROTO, "Nick", &dbv)) return 0;
if(dbv.type != DBVT_ASCIIZ) return 0;
- DBFreeVariant(&dbv);
+ db_free(&dbv);
/* check if this is a chatroom */
if(db_byte_get(hContact, VQCHAT_PROTO, "ChatRoom", 0))
diff --git a/plugins/!NotAdopted/VypressChat/contrib/m_chat.h b/plugins/!NotAdopted/VypressChat/contrib/m_chat.h index 8caf5d0e8c..680d27d1cd 100644 --- a/plugins/!NotAdopted/VypressChat/contrib/m_chat.h +++ b/plugins/!NotAdopted/VypressChat/contrib/m_chat.h @@ -79,7 +79,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto != NULL && !lstrcmpi(szProto, PROTONAME))
{
- if(DBGetContactSettingByte(hContact, PROTONAME, "ChatRoom", 0) == 0)
+ if(db_get_b(hContact, PROTONAME, "ChatRoom", 0) == 0)
{
// ... do something with the hContact here;
}
diff --git a/plugins/!NotAdopted/VypressChat/options.c b/plugins/!NotAdopted/VypressChat/options.c index d159b06b7d..b23b43758a 100644 --- a/plugins/!NotAdopted/VypressChat/options.c +++ b/plugins/!NotAdopted/VypressChat/options.c @@ -495,7 +495,7 @@ static int options_hook_opt_initialise( odp.pszTitle = Translate(VQCHAT_PROTO_NAME);
odp.pfnDlgProc = options_user_dlgproc;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
/* add network configuration page
*/
@@ -504,7 +504,7 @@ static int options_hook_opt_initialise( odp.pszTitle = Translate(VQCHAT_PROTO_NAME " Network");
odp.pfnDlgProc = options_network_dlgproc;
odp.flags = ODPF_BOLDGROUPS;
- CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp);
+ Options_AddPage(wParam, &odp);
return 0; /* success */
}
@@ -758,7 +758,7 @@ static void options_load_settings() /* ok, got name from db */
user_set_nickname(dbv.pszVal, FALSE);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
/* get user gender */
@@ -879,7 +879,7 @@ static void options_load_settings() user_set_chanlist(dbv.pszVal, FALSE);
}
}
- if(!rc) DBFreeVariant(&dbv);
+ if(!rc) db_free(&dbv);
/* convert broadcasts masks from old-style
*/
diff --git a/plugins/!NotAdopted/VypressChat/pthread.c b/plugins/!NotAdopted/VypressChat/pthread.c index 062ec1769b..a2f79da159 100644 --- a/plugins/!NotAdopted/VypressChat/pthread.c +++ b/plugins/!NotAdopted/VypressChat/pthread.c @@ -32,13 +32,13 @@ void pthread_r(struct pthread_arg *fa) {
void (*callercode) (void *) = fa->threadcode;
void *arg = fa->arg;
- CallService(MS_SYSTEM_THREAD_PUSH, 0, 0);
+ Thread_Push(0, 0);
SetEvent(fa->hEvent);
/* __try { */
callercode(arg);
/* } */
/* __finally { */
- CallService(MS_SYSTEM_THREAD_POP, 0, 0);
+ Thread_Pop();
/* } */
}
diff --git a/plugins/!NotAdopted/VypressChat/service.c b/plugins/!NotAdopted/VypressChat/service.c index 72fa7ea3b8..f2d7c33d8a 100644 --- a/plugins/!NotAdopted/VypressChat/service.c +++ b/plugins/!NotAdopted/VypressChat/service.c @@ -312,7 +312,7 @@ service_contact_channel_settings(WPARAM wParam, LPARAM lParam) chatroom_channel_show_settings_dlg(channel);
free(channel);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -367,7 +367,7 @@ service_contact_deleted(WPARAM wParam, LPARAM lParam) free(channel);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
diff --git a/plugins/!NotAdopted/VypressChat/util.c b/plugins/!NotAdopted/VypressChat/util.c index 0cd8c758bf..3636f5e406 100644 --- a/plugins/!NotAdopted/VypressChat/util.c +++ b/plugins/!NotAdopted/VypressChat/util.c @@ -355,7 +355,7 @@ DWORD * db_dword_list( }
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
return list;
}
diff --git a/plugins/!NotAdopted/WinPopup/src/chat.cpp b/plugins/!NotAdopted/WinPopup/src/chat.cpp index 00ffd10b41..2921366a03 100644 --- a/plugins/!NotAdopted/WinPopup/src/chat.cpp +++ b/plugins/!NotAdopted/WinPopup/src/chat.cpp @@ -313,17 +313,17 @@ CString GetChatSession(HANDLE hContact) {
CString sContact;
DBVARIANT dbv = {};
- if ( ! DBGetContactSettingTString( hContact, modname, "ChatRoomID", &dbv ) )
+ if ( ! db_get_ts( hContact, modname, "ChatRoomID", &dbv ) )
{
sContact = dbv.pszVal;
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
return sContact;
}
bool IsChatRoom(HANDLE hContact)
{
- return ( DBGetContactSettingByte( hContact, modname, "ChatRoom", 0 ) != 0 );
+ return ( db_get_b( hContact, modname, "ChatRoom", 0 ) != 0 );
}
#endif // CHAT_ENABLED
diff --git a/plugins/!NotAdopted/WinPopup/src/netbios.cpp b/plugins/!NotAdopted/WinPopup/src/netbios.cpp index 2a1c5a4f68..4ee0298597 100644 --- a/plugins/!NotAdopted/WinPopup/src/netbios.cpp +++ b/plugins/!NotAdopted/WinPopup/src/netbios.cpp @@ -994,21 +994,21 @@ bool netbios::Register () {
// COMPUTER <01> U
netbios_name *pnn1 =
- DBGetContactSettingByte (NULL, modname, "RegisterNick", TRUE) ?
+ db_get_b (NULL, modname, "RegisterNick", TRUE) ?
new netbios_name ( pluginMachineName, 0x01, false, m_le.lana [i]) : NULL;
if (pnn1)
m_names.Add (pnn1);
// COMPUTER <03> U
netbios_name *pnn2 =
- DBGetContactSettingByte (NULL, modname, "RegisterNick", TRUE) ?
+ db_get_b (NULL, modname, "RegisterNick", TRUE) ?
new netbios_name ( pluginMachineName, 0x03, false, m_le.lana [i]) : NULL;
if (pnn2)
m_names.Add (pnn2);
// USER <03> U
netbios_name *pnn3 =
- DBGetContactSettingByte (NULL, modname, "RegisterUser", TRUE) ?
+ db_get_b (NULL, modname, "RegisterUser", TRUE) ?
new netbios_name ( pluginUserName, 0x03, false, m_le.lana [i]) : NULL;
if (pnn3) {
// Проверка на совпадение имени пользователя и имени компьютера
@@ -1021,7 +1021,7 @@ bool netbios::Register () // MNS_STATUS <AB> G
netbios_name *pnn4 =
- DBGetContactSettingByte (NULL, modname, "RegisterStatus", TRUE) ?
+ db_get_b (NULL, modname, "RegisterStatus", TRUE) ?
new netbios_name (MNS_STATUS, 0xab, true, m_le.lana [i]) : NULL;
if ( pnn4 )
m_names.Add( pnn4 );
diff --git a/plugins/!NotAdopted/WinPopup/src/options.cpp b/plugins/!NotAdopted/WinPopup/src/options.cpp index 4dc42977fa..a0bf9a7662 100644 --- a/plugins/!NotAdopted/WinPopup/src/options.cpp +++ b/plugins/!NotAdopted/WinPopup/src/options.cpp @@ -141,25 +141,25 @@ static INT_PTR CALLBACK DlgProcOptions (HWND hwndDlg, UINT Msg, WPARAM wParam, L TreeView_SetImageList (hTree, data->hTreeImages, TVSIL_NORMAL);
- BOOL b = DBGetContactSettingByte (NULL, modname, "RegisterNick", TRUE);
+ BOOL b = db_get_b (NULL, modname, "RegisterNick", TRUE);
CheckDlgButton (hwndDlg, IDC_CHECK_NICK, (UINT)( b ? BST_CHECKED : BST_UNCHECKED ));
EnableWindow (GetDlgItem (hwndDlg, IDC_NICK1), b);
EnableWindow (GetDlgItem (hwndDlg, IDC_NICK2), b);
- b = DBGetContactSettingByte (NULL, modname, "RegisterUser", TRUE);
+ b = db_get_b (NULL, modname, "RegisterUser", TRUE);
CheckDlgButton (hwndDlg, IDC_CHECK_USER, (UINT)( b ? BST_CHECKED : BST_UNCHECKED ));
EnableWindow (GetDlgItem (hwndDlg, IDC_USER), b);
CheckDlgButton (hwndDlg, IDC_AUTOANSWER,
- (UINT)( DBGetContactSettingByte (NULL, modname, "Auto-answer", FALSE) ?
+ (UINT)( db_get_b (NULL, modname, "Auto-answer", FALSE) ?
BST_CHECKED : BST_UNCHECKED ) );
CheckDlgButton (hwndDlg, IDC_DUPS,
- (UINT)( DBGetContactSettingByte (NULL, modname, "Filter-dups", TRUE) ?
+ (UINT)( db_get_b (NULL, modname, "Filter-dups", TRUE) ?
BST_CHECKED : BST_UNCHECKED ) );
CheckDlgButton (hwndDlg, IDC_ALWAYSCHECK00FORONLINE,
(UINT)( IsLegacyOnline( NULL ) ? BST_CHECKED : BST_UNCHECKED ) );
- BYTE method = (BYTE) DBGetContactSettingByte (NULL, modname, "SendMethod", 0);
+ BYTE method = (BYTE) db_get_b (NULL, modname, "SendMethod", 0);
CheckRadioButton (hwndDlg, IDC_USE_MAILSLOT, IDC_USE_NETSEND,
IDC_USE_MAILSLOT + method);
EnableWindow (GetDlgItem (hwndDlg, IDC_USE_NETSEND), (fnNetMessageBufferSend != NULL));
@@ -178,11 +178,11 @@ static INT_PTR CALLBACK DlgProcOptions (HWND hwndDlg, UINT Msg, WPARAM wParam, L }
DBVARIANT dbv = {};
- if ( ! DBGetContactSettingTString( NULL, modname, "User", &dbv ) )
+ if ( ! db_get_ts( NULL, modname, "User", &dbv ) )
{
netbios_name nname (dbv.ptszVal, 3);
SetDlgItemText (hwndDlg, IDC_USER, CA2T( nname.GetANSIFullName() ) );
- DBFreeVariant (&dbv);
+ db_free (&dbv);
}
bLastOnline = ! ( pluginCurrentStatus != ID_STATUS_OFFLINE );
@@ -303,15 +303,15 @@ static INT_PTR CALLBACK DlgProcOptions (HWND hwndDlg, UINT Msg, WPARAM wParam, L return TRUE;
case PSN_APPLY:
- DBWriteContactSettingByte (NULL, modname, "RegisterNick",
+ db_set_b (NULL, modname, "RegisterNick",
(BYTE)( (IsDlgButtonChecked (hwndDlg, IDC_CHECK_NICK) == BST_CHECKED ? TRUE : FALSE ) ));
- DBWriteContactSettingByte (NULL, modname, "RegisterUser",
+ db_set_b (NULL, modname, "RegisterUser",
(BYTE)( (IsDlgButtonChecked (hwndDlg, IDC_CHECK_USER) == BST_CHECKED ? TRUE : FALSE ) ));
- DBWriteContactSettingByte (NULL, modname, "Auto-answer",
+ db_set_b (NULL, modname, "Auto-answer",
(BYTE)( (IsDlgButtonChecked (hwndDlg, IDC_AUTOANSWER) == BST_CHECKED ? TRUE : FALSE ) ));
- DBWriteContactSettingByte (NULL, modname, "Filter-dups",
+ db_set_b (NULL, modname, "Filter-dups",
(BYTE)( (IsDlgButtonChecked (hwndDlg, IDC_DUPS) == BST_CHECKED ? TRUE : FALSE ) ));
- DBWriteContactSettingByte (NULL, modname, "SendMethod",
+ db_set_b (NULL, modname, "SendMethod",
(BYTE)( (((IsDlgButtonChecked (hwndDlg, IDC_USE_MAILSLOT) == BST_CHECKED) ? 0 :
((IsDlgButtonChecked (hwndDlg, IDC_USE_NETBIOS) == BST_CHECKED) ? 1 :
((IsDlgButtonChecked (hwndDlg, IDC_USE_NETSEND) == BST_CHECKED) ? 2 :
diff --git a/plugins/!NotAdopted/WinPopup/src/scanner.cpp b/plugins/!NotAdopted/WinPopup/src/scanner.cpp index 5074e97a5f..c489e60db4 100644 --- a/plugins/!NotAdopted/WinPopup/src/scanner.cpp +++ b/plugins/!NotAdopted/WinPopup/src/scanner.cpp @@ -91,8 +91,8 @@ HANDLE contact_scanner::GetNextScannableContact() {
// Проверка на совпадение протокола контакта
if ( IsMyContact( hContact ) &&
- !DBGetContactSettingByte (hContact, "CList", "NotOnList", 0) &&
- !DBGetContactSettingByte (hContact, "CList", "Hidden", 0) )
+ !db_get_b (hContact, "CList", "NotOnList", 0) &&
+ !db_get_b (hContact, "CList", "Hidden", 0) )
{
// Вычисление сколько секунд прошло со времени последнего
// обновления статуса контакта. Нужна проверка?
@@ -132,7 +132,7 @@ int contact_scanner::ScanContact(HANDLE hContact) int status = ID_STATUS_OFFLINE;
// Получение статуса "Always Online"
- if ( DBGetContactSettingByte( hContact, modname, "AlwaysOnline", FALSE ) )
+ if ( db_get_b( hContact, modname, "AlwaysOnline", FALSE ) )
status = ID_STATUS_ONLINE;
// Получение имени контакта
diff --git a/plugins/!NotAdopted/WinPopup/src/services.cpp b/plugins/!NotAdopted/WinPopup/src/services.cpp index 7bb482dbbe..c43860ebcd 100644 --- a/plugins/!NotAdopted/WinPopup/src/services.cpp +++ b/plugins/!NotAdopted/WinPopup/src/services.cpp @@ -353,7 +353,7 @@ INT_PTR RecvMessage (WPARAM /* flags */, LPARAM lParam) PROTORECVEVENT *pre = (PROTORECVEVENT*) ccs->lParam;
// Добавление сообщения
- DBDeleteContactSetting (ccs->hContact, "CList", "Hidden");
+ db_unset (ccs->hContact, "CList", "Hidden");
DBEVENTINFO ei = { 0 };
ei.cbSize = sizeof (DBEVENTINFO);
ei.szModule = modname;
@@ -499,14 +499,14 @@ INT_PTR SetMyAvatar(WPARAM /*wParam*/, LPARAM lParam) SHFileOperation( &sfo );
}
- DBWriteContactSettingTString( NULL, modname, "AvatarFile",
+ db_set_ts( NULL, modname, "AvatarFile",
_tcsrchr( szPath, _T('\\') ) + 1 );
}
else
{
// Удаление аватара в корзину
DBVARIANT dbv = {};
- if ( ! DBGetContactSettingTString( NULL, modname, "AvatarFile", &dbv ) )
+ if ( ! db_get_ts( NULL, modname, "AvatarFile", &dbv ) )
{
lstrcat( szPath, dbv.ptszVal );
@@ -518,9 +518,9 @@ INT_PTR SetMyAvatar(WPARAM /*wParam*/, LPARAM lParam) FOF_NOCONFIRMATION;
SHFileOperation( &sfo );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
- DBDeleteContactSetting( NULL, modname, "AvatarFile" );
+ db_unset( NULL, modname, "AvatarFile" );
}
}
@@ -540,13 +540,13 @@ INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam) GetAvatarCache( szPath );
DBVARIANT dbv = {};
- if ( ! DBGetContactSettingTString( NULL, modname, "AvatarFile", &dbv ) )
+ if ( ! db_get_ts( NULL, modname, "AvatarFile", &dbv ) )
{
lstrcat( szPath, dbv.ptszVal );
ret = ( GetFileAttributes( szPath ) != INVALID_FILE_ATTRIBUTES );
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
if ( ! ret )
@@ -749,10 +749,10 @@ int __cdecl SYSTEM_MODULESLOADED (WPARAM /* wParam */, LPARAM /* lParam */) wsprintf( path + len, _T("%d"), StatusIcons[i].icon_id );
wsprintf( icon, modname_t _T("%d"), StatusIcons[i].status );
DBVARIANT dbv = {};
- if ( ! DBGetContactSetting( NULL, "Icons", CT2A( icon ), &dbv ) )
- DBFreeVariant( &dbv );
+ if ( ! db_get( NULL, "Icons", CT2A( icon ), &dbv ) )
+ db_free( &dbv );
else
- DBWriteContactSettingTString( NULL, "Icons", CT2A( icon ), path );
+ db_set_ts( NULL, "Icons", CT2A( icon ), path );
}
// Определение имени компьютера
@@ -767,7 +767,7 @@ int __cdecl SYSTEM_MODULESLOADED (WPARAM /* wParam */, LPARAM /* lParam */) GetUserName(
pluginUserName.GetBuffer( (int)iUserNameLength ), &iUserNameLength );
pluginUserName.ReleaseBuffer();
- DBWriteContactSettingTString( NULL, modname, "User", pluginUserName );
+ db_set_ts( NULL, modname, "User", pluginUserName );
// Определение имени рабочей группы
if ( pluginOS.dwPlatformId == VER_PLATFORM_WIN32_NT )
@@ -798,7 +798,7 @@ int __cdecl SYSTEM_MODULESLOADED (WPARAM /* wParam */, LPARAM /* lParam */) RegCloseKey (hKey);
}
}
- DBWriteContactSettingTString (NULL, modname, "Workgroup", pluginDomainName);
+ db_set_ts (NULL, modname, "Workgroup", pluginDomainName);
// Регистрация в Chat
#ifdef CHAT_ENABLED
diff --git a/plugins/!NotAdopted/WinPopup/src/user_info.cpp b/plugins/!NotAdopted/WinPopup/src/user_info.cpp index 3f47e8cb80..02f9c6bae7 100644 --- a/plugins/!NotAdopted/WinPopup/src/user_info.cpp +++ b/plugins/!NotAdopted/WinPopup/src/user_info.cpp @@ -79,7 +79,7 @@ static void FillTreeThread (LPVOID param) if ( WNetGetResourceInformation( &nr, buf, &buf_size, &sys ) == NO_ERROR )
{
ftd->about = buf->lpComment;
- DBWriteContactSettingTString( fttd->hContact, modname,
+ db_set_ts( fttd->hContact, modname,
"About", ftd->about );
}
@@ -195,7 +195,7 @@ static INT_PTR CALLBACK DlgProcUserInfo (HWND hwndDlg, UINT Msg, WPARAM wParam, case PSN_INFOCHANGED:
{
// Флаг "Always Online"
- BOOL b = DBGetContactSettingByte ( data->hContact, modname,
+ BOOL b = db_get_b ( data->hContact, modname,
"AlwaysOnline", FALSE );
CheckDlgButton (hwndDlg, IDC_ONLINE_CHECK,
(UINT)( b ? BST_CHECKED : BST_UNCHECKED ) );
@@ -247,9 +247,9 @@ static INT_PTR CALLBACK DlgProcUserInfo (HWND hwndDlg, UINT Msg, WPARAM wParam, {
BOOL f_now = (IsDlgButtonChecked (hwndDlg, IDC_ONLINE_CHECK) ==
BST_CHECKED) ? TRUE : FALSE;
- BOOL f_old = DBGetContactSettingByte ( data->hContact, modname,
+ BOOL f_old = db_get_b ( data->hContact, modname,
"AlwaysOnline", FALSE );
- DBWriteContactSettingByte (data->hContact, modname,
+ db_set_b (data->hContact, modname,
"AlwaysOnline", (BYTE)( f_now ? TRUE : FALSE ) );
if ( ! f_old && f_now )
SetContactStatus( data->hContact, ID_STATUS_ONLINE, true );
@@ -278,7 +278,7 @@ static INT_PTR CALLBACK DlgProcUserInfo (HWND hwndDlg, UINT Msg, WPARAM wParam, {
BOOL f_now = (IsDlgButtonChecked (hwndDlg, IDC_ONLINE_CHECK) ==
BST_CHECKED) ? TRUE : FALSE;
- BOOL f_old = DBGetContactSettingByte ( data->hContact, modname,
+ BOOL f_old = db_get_b ( data->hContact, modname,
"AlwaysOnline", FALSE );
if ( f_old != f_now )
diff --git a/plugins/!NotAdopted/WinPopup/src/winpopup_proto.cpp b/plugins/!NotAdopted/WinPopup/src/winpopup_proto.cpp index 53e8245ec6..70325e356a 100644 --- a/plugins/!NotAdopted/WinPopup/src/winpopup_proto.cpp +++ b/plugins/!NotAdopted/WinPopup/src/winpopup_proto.cpp @@ -44,17 +44,17 @@ CString GetNick(HANDLE hContact) {
CString sNick;
DBVARIANT dbv = {};
- if ( ! DBGetContactSettingTString( hContact, modname, "Nick", &dbv ) )
+ if ( ! db_get_ts( hContact, modname, "Nick", &dbv ) )
{
sNick = dbv.ptszVal;
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
return sNick;
}
void SetNick(HANDLE hContact, LPCTSTR szNick)
{
- DBWriteContactSettingTString( hContact, modname, "Nick", szNick );
+ db_set_ts( hContact, modname, "Nick", szNick );
}
CComAutoCriticalSection _LOG_SECTION;
@@ -173,7 +173,7 @@ bool InternalStartup() bool err = false;
- BYTE method = (BYTE) DBGetContactSettingByte (NULL, modname, "SendMethod", 0);
+ BYTE method = (BYTE) db_get_b (NULL, modname, "SendMethod", 0);
if ( method == 2 )
{
// Инициализация "Службы Сообщений" с запуском
@@ -471,7 +471,7 @@ void ReceiveContactMessage(LPCTSTR msg_from, LPCTSTR msg_to, LPCTSTR msg_text, i Normalize( text );
// Дубликат?
- if (DBGetContactSettingByte (NULL, modname, "Filter-dups", TRUE))
+ if (db_get_b (NULL, modname, "Filter-dups", TRUE))
{
// Вычисление прошедшего времени с последнего сообщения
static FILETIME last_time = { 0, 0 };
@@ -559,7 +559,7 @@ void ReceiveContactMessage(LPCTSTR msg_from, LPCTSTR msg_to, LPCTSTR msg_text, i CCSDATA ccs = { 0 };
ccs.szProtoService = PSR_MESSAGE;
ccs.hContact = hContact;
- DBDeleteContactSetting (ccs.hContact, "CList", "Hidden");
+ db_unset (ccs.hContact, "CList", "Hidden");
ccs.lParam = (LPARAM) ⪯
CallServiceSync (MS_PROTO_CHAINRECV, 0, (LPARAM) &ccs);
@@ -567,7 +567,7 @@ void ReceiveContactMessage(LPCTSTR msg_from, LPCTSTR msg_to, LPCTSTR msg_text, i SetContactStatus( hContact, contact_scanner::ScanContact( hContact ), true );
// Авто-ответчик
- if ( DBGetContactSettingByte( NULL, modname, "Auto-answer", FALSE ) )
+ if ( db_get_b( NULL, modname, "Auto-answer", FALSE ) )
Autoanswer( hContact );
}
}
@@ -678,23 +678,23 @@ HANDLE AddToListByName(const CString& sName, WPARAM flags, LPCTSTR about, bool b CallService( MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)modname );
SetNick( hContact, sShortName );
SetGroup( hContact, bGroup );
- DBWriteContactSettingTString( hContact, "CList", "MyHandle", sShortName );
- DBWriteContactSettingByte( hContact, "CList", "NotOnList", 1 );
- DBWriteContactSettingByte( hContact, "CList", "Hidden", 1 );
+ db_set_ts( hContact, "CList", "MyHandle", sShortName );
+ db_set_b( hContact, "CList", "NotOnList", 1 );
+ db_set_b( hContact, "CList", "Hidden", 1 );
SetContactIP( hContact, addr );
SetElapsed( hContact, "IPTime" );
if ( about )
- DBWriteContactSettingTString( hContact, modname, "About", about );
+ db_set_ts( hContact, modname, "About", about );
contact_scanner::ScanContact( hContact );
}
}
if ( hContact && ! ( flags & PALF_TEMPORARY ) &&
- DBGetContactSettingByte( hContact, "CList", "NotOnList", 1 ) )
+ db_get_b( hContact, "CList", "NotOnList", 1 ) )
{
// Оставляем контакт
- DBDeleteContactSetting( hContact, "CList", "NotOnList" );
- DBDeleteContactSetting( hContact, "CList", "Hidden" );
+ db_unset( hContact, "CList", "NotOnList" );
+ db_unset( hContact, "CList", "Hidden" );
}
return hContact;
}
@@ -707,9 +707,9 @@ DWORD GetElapsed (HANDLE hContact, const char* name) currentL.LowPart = current.dwLowDateTime;
currentL.HighPart = (LONG)current.dwHighDateTime;
LARGE_INTEGER lastseenL = {};
- lastseenL.LowPart = DBGetContactSettingDword (hContact, modname,
+ lastseenL.LowPart = db_get_dw (hContact, modname,
CStringA (name) + "L", 0);
- lastseenL.HighPart = (LONG)DBGetContactSettingDword (hContact, modname,
+ lastseenL.HighPart = (LONG)db_get_dw (hContact, modname,
CStringA (name) + "H", 0);
return (DWORD) (((currentL.QuadPart - lastseenL.QuadPart) / 10000000L) & 0xffffffff);
}
@@ -718,9 +718,9 @@ void SetElapsed (HANDLE hContact, const char* name) {
FILETIME current = {};
GetSystemTimeAsFileTime (¤t);
- DBWriteContactSettingDword (hContact, modname,
+ db_set_dw (hContact, modname,
CStringA (name) + "L", current.dwLowDateTime);
- DBWriteContactSettingDword (hContact, modname,
+ db_set_dw (hContact, modname,
CStringA (name) + "H", current.dwHighDateTime);
}
@@ -730,7 +730,7 @@ HANDLE GetContact (ip addr) FOR_EACH_CONTACT( hContact )
{
// Получение имени контакта
- ip contact_addr = DBGetContactSettingDword (hContact, modname, "IP", 0);
+ ip contact_addr = db_get_dw (hContact, modname, "IP", 0);
if (contact_addr && (contact_addr == addr))
// Найдено совпадение
break;
@@ -778,16 +778,16 @@ void SetContactStatus (HANDLE hContact, int status, bool simple) else
#endif // CHAT_ENABLED
{
- int ns = DBGetContactSettingWord (hContact, modname, "Status", -1);
+ int ns = db_get_w (hContact, modname, "Status", -1);
if ( ns != status )
{
// Изменение статуса
if ( ! simple )
// Точная установка статуса
- DBWriteContactSettingWord (hContact, modname, "Status", (WORD) status);
+ db_set_w (hContact, modname, "Status", (WORD) status);
else if ( ns == -1 || ns == ID_STATUS_OFFLINE || status != ID_STATUS_ONLINE )
// Примерная установка статуса
- DBWriteContactSettingWord (hContact, modname, "Status", (WORD) status);
+ db_set_w (hContact, modname, "Status", (WORD) status);
}
}
}
@@ -808,7 +808,7 @@ void GetAvatarInfoThread(LPVOID param) // Получение кешированного аватара
DBVARIANT dbv = {};
- if ( ! DBGetContactSettingTString( data->hContact, modname, "AvatarFile", &dbv ) )
+ if ( ! db_get_ts( data->hContact, modname, "AvatarFile", &dbv ) )
{
lstrcat( szPath, dbv.ptszVal );
@@ -857,7 +857,7 @@ void GetAvatarInfoThread(LPVOID param) pai.format = PA_FORMAT_UNKNOWN;
}
}
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
if ( ret )
{
@@ -919,10 +919,10 @@ void SetContactAvatar(HANDLE hContact, LPCVOID pBuffer, DWORD nLength) {
// Получение старого имени
DBVARIANT dbv = {};
- if ( ! DBGetContactSettingTString( hContact, modname, "AvatarFile", &dbv ) )
+ if ( ! db_get_ts( hContact, modname, "AvatarFile", &dbv ) )
{
sFilename = dbv.ptszVal;
- DBFreeVariant( &dbv );
+ db_free( &dbv );
}
else
// Генерация уникального имени
@@ -992,7 +992,7 @@ void SetContactAvatar(HANDLE hContact, LPCVOID pBuffer, DWORD nLength) oAvatarFile.Close();
- DBWriteContactSettingTString( hContact, modname, "AvatarFile", sFilename );
+ db_set_ts( hContact, modname, "AvatarFile", sFilename );
// Определение ожидающей нити по контакту
bool ret = false;
@@ -1035,7 +1035,7 @@ ip GetContactIP (HANDLE hContact) {
got_nick = true;
}
- else if ( ! DBGetContactSettingTString( hContact, "CList", "MyHandle", &dbv ) )
+ else if ( ! db_get_ts( hContact, "CList", "MyHandle", &dbv ) )
{
nick_invalid = true;
got_nick = true;
@@ -1050,7 +1050,7 @@ ip GetContactIP (HANDLE hContact) // Если не истекло время кеширования адреса, то из контакта
DWORD elapsed = GetElapsed (hContact, "IPTime");
if (elapsed <= MAX_TRUSTED_IP_TIME)
- addr = DBGetContactSettingDword (hContact, modname, "IP", 0);
+ addr = db_get_dw (hContact, modname, "IP", 0);
if (addr == INADDR_NONE) {
// Разбор DNS-адреса
CString name (dbv.pszVal);
@@ -1060,7 +1060,7 @@ ip GetContactIP (HANDLE hContact) }
if (addr != INADDR_NONE)
SetContactIP (hContact, addr);
- DBFreeVariant (&dbv);
+ db_free (&dbv);
}
}
return addr;
@@ -1073,35 +1073,35 @@ void SetContactIP(HANDLE hContact, ip addr) if ( hContact )
{
- DBWriteContactSettingDword (hContact, modname, "IP", addr);
- DBWriteContactSettingDword (hContact, modname, "RealIP", addr);
+ db_set_dw (hContact, modname, "IP", addr);
+ db_set_dw (hContact, modname, "RealIP", addr);
}
}
bool IsGroup(HANDLE hContact)
{
- return ( DBGetContactSettingByte( hContact, modname, "Group", 0u ) != 0u );
+ return ( db_get_b( hContact, modname, "Group", 0u ) != 0u );
}
void SetGroup(HANDLE hContact, bool bGroup)
{
- DBWriteContactSettingByte( hContact, modname, "Group", ( bGroup ? 1u : 0u ) );
+ db_set_b( hContact, modname, "Group", ( bGroup ? 1u : 0u ) );
}
bool IsLegacyOnline(HANDLE hContact)
{
- return ( DBGetContactSettingByte( hContact, modname, "Check00ForOnline", 0u ) != 0u );
+ return ( db_get_b( hContact, modname, "Check00ForOnline", 0u ) != 0u );
}
void SetLegacyOnline(HANDLE hContact, bool bOnline)
{
- DBWriteContactSettingByte( hContact, modname, "Check00ForOnline", ( bOnline ? 1u : 0u ) );
+ db_set_b( hContact, modname, "Check00ForOnline", ( bOnline ? 1u : 0u ) );
}
bool SendContactMessage(HANDLE hContact, LPCTSTR msg, DWORD& err)
{
// Получение метода посылки
- BYTE method = (BYTE)DBGetContactSettingByte( NULL, modname, "SendMethod", 0 );
+ BYTE method = (BYTE)db_get_b( NULL, modname, "SendMethod", 0 );
switch ( method )
{
case 0:
|