summaryrefslogtreecommitdiff
path: root/plugins/SimpleAR/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SimpleAR/src')
-rw-r--r--plugins/SimpleAR/src/Main.cpp54
-rw-r--r--plugins/SimpleAR/src/Options.cpp24
2 files changed, 39 insertions, 39 deletions
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp
index 5888a54353..c3f4337efb 100644
--- a/plugins/SimpleAR/src/Main.cpp
+++ b/plugins/SimpleAR/src/Main.cpp
@@ -79,8 +79,8 @@ INT_PTR Toggle(WPARAM w, LPARAM l)
{
HANDLE hContact = (HANDLE)w;
BOOL on = 0;
- on = !DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0);
- DBWriteContactSettingByte(hContact, protocolname, "TurnedOn", on ? 1 : 0);
+ on = !db_get_b(hContact, protocolname, "TurnedOn", 0);
+ db_set_b(hContact, protocolname, "TurnedOn", on ? 1 : 0);
on = on?0:1;
CLISTMENUITEM mi = { sizeof(mi) };
@@ -97,7 +97,7 @@ INT OnPreBuildContactMenu(WPARAM w, LPARAM l)
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- BOOL on = !DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0);
+ BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0);
mi.ptszName = on ? LPGENT("Turn off Autoanswer") : LPGENT("Turn on Autoanswer");
mi.hIcon = on?LoadIcon(hinstance, MAKEINTRESOURCE(IDI_OFF)):LoadIcon(hinstance, MAKEINTRESOURCE(IDI_ON));
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hToggle, (LPARAM)&mi);
@@ -112,14 +112,14 @@ INT CheckDefaults(WPARAM, LPARAM)
UnhookEvent(hCheckDefHook);
- fEnabled=!DBGetContactSettingByte(NULL,protocolname,KEY_ENABLED,1)==1;
- interval=DBGetContactSettingWord(NULL,protocolname,KEY_REPEATINTERVAL,300);
+ fEnabled=!db_get_b(NULL,protocolname,KEY_ENABLED,1)==1;
+ interval=db_get_w(NULL,protocolname,KEY_REPEATINTERVAL,300);
- if (DBGetContactSettingTString(NULL,protocolname,KEY_HEADING,&dbv))
+ if (db_get_ts(NULL,protocolname,KEY_HEADING,&dbv))
// Heading not set
- DBWriteContactSettingTString(NULL,protocolname,KEY_HEADING,TranslateT("Dear %user%, the owner left the following message:"));
+ db_set_ts(NULL,protocolname,KEY_HEADING,TranslateT("Dear %user%, the owner left the following message:"));
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
for (int c=ID_STATUS_ONLINE; c<ID_STATUS_IDLE; c++)
{
@@ -128,7 +128,7 @@ INT CheckDefaults(WPARAM, LPARAM)
continue;
else
{
- if (DBGetContactSettingTString(NULL,protocolname,szStatus,&dbv))
+ if (db_get_ts(NULL,protocolname,szStatus,&dbv))
{
if (c < 40077)
// This mode does not have a preset message
@@ -136,10 +136,10 @@ INT CheckDefaults(WPARAM, LPARAM)
else if(c > 40078)
ptszDefault=ptszDefaultMsg[c-ID_STATUS_ONLINE-3];
if (ptszDefault)
- DBWriteContactSettingTString(NULL,protocolname,szStatus,ptszDefault);
+ db_set_ts(NULL,protocolname,szStatus,ptszDefault);
}
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
hPreBuildHook = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu);
@@ -209,46 +209,46 @@ INT addEvent(WPARAM wParam, LPARAM lParam)
if (!dbei.cbBlob) /// invalid size
return FALSE;
- if (DBGetContactSettingTString(hContact,"Protocol","p",&dbv))
+ if (db_get_ts(hContact,"Protocol","p",&dbv))
// Contact with no protocol ?!!
return FALSE;
else
- DBFreeVariant(&dbv);
+ db_free(&dbv);
- if(DBGetContactSettingByte(hContact, "CList", "NotOnList", 0))
+ if(db_get_b(hContact, "CList", "NotOnList", 0))
return FALSE;
- if(DBGetContactSettingByte(hContact, protocolname, "TurnedOn", 0))
+ if(db_get_b(hContact, protocolname, "TurnedOn", 0))
return FALSE;
if (!( dbei.flags & DBEF_SENT))
{
- int timeBetween=time(NULL)-DBGetContactSettingDword(hContact,protocolname,"LastReplyTS",0);
- if (timeBetween>interval || DBGetContactSettingWord(hContact,protocolname,"LastStatus",0)!=status)
+ int timeBetween=time(NULL)-db_get_dw(hContact,protocolname,"LastReplyTS",0);
+ if (timeBetween>interval || db_get_w(hContact,protocolname,"LastStatus",0)!=status)
{
char szStatus[6]={0};
int msgLen=1;
- int isQun=DBGetContactSettingByte(hContact,pszProto,"IsQun",0);
+ int isQun=db_get_b(hContact,pszProto,"IsQun",0);
if (isQun)
return FALSE;
mir_snprintf(szStatus,SIZEOF(szStatus),"%d",status);
- if (!DBGetContactSettingTString(NULL,protocolname,szStatus,&dbv))
+ if (!db_get_ts(NULL,protocolname,szStatus,&dbv))
{
if (*dbv.ptszVal)
{
DBVARIANT dbvHead={0}, dbvNick={0};
TCHAR *ptszTemp, *ptszTemp2;
- DBGetContactSettingTString(hContact,pszProto,"Nick",&dbvNick);
+ db_get_ts(hContact,pszProto,"Nick",&dbvNick);
if (lstrcmp(dbvNick.ptszVal, NULL) == 0)
{
- DBFreeVariant(&dbvNick);
+ db_free(&dbvNick);
return FALSE;
}
msgLen += (int)_tcslen(dbv.ptszVal);
- if (!DBGetContactSettingTString(NULL,protocolname,KEY_HEADING,&dbvHead))
+ if (!db_get_ts(NULL,protocolname,KEY_HEADING,&dbvHead))
{
ptszTemp = (TCHAR*)mir_alloc(sizeof(TCHAR) * (_tcslen(dbvHead.ptszVal)+1));
_tcscpy(ptszTemp, dbvHead.ptszVal);
@@ -284,17 +284,17 @@ INT addEvent(WPARAM wParam, LPARAM lParam)
mir_free(ptszTemp2);
mir_free(pszUtf);
if (dbvNick.ptszVal)
- DBFreeVariant(&dbvNick);
+ db_free(&dbvNick);
if (dbvHead.ptszVal)
- DBFreeVariant(&dbvHead);
+ db_free(&dbvHead);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
- DBWriteContactSettingDword(hContact,protocolname,"LastReplyTS",time(NULL));
- DBWriteContactSettingWord(hContact,protocolname,"LastStatus",status);
+ db_set_dw(hContact,protocolname,"LastReplyTS",time(NULL));
+ db_set_w(hContact,protocolname,"LastStatus",status);
}
return 0;
}
diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp
index e53236d22c..41a0a5f1f0 100644
--- a/plugins/SimpleAR/src/Options.cpp
+++ b/plugins/SimpleAR/src/Options.cpp
@@ -14,13 +14,13 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
TCHAR* pszStatus;
char tszStatus[6]={0};
- CheckDlgButton(hwndDlg,IDC_ENABLEREPLIER,DBGetContactSettingByte(NULL,protocolname,KEY_ENABLED,1)==1);
- SetDlgItemInt(hwndDlg,IDC_INTERVAL,DBGetContactSettingWord(NULL,protocolname,KEY_REPEATINTERVAL,300)/60,FALSE);
+ CheckDlgButton(hwndDlg,IDC_ENABLEREPLIER,db_get_b(NULL,protocolname,KEY_ENABLED,1)==1);
+ SetDlgItemInt(hwndDlg,IDC_INTERVAL,db_get_w(NULL,protocolname,KEY_REPEATINTERVAL,300)/60,FALSE);
- if (!DBGetContactSettingTString(NULL,protocolname,KEY_HEADING,&dbv))
+ if (!db_get_ts(NULL,protocolname,KEY_HEADING,&dbv))
{
SetDlgItemText(hwndDlg,IDC_HEADING,dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
for (INT c = ID_STATUS_ONLINE; c < ID_STATUS_IDLE; c++)
@@ -33,13 +33,13 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
{
SendDlgItemMessage(hwndDlg,IDC_STATUSMODE,CB_ADDSTRING,0,(LPARAM)pszStatus);
- if (!DBGetContactSettingTString(NULL, protocolname, tszStatus, &dbv))
+ if (!db_get_ts(NULL, protocolname, tszStatus, &dbv))
{
if (c < 40077)
ptszMessage[c-ID_STATUS_ONLINE-1] = _tcsdup(dbv.ptszVal);
else if (c > 40078)
ptszMessage[c-ID_STATUS_ONLINE-3] = _tcsdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
}
@@ -93,15 +93,15 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
BOOL translated;
fEnabled=IsDlgButtonChecked(hwndDlg,IDC_ENABLEREPLIER)==1;
- DBWriteContactSettingByte(NULL,protocolname,KEY_ENABLED,(BYTE)fEnabled);
+ db_set_b(NULL,protocolname,KEY_ENABLED,(BYTE)fEnabled);
GetDlgItemText(hwndDlg,IDC_HEADING,ptszText,SIZEOF(ptszText));
- DBWriteContactSettingTString(NULL,protocolname,KEY_HEADING,ptszText);
+ db_set_ts(NULL,protocolname,KEY_HEADING,ptszText);
size=GetDlgItemInt(hwndDlg,IDC_INTERVAL,&translated,FALSE);
if (translated)
interval=size*60;
- DBWriteContactSettingWord(NULL,protocolname,KEY_REPEATINTERVAL,interval);
+ db_set_w(NULL,protocolname,KEY_REPEATINTERVAL,interval);
size=SendDlgItemMessage(hwndDlg,IDC_MESSAGE,WM_GETTEXTLENGTH,0,0)+1;
GetDlgItemText(hwndDlg,IDC_MESSAGE,ptszMessage[lastIndex],size);
@@ -115,11 +115,11 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
mir_snprintf(szStatus,SIZEOF(szStatus),"%d",c);
if (c<40077 && ptszMessage[c-ID_STATUS_ONLINE-1])
- DBWriteContactSettingTString(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-1]);
+ db_set_ts(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-1]);
else if (c>40078 && ptszMessage[c-ID_STATUS_ONLINE-3])
- DBWriteContactSettingTString(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-3]);
+ db_set_ts(NULL,protocolname,szStatus,ptszMessage[c-ID_STATUS_ONLINE-3]);
else
- DBDeleteContactSetting(NULL,protocolname,szStatus);
+ db_unset(NULL,protocolname,szStatus);
}
}
return TRUE;