diff options
-rw-r--r-- | plugins/MetaContacts/src/addto.cpp | 6 | ||||
-rw-r--r-- | plugins/MetaContacts/src/edit.cpp | 18 | ||||
-rw-r--r-- | plugins/MetaContacts/src/meta_api.cpp | 40 | ||||
-rw-r--r-- | plugins/MetaContacts/src/meta_main.cpp | 87 | ||||
-rw-r--r-- | plugins/MetaContacts/src/meta_menu.cpp | 98 | ||||
-rw-r--r-- | plugins/MetaContacts/src/meta_options.cpp | 98 | ||||
-rw-r--r-- | plugins/MetaContacts/src/meta_services.cpp | 152 | ||||
-rw-r--r-- | plugins/MetaContacts/src/meta_utils.cpp | 550 | ||||
-rw-r--r-- | plugins/MetaContacts/src/metacontacts.h | 2 |
9 files changed, 513 insertions, 538 deletions
diff --git a/plugins/MetaContacts/src/addto.cpp b/plugins/MetaContacts/src/addto.cpp index efde87e05f..1c4213137f 100644 --- a/plugins/MetaContacts/src/addto.cpp +++ b/plugins/MetaContacts/src/addto.cpp @@ -61,7 +61,7 @@ int FillList(HWND list, BOOL sort) while(hMetaUser) // The DB is searched through, to get all the metacontacts
{
- if ((metaID=DBGetContactSettingDword(hMetaUser,META_PROTO,META_ID,(DWORD)-1))==(DWORD)-1)
+ if ((metaID = db_get_dw(hMetaUser,META_PROTO,META_ID,(DWORD)-1))==(DWORD)-1)
{
// This isn't a MetaContact, go to the next
hMetaUser = db_find_next(hMetaUser);
@@ -171,14 +171,14 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault( hwndDlg );
- if (DBGetContactSettingDword((HANDLE)lParam,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1)
+ if (db_get_dw((HANDLE)lParam,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1)
{
MessageBox(hwndDlg,Translate("This contact is a MetaContact.\nYou can't add a MetaContact to another MetaContact.\n\nPlease choose another."),
Translate("MetaContact Conflict"),MB_ICONERROR);
DestroyWindow(hwndDlg);
return TRUE;
}
- if (DBGetContactSettingDword((HANDLE)lParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1)
+ if (db_get_dw((HANDLE)lParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1)
{
MessageBox(hwndDlg,Translate("This contact is already associated to a MetaContact.\nYou cannot add a contact to multiple MetaContacts."),
Translate("Multiple MetaContacts"),MB_ICONERROR);
diff --git a/plugins/MetaContacts/src/edit.cpp b/plugins/MetaContacts/src/edit.cpp index 15e9455bda..cf21c42edb 100644 --- a/plugins/MetaContacts/src/edit.cpp +++ b/plugins/MetaContacts/src/edit.cpp @@ -107,7 +107,7 @@ void FillContactList(HWND hWndDlg, CHANGES *chg) { if (proto) {
field = (char *)CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
- DBGetContactSetting(chg->hContact[i],proto,field,&dbv);
+ db_get(chg->hContact[i],proto,field,&dbv);
switch(dbv.type)
{
case DBVT_ASCIIZ:
@@ -126,7 +126,7 @@ void FillContactList(HWND hWndDlg, CHANGES *chg) { //sprintf(buff,"");
buff[0] = 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
LvItem.pszText = buff;
SendMessage(hList,LVM_SETITEM,0,(LPARAM)&LvItem); // Enter text to SubItems
@@ -194,16 +194,16 @@ void ApplyChanges(CHANGES *chg) // set default
if (chg->hDefaultContact)
- DBWriteContactSettingDword(chg->hMeta, META_PROTO, "Default", Meta_GetContactNumber(chg->hDefaultContact));
+ db_set_dw(chg->hMeta, META_PROTO, "Default", Meta_GetContactNumber(chg->hDefaultContact));
else
- DBWriteContactSettingDword(chg->hMeta, META_PROTO, "Default", 0);
+ db_set_dw(chg->hMeta, META_PROTO, "Default", 0);
NotifyEventHooks(hEventDefaultChanged, (WPARAM)chg->hMeta, (LPARAM)chg->hDefaultContact);
// set offline
if (chg->hOfflineContact)
- DBWriteContactSettingDword(chg->hMeta, META_PROTO, "OfflineSend", Meta_GetContactNumber(chg->hOfflineContact));
+ db_set_dw(chg->hMeta, META_PROTO, "OfflineSend", Meta_GetContactNumber(chg->hOfflineContact));
else
- DBWriteContactSettingDword(chg->hMeta, META_PROTO, "OfflineSend", (DWORD)-1);
+ db_set_dw(chg->hMeta, META_PROTO, "OfflineSend", (DWORD)-1);
// fix nick
most_online = Meta_GetMostOnline(chg->hMeta);
@@ -337,9 +337,9 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hwnd = GetDlgItem(hwndDlg, IDC_BTN_DOWN);
EnableWindow(hwnd, FALSE);
- nb_contacts = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "NumContacts", 0);
- default_contact_number = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1);
- offline_contact_number = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "OfflineSend", (DWORD)-1);
+ nb_contacts = db_get_dw((HANDLE)lParam, META_PROTO, "NumContacts", 0);
+ default_contact_number = db_get_dw((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1);
+ offline_contact_number = db_get_dw((HANDLE)lParam, META_PROTO, "OfflineSend", (DWORD)-1);
changes.hMeta = (HANDLE)lParam;
changes.num_contacts = nb_contacts;
diff --git a/plugins/MetaContacts/src/meta_api.cpp b/plugins/MetaContacts/src/meta_api.cpp index 73e7624521..f147f41251 100644 --- a/plugins/MetaContacts/src/meta_api.cpp +++ b/plugins/MetaContacts/src/meta_api.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //lParam=0
//returns a handle to the parent metacontact, or null if this contact is not a subcontact
INT_PTR MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam) {
- return (INT_PTR)(HANDLE)DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Handle", 0);
+ return (INT_PTR)(HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle", 0);
}
//gets the handle for the default contact
@@ -40,7 +40,7 @@ INT_PTR MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam) { //lParam=0
//returns a handle to the default contact, or null on failure
INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam) {
- DWORD default_contact_number = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1);
+ DWORD default_contact_number = db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1);
if (default_contact_number != -1) {
return (INT_PTR)Meta_GetContactHandle((HANDLE)wParam, default_contact_number);
}
@@ -52,7 +52,7 @@ INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam) { //lParam=0
//returns a DWORD contact number, or -1 on failure
INT_PTR MetaAPI_GetDefaultNum(WPARAM wParam, LPARAM lParam) {
- return DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1);
+ return db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1);
}
//gets the handle for the 'most online' contact
@@ -68,7 +68,7 @@ INT_PTR MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam) { //lParam=0
//returns a DWORD representing the number of subcontacts for the given metacontact
INT_PTR MetaAPI_GetNumContacts(WPARAM wParam, LPARAM lParam) {
- DWORD num_contacts = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "NumContacts", -1);
+ DWORD num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", -1);
return num_contacts;
}
@@ -85,12 +85,12 @@ INT_PTR MetaAPI_GetContact(WPARAM wParam, LPARAM lParam) { //lParam=(DWORD)contact number
//returns 0 on success
INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) {
- DWORD num_contacts = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "NumContacts", -1);
+ DWORD num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", -1);
if (num_contacts == -1)
return 1;
if ((DWORD)lParam >= num_contacts || (DWORD)lParam < 0)
return 1;
- if (DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "Default", (DWORD)lParam))
+ if (db_set_dw((HANDLE)wParam, META_PROTO, "Default", (DWORD)lParam))
return 1;
NotifyEventHooks(hEventDefaultChanged, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, (int)lParam));
@@ -102,11 +102,11 @@ INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) { //lParam=(HANDLE)hSubcontact
//returns 0 on success
INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) {
- HANDLE hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "Handle", 0);
+ HANDLE hMeta = (HANDLE)db_get_dw((HANDLE)lParam, META_PROTO, "Handle", 0);
DWORD contact_number = Meta_GetContactNumber((HANDLE)lParam);
if (contact_number == -1 || !hMeta || hMeta != (HANDLE)wParam)
return 1;
- if (DBWriteContactSettingDword(hMeta, META_PROTO, "Default", contact_number))
+ if (db_set_dw(hMeta, META_PROTO, "Default", contact_number))
return 1;
NotifyEventHooks(hEventDefaultChanged, wParam, lParam);
@@ -119,11 +119,11 @@ INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) { //returns 0 on success
INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, (int)lParam);
- HANDLE hMeta = (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0);
- if (!hContact || !hMeta || hMeta != (HANDLE)wParam || DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0))
+ HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0);
+ if (!hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0))
return 1;
- DBWriteContactSettingDword(hMeta, META_PROTO, "ForceSend", (DWORD)hContact);
+ db_set_dw(hMeta, META_PROTO, "ForceSend", (DWORD)hContact);
NotifyEventHooks(hEventForceSend, wParam, (LPARAM)hContact);
return 0;
@@ -135,11 +135,11 @@ INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) { //returns 0 on success (will fail if 'force default' is in effect)
INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)lParam;
- HANDLE hMeta = (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0);
- if (!hContact || !hMeta || hMeta != (HANDLE)wParam || DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0))
+ HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0);
+ if (!hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0))
return 1;
- DBWriteContactSettingDword(hMeta, META_PROTO, "ForceSend", (DWORD)hContact);
+ db_set_dw(hMeta, META_PROTO, "ForceSend", (DWORD)hContact);
NotifyEventHooks(hEventForceSend, wParam, lParam);
return 0;
@@ -150,10 +150,10 @@ INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) { //lParam=0
//returns 0 on success (will fail if 'force default' is in effect)
INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam) {
- if (DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
+ if (db_get_b((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
return 1;
- DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "ForceSend", 0);
+ db_set_dw((HANDLE)wParam, META_PROTO, "ForceSend", 0);
NotifyEventHooks(hEventUnforceSend, wParam, lParam);
return 0;
@@ -169,7 +169,7 @@ INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam) { INT_PTR MetaAPI_ForceDefault(WPARAM wParam, LPARAM lParam) {
// forward to menu function
Meta_ForceDefault(wParam, lParam);
- return DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0);
+ return db_get_b((HANDLE)wParam, META_PROTO, "ForceDefault", 0);
}
// method to get state of 'force' for a metacontact
@@ -184,12 +184,12 @@ INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) { if (!hMeta) return 0;
- if (DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0)) {
- if (lParam) *(DWORD *)lParam = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1);
+ if (db_get_b(hMeta, META_PROTO, "ForceDefault", 0)) {
+ if (lParam) *(DWORD *)lParam = db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1);
return 1;
}
- hContact = (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0);
+ hContact = (HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0);
if (!hContact) {
if (lParam) *(DWORD *)lParam = -1;
diff --git a/plugins/MetaContacts/src/meta_main.cpp b/plugins/MetaContacts/src/meta_main.cpp index 9e04413983..a8d48829f2 100644 --- a/plugins/MetaContacts/src/meta_main.cpp +++ b/plugins/MetaContacts/src/meta_main.cpp @@ -115,14 +115,14 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo;
}
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_METACONTACTS, MIID_LAST};
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_METACONTACTS, MIID_LAST };
/** DLL entry point
* Required to store the instance handle
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
- hInstance=hinstDLL;
+ hInstance = hinstDLL;
return TRUE;
}
@@ -150,49 +150,37 @@ BOOL IsUnicodeOS() */
extern "C" __declspec(dllexport) int Load(void)
{
- DBVARIANT dbv;
-
mir_getLP(&pluginInfo);
os_unicode_enabled = IsUnicodeOS();
- if (ServiceExists(MS_DB_SETSETTINGRESIDENT)) { // 0.6+
- CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Status"));
- CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/IdleTS"));
- CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/ContactCountCheck"));
- CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Handle"));
- CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/WindowOpen"));
- }
+ CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Status"));
+ CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/IdleTS"));
+ CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/ContactCountCheck"));
+ CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/Handle"));
+ CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(META_PROTO "/WindowOpen"));
//set all contacts to 'offline', and initialize subcontact counter for db consistency check
- {
- HANDLE hContact = db_find_first();
- char *proto;
- while(hContact != NULL) {
- //proto = GetContactProto(hContact);
- if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv)) {
- proto = dbv.pszVal;
- if (proto && !lstrcmp( META_PROTO, proto)) {
- DBWriteContactSettingWord(hContact, META_PROTO, "Status", ID_STATUS_OFFLINE);
- DBWriteContactSettingDword(hContact, META_PROTO, "IdleTS", 0);
- DBWriteContactSettingByte(hContact, META_PROTO, "ContactCountCheck", 0);
-
- // restore any saved defaults that might have remained if miranda was closed or crashed while a convo was happening
- if (DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1) != (DWORD)-1) {
- DBWriteContactSettingDword(hContact, META_PROTO, "Default", DBGetContactSettingDword(hContact, META_PROTO, "SavedDefault", 0));
- DBWriteContactSettingDword(hContact, META_PROTO, "SavedDefault", (DWORD)-1);
- }
- }
- DBFreeVariant(&dbv);
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
+ char *proto = GetContactProto(hContact);
+ if (proto && !lstrcmp( META_PROTO, proto)) {
+ db_set_w(hContact, META_PROTO, "Status", ID_STATUS_OFFLINE);
+ db_set_dw(hContact, META_PROTO, "IdleTS", 0);
+ db_set_b(hContact, META_PROTO, "ContactCountCheck", 0);
+
+ // restore any saved defaults that might have remained if miranda was closed or crashed while a convo was happening
+ if (db_get_dw(hContact, META_PROTO, "SavedDefault", (DWORD)-1) != (DWORD)-1) {
+ db_set_dw(hContact, META_PROTO, "Default", db_get_dw(hContact, META_PROTO, "SavedDefault", 0));
+ db_set_dw(hContact, META_PROTO, "SavedDefault", (DWORD)-1);
}
+ }
- hContact = db_find_next(hContact);
- }
- }
+ hContact = db_find_next(hContact);
+ }
Meta_ReadOptions(&options);
-
// sets subcontact handles to metacontacts, and metacontact handles to subcontacts
// (since these handles are not necessarily the same from run to run of miranda)
@@ -200,33 +188,31 @@ extern "C" __declspec(dllexport) int Load(void) // that metacontacts: have the correct number of subcontacts, and have reasonable defaults
if (Meta_SetHandles()) {
// error - db corruption
- if (!DBGetContactSettingByte(0, META_PROTO, "DisabledMessageShown", 0)) {
+ if (!db_get_b(0, META_PROTO, "DisabledMessageShown", 0)) {
MessageBox(0, Translate("Error - Database corruption.\nPlugin disabled."), Translate("MetaContacts"), MB_OK | MB_ICONERROR);
- DBWriteContactSettingByte(0, META_PROTO, "DisabledMessageShown", 1);
+ db_set_b(0, META_PROTO, "DisabledMessageShown", 1);
}
//Meta_HideMetaContacts(TRUE);
return 1;
}
- DBDeleteContactSetting(0, META_PROTO, "DisabledMessageShown");
+ db_unset(0, META_PROTO, "DisabledMessageShown");
// add our modules to the KnownModules list
- {
- DBVARIANT dbv;
- if (DBGetContactSetting(NULL, "KnownModules", META_PROTO, &dbv))
- DBWriteContactSettingString(NULL, "KnownModules", META_PROTO, META_PROTO);
- else
- DBFreeVariant(&dbv);
- }
+ DBVARIANT dbv;
+ if ( db_get(NULL, "KnownModules", META_PROTO, &dbv))
+ db_set_s(NULL, "KnownModules", META_PROTO, META_PROTO);
+ else
+ db_free(&dbv);
PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = META_FILTER;
pd.type = PROTOTYPE_FILTER;
- CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
pd.szName = META_PROTO;
- pd.type = PROTOTYPE_PROTOCOL;
- CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd);
+ pd.type = PROTOTYPE_VIRTUAL;
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
// further db setup done in modules loaded (nick [protocol string required] & clist display name)
@@ -236,12 +222,11 @@ extern "C" __declspec(dllexport) int Load(void) // check protocol for jabber hack, and the proto modules must be loaded
//Meta_HideLinkedContactsAndSetHandles();
- if (ServiceExists(MS_MSG_GETWINDOWAPI)) {
+ if ( ServiceExists(MS_MSG_GETWINDOWAPI))
message_window_api_enabled = TRUE;
- }
// for clist_meta_mw - write hidden group name to DB
- DBWriteContactSettingString(0, META_PROTO, "HiddenGroupName", META_HIDDEN_GROUP);
+ db_set_s(0, META_PROTO, "HiddenGroupName", META_HIDDEN_GROUP);
return 0;
-}
\ No newline at end of file +}
diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp index 524a46931c..3fffdd01b6 100644 --- a/plugins/MetaContacts/src/meta_menu.cpp +++ b/plugins/MetaContacts/src/meta_menu.cpp @@ -45,7 +45,7 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) // proto = GetContactProto(wParam,0);
if (!DBGetContactSettingStringUtf((HANDLE)wParam,"CList","Group",&dbv)) {
group = _strdup(dbv.pszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// Create a new metacontact
@@ -55,9 +55,9 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) if (hMetaContact)
{
- DBWriteContactSettingDword(hMetaContact,META_PROTO,META_ID,nextMetaID);
- DBWriteContactSettingDword(hMetaContact,META_PROTO,"NumContacts",0);
- DBWriteContactSettingDword(NULL,META_PROTO,"NextMetaID",++nextMetaID);
+ db_set_dw(hMetaContact,META_PROTO,META_ID,nextMetaID);
+ db_set_dw(hMetaContact,META_PROTO,"NumContacts",0);
+ db_set_dw(NULL,META_PROTO,"NextMetaID",++nextMetaID);
// Add the MetaContact protocol to the new meta contact
CallService( MS_PROTO_ADDTOCONTACT, ( WPARAM )hMetaContact, ( LPARAM )META_PROTO );
@@ -66,7 +66,7 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) if (ServiceExists(MS_DB_CONTACT_GETSETTING_STR))
DBWriteContactSettingStringUtf(hMetaContact,"CList","Group",group);
else
- DBWriteContactSettingString(hMetaContact,"CList","Group",group);
+ db_set_s(hMetaContact,"CList","Group",group);
}
// Assign the contact to the MetaContact just created (and make default).
@@ -78,7 +78,7 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) // hide the contact if clist groups disabled (shouldn't create one anyway since menus disabled)
if (!Meta_IsEnabled())
- DBWriteContactSettingByte(hMetaContact, "CList", "Hidden", 1);
+ db_set_b(hMetaContact, "CList", "Hidden", 1);
}
@@ -145,24 +145,24 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { char buffer[512], buffer2[512];
- num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", 0);
- default_contact = DBGetContactSettingDword(hMeta, META_PROTO, "Default", -1);
+ num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", 0);
+ default_contact = db_get_dw(hMeta, META_PROTO, "Default", -1);
if (number >= 0 && number < num_contacts) {
// get the handle
hContact = Meta_GetContactHandle(hMeta, number);
// make sure this contact thinks it's part of this metacontact
- if ((HANDLE)DBGetContactSettingDword(hContact,META_PROTO,"Handle", 0) == hMeta) {
+ if ((HANDLE)db_get_dw(hContact,META_PROTO,"Handle", 0) == hMeta) {
// remove link to meta contact
- DBDeleteContactSetting(hContact,META_PROTO,"IsSubcontact");
- DBDeleteContactSetting(hContact,META_PROTO,META_LINK);
- DBDeleteContactSetting(hContact,META_PROTO,"Handle");
- DBDeleteContactSetting(hContact,META_PROTO,"ContactNumber");
+ db_unset(hContact,META_PROTO,"IsSubcontact");
+ db_unset(hContact,META_PROTO,META_LINK);
+ db_unset(hContact,META_PROTO,"Handle");
+ db_unset(hContact,META_PROTO,"ContactNumber");
// unhide - must be done after removing link (see meta_services.c:Meta_ChangeStatus)
Meta_RestoreGroup(hContact);
- DBDeleteContactSetting(hContact,META_PROTO,"OldCListGroup");
+ db_unset(hContact,META_PROTO,"OldCListGroup");
//CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_PROTO);
CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_FILTER);
// stop ignoring, if we were
@@ -182,25 +182,25 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { // remove the last one
strcpy(buffer, "Protocol");
strcat(buffer, _itoa((num_contacts - 1), buffer2, 10));
- DBDeleteContactSetting(hMeta, META_PROTO, buffer);
+ db_unset(hMeta, META_PROTO, buffer);
strcpy(buffer, "Status");
strcat(buffer, _itoa((num_contacts - 1), buffer2, 10));
- DBDeleteContactSetting(hMeta, META_PROTO, buffer);
+ db_unset(hMeta, META_PROTO, buffer);
strcpy(buffer, "Handle");
strcat(buffer, _itoa((num_contacts - 1), buffer2, 10));
- DBDeleteContactSetting(hMeta, META_PROTO, buffer);
+ db_unset(hMeta, META_PROTO, buffer);
strcpy(buffer, "StatusString");
strcat(buffer, _itoa((num_contacts - 1), buffer2, 10));
- DBDeleteContactSetting(hMeta, META_PROTO, buffer);
+ db_unset(hMeta, META_PROTO, buffer);
strcpy(buffer, "Login");
strcat(buffer, _itoa((num_contacts - 1), buffer2, 10));
- DBDeleteContactSetting(hMeta, META_PROTO, buffer);
+ db_unset(hMeta, META_PROTO, buffer);
strcpy(buffer, "Nick");
strcat(buffer, _itoa((num_contacts - 1), buffer2, 10));
- DBDeleteContactSetting(hMeta, META_PROTO, buffer);
+ db_unset(hMeta, META_PROTO, buffer);
strcpy(buffer, "CListName");
strcat(buffer, _itoa((num_contacts - 1), buffer2, 10));
- DBDeleteContactSetting(hMeta, META_PROTO, buffer);
+ db_unset(hMeta, META_PROTO, buffer);
// if the default contact was equal to or greater than 'number', decrement it (and deal with ends)
if (default_contact >= number) {
@@ -208,11 +208,11 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) { if (default_contact < 0)
default_contact = 0;
- DBWriteContactSettingDword(hMeta, META_PROTO, "Default", (DWORD)default_contact);
+ db_set_dw(hMeta, META_PROTO, "Default", (DWORD)default_contact);
NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)Meta_GetContactHandle(hMeta, default_contact));
}
num_contacts--;
- DBWriteContactSettingDword(hMeta, META_PROTO, "NumContacts", (DWORD)num_contacts);
+ db_set_dw(hMeta, META_PROTO, "NumContacts", (DWORD)num_contacts);
// fix nick
hContact = Meta_GetMostOnline(hMeta);
@@ -250,7 +250,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) DWORD metaID;
HANDLE hContact;
- if ((metaID=DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1)
+ if ((metaID=db_get_dw((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1)
{// The wParam is a metacontact
if (!lParam) { // check from recursion - see second half of this function
if (MessageBox((HWND)CallService(MS_CLUI_GETHWND,0,0),Translate("This will remove the MetaContact permanently.\n\nProceed Anyway?"),
@@ -263,15 +263,15 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) hContact = db_find_first();
while(hContact)
{ // Scans the database to get all the contacts that have been previously linked to this MetaContact
- if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)==metaID)
+ if (db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1)==metaID)
{ // This contact is assigned to the MetaContact that will be deleted, clear the "MetaContacts" information
- DBDeleteContactSetting(hContact,META_PROTO,"IsSubcontact");
- DBDeleteContactSetting(hContact,META_PROTO,META_LINK);
- DBDeleteContactSetting(hContact,META_PROTO,"Handle");
- DBDeleteContactSetting(hContact,META_PROTO,"ContactNumber");
+ db_unset(hContact,META_PROTO,"IsSubcontact");
+ db_unset(hContact,META_PROTO,META_LINK);
+ db_unset(hContact,META_PROTO,"Handle");
+ db_unset(hContact,META_PROTO,"ContactNumber");
// unhide - must be done after removing link (see meta_services.c:Meta_ChangeStatus)
Meta_RestoreGroup(hContact);
- DBDeleteContactSetting(hContact,META_PROTO,"OldCListGroup");
+ db_unset(hContact,META_PROTO,"OldCListGroup");
CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)hContact,(LPARAM)META_FILTER);
// stop ignoring, if we were
@@ -280,8 +280,8 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) }
hContact = db_find_next(hContact);
}
- //DBDeleteContactSetting((HANDLE)wParam, META_PROTO, META_ID);
- //DBDeleteContactSetting((HANDLE)wParam, META_PROTO, "NumContacts");
+ //db_unset((HANDLE)wParam, META_PROTO, META_ID);
+ //db_unset((HANDLE)wParam, META_PROTO, "NumContacts");
//CallService(MS_PROTO_REMOVEFROMCONTACT,wParam,(LPARAM)META_PROTO);
NotifyEventHooks(hSubcontactsChanged, (WPARAM)wParam, 0);
CallService(MS_DB_CONTACT_DELETE,wParam,0);
@@ -292,10 +292,10 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) // return 1; // The function has been called by the menu of a simple contact. Should not happen.
//else
{// The function has been called by the edit dialog
- HANDLE hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Handle", 0);
+ HANDLE hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle", 0);
- DWORD num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", -1);
+ DWORD num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", -1);
if (num_contacts == 1) {
if (MessageBox(0,Translate("You are going to remove all the contacts associated with this MetaContact.\nThis will delete the MetaContact.\n\nProceed Anyway?"),
@@ -307,7 +307,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) return 0;
}
- Meta_RemoveContactNumber(hMeta, DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"ContactNumber", -1));
+ Meta_RemoveContactNumber(hMeta, db_get_dw((HANDLE)wParam,META_PROTO,"ContactNumber", -1));
CallService(MS_PROTO_REMOVEFROMCONTACT,(WPARAM)wParam,(LPARAM)META_FILTER);
}
@@ -327,9 +327,9 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam) {
HANDLE hMeta;
- if ((hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",0)) != 0)
+ if ((hMeta = (HANDLE)db_get_dw((HANDLE)wParam,META_PROTO,"Handle",0)) != 0)
{ // the wParam is a subcontact
- DBWriteContactSettingDword(hMeta, META_PROTO, "Default", (DWORD)Meta_GetContactNumber((HANDLE)wParam));
+ db_set_dw(hMeta, META_PROTO, "Default", (DWORD)Meta_GetContactNumber((HANDLE)wParam));
NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)(HANDLE)wParam);
}
return 0;
@@ -345,16 +345,16 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam) */
INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam)
{
- if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
+ if (db_get_dw((HANDLE)wParam,META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
{ // the wParam is a MetaContact
- BOOL current = DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0);
+ BOOL current = db_get_b((HANDLE)wParam, META_PROTO, "ForceDefault", 0);
current = !current;
- DBWriteContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", (BYTE)current);
+ db_set_b((HANDLE)wParam, META_PROTO, "ForceDefault", (BYTE)current);
- DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "ForceSend", 0);
+ db_set_dw((HANDLE)wParam, META_PROTO, "ForceSend", 0);
- if (current) NotifyEventHooks(hEventForceSend, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Default", -1)));
+ if (current) NotifyEventHooks(hEventForceSend, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1)));
else NotifyEventHooks(hEventUnforceSend, wParam, 0);
}
return 0;
@@ -408,7 +408,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) mi.flags = CMIM_FLAGS;
mi.cbSize = sizeof(CLISTMENUITEM);
- if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,-1) != (DWORD)-1)
+ if (db_get_dw((HANDLE)wParam,META_PROTO,META_ID,-1) != (DWORD)-1)
{
int num_contacts, i;
@@ -418,7 +418,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) // This is a MetaContact, show the edit, force default, and the delete menu, and hide the others
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuEdit, (LPARAM)&mi);
//mi.flags |= CMIM_NAME;
- //if (DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
+ //if (db_get_b((HANDLE)wParam, META_PROTO, "ForceDefault", 0))
// mi.pszName = Translate("Unforce Default");
//else
// mi.pszName = Translate("Force Default");
@@ -433,7 +433,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) //show subcontact menu items
- num_contacts = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "NumContacts", 0);
+ num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", 0);
for (i = 0; i < MAX_CONTACTS; i++) {
if (i < num_contacts) {
hContact = Meta_GetContactHandle((HANDLE)wParam, i);
@@ -442,13 +442,13 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) if (!proto)
status = ID_STATUS_OFFLINE;
else
- status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
+ status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
if (options.menu_contact_label == DNT_UID) {
strcpy(buf, "Login");
strcat(buf, _itoa(i, buffer2, 10));
- DBGetContactSetting((HANDLE)wParam,META_PROTO,buf,&dbv);
+ db_get((HANDLE)wParam,META_PROTO,buf,&dbv);
switch(dbv.type)
{
case DBVT_ASCIIZ:
@@ -466,7 +466,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) default:
buf[0] = 0;
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
mi.pszName = buf;
mi.flags = 0;
} else {
@@ -526,7 +526,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuContact[i], (LPARAM)&mi);
}
- } else if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ } else if (db_get_dw((HANDLE)wParam,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
// The contact is affected to a metacontact.
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuDefault, (LPARAM)&mi);
mi.flags |= CMIM_NAME;
diff --git a/plugins/MetaContacts/src/meta_options.cpp b/plugins/MetaContacts/src/meta_options.cpp index a5394c5e84..f254e82171 100644 --- a/plugins/MetaContacts/src/meta_options.cpp +++ b/plugins/MetaContacts/src/meta_options.cpp @@ -240,66 +240,66 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara }
int Meta_WriteOptions(MetaOptions *opt) {
- DBWriteContactSettingByte(NULL, META_PROTO, "SetDefaultOnRecv", (BYTE)(opt->set_default_on_recv ? 1 : 0));
- DBWriteContactSettingByte(NULL, META_PROTO, "TempDefault", (BYTE)(opt->temp_default ? 1 : 0));
- DBWriteContactSettingByte(NULL, META_PROTO, "AlwaysUseDefault", (BYTE)(opt->always_use_default ? 1 : 0));
- DBWriteContactSettingByte(NULL, META_PROTO, "SuppressStatus", (BYTE)(opt->suppress_status ? 1 : 0));
- DBWriteContactSettingWord(NULL, META_PROTO, "MenuContactLabel", (WORD)opt->menu_contact_label);
- DBWriteContactSettingWord(NULL, META_PROTO, "MenuContactFunction", (WORD)opt->menu_function);
- DBWriteContactSettingWord(NULL, META_PROTO, "CListContactName", (WORD)opt->clist_contact_name);
- DBWriteContactSettingByte(NULL, META_PROTO, "SuppressProto", (BYTE)(opt->suppress_proto ? 1 : 0));
- DBWriteContactSettingByte(NULL, META_PROTO, "CopyHistory", (BYTE)(opt->copy_subcontact_history ? 1 : 0));
- DBWriteContactSettingDword(NULL, META_PROTO, "DaysHistory", (DWORD)(opt->days_history));
- DBWriteContactSettingDword(NULL, META_PROTO, "SetStatusFromOfflineDelay", (DWORD)(opt->set_status_from_offline_delay));
- DBWriteContactSettingByte(NULL, META_PROTO, "SubcontactWindows", (BYTE)(opt->subcontact_windows ? 1 : 0));
- DBWriteContactSettingByte(NULL, META_PROTO, "CopyData", (BYTE)(opt->copydata ? 1 : 0));
- DBWriteContactSettingByte(NULL, META_PROTO, "LockHandle", (BYTE)(opt->lockHandle ? 1 : 0));
- DBWriteContactSettingByte(NULL, META_PROTO, "MetaMessageIcon", (BYTE)(opt->flash_meta_message_icon ? 1 : 0));
- DBWriteContactSettingByte(NULL, META_PROTO, "CopyUserInfo", (BYTE)(opt->copy_userinfo ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "SetDefaultOnRecv", (BYTE)(opt->set_default_on_recv ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "TempDefault", (BYTE)(opt->temp_default ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "AlwaysUseDefault", (BYTE)(opt->always_use_default ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "SuppressStatus", (BYTE)(opt->suppress_status ? 1 : 0));
+ db_set_w(NULL, META_PROTO, "MenuContactLabel", (WORD)opt->menu_contact_label);
+ db_set_w(NULL, META_PROTO, "MenuContactFunction", (WORD)opt->menu_function);
+ db_set_w(NULL, META_PROTO, "CListContactName", (WORD)opt->clist_contact_name);
+ db_set_b(NULL, META_PROTO, "SuppressProto", (BYTE)(opt->suppress_proto ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "CopyHistory", (BYTE)(opt->copy_subcontact_history ? 1 : 0));
+ db_set_dw(NULL, META_PROTO, "DaysHistory", (DWORD)(opt->days_history));
+ db_set_dw(NULL, META_PROTO, "SetStatusFromOfflineDelay", (DWORD)(opt->set_status_from_offline_delay));
+ db_set_b(NULL, META_PROTO, "SubcontactWindows", (BYTE)(opt->subcontact_windows ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "CopyData", (BYTE)(opt->copydata ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "LockHandle", (BYTE)(opt->lockHandle ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "MetaMessageIcon", (BYTE)(opt->flash_meta_message_icon ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "CopyUserInfo", (BYTE)(opt->copy_userinfo ? 1 : 0));
if (!opt->subcontact_windows)
- DBWriteContactSettingByte(NULL, META_PROTO, "MetaHistory", 1);
+ db_set_b(NULL, META_PROTO, "MetaHistory", 1);
else
- DBWriteContactSettingByte(NULL, META_PROTO, "MetaHistory", (BYTE)(opt->metahistory ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "MetaHistory", (BYTE)(opt->metahistory ? 1 : 0));
if (opt->subcontact_windows)
- DBWriteContactSettingByte(NULL, META_PROTO, "SubcontactHistory", 1);
+ db_set_b(NULL, META_PROTO, "SubcontactHistory", 1);
else
- DBWriteContactSettingByte(NULL, META_PROTO, "SubcontactHistory", (BYTE)(opt->subhistory ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "SubcontactHistory", (BYTE)(opt->subhistory ? 1 : 0));
return 0;
- DBWriteContactSettingByte(NULL, META_PROTO, "UseProtoRecv", (BYTE)(opt->use_proto_recv ? 1 : 0));
+ db_set_b(NULL, META_PROTO, "UseProtoRecv", (BYTE)(opt->use_proto_recv ? 1 : 0));
}
int Meta_ReadOptions(MetaOptions *opt) {
- opt->set_default_on_recv = (DBGetContactSettingByte(NULL, META_PROTO, "SetDefaultOnRecv", 1) == 1 ? TRUE : FALSE);
- opt->temp_default = (DBGetContactSettingByte(NULL, META_PROTO, "TempDefault", 1) == 1 ? TRUE : FALSE);
- opt->always_use_default = (DBGetContactSettingByte(NULL, META_PROTO, "AlwaysUseDefault", 1) == 1 ? TRUE : FALSE);
- opt->suppress_status = (DBGetContactSettingByte(NULL, META_PROTO, "SuppressStatus", 1) == 1 ? TRUE : FALSE);
- opt->menu_contact_label = (int)DBGetContactSettingWord(NULL, META_PROTO, "MenuContactLabel", DNT_UID);
- opt->menu_function = (int)DBGetContactSettingWord(NULL, META_PROTO, "MenuContactFunction", FT_MENU);
- opt->clist_contact_name = (int)DBGetContactSettingWord(NULL, META_PROTO, "CListContactName", CNNT_NICK);
- opt->suppress_proto = (DBGetContactSettingByte(NULL, META_PROTO, "SuppressProto", 0) == 1 ? TRUE : FALSE);
- opt->copy_subcontact_history = (DBGetContactSettingByte(NULL, META_PROTO, "CopyHistory", 1) == 1 ? TRUE : FALSE);
- opt->days_history = (int)DBGetContactSettingDword(NULL, META_PROTO, "DaysHistory", 0);
- opt->set_status_from_offline_delay = (int)DBGetContactSettingDword(NULL, META_PROTO, "SetStatusFromOfflineDelay", DEFAULT_SET_STATUS_SLEEP_TIME);
- opt->subcontact_windows = (DBGetContactSettingByte(NULL, META_PROTO, "SubcontactWindows", 0) == 1 ? TRUE : FALSE);
- opt->copydata = (DBGetContactSettingByte(NULL, META_PROTO, "CopyData", 1) == 1 ? TRUE : FALSE);
- opt->lockHandle = (DBGetContactSettingByte(NULL, META_PROTO, "LockHandle", 0) == 1 ? TRUE : FALSE);
- opt->flash_meta_message_icon = (DBGetContactSettingByte(NULL, META_PROTO, "MetaMessageIcon", 1) == 1 ? TRUE : FALSE);
- opt->copy_userinfo = (DBGetContactSettingByte(NULL, META_PROTO, "CopyUserInfo", 1) == 1 ? TRUE : FALSE);
+ opt->set_default_on_recv = (db_get_b(NULL, META_PROTO, "SetDefaultOnRecv", 1) == 1 ? TRUE : FALSE);
+ opt->temp_default = (db_get_b(NULL, META_PROTO, "TempDefault", 1) == 1 ? TRUE : FALSE);
+ opt->always_use_default = (db_get_b(NULL, META_PROTO, "AlwaysUseDefault", 1) == 1 ? TRUE : FALSE);
+ opt->suppress_status = (db_get_b(NULL, META_PROTO, "SuppressStatus", 1) == 1 ? TRUE : FALSE);
+ opt->menu_contact_label = (int)db_get_w(NULL, META_PROTO, "MenuContactLabel", DNT_UID);
+ opt->menu_function = (int)db_get_w(NULL, META_PROTO, "MenuContactFunction", FT_MENU);
+ opt->clist_contact_name = (int)db_get_w(NULL, META_PROTO, "CListContactName", CNNT_NICK);
+ opt->suppress_proto = (db_get_b(NULL, META_PROTO, "SuppressProto", 0) == 1 ? TRUE : FALSE);
+ opt->copy_subcontact_history = (db_get_b(NULL, META_PROTO, "CopyHistory", 1) == 1 ? TRUE : FALSE);
+ opt->days_history = (int)db_get_dw(NULL, META_PROTO, "DaysHistory", 0);
+ opt->set_status_from_offline_delay = (int)db_get_dw(NULL, META_PROTO, "SetStatusFromOfflineDelay", DEFAULT_SET_STATUS_SLEEP_TIME);
+ opt->subcontact_windows = (db_get_b(NULL, META_PROTO, "SubcontactWindows", 0) == 1 ? TRUE : FALSE);
+ opt->copydata = (db_get_b(NULL, META_PROTO, "CopyData", 1) == 1 ? TRUE : FALSE);
+ opt->lockHandle = (db_get_b(NULL, META_PROTO, "LockHandle", 0) == 1 ? TRUE : FALSE);
+ opt->flash_meta_message_icon = (db_get_b(NULL, META_PROTO, "MetaMessageIcon", 1) == 1 ? TRUE : FALSE);
+ opt->copy_userinfo = (db_get_b(NULL, META_PROTO, "CopyUserInfo", 1) == 1 ? TRUE : FALSE);
if (!opt->subcontact_windows)
opt->metahistory = TRUE;
else
- opt->metahistory = (DBGetContactSettingByte(NULL, META_PROTO, "MetaHistory", 1) == 1 ? TRUE : FALSE);
+ opt->metahistory = (db_get_b(NULL, META_PROTO, "MetaHistory", 1) == 1 ? TRUE : FALSE);
if (opt->subcontact_windows)
opt->subhistory = TRUE;
else
- opt->subhistory = (DBGetContactSettingByte(NULL, META_PROTO, "SubcontactHistory", 1) == 1 ? TRUE : FALSE);
+ opt->subhistory = (db_get_b(NULL, META_PROTO, "SubcontactHistory", 1) == 1 ? TRUE : FALSE);
- opt->use_proto_recv = (DBGetContactSettingByte(NULL, META_PROTO, "UseProtoRecv", 1) == 1 ? TRUE : FALSE);
+ opt->use_proto_recv = (db_get_b(NULL, META_PROTO, "UseProtoRecv", 1) == 1 ? TRUE : FALSE);
return 0;
}
@@ -342,14 +342,14 @@ int GetRealPriority(char *proto, int status) { char szSetting[256];
if (!proto) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", status);
- return DBGetContactSettingWord(0, META_PROTO, szSetting, GetDefaultPrio(status));
+ return db_get_w(0, META_PROTO, szSetting, GetDefaultPrio(status));
} else {
int prio;
mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", proto, status);
- prio = DBGetContactSettingWord(0, META_PROTO, szSetting, 0xFFFF);
+ prio = db_get_w(0, META_PROTO, szSetting, 0xFFFF);
if (prio == 0xFFFF) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", status);
- return DBGetContactSettingWord(0, META_PROTO, szSetting, GetDefaultPrio(status));
+ return db_get_w(0, META_PROTO, szSetting, GetDefaultPrio(status));
} else
return prio;
}
@@ -369,13 +369,13 @@ void ReadPriorities() { for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", i);
current->def[i - ID_STATUS_OFFLINE] = TRUE;
- current->prio[i - ID_STATUS_OFFLINE] = DBGetContactSettingWord(0, META_PROTO, szSetting, GetDefaultPrio(i));
+ current->prio[i - ID_STATUS_OFFLINE] = db_get_w(0, META_PROTO, szSetting, GetDefaultPrio(i));
}
for (i = 0; i < num_protocols; i++) {
current = priorities + (i + 1);
for (j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szModuleName, j);
- current->prio[j - ID_STATUS_OFFLINE] = DBGetContactSettingWord(0, META_PROTO, szSetting, 0xFFFF);
+ current->prio[j - ID_STATUS_OFFLINE] = db_get_w(0, META_PROTO, szSetting, 0xFFFF);
current->def[j - ID_STATUS_OFFLINE] = (current->prio[j - ID_STATUS_OFFLINE] == 0xFFFF);
}
}
@@ -393,18 +393,18 @@ void WritePriorities() { for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) {
mir_snprintf(szSetting, 256, "DefaultPrio_%d", i);
if (current->prio[i - ID_STATUS_OFFLINE] != GetDefaultPrio(i))
- DBWriteContactSettingWord(0, META_PROTO, szSetting, (WORD)current->prio[i - ID_STATUS_OFFLINE]);
+ db_set_w(0, META_PROTO, szSetting, (WORD)current->prio[i - ID_STATUS_OFFLINE]);
else
- DBDeleteContactSetting(0, META_PROTO, szSetting);
+ db_unset(0, META_PROTO, szSetting);
}
for (i = 0; i < num_protocols; i++) {
current = priorities + (i + 1);
for (j = ID_STATUS_OFFLINE; j <= ID_STATUS_OUTTOLUNCH; j++) {
mir_snprintf(szSetting, 256, "ProtoPrio_%s%d", pppDesc[i]->szModuleName, j);
if (!current->def[j - ID_STATUS_OFFLINE])
- DBWriteContactSettingWord(0, META_PROTO, szSetting, (WORD)current->prio[j - ID_STATUS_OFFLINE]);
+ db_set_w(0, META_PROTO, szSetting, (WORD)current->prio[j - ID_STATUS_OFFLINE]);
else
- DBDeleteContactSetting(0, META_PROTO, szSetting);
+ db_unset(0, META_PROTO, szSetting);
}
}
}
diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index d2b5ca563c..ead0bd10c8 100644 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -255,7 +255,7 @@ INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam) CCSDATA *ccs = (CCSDATA *) lParam;
HANDLE hMeta;
- if ((hMeta = (HANDLE)DBGetContactSettingDword(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) {
+ if ((hMeta = (HANDLE)db_get_dw(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) {
return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // Can't find the MetaID of the metacontact linked to
}
@@ -325,7 +325,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact, let through the stack of protocols
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -414,31 +414,31 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
HANDLE hMeta;
- if ((hMeta = (HANDLE)DBGetContactSettingDword(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) {
+ if ((hMeta = (HANDLE)db_get_dw(ccs->hContact,META_PROTO, "Handle", (DWORD)0)) == (DWORD)0) {
CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); // Can't find the MetaID of the metacontact linked to
// this contact, let through the protocol chain
return 0;
}
if (options.set_default_on_recv) {
- if (options.temp_default && DBGetContactSettingDword(hMeta, META_PROTO, "SavedDefault", (DWORD)-1) == (DWORD)-1)
- DBWriteContactSettingDword(hMeta, META_PROTO, "SavedDefault", DBGetContactSettingDword(hMeta, META_PROTO, "Default", 0));
- DBWriteContactSettingDword(hMeta, META_PROTO, "Default", DBGetContactSettingDword(ccs->hContact, META_PROTO, "ContactNumber", 0));
+ if (options.temp_default && db_get_dw(hMeta, META_PROTO, "SavedDefault", (DWORD)-1) == (DWORD)-1)
+ db_set_dw(hMeta, META_PROTO, "SavedDefault", db_get_dw(hMeta, META_PROTO, "Default", 0));
+ db_set_dw(hMeta, META_PROTO, "Default", db_get_dw(ccs->hContact, META_PROTO, "ContactNumber", 0));
NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)ccs->hContact); // nick set in event handler
}
// if meta disabled (now message api) or window open (message api), or using subcontact windows,
// let through but add db event for metacontact history
if (!Meta_IsEnabled()
- || DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) == 1
+ || db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) == 1
|| options.subcontact_windows)
{
// add a clist event, so that e.g. there is an icon flashing
// (only add it when message api available, 'cause then we can remove the event when the message window is opened)
if (message_window_api_enabled
- && DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) == 0
- && DBGetContactSettingByte(hMeta, META_PROTO, "WindowOpen", 0) == 0
+ && db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) == 0
+ && db_get_b(hMeta, META_PROTO, "WindowOpen", 0) == 0
&& options.flash_meta_message_icon)
{
CLISTEVENT cle;
@@ -471,7 +471,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) DWORD flags = pre->flags;
mir_snprintf(service, 256, "%s%s", proto, PSR_MESSAGE);
ccs->hContact = hMeta;
- pre->flags |= (DBGetContactSettingByte(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
+ pre->flags |= (db_get_b(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
if (ServiceExists(service) && !CallService(service, 0, (LPARAM)ccs))
added = TRUE;
ccs->hContact = hSub;
@@ -485,7 +485,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) dbei.cbSize = sizeof(dbei);
dbei.szModule = META_PROTO;
dbei.timestamp = pre->timestamp;
- dbei.flags = (DBGetContactSettingByte(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
+ dbei.flags = (db_get_b(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
if (pre->flags & PREF_UTF) dbei.flags |= DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
@@ -511,7 +511,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) dbei.cbSize = sizeof(dbei);
dbei.szModule = GetContactProto(ccs->hContact, 0);
dbei.timestamp = pre->timestamp;
- dbei.flags = (DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
+ dbei.flags = (db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ);
if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.cbBlob = strlen(pre->szMessage) + 1;
@@ -533,7 +533,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) if (options.subhistory && !(ccs->wParam & PREF_METANODB)) {
// allow event pass through and thereby be added to subcontact history
- pre->flags |= (DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
+ pre->flags |= (db_get_b(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD);
CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); // pass through as normal
return 0;
}
@@ -608,7 +608,7 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) ACKDATA *ack = (ACKDATA*) lParam;
HANDLE hUser;
- if (ack->hContact == 0 || (hUser = (HANDLE)DBGetContactSettingDword(ack->hContact,META_PROTO,"Handle",0)) == 0)
+ if (ack->hContact == 0 || (hUser = (HANDLE)db_get_dw(ack->hContact,META_PROTO,"Handle",0)) == 0)
return 0; // Can't find the MetaID, let through the protocol chain
@@ -637,10 +637,10 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) return 0;
}
- //if (!DBGetContactSetting(AI.hContact, "ContactPhoto", "File", &dbv)) {
- if (!DBGetContactSetting(ack->hContact, "ContactPhoto", "File", &dbv)) {
+ //if (!db_get(AI.hContact, "ContactPhoto", "File", &dbv)) {
+ if (!db_get(ack->hContact, "ContactPhoto", "File", &dbv)) {
DBWriteContactSettingTString(hUser, "ContactPhoto", "File", dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
if (ack->hProcess) {
@@ -696,7 +696,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) HANDLE hContact = db_find_first();
int meta_id;
while ( hContact != NULL ) {
- if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
Meta_CopyData(hContact);
}
hContact = db_find_next(hContact);
@@ -717,7 +717,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // from here on, we're just interested in contact settings
if (wParam == 0) return 0;
- if ((hMeta=(HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",0))!=0
+ if ((hMeta=(HANDLE)db_get_dw((HANDLE)wParam,META_PROTO,"Handle",0))!=0
&& CallService(MS_DB_CONTACT_IS, (WPARAM)hMeta, 0)) // just to be safe
{ // This contact is attached to a MetaContact.
@@ -726,38 +726,38 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) if (contact_number == -1) return 0; // exit - db corruption
if (!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Group") &&
- Meta_IsEnabled() && DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) {
+ Meta_IsEnabled() && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) {
if ((dcws->value.type == DBVT_ASCIIZ || dcws->value.type == DBVT_UTF8) && !Meta_IsHiddenGroup(dcws->value.pszVal)) {
// subcontact group reassigned - copy to saved group
MyDBWriteContactSetting((HANDLE)wParam, META_PROTO, "OldCListGroup", &dcws->value);
- DBWriteContactSettingString((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
+ db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
} else if (dcws->value.type == DBVT_DELETED) {
- DBDeleteContactSetting((HANDLE)wParam, META_PROTO, "OldCListGroup");
- DBWriteContactSettingString((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
+ db_unset((HANDLE)wParam, META_PROTO, "OldCListGroup");
+ db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP);
}
} else
// copy IP
if (!strcmp(dcws->szSetting, "IP")) {
if (dcws->value.type == DBVT_DWORD)
- DBWriteContactSettingDword(hMeta, META_PROTO, "IP", dcws->value.dVal);
+ db_set_dw(hMeta, META_PROTO, "IP", dcws->value.dVal);
else
- DBDeleteContactSetting(hMeta, META_PROTO, "IP");
+ db_unset(hMeta, META_PROTO, "IP");
} else
// copy RealIP
if (!strcmp(dcws->szSetting, "RealIP")) {
if (dcws->value.type == DBVT_DWORD)
- DBWriteContactSettingDword(hMeta, META_PROTO, "RealIP", dcws->value.dVal);
+ db_set_dw(hMeta, META_PROTO, "RealIP", dcws->value.dVal);
else
- DBDeleteContactSetting(hMeta, META_PROTO, "RealIP");
+ db_unset(hMeta, META_PROTO, "RealIP");
} else
// copy ListeningTo
if (!strcmp(dcws->szSetting, "ListeningTo")) {
switch(dcws->value.type) {
case DBVT_ASCIIZ:
- DBWriteContactSettingString(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal);
+ db_set_s(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal);
break;
case DBVT_UTF8:
DBWriteContactSettingStringUtf(hMeta, META_PROTO, "ListeningTo", dcws->value.pszVal);
@@ -766,7 +766,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) DBWriteContactSettingWString(hMeta, META_PROTO, "ListeningTo", dcws->value.pwszVal);
break;
case DBVT_DELETED:
- DBDeleteContactSetting(hMeta, META_PROTO, "ListeningTo");
+ db_unset(hMeta, META_PROTO, "ListeningTo");
break;
}
} else
@@ -780,12 +780,12 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) strcat(buffer, _itoa(contact_number, buffer2, 10));
MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
- if (MyDBGetContactSetting((HANDLE)wParam, "CList", "MyHandle", &dbv)) {
+ if (Mydb_get((HANDLE)wParam, "CList", "MyHandle", &dbv)) {
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dcws->value);
} else {
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
// copy nick to metacontact, if it's the most online
@@ -797,16 +797,16 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) if (!strcmp(dcws->szSetting, "IdleTS")) {
if (dcws->value.type == DBVT_DWORD)
- DBWriteContactSettingDword(hMeta, META_PROTO, "IdleTS", dcws->value.dVal);
+ db_set_dw(hMeta, META_PROTO, "IdleTS", dcws->value.dVal);
else if (dcws->value.type == DBVT_DELETED)
- DBWriteContactSettingDword(hMeta, META_PROTO, "IdleTS", 0);
+ db_set_dw(hMeta, META_PROTO, "IdleTS", 0);
} else
if (!strcmp(dcws->szSetting, "LogonTS")) {
if (dcws->value.type == DBVT_DWORD)
- DBWriteContactSettingDword(hMeta, META_PROTO, "LogonTS", dcws->value.dVal);
+ db_set_dw(hMeta, META_PROTO, "LogonTS", dcws->value.dVal);
else if (dcws->value.type == DBVT_DELETED)
- DBWriteContactSettingDword(hMeta, META_PROTO, "LogonTS", 0);
+ db_set_dw(hMeta, META_PROTO, "LogonTS", 0);
} else
if (!strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "MyHandle")) {
@@ -818,11 +818,11 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) char *proto = GetContactProto((HANDLE)wParam);
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- if (proto && !MyDBGetContactSetting((HANDLE)wParam, proto, "Nick", &dbv)) {
+ if (proto && !Mydb_get((HANDLE)wParam, proto, "Nick", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, buffer, &dbv);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
- DBDeleteContactSetting(hMeta, META_PROTO, buffer);
+ db_unset(hMeta, META_PROTO, buffer);
}
} else {
// subcontact clist displayname has changed - update metacontact
@@ -845,14 +845,14 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // update subcontact status setting
strcpy(buffer, "Status");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- DBWriteContactSettingWord(hMeta, META_PROTO, buffer, dcws->value.wVal);
+ db_set_w(hMeta, META_PROTO, buffer, dcws->value.wVal);
strcpy(buffer, "StatusString");
strcat(buffer, _itoa(contact_number, buffer2, 10));
Meta_GetStatusString(dcws->value.wVal, buffer2, 512);
- DBWriteContactSettingString(hMeta, META_PROTO, buffer, buffer2);
+ db_set_s(hMeta, META_PROTO, buffer, buffer2);
// if the contact was forced, unforce it (which updates status)
- if ((HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0) == (HANDLE)wParam) {
+ if ((HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0) == (HANDLE)wParam) {
MetaAPI_UnforceSendContact((WPARAM)hMeta, 0);
} else {
// set status to that of most online contact
@@ -888,11 +888,11 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) } else
if (!meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Hidden")) {
- if ((dcws->value.type == DBVT_DELETED || DBGetContactSettingByte((HANDLE)wParam, "CList", "Hidden", 0) == 0)
- && DBGetContactSettingByte((HANDLE)wParam, META_PROTO, "Hidden", 0) == 1)
+ if ((dcws->value.type == DBVT_DELETED || db_get_b((HANDLE)wParam, "CList", "Hidden", 0) == 0)
+ && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 1)
{
// a subcontact we hid (e.g. jabber) has been unhidden - hide it again :(
- DBWriteContactSettingByte((HANDLE)wParam, "CList", "Hidden", 1);
+ db_set_b((HANDLE)wParam, "CList", "Hidden", 1);
}
}
}
@@ -904,14 +904,14 @@ int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) { HANDLE hMeta;
// is a subcontact - update meta contact
- hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "Handle", 0);
+ hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle", 0);
if (hMeta) {
- Meta_RemoveContactNumber(hMeta, DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "ContactNumber", -1));
+ Meta_RemoveContactNumber(hMeta, db_get_dw((HANDLE)wParam, META_PROTO, "ContactNumber", -1));
NotifyEventHooks(hSubcontactsChanged, (WPARAM)hMeta, 0);
return 0;
} else {
// not a subcontact - is it a metacontact?
- int num_contacts = DBGetContactSettingDword((HANDLE)wParam, META_PROTO, "NumContacts", 0);
+ int num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", 0);
int i;
HANDLE hContact;
@@ -921,14 +921,14 @@ int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) { for (i = 0; i < num_contacts; i++) {
hContact = Meta_GetContactHandle((HANDLE)wParam, i);
- if (hContact && (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0) == (HANDLE)wParam) {
- if (DBGetContactSettingByte(hContact, META_PROTO, "IsSubcontact", 0) == 1)
- DBDeleteContactSetting(hContact,META_PROTO,"IsSubcontact");
- DBDeleteContactSetting(hContact,META_PROTO,META_LINK);
- DBDeleteContactSetting(hContact,META_PROTO,"Handle");
- DBDeleteContactSetting(hContact,META_PROTO,"ContactNumber");
+ if (hContact && (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0) == (HANDLE)wParam) {
+ if (db_get_b(hContact, META_PROTO, "IsSubcontact", 0) == 1)
+ db_unset(hContact,META_PROTO,"IsSubcontact");
+ db_unset(hContact,META_PROTO,META_LINK);
+ db_unset(hContact,META_PROTO,"Handle");
+ db_unset(hContact,META_PROTO,"ContactNumber");
Meta_RestoreGroup(hContact);
- DBDeleteContactSetting(hContact,META_PROTO,"OldCListGroup");
+ db_unset(hContact,META_PROTO,"OldCListGroup");
CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)META_FILTER);
// stop ignoring, if we were
@@ -953,7 +953,7 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam) char *proto;
char buff[512];
- if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1) == (DWORD)-1)
+ if (db_get_dw((HANDLE)wParam,META_PROTO,META_ID,(DWORD)-1) == (DWORD)-1)
{
// This is a simple contact, let through the stack of protocols
return 0;
@@ -990,7 +990,7 @@ int Meta_ContactIsTyping(WPARAM wParam, LPARAM lParam) {
HANDLE hMeta;
- if ((hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Handle",(DWORD)0)) != 0
+ if ((hMeta = (HANDLE)db_get_dw((HANDLE)wParam,META_PROTO,"Handle",(DWORD)0)) != 0
// check metacontacts enabled
&& Meta_IsEnabled()
)
@@ -1017,7 +1017,7 @@ int Meta_ContactIsTyping(WPARAM wParam, LPARAM lParam) */
int Meta_UserInfo(WPARAM wParam, LPARAM lParam)
{
- DWORD default_contact_number = DBGetContactSettingDword((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1);
+ DWORD default_contact_number = db_get_dw((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1);
if (default_contact_number == -1) // not a meta contact
return 0;
@@ -1035,18 +1035,18 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { message_window_api_enabled = TRUE;
- if ((hMeta = (HANDLE)DBGetContactSettingDword(mwed->hContact, META_PROTO, "Handle", 0)) != 0
- || DBGetContactSettingDword(mwed->hContact, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
+ if ((hMeta = (HANDLE)db_get_dw(mwed->hContact, META_PROTO, "Handle", 0)) != 0
+ || db_get_dw(mwed->hContact, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1)
{
// contact is subcontact of metacontact, or an actual metacontact - record whether window is open or closed
if (mwed->uType == MSG_WINDOW_EVT_OPEN || mwed->uType == MSG_WINDOW_EVT_OPENING) {
- DBWriteContactSettingByte(mwed->hContact, META_PROTO, "WindowOpen", 1);
+ db_set_b(mwed->hContact, META_PROTO, "WindowOpen", 1);
if (hMeta) { // subcontact window opened - remove clist events we added for metacontact
while(!CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hMeta, (LPARAM)mwed->hContact));
}
} else if (mwed->uType == MSG_WINDOW_EVT_CLOSE || mwed->uType == MSG_WINDOW_EVT_CLOSING) {
- DBWriteContactSettingByte(mwed->hContact, META_PROTO, "WindowOpen", 0);
+ db_set_b(mwed->hContact, META_PROTO, "WindowOpen", 0);
if (!hMeta) { // hMeta is 0 for metacontact (sorry)
DWORD saved_def;
@@ -1054,10 +1054,10 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { // restore saved default contact
if (options.set_default_on_recv) {
- saved_def = DBGetContactSettingDword(mwed->hContact, META_PROTO, "SavedDefault", -1);
+ saved_def = db_get_dw(mwed->hContact, META_PROTO, "SavedDefault", -1);
if (options.temp_default && saved_def != (DWORD)-1) {
- DBWriteContactSettingDword(mwed->hContact, META_PROTO, "Default", saved_def);
- DBWriteContactSettingDword(mwed->hContact, META_PROTO, "SavedDefault", (DWORD)-1);
+ db_set_dw(mwed->hContact, META_PROTO, "Default", saved_def);
+ db_set_dw(mwed->hContact, META_PROTO, "SavedDefault", (DWORD)-1);
NotifyEventHooks(hEventDefaultChanged, (WPARAM)mwed->hContact, (LPARAM)Meta_GetContactHandle(hMeta, saved_def)); // nick set in event handler
}
}
@@ -1071,7 +1071,7 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam)
{
- if (DBGetContactSettingDword((HANDLE)wParam,META_PROTO,"Default",(WORD)-1) == (WORD)-1)
+ if (db_get_dw((HANDLE)wParam,META_PROTO,"Default",(WORD)-1) == (WORD)-1)
{
// This is a simple contact
return 0;
@@ -1135,7 +1135,7 @@ INT_PTR Meta_ClistMessageEventClicked(WPARAM wParam, LPARAM lParam) { int NudgeRecieved(WPARAM wParam, LPARAM lParam) {
/*
// already being forwarded by someone
- HANDLE hMeta = (HANDLE)DBGetContactSettingDword((HANDLE)wParam,META_PROTO, "Handle", (DWORD)0);
+ HANDLE hMeta = (HANDLE)db_get_dw((HANDLE)wParam,META_PROTO, "Handle", (DWORD)0);
if (hMeta)
NotifyEventHooks(hEventNudge, (WPARAM)hMeta, 0);
*/
@@ -1226,7 +1226,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) hMenuContact[i] = Menu_AddContactMenuItem(&mi);
}
- nextMetaID = DBGetContactSettingDword(NULL,META_PROTO,"NextMetaID",(DWORD)0);
+ nextMetaID = db_get_dw(NULL,META_PROTO,"NextMetaID",(DWORD)0);
// attemp to subsume userinfo...(returning 1 does not prevent dialog - so disabled)
//hHooks[] = (HANDLE)HookEvent(ME_USERINFO_INITIALISE, Meta_UserInfo);
@@ -1236,7 +1236,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) HANDLE hContact = db_find_first();
int meta_id;
while ( hContact != NULL ) {
- if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
Meta_CopyData(hContact);
}
hContact = db_find_next(hContact);
@@ -1323,7 +1323,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { if ((caps & PF1_IMSEND) || (caps & PF1_CHAT) || (proto && strcmp(proto, "IRC") == 0)) {
// set default contact for sending/status and open message window
- DBWriteContactSettingDword((HANDLE)wParam, META_PROTO, "Default", (DWORD)(int)lParam);
+ db_set_dw((HANDLE)wParam, META_PROTO, "Default", (DWORD)(int)lParam);
NotifyEventHooks(hEventDefaultChanged, wParam, (LPARAM)hContact);
CallService(MS_MSG_SENDMESSAGE, wParam, 0);
} else
@@ -1354,7 +1354,7 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam) char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1399,7 +1399,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) { char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1432,7 +1432,7 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) { char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = DBGetContactSettingDword(AI->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(AI->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1468,7 +1468,7 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) { char *proto = 0;
DWORD default_contact_number;
- if ((default_contact_number = DBGetContactSettingDword(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(ccs->hContact,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact
// (this should normally not happen, since linked contacts do not appear on the list.)
@@ -1562,15 +1562,15 @@ INT_PTR Meta_OnOff(WPARAM wParam, LPARAM lParam) { CLISTMENUITEM mi;
mi.cbSize = sizeof(CLISTMENUITEM);
// just write to db - the rest is handled in the Meta_SettingChanged function
- if (DBGetContactSettingByte(0, META_PROTO, "Enabled", 1)) {
- DBWriteContactSettingByte(0, META_PROTO, "Enabled", 0);
+ if (db_get_b(0, META_PROTO, "Enabled", 1)) {
+ db_set_b(0, META_PROTO, "Enabled", 0);
// modify main mi item
mi.flags = CMIM_NAME | CMIM_ICON;
mi.hIcon = LoadIconEx(I_MENU);
mi.pszName = "Toggle MetaContacts On";
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuOnOff, (LPARAM)&mi);
} else {
- DBWriteContactSettingByte(0, META_PROTO, "Enabled", 1);
+ db_set_b(0, META_PROTO, "Enabled", 1);
// modify main mi item
mi.flags = CMIM_NAME | CMIM_ICON;
mi.hIcon = LoadIconEx(I_MENUOFF);
diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp index 8df0479440..3160e67543 100644 --- a/plugins/MetaContacts/src/meta_utils.cpp +++ b/plugins/MetaContacts/src/meta_utils.cpp @@ -36,7 +36,7 @@ INT_PTR MyDBWriteContactSetting(HANDLE hContact, const char *szModule, const cha return CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&dcws);
}
-INT_PTR MyDBGetContactSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
+INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) {
static BOOL strsvc, strsvcset = FALSE;
memset(dbv, 0, sizeof(DBVARIANT));
@@ -45,14 +45,14 @@ INT_PTR MyDBGetContactSetting(HANDLE hContact, const char *szModule, const char // preserve unicode strings - this service should return other data types unchanged
if (strsvc) return DBGetContactSettingW(hContact, szModule, szSetting, dbv);
- return DBGetContactSetting(hContact, szModule, szSetting, dbv);
+ return db_get(hContact, szModule, szSetting, dbv);
}
int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id) {
DWORD res = 1;
int i;
if (dbv->type == id->type)
- { // If the id parameter and the value returned by the DBGetContactSetting
+ { // If the id parameter and the value returned by the db_get
// are the same, this is the correct HANDLE, return it.
switch(dbv->type)
{
@@ -115,72 +115,62 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) field = (char *)CallProtoService(protocol,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
hUser = db_find_first();
- while(hUser)
- { // Scan the database and retrieve the field for each contact
- if (!DBGetContactSetting(hUser,protocol,field,&dbv))
- {
- if (dbv.type == id->type)
- { // If the id parameter and the value returned by the DBGetContactSetting
+ while(hUser) {
+ // Scan the database and retrieve the field for each contact
+ if (!db_get(hUser,protocol,field,&dbv)) {
+ if (dbv.type == id->type) {
+ // If the id parameter and the value returned by the db_get
// are the same, this is the correct HANDLE, return it.
- switch(dbv.type)
- {
- case DBVT_DELETED:
- break;
- case DBVT_BYTE:
- if (dbv.bVal == id->bVal)
- return hUser;
- break;
- case DBVT_WORD:
- if (dbv.wVal == id->wVal)
- return hUser;
- break;
- case DBVT_DWORD:
- if (dbv.dVal == id->dVal)
- return hUser;
- break;
- case DBVT_ASCIIZ:
- case DBVT_UTF8:
- if (!strcmp(dbv.pszVal,id->pszVal))
- {
- DBFreeVariant(&dbv);
- return hUser;
- }
- else
- {
- DBFreeVariant(&dbv);
- break;
- }
- case DBVT_WCHAR:
- if (!wcscmp(dbv.pwszVal,id->pwszVal))
- {
- DBFreeVariant(&dbv);
+ switch(dbv.type) {
+ case DBVT_DELETED:
+ break;
+ case DBVT_BYTE:
+ if (dbv.bVal == id->bVal)
+ return hUser;
+ break;
+ case DBVT_WORD:
+ if (dbv.wVal == id->wVal)
+ return hUser;
+ break;
+ case DBVT_DWORD:
+ if (dbv.dVal == id->dVal)
+ return hUser;
+ break;
+ case DBVT_ASCIIZ:
+ case DBVT_UTF8:
+ if (!strcmp(dbv.pszVal,id->pszVal)) {
+ db_free(&dbv);
+ return hUser;
+ }
+ db_free(&dbv);
+ break;
+
+ case DBVT_WCHAR:
+ if (!wcscmp(dbv.pwszVal,id->pwszVal)) {
+ db_free(&dbv);
+ return hUser;
+ }
+ db_free(&dbv);
+ break;
+
+ case DBVT_BLOB:
+ if (dbv.cpbVal == id->cpbVal) {
+ for (i=dbv.cpbVal;res && i<=0;i--)
+ res = (dbv.pbVal[i] == id->pbVal[i]);
+ if (res) {
+ db_free(&dbv);
return hUser;
}
- else
- {
- DBFreeVariant(&dbv);
- break;
- }
- case DBVT_BLOB:
- if (dbv.cpbVal == id->cpbVal)
- {
- for (i=dbv.cpbVal;res && i<=0;i--)
- res = (dbv.pbVal[i] == id->pbVal[i]);
- if (res)
- {
- DBFreeVariant(&dbv);
- return hUser;
- }
- }
- DBFreeVariant(&dbv);
- break;
+ }
+ db_free(&dbv);
+ break;
} // end switch
- } else
- DBFreeVariant(&dbv);
- } // end if (!DBGetContactSetting(hUser,protocol,field,&dbv))
+ }
+ else db_free(&dbv);
+ }
// This contact wasn't the good one, go to the next.
hUser = db_find_next(hUser);
- } // end while
+ }
return NULL;
}
@@ -203,29 +193,29 @@ int Meta_SetNick(char *proto) ci.szProto = proto;
if (CallService(MS_CONTACT_GETCONTACTINFO,0,(LPARAM)&ci))
return 1;
- switch(ci.type)
- {
- case CNFT_BYTE:
- if (DBWriteContactSettingByte(NULL,META_PROTO,"Nick",ci.bVal))
- return 1;
- break;
- case CNFT_WORD:
- if (DBWriteContactSettingWord(NULL,META_PROTO,"Nick",ci.wVal))
- return 1;
- break;
- case CNFT_DWORD:
- if (DBWriteContactSettingDword(NULL,META_PROTO,"Nick",ci.dVal))
- return 1;
- break;
- case CNFT_ASCIIZ:
- if (DBWriteContactSettingString(NULL,META_PROTO,"Nick",ci.pszVal))
- return 1;
- mir_free(ci.pszVal);
- break;
- default:
- if (DBWriteContactSettingString(NULL,META_PROTO,"Nick",(char *)Translate("Sender")))
- return 1;
- break;
+
+ switch(ci.type) {
+ case CNFT_BYTE:
+ if ( db_set_b(NULL,META_PROTO,"Nick",ci.bVal))
+ return 1;
+ break;
+ case CNFT_WORD:
+ if ( db_set_w(NULL,META_PROTO,"Nick",ci.wVal))
+ return 1;
+ break;
+ case CNFT_DWORD:
+ if ( db_set_dw(NULL,META_PROTO,"Nick",ci.dVal))
+ return 1;
+ break;
+ case CNFT_ASCIIZ:
+ if ( db_set_s(NULL,META_PROTO,"Nick",ci.pszVal))
+ return 1;
+ mir_free(ci.pszVal);
+ break;
+ default:
+ if ( db_set_s(NULL,META_PROTO,"Nick",(char *)Translate("Sender")))
+ return 1;
+ break;
}
return 0;
}
@@ -249,11 +239,11 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) WORD status;
HANDLE most_online;
- if ((metaID=DBGetContactSettingDword(dest,META_PROTO,META_ID,(DWORD)-1))==-1) {
+ if ((metaID=db_get_dw(dest,META_PROTO,META_ID,(DWORD)-1))==-1) {
MessageBox(0, Translate("Could not get MetaContact id"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
- if ((num_contacts=DBGetContactSettingDword(dest,META_PROTO,"NumContacts",(DWORD)-1))==-1) {
+ if ((num_contacts=db_get_dw(dest,META_PROTO,"NumContacts",(DWORD)-1))==-1) {
MessageBox(0, Translate("Could not retreive MetaContact contact count"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -264,22 +254,22 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) // Get the login of the subcontact
field = (char *)CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
- if (DBGetContactSetting(src,proto,field,&cws.value)) {
+ if ( db_get(src,proto,field,&cws.value)) {
MessageBox(0, Translate("Could not get unique id of contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Check that is is 'on the list'
- if (DBGetContactSettingByte(src, "CList", "NotOnList", 0) == 1) {
+ if ( db_get_b(src, "CList", "NotOnList", 0) == 1) {
MessageBox(0, Translate("Contact is 'Not on List' - please add the contact to your contact list before assigning."), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
return FALSE;
}
num_contacts++;
if (num_contacts >= MAX_CONTACTS) {
MessageBox(0, Translate("MetaContact is full"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
return FALSE;
}
@@ -287,9 +277,9 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) strcpy(buffer, "Protocol");
strcat(buffer, _itoa((int)(num_contacts -1), buffer2, 10));
- if (DBWriteContactSettingString(dest, META_PROTO, buffer, proto)) {
+ if ( db_set_s(dest, META_PROTO, buffer, proto)) {
MessageBox(0, Translate("Could not write contact protocol to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
return FALSE;
}
@@ -300,16 +290,16 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) cws.szModule=META_PROTO;
cws.szSetting=buffer;
- if (CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)dest,(LPARAM)&cws)) {
+ if ( CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)dest,(LPARAM)&cws)) {
MessageBox(0, Translate("Could not write unique id of contact to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
return FALSE;
}
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
// If we can get the nickname of the subcontact...
- if (!DBGetContactSetting(src,proto,"Nick",&cws.value)) {
+ if (!db_get(src,proto,"Nick",&cws.value)) {
// write the nickname
strcpy(buffer, "Nick");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
@@ -322,7 +312,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) return FALSE;
}
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
}
{
@@ -337,19 +327,19 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) if (wname && strncmp(name, (char *)wname, strlen(name)) != 0) {
DBWriteContactSettingWString(dest, META_PROTO, buffer, wname);
} else
- DBWriteContactSettingString(dest, META_PROTO, buffer, name);
+ db_set_s(dest, META_PROTO, buffer, name);
// Get the status
if (!proto)
status = ID_STATUS_OFFLINE;
else
- status = DBGetContactSettingWord(src, proto, "Status", ID_STATUS_OFFLINE);
+ status = db_get_w(src, proto, "Status", ID_STATUS_OFFLINE);
}
// write the status
strcpy(buffer, "Status");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
- if (DBWriteContactSettingWord(dest, META_PROTO, buffer, status)) {
+ if (db_set_w(dest, META_PROTO, buffer, status)) {
MessageBox(0, Translate("Could not write contact status to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -357,7 +347,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) // write the handle
strcpy(buffer, "Handle");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
- if (DBWriteContactSettingDword(dest, META_PROTO, buffer, (DWORD)src)) {
+ if (db_set_dw(dest, META_PROTO, buffer, (DWORD)src)) {
MessageBox(0, Translate("Could not write contact handle to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
@@ -366,41 +356,41 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) strcpy(buffer, "StatusString");
strcat(buffer, _itoa((int)(num_contacts - 1), buffer2, 10));
Meta_GetStatusString(status, buffer2, 512);
- if (DBWriteContactSettingString(dest, META_PROTO, buffer, buffer2)) {
+ if (db_set_s(dest, META_PROTO, buffer, buffer2)) {
MessageBox(0, Translate("Could not write contact status string to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Write the link in the contact
- if (DBWriteContactSettingDword(src,META_PROTO,META_LINK,metaID)) {
+ if (db_set_dw(src,META_PROTO,META_LINK,metaID)) {
MessageBox(0, Translate("Could not write MetaContact id to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Write the contact number in the contact
- if (DBWriteContactSettingDword(src,META_PROTO,"ContactNumber",(DWORD)(num_contacts - 1))) {
+ if (db_set_dw(src,META_PROTO,"ContactNumber",(DWORD)(num_contacts - 1))) {
MessageBox(0, Translate("Could not write MetaContact contact number to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// Write the handle in the contact
- if (DBWriteContactSettingDword(src,META_PROTO,"Handle",(DWORD)dest)) {
+ if (db_set_dw(src,META_PROTO,"Handle",(DWORD)dest)) {
MessageBox(0, Translate("Could not write MetaContact contact number to contact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
// update count of contacts
- if (DBWriteContactSettingDword(dest,META_PROTO,"NumContacts",num_contacts)) {
+ if (db_set_dw(dest,META_PROTO,"NumContacts",num_contacts)) {
MessageBox(0, Translate("Could not write contact count to MetaContact"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING);
return FALSE;
}
if (set_as_default) {
- DBWriteContactSettingDword(dest, META_PROTO, "Default", (WORD)(num_contacts - 1));
+ db_set_dw(dest, META_PROTO, "Default", (WORD)(num_contacts - 1));
NotifyEventHooks(hEventDefaultChanged, (WPARAM)dest, (LPARAM)src);
}
- DBWriteContactSettingByte(src, META_PROTO, "IsSubcontact", 1);
+ db_set_b(src, META_PROTO, "IsSubcontact", 1);
// set nick to most online contact that can message
most_online = Meta_GetMostOnline(dest);
Meta_CopyContactNick(dest, most_online);
@@ -440,7 +430,6 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) return TRUE;
}
-
/**
* Convenience method - get most online contact supporting messaging
*
@@ -464,7 +453,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca char *proto, *most_online_proto;
// you can't get more online than having the default contact ONLINE - so check that first
- if ((default_contact_number = DBGetContactSettingDword(hMeta,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
+ if ((default_contact_number = db_get_dw(hMeta,META_PROTO,"Default",(DWORD)-1)) == (DWORD)-1)
{
// This is a simple contact - return NULL to signify error.
// (this should normally not happen, since all meta contacts have a default contact)
@@ -472,7 +461,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca }
// if the default is beyond the end of the list (eek!) return null
- if (default_contact_number >= (num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", 0)))
+ if (default_contact_number >= (num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", 0)))
return NULL;
most_online_contact = Meta_GetContactHandle(hMeta, default_contact_number);
@@ -480,11 +469,11 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
// we are forced to do use default for sending - '-1' capability indicates no specific capability, but respect 'Force Default'
- if (proto && DBGetContactSettingByte(hMeta, META_PROTO, "ForceDefault", 0) && capability != 0 && (capability == -1 || (caps & capability) == capability)) // capability is 0 when we're working out status
+ if (proto && db_get_b(hMeta, META_PROTO, "ForceDefault", 0) && capability != 0 && (capability == -1 || (caps & capability) == capability)) // capability is 0 when we're working out status
return most_online_contact;
// a subcontact is being temporarily 'forced' to do sending
- if ((most_online_contact = (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, "ForceSend", 0))) {
+ if ((most_online_contact = (HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0))) {
caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
if (proto && (caps & capability) == capability && capability != 0) // capability is 0 when we're working out status
@@ -497,7 +486,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0;
if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
if (proto && (capability == -1 || (caps & capability) == capability)) {
- most_online_status = DBGetContactSettingWord(most_online_contact, proto, "Status", ID_STATUS_OFFLINE);
+ most_online_status = db_get_w(most_online_contact, proto, "Status", ID_STATUS_OFFLINE);
// if our default is not offline, and option to use default is set - return default
// and also if our default is online, return it
@@ -525,7 +514,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM;
if (proto && (capability == -1 || (caps & capability) == capability)) {
- status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
+ status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
if (status == ID_STATUS_ONLINE) {
most_online_contact = hContact;
@@ -545,7 +534,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca // no online contacts? if we're trying to message, use 'send offline' contact
if (most_online_status == ID_STATUS_OFFLINE && capability == PF1_IM) {
- HANDLE hOffline = Meta_GetContactHandle(hMeta, DBGetContactSettingDword(hMeta, META_PROTO, "OfflineSend", (DWORD)-1));
+ HANDLE hOffline = Meta_GetContactHandle(hMeta, db_get_dw(hMeta, META_PROTO, "OfflineSend", (DWORD)-1));
if (hOffline)
most_online_contact = hOffline;
}
@@ -554,7 +543,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca }
int Meta_GetContactNumber(HANDLE hContact) {
- return DBGetContactSettingDword(hContact, META_PROTO, "ContactNumber", -1);
+ return db_get_dw(hContact, META_PROTO, "ContactNumber", -1);
}
BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) {
@@ -578,8 +567,8 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { }
void copy_settings_array(HANDLE hMeta, char *module, const char *settings[], int num_settings) {
- int num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", (DWORD)-1),
- default_contact = DBGetContactSettingDword(hMeta, META_PROTO, "Default", (DWORD)-1),
+ int num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", (DWORD)-1),
+ default_contact = db_get_dw(hMeta, META_PROTO, "Default", (DWORD)-1),
most_online = Meta_GetContactNumber(Meta_GetMostOnline(hMeta));
HANDLE hContact;
@@ -608,27 +597,27 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { if (hContact) {
if (!module) {
used_mod = GetContactProto(hContact);
- if (!used_mod) continue; // next contact
- } else
- used_mod = module;
-
- if (j == 0 && strcmp(settings[i], "MirVer") == 0) { //Always reset MirVer
- DBDeleteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i]);
+ if (!used_mod)
+ continue; // next contact
}
+ else used_mod = module;
+
+ if (j == 0 && strcmp(settings[i], "MirVer") == 0) //Always reset MirVer
+ db_unset(hMeta, (module ? used_mod : META_PROTO), settings[i]);
- got_val = !MyDBGetContactSetting(hContact, used_mod, settings[i], &dbv2);
+ got_val = !Mydb_get(hContact, used_mod, settings[i], &dbv2);
if (got_val) {
- free = !MyDBGetContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv1);
+ free = !Mydb_get(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv1);
if (strcmp(settings[i], "MirVer") == 0) {
- if (DBGetContactSettingWord(hContact, used_mod, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
+ if (db_get_w(hContact, used_mod, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) {
if (!free || (dbv1.pszVal == NULL || strcmp(dbv1.pszVal, "") == 0 || strlen(dbv1.pszVal) < 2)) {
MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
bDataWritten = TRUE; //only break if found something to copy
}
}
-
- } else {
+ }
+ else {
if (!free || !dbv_same(&dbv1, &dbv2)) {
MyDBWriteContactSetting(hMeta, (module ? used_mod : META_PROTO), settings[i], &dbv2);
if (dbv2.type == DBVT_ASCIIZ || dbv2.type == DBVT_UTF8) {
@@ -644,8 +633,8 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { bDataWritten = TRUE;
}
- DBFreeVariant(&dbv2);
- if (free)DBFreeVariant(&dbv1);
+ db_free(&dbv2);
+ if (free)db_free(&dbv1);
}
}
}
@@ -680,17 +669,17 @@ const char *MBirthdaySettings[3] = // copy from first subcontact with any of these values that has the same status as the most online contact
// proto:
// clist: "StatusMsg"
-void CopyStatusData(HANDLE hMeta) {
- int num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", (DWORD)-1),
- most_online = Meta_GetContactNumber(Meta_GetMostOnline(hMeta));
- WORD status = DBGetContactSettingWord(hMeta, META_PROTO, "Status", ID_STATUS_OFFLINE);
+
+void CopyStatusData(HANDLE hMeta)
+{
+ int num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", (DWORD)-1),
+ most_online = Meta_GetContactNumber(Meta_GetMostOnline(hMeta));
+ WORD status = db_get_w(hMeta, META_PROTO, "Status", ID_STATUS_OFFLINE);
HANDLE hContact;
DBVARIANT dbv;
- char *proto;
BOOL bDoneStatus = FALSE, bDoneXStatus = FALSE;
- int i;
- for (i = 0; i < num_contacts; i++) {
+ for (int i = 0; i < num_contacts; i++) {
if (i == 0)
hContact = Meta_GetContactHandle(hMeta, most_online);
else if (i <= most_online)
@@ -698,26 +687,26 @@ void CopyStatusData(HANDLE hMeta) { else
hContact = Meta_GetContactHandle(hMeta, i);
- proto = GetContactProto(hContact);
+ char *proto = GetContactProto(hContact);
- if (proto && DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE) == status) {
- if (!bDoneStatus && !MyDBGetContactSetting(hContact, "CList", "StatusMsg", &dbv)) {
+ if (proto && db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE) == status) {
+ if (!bDoneStatus && !Mydb_get(hContact, "CList", "StatusMsg", &dbv)) {
MyDBWriteContactSetting(hMeta, "CList", "StatusMsg", &dbv);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
bDoneStatus = TRUE;
}
- if ((!bDoneXStatus) && (!MyDBGetContactSetting(hContact, proto, "XStatusId", &dbv)) && dbv.type != DBVT_DELETED) {
- DBWriteContactSettingString(hMeta, META_PROTO, "XStatusProto", proto);
+ if ((!bDoneXStatus) && (!Mydb_get(hContact, proto, "XStatusId", &dbv)) && dbv.type != DBVT_DELETED) {
+ db_set_s(hMeta, META_PROTO, "XStatusProto", proto);
MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusId", &dbv);
- DBFreeVariant(&dbv);
- if (!MyDBGetContactSetting(hContact, proto, "XStatusMsg", &dbv)) {
+ db_free(&dbv);
+ if (!Mydb_get(hContact, proto, "XStatusMsg", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusMsg", &dbv);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
- if (!MyDBGetContactSetting(hContact, proto, "XStatusName", &dbv)) {
+ if (!Mydb_get(hContact, proto, "XStatusName", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, "XStatusName", &dbv);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
bDoneXStatus = TRUE;
}
@@ -726,15 +715,16 @@ void CopyStatusData(HANDLE hMeta) { if (bDoneStatus && bDoneXStatus) break;
}
- if (!bDoneStatus) DBDeleteContactSetting(hMeta, "CList", "StatusMsg");
+ if (!bDoneStatus) db_unset(hMeta, "CList", "StatusMsg");
if (!bDoneXStatus) {
- DBDeleteContactSetting(hMeta, META_PROTO, "XStatusId");
- DBDeleteContactSetting(hMeta, META_PROTO, "XStatusMsg");
- DBDeleteContactSetting(hMeta, META_PROTO, "XStatusName");
+ db_unset(hMeta, META_PROTO, "XStatusId");
+ db_unset(hMeta, META_PROTO, "XStatusMsg");
+ db_unset(hMeta, META_PROTO, "XStatusName");
}
}
-void Meta_CopyData(HANDLE hMeta) {
+void Meta_CopyData(HANDLE hMeta)
+{
if (options.copydata) {
CopyStatusData(hMeta);
@@ -748,16 +738,16 @@ void Meta_CopyData(HANDLE hMeta) { }
-HANDLE Meta_GetContactHandle(HANDLE hMeta, int contact_number) {
+HANDLE Meta_GetContactHandle(HANDLE hMeta, int contact_number)
+{
char buffer[512], buffer2[512];
- int num_contacts = DBGetContactSettingDword(hMeta, META_PROTO, "NumContacts", 0);
+ int num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", 0);
if (contact_number >= num_contacts || contact_number < 0) return 0;
strcpy(buffer, "Handle");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- return (HANDLE)DBGetContactSettingDword(hMeta, META_PROTO, buffer, 0);
-
+ return (HANDLE)db_get_dw(hMeta, META_PROTO, buffer, 0);
}
int Meta_SetHandles(void) {
@@ -768,14 +758,14 @@ int Meta_SetHandles(void) { BOOL found;
while ( hContact != NULL ) {
- if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) {
// is a subcontact
// get nick for debug messages
strcpy(nick_buffer, "meta_id: ");
strcat(nick_buffer, _itoa(meta_id, buffer2, 10));
- contact_number = DBGetContactSettingDword(hContact, META_PROTO, "ContactNumber", (DWORD)-1);
+ contact_number = db_get_dw(hContact, META_PROTO, "ContactNumber", (DWORD)-1);
strcat(nick_buffer, ", contact num: ");
strcat(nick_buffer, _itoa(contact_number, buffer2, 10));
@@ -791,7 +781,7 @@ int Meta_SetHandles(void) { }
// ensure the window open flag is not present
- DBDeleteContactSetting(hContact, META_PROTO, "WindowOpen");
+ db_unset(hContact, META_PROTO, "WindowOpen");
// find metacontact
@@ -799,22 +789,22 @@ int Meta_SetHandles(void) { hContact2 = db_find_first();
while ( hContact2 != NULL ) {
- if (DBGetContactSettingDword(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
+ if (db_get_dw(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
found = TRUE;
// set handle
- DBWriteContactSettingDword(hContact, META_PROTO, "Handle", (DWORD)hContact2);
+ db_set_dw(hContact, META_PROTO, "Handle", (DWORD)hContact2);
// increment contact counter (cleared in Load function)
- DBWriteContactSettingByte(hContact2, META_PROTO, "ContactCountCheck",
- (unsigned char)(DBGetContactSettingByte(hContact2, META_PROTO, "ContactCountCheck", 0) + 1));
+ db_set_b(hContact2, META_PROTO, "ContactCountCheck",
+ (unsigned char)(db_get_b(hContact2, META_PROTO, "ContactCountCheck", 0) + 1));
- num_contacts = DBGetContactSettingDword(hContact2, META_PROTO, "NumContacts", (DWORD)-1);
+ num_contacts = db_get_dw(hContact2, META_PROTO, "NumContacts", (DWORD)-1);
if (contact_number >= 0 && contact_number < num_contacts) {
// set metacontact's handle to us
strcpy(buffer, "Handle");
strcat(buffer, _itoa((int)contact_number, buffer2, 10));
- DBWriteContactSettingDword(hContact2, META_PROTO, buffer, (DWORD)hContact);
+ db_set_dw(hContact2, META_PROTO, buffer, (DWORD)hContact);
} else {
char buff[256];
// problem - contact number is greater than meta's number of contacts
@@ -837,12 +827,12 @@ int Meta_SetHandles(void) { MessageBox(0, Translate("Subcontact's MetaContact not found - deleting MetaContact data"), nick_buffer, MB_OK | MB_ICONERROR);
// delete meta data
- DBDeleteContactSetting(hContact,META_PROTO,"IsSubcontact");
- DBDeleteContactSetting(hContact,META_PROTO,META_LINK);
- DBDeleteContactSetting(hContact,META_PROTO,"Handle");
- DBDeleteContactSetting(hContact,META_PROTO,"ContactNumber");
+ db_unset(hContact,META_PROTO,"IsSubcontact");
+ db_unset(hContact,META_PROTO,META_LINK);
+ db_unset(hContact,META_PROTO,"Handle");
+ db_unset(hContact,META_PROTO,"ContactNumber");
Meta_RestoreGroup(hContact);
- DBDeleteContactSetting(hContact,META_PROTO,"OldCListGroup");
+ db_unset(hContact,META_PROTO,"OldCListGroup");
CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)META_FILTER);
// stop ignoring, if we were
@@ -850,14 +840,14 @@ int Meta_SetHandles(void) { CallService(MS_IGNORE_UNIGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
} else {
- if (!DBGetContactSettingByte(hContact, META_PROTO, "IsSubcontact", 0))
- DBWriteContactSettingByte(hContact, META_PROTO, "IsSubcontact", 1);
+ if (!db_get_b(hContact, META_PROTO, "IsSubcontact", 0))
+ db_set_b(hContact, META_PROTO, "IsSubcontact", 1);
}
} else
- DBDeleteContactSetting(hContact, META_PROTO, "Handle");
+ db_unset(hContact, META_PROTO, "Handle");
- if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
// is a metacontact
// get nick for debug messages
@@ -865,11 +855,11 @@ int Meta_SetHandles(void) { strcat(nick_buffer, _itoa(meta_id, buffer2, 10));
// ensure the window open flag is not present
- DBDeleteContactSetting(hContact, META_PROTO, "WindowOpen");
+ db_unset(hContact, META_PROTO, "WindowOpen");
// ensure default is reasonable
- contact_number = DBGetContactSettingDword(hContact, META_PROTO, "Default", -1);
- num_contacts = DBGetContactSettingDword(hContact, META_PROTO, "NumContacts", (DWORD)-1);
+ contact_number = db_get_dw(hContact, META_PROTO, "Default", -1);
+ num_contacts = db_get_dw(hContact, META_PROTO, "NumContacts", (DWORD)-1);
if (num_contacts < 0) {
// problem
@@ -900,13 +890,13 @@ int Meta_SetHandles(void) { // loop through one more time - check contact counts match
hContact = db_find_first();
while ( hContact != NULL ) {
- if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1))!=(DWORD)-1) {
// get nick for debug messages
strcpy(nick_buffer, Translate("MetaId: "));
strcat(nick_buffer, _itoa(meta_id, buffer2, 10));
- num_contacts = DBGetContactSettingByte(hContact, META_PROTO, "ContactCountCheck", -2);
- if (num_contacts != (DWORD)DBGetContactSettingDword(hContact, META_PROTO, "NumContacts", (DWORD)-1)) {
+ num_contacts = db_get_b(hContact, META_PROTO, "ContactCountCheck", -2);
+ if (num_contacts != (DWORD)db_get_dw(hContact, META_PROTO, "NumContacts", (DWORD)-1)) {
// mismatch
//if (MessageBox(0, Translate("MetaContact corrupted - the number of subcontacts is incorrect.\nDelete MetaContact?"), nick_buffer, MB_YESNO | MB_ICONERROR) == IDYES) {
// Meta_Delete((WPARAM)hContact, (LPARAM)1); // second param prevents confirm dialog
@@ -962,7 +952,7 @@ int Meta_HideLinkedContacts(void) { while ( hContact != NULL ) {
- if ((meta_id = DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) {
+ if ((meta_id = db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1))!=(DWORD)-1) {
// is a subcontact
// * ensure filter present
@@ -971,7 +961,7 @@ int Meta_HideLinkedContacts(void) { // get contact number
- contact_number = DBGetContactSettingDword(hContact, META_PROTO, "ContactNumber", (DWORD)-1);
+ contact_number = db_get_dw(hContact, META_PROTO, "ContactNumber", (DWORD)-1);
// prepare to update metacontact record of subcontat status
proto = GetContactProto(hContact);
@@ -983,42 +973,42 @@ int Meta_HideLinkedContacts(void) { hContact2 = db_find_first();
while ( hContact2 != NULL ) {
- if (DBGetContactSettingDword(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
- num_contacts = DBGetContactSettingDword(hContact2, META_PROTO, "NumContacts", (DWORD)-1);
+ if (db_get_dw(hContact2,META_PROTO,META_ID,(DWORD)-1) == meta_id) {
+ num_contacts = db_get_dw(hContact2, META_PROTO, "NumContacts", (DWORD)-1);
if (contact_number >= 0 && contact_number < num_contacts) {
if (!proto)
status = ID_STATUS_OFFLINE;
else
- status = DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE);
+ status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
// update metacontact's record of status for this contact
strcpy(buffer, "Status");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- DBWriteContactSettingWord(hContact2, META_PROTO, buffer, status);
+ db_set_w(hContact2, META_PROTO, buffer, status);
// update metacontact's record of nick for this contact
- if (proto && !DBGetContactSetting(hContact, proto, "Nick", &dbv)) {
+ if (proto && !db_get(hContact, proto, "Nick", &dbv)) {
strcpy(buffer, "Nick");
strcat(buffer, _itoa(contact_number, buffer2, 10));
MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
- if (DBGetContactSetting(hContact, "CList", "MyHandle", &dbv2)) {
+ if (db_get(hContact, "CList", "MyHandle", &dbv2)) {
MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
} else {
MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv2);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else {
- if (!DBGetContactSetting(hContact, "CList", "MyHandle", &dbv)) {
+ if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
strcpy(buffer, "CListName");
strcat(buffer, _itoa(contact_number, buffer2, 10));
MyDBWriteContactSetting(hContact2, META_PROTO, buffer, &dbv);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -1037,7 +1027,7 @@ int Meta_HideLinkedContacts(void) { // do metacontacts after handles set properly above
hContact = db_find_first();
while ( hContact != NULL ) {
- if (DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
// is a meta contact
HANDLE hMostOnline = Meta_GetMostOnline(hContact); // set nick
Meta_CopyContactNick(hContact, hMostOnline);
@@ -1060,7 +1050,7 @@ int Meta_UnhideLinkedContacts(void) { HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
- if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
// has a link - unhide it
// restore old group
Meta_RestoreGroup(hContact);
@@ -1082,15 +1072,15 @@ int Meta_HideMetaContacts(int hide) { else Meta_SuppressStatus(options.suppress_status);
while ( hContact != NULL ) {
- if (DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
// is a meta contact
if (hide)
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
else
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
- } else if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ } else if (db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
// when metacontacts are hidden, show subcontacts, and vice versa
if (hide) {
Meta_RestoreGroup(hContact);
@@ -1116,20 +1106,20 @@ void Meta_RestoreGroup(HANDLE hContact) { // show it anyway - users are reporting contacts removed from meta remain 'hidden'
// possible suspect - server side groups cause hidden group hack to fail, users hide contacts via clist->delete->hide option
- DBDeleteContactSetting(hContact, META_PROTO, "Hidden");
+ db_unset(hContact, META_PROTO, "Hidden");
- if (DBGetContactSettingByte(hContact, META_PROTO, "Hidden", 0) == 1)
+ if (db_get_b(hContact, META_PROTO, "Hidden", 0) == 1)
{
// if we hid it, unhide it
- DBDeleteContactSetting(hContact, META_PROTO, "Hidden");
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, META_PROTO, "Hidden");
+ db_unset(hContact, "CList", "Hidden");
} else {
DBCONTACTWRITESETTING cws;
- if (!DBGetContactSetting(hContact, META_PROTO, "OldCListGroup", &cws.value)) {
+ if (!db_get(hContact, META_PROTO, "OldCListGroup", &cws.value)) {
if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) {
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
} else {
int hGroup = 1;
char *name = 0;
@@ -1148,32 +1138,32 @@ void Meta_RestoreGroup(HANDLE hContact) { cws.szSetting = "Group";
CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
} else {
- //DBDeleteContactSetting(hContact, "CList", "Group");
+ //db_unset(hContact, "CList", "Group");
// put back into metacontact's group
DBVARIANT dbv;
- HANDLE hMeta = (HANDLE)DBGetContactSettingDword(hContact, META_PROTO, "Handle", 0);
- if (hMeta && !MyDBGetContactSetting(hMeta, "CList", "Group", &dbv)) {
+ HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0);
+ if (hMeta && !Mydb_get(hMeta, "CList", "Group", &dbv)) {
MyDBWriteContactSetting(hContact, "CList", "Group", &dbv);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} else
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
}
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
}
- DBDeleteContactSetting(hContact, META_PROTO, "OldCListGroup");
+ db_unset(hContact, META_PROTO, "OldCListGroup");
- if (!DBGetContactSetting(hContact, "CList", "Group", &cws.value)) {
+ if (!db_get(hContact, "CList", "Group", &cws.value)) {
if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) {
- DBDeleteContactSetting(hContact, "CList", "Group");
+ db_unset(hContact, "CList", "Group");
}
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
}
}
// show it anyway - users are reporting contacts removed from meta remain 'hidden'
// possible suspect - server side groups cause hidden group hack to fail, users hide contacts via clist->delete->hide option
- DBDeleteContactSetting(hContact, "CList", "Hidden");
+ db_unset(hContact, "CList", "Hidden");
}
void Meta_SetGroup(HANDLE hContact) {
@@ -1190,12 +1180,12 @@ void Meta_SetGroup(HANDLE hContact) { if (proto && uid && (INT_PTR)uid != CALLSERVICE_NOTFOUND && !strcmp(JABBER_UNIQUE_ID_SETTING, uid)) {
// if it's a jabber contact, hide it, and record the fact that it was us who did
- DBWriteContactSettingByte(hContact, META_PROTO, "Hidden", 1);
- DBWriteContactSettingByte(hContact, "CList", "Hidden", 1);
+ db_set_b(hContact, META_PROTO, "Hidden", 1);
+ db_set_b(hContact, "CList", "Hidden", 1);
} else {
DBCONTACTWRITESETTING cws;
// save old group and move to invisible group (i.e. non-existent group)
- if (!MyDBGetContactSetting(hContact, "CList", "Group", &cws.value)) {
+ if (!Mydb_get(hContact, "CList", "Group", &cws.value)) {
if ((cws.value.type == DBVT_ASCIIZ || cws.value.type == DBVT_UTF8) && !strcmp(cws.value.pszVal, META_HIDDEN_GROUP)) {
// it's already in the group (shouldn't be - but maybe a crash)
} else {
@@ -1203,11 +1193,11 @@ void Meta_SetGroup(HANDLE hContact) { cws.szSetting = "OldCListGroup";
CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws);
}
- DBFreeVariant(&cws.value);
+ db_free(&cws.value);
} else
- DBDeleteContactSetting(hContact, META_PROTO, "OldCListGroup");
+ db_unset(hContact, META_PROTO, "OldCListGroup");
- DBWriteContactSettingString(hContact, "CList", "Group", META_HIDDEN_GROUP);
+ db_set_s(hContact, "CList", "Group", META_HIDDEN_GROUP);
}
}
@@ -1256,7 +1246,7 @@ int Meta_SuppressStatus(BOOL suppress) { HANDLE hContact = db_find_first();
while ( hContact != NULL ) {
- if (DBGetContactSettingDword(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact,META_PROTO,META_LINK,(DWORD)-1)!=(DWORD)-1) {
// is a subcontact
if (suppress)
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, (WPARAM)IGNOREEVENT_USERONLINE);
@@ -1282,16 +1272,16 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { //proto = GetContactProto(hContact);
// read proto direct from db, since we do this on load and other proto plugins may not be loaded yet
- if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv_proto)) {
+ if (!db_get(hContact, "Protocol", "p", &dbv_proto)) {
proto = dbv_proto.pszVal;
if (options.clist_contact_name == CNNT_NICK && proto) {
- if (!MyDBGetContactSetting(hContact, proto, "Nick", &dbv)) {
+ if (!Mydb_get(hContact, proto, "Nick", &dbv)) {
MyDBWriteContactSetting(hMeta, META_PROTO, "Nick", &dbv);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
//CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)hMeta, 0);
//CallService(MS_CLUI_CONTACTRENAMED, (WPARAM)hMeta, 0);
- DBFreeVariant(&dbv_proto);
+ db_free(&dbv_proto);
return 0;
}
} else if (options.clist_contact_name == CNNT_DISPLAYNAME) {
@@ -1306,14 +1296,14 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { MyDBWriteContactSetting(hMeta, META_PROTO, "Nick", &dbv);
} else
- DBWriteContactSettingString(hMeta, META_PROTO, "Nick", name);
+ db_set_s(hMeta, META_PROTO, "Nick", name);
//CallService(MS_CLIST_INVALIDATEDISPLAYNAME, (WPARAM)hMeta, 0);
//CallService(MS_CLUI_CONTACTRENAMED, (WPARAM)hMeta, 0);
- DBFreeVariant(&dbv_proto);
+ db_free(&dbv_proto);
return 0;
}
}
- DBFreeVariant(&dbv_proto);
+ db_free(&dbv_proto);
}
return 1;
}
@@ -1322,7 +1312,7 @@ int Meta_SetAllNicks() { HANDLE hContact = db_find_first(), most_online;
while ( hContact != NULL ) {
- if (DBGetContactSettingDword(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
+ if (db_get_dw(hContact,META_PROTO,META_ID,(DWORD)-1)!=(DWORD)-1) {
most_online = Meta_GetMostOnline(hContact);
Meta_CopyContactNick(hContact, most_online);
Meta_FixStatus(hContact);
@@ -1353,15 +1343,15 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff1, _itoa(contact_number1, buff12, 10));
strcpy(buff2, "Protocol");
strcat(buff2, _itoa(contact_number2, buff22, 10));
- ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
- ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
+ ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
+ ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
// swap the status
@@ -1369,15 +1359,15 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff1, _itoa(contact_number1, buff12, 10));
strcpy(buff2, "Status");
strcat(buff2, _itoa(contact_number2, buff22, 10));
- ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
- ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
+ ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
+ ok1 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
// swap the status string
@@ -1385,15 +1375,15 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff1, _itoa(contact_number1, buff12, 10));
strcpy(buff2, "StatusString");
strcat(buff2, _itoa(contact_number2, buff22, 10));
- ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
- ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
+ ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
+ ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
// swap the login
@@ -1401,17 +1391,17 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff1, _itoa(contact_number1, buff12, 10));
strcpy(buff2, "Login");
strcat(buff2, _itoa(contact_number2, buff22, 10));
- ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
- ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
+ ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
+ ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
- DBDeleteContactSetting(hMeta, META_PROTO, buff2);
+ db_unset(hMeta, META_PROTO, buff2);
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
}
if (ok2) {
- DBDeleteContactSetting(hMeta, META_PROTO, buff1);
+ db_unset(hMeta, META_PROTO, buff1);
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
}
// swap the nick
@@ -1419,19 +1409,19 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff1, _itoa(contact_number1, buff12, 10));
strcpy(buff2, "Nick");
strcat(buff2, _itoa(contact_number2, buff22, 10));
- ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
- ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
+ ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
+ ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
} else {
- DBDeleteContactSetting(hMeta, META_PROTO, buff2);
+ db_unset(hMeta, META_PROTO, buff2);
}
if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
} else {
- DBDeleteContactSetting(hMeta, META_PROTO, buff1);
+ db_unset(hMeta, META_PROTO, buff1);
}
// swap the clist name
@@ -1439,19 +1429,19 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff1, _itoa(contact_number1, buff12, 10));
strcpy(buff2, "CListName");
strcat(buff2, _itoa(contact_number2, buff22, 10));
- ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
- ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
+ ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
+ ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
} else {
- DBDeleteContactSetting(hMeta, META_PROTO, buff2);
+ db_unset(hMeta, META_PROTO, buff2);
}
if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
} else {
- DBDeleteContactSetting(hMeta, META_PROTO, buff1);
+ db_unset(hMeta, META_PROTO, buff1);
}
// swap the handle
@@ -1459,24 +1449,24 @@ int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2 strcat(buff1, _itoa(contact_number1, buff12, 10));
strcpy(buff2, "Handle");
strcat(buff2, _itoa(contact_number2, buff22, 10));
- ok1 = !MyDBGetContactSetting(hMeta, META_PROTO, buff1, &dbv1);
- ok2 = !MyDBGetContactSetting(hMeta, META_PROTO, buff2, &dbv2);
+ ok1 = !Mydb_get(hMeta, META_PROTO, buff1, &dbv1);
+ ok2 = !Mydb_get(hMeta, META_PROTO, buff2, &dbv2);
if (ok1) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff2, &dbv1);
- DBFreeVariant(&dbv1);
+ db_free(&dbv1);
} else {
- DBDeleteContactSetting(hMeta, META_PROTO, buff2);
+ db_unset(hMeta, META_PROTO, buff2);
}
if (ok2) {
MyDBWriteContactSetting(hMeta, META_PROTO, buff1, &dbv2);
- DBFreeVariant(&dbv2);
+ db_free(&dbv2);
} else {
- DBDeleteContactSetting(hMeta, META_PROTO, buff1);
+ db_unset(hMeta, META_PROTO, buff1);
}
// finally, inform the contacts of their change in position
- DBWriteContactSettingDword(hContact1, META_PROTO, "ContactNumber", (DWORD)contact_number2);
- DBWriteContactSettingDword(hContact2, META_PROTO, "ContactNumber", (DWORD)contact_number1);
+ db_set_dw(hContact1, META_PROTO, "ContactNumber", (DWORD)contact_number2);
+ db_set_dw(hContact2, META_PROTO, "ContactNumber", (DWORD)contact_number1);
return 0;
}
@@ -1655,7 +1645,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { field = (char *)CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0);
if (!field) return 0;
- DBGetContactSetting(hContact,proto,field,&dbv);
+ db_get(hContact,proto,field,&dbv);
switch(dbv.type)
{
case DBVT_ASCIIZ:
@@ -1673,7 +1663,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { default:
sprintf(buff,"bugger this");
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
strncpy(id + used, buff, 256 - used);
if (used) {
@@ -1689,16 +1679,16 @@ void Meta_FixStatus(HANDLE hMeta) { if (most_online) {
char *proto = GetContactProto(most_online);
if (proto) {
- WORD status = (WORD)DBGetContactSettingWord(most_online, proto, "Status", (WORD)ID_STATUS_OFFLINE);
- DBWriteContactSettingWord(hMeta, META_PROTO, "Status", status);
+ WORD status = (WORD)db_get_w(most_online, proto, "Status", (WORD)ID_STATUS_OFFLINE);
+ db_set_w(hMeta, META_PROTO, "Status", status);
}
- else DBWriteContactSettingWord(hMeta, META_PROTO, "Status", (WORD)ID_STATUS_OFFLINE);
+ else db_set_w(hMeta, META_PROTO, "Status", (WORD)ID_STATUS_OFFLINE);
}
- else DBWriteContactSettingWord(hMeta, META_PROTO, "Status", (WORD)ID_STATUS_OFFLINE);
+ else db_set_w(hMeta, META_PROTO, "Status", (WORD)ID_STATUS_OFFLINE);
}
INT_PTR Meta_IsEnabled() {
- return DBGetContactSettingByte(0, META_PROTO, "Enabled", 1) && (meta_group_hack_disabled || DBGetContactSettingByte(NULL, "CList", "UseGroups", 1));
+ return db_get_b(0, META_PROTO, "Enabled", 1) && (meta_group_hack_disabled || db_get_b(NULL, "CList", "UseGroups", 1));
}
diff --git a/plugins/MetaContacts/src/metacontacts.h b/plugins/MetaContacts/src/metacontacts.h index 00eae31bda..5312bdb4ba 100644 --- a/plugins/MetaContacts/src/metacontacts.h +++ b/plugins/MetaContacts/src/metacontacts.h @@ -221,7 +221,7 @@ INT_PTR MetaAPI_DisableHiddenGroup(WPARAM wParam, LPARAM lParam); // extended db get/write setting functions, that handle unicode
INT_PTR MyDBWriteContactSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
-INT_PTR MyDBGetContactSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
+INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv);
// IcoLib support
void InitIcons(void);
|