diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-17 15:06:11 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-17 15:06:11 +0000 |
commit | 82ae452fff08430d514f762f49e78fec90f88625 (patch) | |
tree | 184c31c029a364eec13b58d060d20ba85b2a20bc | |
parent | 15267ea2d489606fb4b99d011bc3ea7c2a644a9f (diff) |
- rest of memory leaks
- code cleaning;
git-svn-id: http://svn.miranda-ng.org/main/trunk@4078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
35 files changed, 723 insertions, 847 deletions
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp index 7869c8d416..dacdfda235 100644 --- a/plugins/CryptoPP/src/main.cpp +++ b/plugins/CryptoPP/src/main.cpp @@ -89,34 +89,34 @@ extern "C" __declspec(dllexport) int Unload() BOOL ExtractFileFromResource( HANDLE FH, int ResType, int ResId, DWORD* Size )
{
- HRSRC RH;
- PBYTE RP;
- DWORD s,x;
-
- RH = FindResource( g_hInst, MAKEINTRESOURCE( ResId ), MAKEINTRESOURCE( ResType ) );
-
- if ( RH == NULL ) return FALSE;
- RP = (PBYTE) LoadResource( g_hInst, RH );
- if ( RP == NULL ) return FALSE;
- s = SizeofResource( g_hInst, RH );
- if ( !WriteFile( FH, RP, s, &x, NULL ) ) return FALSE;
- if ( x != s ) return FALSE;
- if ( Size ) *Size = s;
- return TRUE;
+ HRSRC RH = FindResource(g_hInst, MAKEINTRESOURCE(ResId), MAKEINTRESOURCE(ResType));
+ if ( RH == NULL )
+ return FALSE;
+
+ PBYTE RP = (PBYTE) LoadResource( g_hInst, RH );
+ if ( RP == NULL )
+ return FALSE;
+
+ DWORD x, s = SizeofResource(g_hInst, RH);
+ if ( !WriteFile(FH, RP, s, &x, NULL)) return FALSE;
+ if (x != s) return FALSE;
+ if (Size) *Size = s;
+ return TRUE;
}
-
-void ExtractFile( char *FileName, int ResType, int ResId )
+void ExtractFile(char *FileName, int ResType, int ResId)
{
- HANDLE FH;
- FH = CreateFile( FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
- if ( FH == INVALID_HANDLE_VALUE ) return;
- if (!ExtractFileFromResource( FH, ResType, ResId, NULL )) MessageBoxA(0,"Can't extract","!!!",MB_OK);
+ HANDLE FH = CreateFile( FileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
+ if (FH == INVALID_HANDLE_VALUE)
+ return;
+
+ if (!ExtractFileFromResource( FH, ResType, ResId, NULL ))
+ MessageBoxA(0,"Can't extract","!!!",MB_OK);
CloseHandle( FH );
}
-
-size_t rtrim(LPCSTR str) {
+size_t rtrim(LPCSTR str)
+{
size_t len = strlen(str);
LPSTR ptr = (LPSTR)str+len-1;
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index d0ed93e550..1affca7df3 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -44,13 +44,12 @@ void LoadActions() { sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE,0), "General/Dismiss popup", 0},
{ sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_COPY,0), "General/Copy to clipboard", 0},
-//remove popup action
+ //remove popup action
#if defined(_DEBUG)
{ sizeof(POPUPACTION), IcoLib_GetIcon(ICO_POPUP_ON,0), "Popup Plus/Test action", PAF_ENABLED},
{ sizeof(POPUPACTION), IcoLib_GetIcon(ICO_ACT_CLOSE,0), "Popup Plus/Second test action", 0},
{ sizeof(POPUPACTION), LoadSkinnedIcon(SKINICON_OTHER_MIRANDA), "Popup Plus/One more action", PAF_ENABLED},
#endif
-
};
for (int i=0; i < SIZEOF(actions); ++i)
@@ -59,26 +58,23 @@ void LoadActions() void UnloadActions()
{
-// for (int i=0; i < gActions.getCount(); ++i)
-// delete gActions[i];
+ for (int i=0; i < gActions.getCount(); ++i)
+ delete gActions[i];
gActions.destroy();
}
void RegisterAction(POPUPACTION *action)
{
int index;
- if ((index = gActions.getIndex(action)) >= 0)
- {
+ if ((index = gActions.getIndex(action)) >= 0) {
DWORD flags = gActions[index]->flags;
*gActions[index] = *action;
gActions[index]->flags = flags;
- } else
- {
- POPUPACTION *actionCopy = (POPUPACTION *)mir_alloc(sizeof(POPUPACTION));
+ }
+ else {
+ POPUPACTION *actionCopy = new POPUPACTION;
*actionCopy = *action;
- actionCopy->flags =
- DBGetContactSettingByte(NULL, "PopUpActions", actionCopy->lpzTitle, actionCopy->flags & PAF_ENABLED) ?
- PAF_ENABLED : 0;
+ actionCopy->flags = db_get_b(NULL, "PopUpActions", actionCopy->lpzTitle, actionCopy->flags & PAF_ENABLED) ? PAF_ENABLED : 0;
gActions.insert(actionCopy);
}
}
@@ -161,76 +157,73 @@ void LoadOption_Actions() { PopUpOptions.overrideRight = DBGetContactSettingDword(NULL,MODULNAME, "OverrideRight", 0);
}
+static UINT controls[] =
+{
+ IDC_GRP_CUSTOMACTIONS,
+ IDC_TXT_CUSTOMACTIONS,
+ IDC_CHK_IMCONTACTSONLY,
+ IDC_CHK_CONTACTSONLY,
+ IDC_CHK_DONTCLOSE,
+ IDC_GRP_SIZEPOSITION,
+ IDC_CHK_LARGEICONS,
+ IDC_TXT_POSITION,
+ IDC_RD_TEXT,
+ IDC_RD_LEFTICONS,
+ IDC_RD_RIGHTICONS,
+ IDC_GRP_ACTIONS,
+ IDC_ACTIONS,
+ IDC_GRP_SIZEPOSITION2,
+ IDC_TXT_POSITION2,
+ IDC_CB_LEFT,
+ IDC_TXT_MIDDLE,
+ IDC_CB_MIDDLE,
+ IDC_TXT_RIGHT,
+ IDC_CB_RIGHT
+};
+
INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static bool windowInitialized = false;
+ int i;
- static UINT controls[] =
- {
- IDC_GRP_CUSTOMACTIONS,
- IDC_TXT_CUSTOMACTIONS,
- IDC_CHK_IMCONTACTSONLY,
- IDC_CHK_CONTACTSONLY,
- IDC_CHK_DONTCLOSE,
- IDC_GRP_SIZEPOSITION,
- IDC_CHK_LARGEICONS,
- IDC_TXT_POSITION,
- IDC_RD_TEXT,
- IDC_RD_LEFTICONS,
- IDC_RD_RIGHTICONS,
- IDC_GRP_ACTIONS,
- IDC_ACTIONS,
- IDC_GRP_SIZEPOSITION2,
- IDC_TXT_POSITION2,
- IDC_CB_LEFT,
- IDC_TXT_MIDDLE,
- IDC_CB_MIDDLE,
- IDC_TXT_RIGHT,
- IDC_CB_RIGHT
- };
+ switch (msg) {
+ case WM_INITDIALOG:
+ windowInitialized = false;
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- int i;
- windowInitialized = false;
+ TranslateDialogDefault(hwnd);
- TranslateDialogDefault(hwnd);
+ SendMessage(GetDlgItem(hwnd, IDC_ICO_INFO), STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY,0), 0);
- SendMessage(GetDlgItem(hwnd, IDC_ICO_INFO), STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_MISC_NOTIFY,0), 0);
+ CheckDlgButton(hwnd, IDC_CHK_ENABLEACTIONS, PopUpOptions.actions&ACT_ENABLE ? TRUE : FALSE);
+ CheckDlgButton(hwnd, IDC_CHK_IMCONTACTSONLY, PopUpOptions.actions&ACT_DEF_IMONLY ? TRUE : FALSE);
+ CheckDlgButton(hwnd, IDC_CHK_CONTACTSONLY, PopUpOptions.actions&ACT_DEF_NOGLOBAL ? TRUE : FALSE);
+ CheckDlgButton(hwnd, IDC_CHK_DONTCLOSE, PopUpOptions.actions&ACT_DEF_KEEPWND ? TRUE : FALSE);
+ CheckDlgButton(hwnd, IDC_CHK_LARGEICONS, PopUpOptions.actions&ACT_LARGE ? TRUE : FALSE);
+ CheckDlgButton(hwnd, IDC_RD_TEXT, PopUpOptions.actions&ACT_TEXT ? TRUE : FALSE);
+ CheckDlgButton(hwnd, IDC_RD_LEFTICONS, PopUpOptions.actions&ACT_LEFTICONS ? TRUE : FALSE);
+ CheckDlgButton(hwnd, IDC_RD_RIGHTICONS, PopUpOptions.actions&ACT_RIGHTICONS ? TRUE : FALSE);
- CheckDlgButton(hwnd, IDC_CHK_ENABLEACTIONS, PopUpOptions.actions&ACT_ENABLE ? TRUE : FALSE);
- CheckDlgButton(hwnd, IDC_CHK_IMCONTACTSONLY, PopUpOptions.actions&ACT_DEF_IMONLY ? TRUE : FALSE);
- CheckDlgButton(hwnd, IDC_CHK_CONTACTSONLY, PopUpOptions.actions&ACT_DEF_NOGLOBAL ? TRUE : FALSE);
- CheckDlgButton(hwnd, IDC_CHK_DONTCLOSE, PopUpOptions.actions&ACT_DEF_KEEPWND ? TRUE : FALSE);
- CheckDlgButton(hwnd, IDC_CHK_LARGEICONS, PopUpOptions.actions&ACT_LARGE ? TRUE : FALSE);
- CheckDlgButton(hwnd, IDC_RD_TEXT, PopUpOptions.actions&ACT_TEXT ? TRUE : FALSE);
- CheckDlgButton(hwnd, IDC_RD_LEFTICONS, PopUpOptions.actions&ACT_LEFTICONS ? TRUE : FALSE);
- CheckDlgButton(hwnd, IDC_RD_RIGHTICONS, PopUpOptions.actions&ACT_RIGHTICONS ? TRUE : FALSE);
+ {
+ DWORD dwActiveItem = 0;
+ HWND hCombo = GetDlgItem(hwnd, IDC_CB_LEFT);
+ dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideLeft);
+ SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_SETCURSEL, dwActiveItem, 0);
- {
- DWORD dwActiveItem = 0;
- HWND hCombo = GetDlgItem(hwnd, IDC_CB_LEFT);
- dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideLeft);
- SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_SETCURSEL, dwActiveItem, 0);
-
- dwActiveItem = 0;
- hCombo = GetDlgItem(hwnd, IDC_CB_MIDDLE);
- dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideMiddle);
- SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_SETCURSEL, dwActiveItem, 0);
-
- dwActiveItem = 0;
- hCombo = GetDlgItem(hwnd, IDC_CB_RIGHT);
- dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideRight);
- SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_SETCURSEL, dwActiveItem, 0);
- }
+ dwActiveItem = 0;
+ hCombo = GetDlgItem(hwnd, IDC_CB_MIDDLE);
+ dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideMiddle);
+ SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_SETCURSEL, dwActiveItem, 0);
+
+ dwActiveItem = 0;
+ hCombo = GetDlgItem(hwnd, IDC_CB_RIGHT);
+ dwActiveItem = MouseOverride(hCombo, PopUpOptions.overrideRight);
+ SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_SETCURSEL, dwActiveItem, 0);
HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS);
ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES|LVS_EX_LABELTIP);
HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus()? ILC_COLOR32 : ILC_COLOR16), 10, 1);
ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL);
-
+
LVCOLUMN column = {0};
column.mask = LVCF_TEXT|LVCF_WIDTH;
column.pszText = TranslateT("Action");
@@ -242,8 +235,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LIST<char> groups(1, strcmp);
- for (i = 0; i < gActions.getCount(); ++i)
- {
+ for (i = 0; i < gActions.getCount(); ++i) {
char szGroup[64];
char *szName = strchr(gActions[i]->lpzTitle, '/');
if (!szName) szName = gActions[i]->lpzTitle;
@@ -284,129 +276,108 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
groups.destroy();
-
+
BOOL enabled = (PopUpOptions.actions&ACT_ENABLE) ? TRUE : FALSE;
for (i = 0; i < SIZEOF(controls); ++i)
EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
-
- windowInitialized = true;
- break;
}
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
+ windowInitialized = true;
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CHK_ENABLEACTIONS:
+ PopUpOptions.actions &= ~ACT_ENABLE;
+ PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_ENABLEACTIONS) ? ACT_ENABLE : 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
{
- case IDC_CHK_ENABLEACTIONS:
- {
- PopUpOptions.actions &= ~ACT_ENABLE;
- PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_ENABLEACTIONS) ? ACT_ENABLE : 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
-
- BOOL enabled = (PopUpOptions.actions&ACT_ENABLE) ? TRUE : FALSE;
- for (int i=0; i < SIZEOF(controls); ++i)
- EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
- break;
- }
-
- case IDC_CHK_IMCONTACTSONLY:
- PopUpOptions.actions &= ~ACT_DEF_IMONLY;
- PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_IMCONTACTSONLY) ? ACT_DEF_IMONLY : 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- break;
- case IDC_CHK_CONTACTSONLY:
- PopUpOptions.actions &= ~ACT_DEF_NOGLOBAL;
- PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_CONTACTSONLY) ? ACT_DEF_NOGLOBAL : 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- break;
- case IDC_CHK_DONTCLOSE:
- PopUpOptions.actions &= ~ACT_DEF_KEEPWND;
- PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_DONTCLOSE) ? ACT_DEF_KEEPWND : 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- break;
- case IDC_CHK_LARGEICONS:
- PopUpOptions.actions &= ~ACT_LARGE;
- PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_LARGEICONS) ? ACT_LARGE : 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- break;
- case IDC_RD_TEXT:
- PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS);
- PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_ENABLEACTIONS) ? ACT_TEXT : 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- break;
- case IDC_RD_LEFTICONS:
- PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS);
- PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_RD_LEFTICONS) ? ACT_LEFTICONS : 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- break;
- case IDC_RD_RIGHTICONS:
- PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS);
- PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_RD_RIGHTICONS) ? ACT_RIGHTICONS : 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- break;
- case IDC_PREVIEW:
- PopUpPreview();
- break;
- case IDC_CB_LEFT:
- case IDC_CB_MIDDLE:
- case IDC_CB_RIGHT:
- PopUpOptions.overrideLeft = SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_GETITEMDATA,
- SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_GETCURSEL,0,0),0);
- PopUpOptions.overrideMiddle = SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_GETITEMDATA,
- SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_GETCURSEL,0,0),0);
- PopUpOptions.overrideRight = SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETITEMDATA,
- SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETCURSEL,0,0),0);
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- break;
+ BOOL enabled = (PopUpOptions.actions & ACT_ENABLE) ? TRUE : FALSE;
+ for (i=0; i < SIZEOF(controls); ++i)
+ EnableWindow(GetDlgItem(hwnd, controls[i]), enabled);
}
break;
+
+ case IDC_CHK_IMCONTACTSONLY:
+ PopUpOptions.actions &= ~ACT_DEF_IMONLY;
+ PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_IMCONTACTSONLY) ? ACT_DEF_IMONLY : 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+ case IDC_CHK_CONTACTSONLY:
+ PopUpOptions.actions &= ~ACT_DEF_NOGLOBAL;
+ PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_CONTACTSONLY) ? ACT_DEF_NOGLOBAL : 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+ case IDC_CHK_DONTCLOSE:
+ PopUpOptions.actions &= ~ACT_DEF_KEEPWND;
+ PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_DONTCLOSE) ? ACT_DEF_KEEPWND : 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+ case IDC_CHK_LARGEICONS:
+ PopUpOptions.actions &= ~ACT_LARGE;
+ PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_LARGEICONS) ? ACT_LARGE : 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+ case IDC_RD_TEXT:
+ PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS);
+ PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_CHK_ENABLEACTIONS) ? ACT_TEXT : 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+ case IDC_RD_LEFTICONS:
+ PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS);
+ PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_RD_LEFTICONS) ? ACT_LEFTICONS : 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+ case IDC_RD_RIGHTICONS:
+ PopUpOptions.actions &= ~(ACT_TEXT|ACT_LEFTICONS|ACT_RIGHTICONS);
+ PopUpOptions.actions |= IsDlgButtonChecked(hwnd, IDC_RD_RIGHTICONS) ? ACT_RIGHTICONS : 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+ case IDC_PREVIEW:
+ PopUpPreview();
+ break;
+ case IDC_CB_LEFT:
+ case IDC_CB_MIDDLE:
+ case IDC_CB_RIGHT:
+ PopUpOptions.overrideLeft = SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_GETITEMDATA,
+ SendDlgItemMessage(hwnd, IDC_CB_LEFT, CB_GETCURSEL,0,0),0);
+ PopUpOptions.overrideMiddle = SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_GETITEMDATA,
+ SendDlgItemMessage(hwnd, IDC_CB_MIDDLE, CB_GETCURSEL,0,0),0);
+ PopUpOptions.overrideRight = SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETITEMDATA,
+ SendDlgItemMessage(hwnd, IDC_CB_RIGHT, CB_GETCURSEL,0,0),0);
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
}
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ LoadOption_Actions();
+ break;
- case WM_NOTIFY:
- {
- switch (((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_RESET:
- LoadOption_Actions();
- break;
- case PSN_APPLY:
- {
- DBWriteContactSettingDword(NULL, MODULNAME, "Actions", PopUpOptions.actions);
- HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS);
- for (int i=0; i < gActions.getCount(); ++i)
- {
- gActions[i]->flags = (ListView_GetItemState(hwndList, i, LVIS_STATEIMAGEMASK) == 0x2000) ? PAF_ENABLED : 0;
- DBWriteContactSettingByte(NULL, "PopUpActions", gActions[i]->lpzTitle, (gActions[i]->flags&PAF_ENABLED) ? 1 : 0);
- }
- //overrideActions
- DBWriteContactSettingDword(NULL, MODULNAME, "OverrideLeft", PopUpOptions.overrideLeft);
- DBWriteContactSettingDword(NULL, MODULNAME, "OverrideMiddle", PopUpOptions.overrideMiddle);
- DBWriteContactSettingDword(NULL, MODULNAME, "OverrideRight", PopUpOptions.overrideRight);
- break;
- }
- }
- break;
- }
+ case PSN_APPLY:
+ db_set_dw(NULL, MODULNAME, "Actions", PopUpOptions.actions);
+ HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS);
- case IDC_ACTIONS:
- {
- NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- if (windowInitialized &&
- nmlv && nmlv->hdr.code == LVN_ITEMCHANGED && nmlv->uOldState != 0 &&
- (nmlv->uNewState == 0x1000 || nmlv->uNewState == 0x2000))
- {
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
+ for (i=0; i < gActions.getCount(); ++i) {
+ gActions[i]->flags = (ListView_GetItemState(hwndList, i, LVIS_STATEIMAGEMASK) == 0x2000) ? PAF_ENABLED : 0;
+ db_set_b(NULL, "PopUpActions", gActions[i]->lpzTitle, (gActions[i]->flags&PAF_ENABLED) ? 1 : 0);
}
+
+ //overrideActions
+ db_set_dw(NULL, MODULNAME, "OverrideLeft", PopUpOptions.overrideLeft);
+ db_set_dw(NULL, MODULNAME, "OverrideMiddle", PopUpOptions.overrideMiddle);
+ db_set_dw(NULL, MODULNAME, "OverrideRight", PopUpOptions.overrideRight);
}
- break;
}
+ break;
+ case IDC_ACTIONS:
+ NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
+ if (windowInitialized && nmlv && nmlv->hdr.code == LVN_ITEMCHANGED && nmlv->uOldState != 0 && (nmlv->uNewState == 0x1000 || nmlv->uNewState == 0x2000))
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
}
return FALSE;
}
diff --git a/plugins/Popup/src/avatars.cpp b/plugins/Popup/src/avatars.cpp index 059bfa1b97..e7d90a396f 100644 --- a/plugins/Popup/src/avatars.cpp +++ b/plugins/Popup/src/avatars.cpp @@ -37,7 +37,7 @@ PopupAvatar *PopupAvatar::create(HANDLE hContact) if (!_tcsicmp(av->szFilename+_tcslen(av->szFilename)-4, _T(".gif")))
{
// MessageBox(NULL, _T("02"), _T(MODULNAME_LONG), MB_OK);
- if (DBGetContactSettingByte(NULL, MODULNAME, "EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename))
+ if (db_get_b(NULL, MODULNAME, "EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename))
{
// MessageBox(NULL, _T("03"), _T(MODULNAME_LONG), MB_OK);
return new GifAvatar(hContact);
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 1b0ecaee13..d4c88ff200 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -72,7 +72,7 @@ HRESULT (WINAPI *MyDwmEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurB void LoadOptions() {
ZeroMemory(&PopUpOptions, sizeof(PopUpOptions));
#if defined(_DEBUG)
- PopUpOptions.debug = DBGetContactSettingByte(NULL, MODULNAME, "debug", FALSE);
+ PopUpOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE);
#endif
//Load PopUp Options
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 9eb494ad05..be8ba531fb 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -168,7 +168,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp) //The module is enabled.
//The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item.
PopUpOptions.ModuleIsEnabled = FALSE;
- DBWriteContactSettingByte(NULL, MODULNAME, "ModuleIsEnabled", FALSE);
+ db_set_b(NULL, MODULNAME, "ModuleIsEnabled", FALSE);
mi.ptszName = LPGENT("Enable &popup module");
mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF,0);
}
@@ -176,7 +176,7 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM wp, LPARAM lp) //The module is disabled.
//The action to do is enable popups (show enabled), then write "disable popup" in the new item.
PopUpOptions.ModuleIsEnabled = TRUE;
- DBWriteContactSettingByte(NULL, MODULNAME, "ModuleIsEnabled", TRUE);
+ db_set_b(NULL, MODULNAME, "ModuleIsEnabled", TRUE);
mi.ptszName = LPGENT("Disable &popup module");
mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON,0);
}
@@ -352,7 +352,7 @@ MIRAPI int Load(void) CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus);
#if defined(_DEBUG)
- PopUpOptions.debug = DBGetContactSettingByte(NULL, MODULNAME, "debug", FALSE);
+ PopUpOptions.debug = db_get_b(NULL, MODULNAME, "debug", FALSE);
#else
PopUpOptions.debug = false;
#endif
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 5c01266b9f..40b971e160 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -102,7 +102,7 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}enabled",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- DBWriteContactSettingByte(NULL, szModul, setting, ptd->enabled);
+ db_set_b(NULL, szModul, setting, ptd->enabled);
mir_snprintf(setting, sizeof(setting), "{%s/%s}TimeoutVal",
ptd->notification.lpzGroup,
@@ -112,7 +112,7 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}disableWhen",
ptd->notification.lpzGroup,
ptd->notification.lpzName);
- DBWriteContactSettingByte(NULL, szModul, setting, ptd->disableWhen);
+ db_set_b(NULL, szModul, setting, ptd->disableWhen);
mir_snprintf(setting, sizeof(setting), "{%s/%s}leftAction",
ptd->notification.lpzGroup,
@@ -154,7 +154,7 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}enabled", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->enabled =
- (signed char)DBGetContactSettingByte(NULL, szModul, setting, TRUE);
+ (signed char)db_get_b(NULL, szModul, setting, TRUE);
mir_snprintf(setting, sizeof(setting), "{%s/%s}Timeout", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->notification.iSeconds =
@@ -167,7 +167,7 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName);
ptd->disableWhen =
- DBGetContactSettingByte(NULL, szModul, setting, 0);
+ db_get_b(NULL, szModul, setting, 0);
mir_snprintf(setting, sizeof(setting), "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
szTmp = DBGetContactSettingString(NULL, szModul, setting, ptd->notification.lpzLAction);
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 74b023f389..bc2c5db587 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -43,25 +43,25 @@ void OptAdv_UnregisterVfx() { //Main Dialog Proc
void LoadOption_AdvOpts() {
//History
- PopUpOptions.EnableHistory = DBGetContactSettingByte (NULL,MODULNAME, "EnableHistory", TRUE);
+ PopUpOptions.EnableHistory = db_get_b (NULL,MODULNAME, "EnableHistory", TRUE);
PopUpOptions.HistorySize = DBGetContactSettingWord (NULL,MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT);
- PopUpOptions.UseHppHistoryLog = DBGetContactSettingByte (NULL,MODULNAME, "UseHppHistoryLog", TRUE);
+ PopUpOptions.UseHppHistoryLog = db_get_b (NULL,MODULNAME, "UseHppHistoryLog", TRUE);
//Avatars
- PopUpOptions.avatarBorders = DBGetContactSettingByte (NULL,MODULNAME, "AvatarBorders", TRUE);
- PopUpOptions.avatarPNGBorders = DBGetContactSettingByte (NULL,MODULNAME, "AvatarPNGBorders", FALSE);
- PopUpOptions.avatarRadius = DBGetContactSettingByte (NULL,MODULNAME, "AvatarRadius", 2);
+ PopUpOptions.avatarBorders = db_get_b (NULL,MODULNAME, "AvatarBorders", TRUE);
+ PopUpOptions.avatarPNGBorders = db_get_b (NULL,MODULNAME, "AvatarPNGBorders", FALSE);
+ PopUpOptions.avatarRadius = db_get_b (NULL,MODULNAME, "AvatarRadius", 2);
PopUpOptions.avatarSize = DBGetContactSettingWord (NULL,MODULNAME, "AvatarSize", SETTING_AVTSIZE_DEFAULT);
- PopUpOptions.EnableAvatarUpdates = DBGetContactSettingByte (NULL,MODULNAME, "EnableAvatarUpdates", FALSE);
+ PopUpOptions.EnableAvatarUpdates = db_get_b (NULL,MODULNAME, "EnableAvatarUpdates", FALSE);
//Monitor
- PopUpOptions.Monitor = DBGetContactSettingByte (NULL,MODULNAME, "Monitor", SETTING_MONITOR_DEFAULT);
+ PopUpOptions.Monitor = db_get_b (NULL,MODULNAME, "Monitor", SETTING_MONITOR_DEFAULT);
//Transparency
- PopUpOptions.Enable9xTransparency = DBGetContactSettingByte (NULL,MODULNAME, "EnableRegionTransparency", TRUE);
- PopUpOptions.UseTransparency = DBGetContactSettingByte (NULL,MODULNAME, "UseTransparency", TRUE);
- PopUpOptions.Alpha = DBGetContactSettingByte (NULL,MODULNAME, "Alpha", SETTING_ALPHA_DEFAULT);
- PopUpOptions.OpaqueOnHover = DBGetContactSettingByte (NULL,MODULNAME, "OpaqueOnHover", TRUE);
+ PopUpOptions.Enable9xTransparency = db_get_b (NULL,MODULNAME, "EnableRegionTransparency", TRUE);
+ PopUpOptions.UseTransparency = db_get_b (NULL,MODULNAME, "UseTransparency", TRUE);
+ PopUpOptions.Alpha = db_get_b (NULL,MODULNAME, "Alpha", SETTING_ALPHA_DEFAULT);
+ PopUpOptions.OpaqueOnHover = db_get_b (NULL,MODULNAME, "OpaqueOnHover", TRUE);
//Effects
- PopUpOptions.UseAnimations = DBGetContactSettingByte (NULL,MODULNAME, "UseAnimations", TRUE);
- PopUpOptions.UseEffect = DBGetContactSettingByte (NULL,MODULNAME, "Fade", TRUE);
+ PopUpOptions.UseAnimations = db_get_b (NULL,MODULNAME, "UseAnimations", TRUE);
+ PopUpOptions.UseEffect = db_get_b (NULL,MODULNAME, "Fade", TRUE);
PopUpOptions.Effect = (LPTSTR)DBGetContactSettingStringX(NULL,MODULNAME, "Effect", "", DBVT_TCHAR);
PopUpOptions.FadeIn = DBGetContactSettingDword(NULL,MODULNAME, "FadeInTime", SETTING_FADEINTIME_DEFAULT);
PopUpOptions.FadeOut = DBGetContactSettingDword(NULL,MODULNAME, "FadeOutTime",SETTING_FADEOUTTIME_DEFAULT);
@@ -526,30 +526,30 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY:
{
//History
- DBWriteContactSettingByte (NULL,MODULNAME, "EnableHistory", (BYTE)PopUpOptions.EnableHistory);
+ db_set_b (NULL,MODULNAME, "EnableHistory", (BYTE)PopUpOptions.EnableHistory);
DBWriteContactSettingWord (NULL,MODULNAME, "HistorySize", PopUpOptions.HistorySize);
PopupHistoryResize();
- DBWriteContactSettingByte (NULL,MODULNAME, "UseHppHistoryLog", PopUpOptions.UseHppHistoryLog);
+ db_set_b (NULL,MODULNAME, "UseHppHistoryLog", PopUpOptions.UseHppHistoryLog);
//Avatars
- DBWriteContactSettingByte (NULL,MODULNAME, "AvatarBorders", PopUpOptions.avatarBorders);
- DBWriteContactSettingByte (NULL,MODULNAME, "AvatarPNGBorders", PopUpOptions.avatarPNGBorders);
- DBWriteContactSettingByte (NULL,MODULNAME, "AvatarRadius", PopUpOptions.avatarRadius);
+ db_set_b (NULL,MODULNAME, "AvatarBorders", PopUpOptions.avatarBorders);
+ db_set_b (NULL,MODULNAME, "AvatarPNGBorders", PopUpOptions.avatarPNGBorders);
+ db_set_b (NULL,MODULNAME, "AvatarRadius", PopUpOptions.avatarRadius);
DBWriteContactSettingWord (NULL,MODULNAME, "AvatarSize", PopUpOptions.avatarSize);
- DBWriteContactSettingByte (NULL,MODULNAME, "EnableAvatarUpdates", PopUpOptions.EnableAvatarUpdates);
+ db_set_b (NULL,MODULNAME, "EnableAvatarUpdates", PopUpOptions.EnableAvatarUpdates);
//Monitor
- DBWriteContactSettingByte (NULL,MODULNAME, "Monitor", PopUpOptions.Monitor);
+ db_set_b (NULL,MODULNAME, "Monitor", PopUpOptions.Monitor);
//Transparency
- DBWriteContactSettingByte (NULL,MODULNAME, "EnableRegionTransparency", PopUpOptions.Enable9xTransparency);
- DBWriteContactSettingByte (NULL,MODULNAME, "UseTransparency", PopUpOptions.UseTransparency);
- DBWriteContactSettingByte (NULL,MODULNAME, "Alpha", PopUpOptions.Alpha);
- DBWriteContactSettingByte (NULL,MODULNAME, "OpaqueOnHover", PopUpOptions.OpaqueOnHover);
+ db_set_b (NULL,MODULNAME, "EnableRegionTransparency", PopUpOptions.Enable9xTransparency);
+ db_set_b (NULL,MODULNAME, "UseTransparency", PopUpOptions.UseTransparency);
+ db_set_b (NULL,MODULNAME, "Alpha", PopUpOptions.Alpha);
+ db_set_b (NULL,MODULNAME, "OpaqueOnHover", PopUpOptions.OpaqueOnHover);
//Effects
- DBWriteContactSettingByte (NULL,MODULNAME, "UseAnimations", PopUpOptions.UseAnimations);
- DBWriteContactSettingByte (NULL,MODULNAME, "Fade", PopUpOptions.UseEffect);
+ db_set_b (NULL,MODULNAME, "UseAnimations", PopUpOptions.UseAnimations);
+ db_set_b (NULL,MODULNAME, "Fade", PopUpOptions.UseEffect);
DBWriteContactSettingTString(NULL, MODULNAME, "Effect", PopUpOptions.Effect);
- DBWriteContactSettingDword(NULL,MODULNAME, "FadeInTime", PopUpOptions.FadeIn);
- DBWriteContactSettingDword(NULL,MODULNAME, "FadeOutTime", PopUpOptions.FadeOut);
+ db_set_dw(NULL,MODULNAME, "FadeInTime", PopUpOptions.FadeIn);
+ db_set_dw(NULL,MODULNAME, "FadeOutTime", PopUpOptions.FadeOut);
//other old stuff
DBWriteContactSettingWord (NULL,MODULNAME, "MaxPopups", (BYTE)PopUpOptions.MaxPopups);
}
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 246eef9bfa..eb4978b1d6 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -500,7 +500,7 @@ void LoadClassSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "%s/enabled", ptd->pupClass.pszName);
ptd->enabled =
- (signed char)DBGetContactSettingByte(NULL, szModul, setting, TRUE);
+ (signed char)db_get_b(NULL, szModul, setting, TRUE);
mir_snprintf(setting, sizeof(setting), "%s/Timeout", ptd->pupClass.pszName);
ptd->pupClass.iSeconds =
@@ -527,7 +527,7 @@ void SaveClassSettings(POPUPTREEDATA *ptd, char* szModul) char setting[2*MAXMODULELABELLENGTH];
mir_snprintf(setting, sizeof(setting), "%s/enabled", ptd->pupClass.pszName);
- DBWriteContactSettingByte(NULL, szModul, setting, ptd->enabled);
+ db_set_b(NULL, szModul, setting, ptd->enabled);
mir_snprintf(setting, sizeof(setting), "%s/Timeout", ptd->pupClass.pszName);
DBWriteContactSettingWord(NULL, szModul, setting, ptd->pupClass.iSeconds);
diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 46d735dfd4..84e528ea03 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -110,7 +110,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l {
if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0)))
{
- DBWriteContactSettingByte(hContact, MODULNAME, "ShowMode", i);
+ db_set_b(hContact, MODULNAME, "ShowMode", i);
break;
}
}
@@ -146,7 +146,7 @@ static void sttSetAllContactIcons(HWND hwndList) hContact=db_find_next(hContact))
{
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- DWORD dwMode = DBGetContactSettingByte(hContact, MODULNAME, "ShowMode", 0);
+ DWORD dwMode = db_get_b(hContact, MODULNAME, "ShowMode", 0);
for (int i=0; i < 4 /*SIZEOF(sttIcons)*/; ++i)
//hIml element [0] = SKINICON_OTHER_SMALLDOT
//hIml element [1..5] = IcoLib_GetIcon(....) ~ old sttIcons
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 863fdabe4b..9fc6001e8e 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -87,15 +87,15 @@ int AddStatusModes(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flags) //Main Dialog Proc
void LoadOption_General() {
//Seconds
- PopUpOptions.InfiniteDelay = DBGetContactSettingByte(NULL, MODULNAME, "InfiniteDelay", FALSE);
+ PopUpOptions.InfiniteDelay = db_get_b(NULL, MODULNAME, "InfiniteDelay", FALSE);
PopUpOptions.Seconds = DBGetContactSettingRangedWord(NULL, MODULNAME, "Seconds",
SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- PopUpOptions.LeaveHovered = DBGetContactSettingByte(NULL, MODULNAME, "LeaveHovered", TRUE);
+ PopUpOptions.LeaveHovered = db_get_b(NULL, MODULNAME, "LeaveHovered", TRUE);
//Dynamic Resize
- PopUpOptions.DynamicResize = DBGetContactSettingByte(NULL, MODULNAME, "DynamicResize", FALSE);
- PopUpOptions.UseMinimumWidth = DBGetContactSettingByte(NULL, MODULNAME, "UseMinimumWidth", TRUE);
+ PopUpOptions.DynamicResize = db_get_b(NULL, MODULNAME, "DynamicResize", FALSE);
+ PopUpOptions.UseMinimumWidth = db_get_b(NULL, MODULNAME, "UseMinimumWidth", TRUE);
PopUpOptions.MinimumWidth = DBGetContactSettingWord(NULL, MODULNAME, "MinimumWidth", 160);
- PopUpOptions.UseMaximumWidth = DBGetContactSettingByte(NULL, MODULNAME, "UseMaximumWidth", TRUE);
+ PopUpOptions.UseMaximumWidth = db_get_b(NULL, MODULNAME, "UseMaximumWidth", TRUE);
PopUpOptions.MaximumWidth = DBGetContactSettingWord(NULL, MODULNAME, "MaximumWidth", 300);
//Position
PopUpOptions.Position = DBGetContactSettingRangedByte(NULL, MODULNAME, "Position",
@@ -110,11 +110,11 @@ void LoadOption_General() { PopUpOptions.Spreading = DBGetContactSettingRangedByte(NULL, MODULNAME, "Spreading",
SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE);
//miscellaneous
- PopUpOptions.ReorderPopUps = DBGetContactSettingByte(NULL, MODULNAME, "ReorderPopUps", TRUE);
- PopUpOptions.ReorderPopUpsWarning = DBGetContactSettingByte(NULL, MODULNAME, "ReorderPopUpsWarning", TRUE);
+ PopUpOptions.ReorderPopUps = db_get_b(NULL, MODULNAME, "ReorderPopUps", TRUE);
+ PopUpOptions.ReorderPopUpsWarning = db_get_b(NULL, MODULNAME, "ReorderPopUpsWarning", TRUE);
//disable When
- PopUpOptions.ModuleIsEnabled = DBGetContactSettingByte(NULL, MODULNAME, "ModuleIsEnabled", TRUE);
- PopUpOptions.DisableWhenFullscreen = DBGetContactSettingByte(NULL, MODULNAME, "DisableWhenFullscreen", TRUE);
+ PopUpOptions.ModuleIsEnabled = db_get_b(NULL, MODULNAME, "ModuleIsEnabled", TRUE);
+ PopUpOptions.DisableWhenFullscreen = db_get_b(NULL, MODULNAME, "DisableWhenFullscreen", TRUE);
//new status options (done inside WM_INITDIALOG)
//Debug (done inside LoadOptions())
}
@@ -348,7 +348,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
PopUpOptions.ReorderPopUps = !PopUpOptions.ReorderPopUps;
PopUpOptions.ReorderPopUpsWarning = PopUpOptions.ReorderPopUps ?
- DBGetContactSettingByte(NULL, MODULNAME, "ReorderPopUpsWarning", TRUE) : TRUE;
+ db_get_b(NULL, MODULNAME, "ReorderPopUpsWarning", TRUE) : TRUE;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
break;
@@ -513,17 +513,17 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return TRUE;
case PSN_APPLY: {
//Seconds
- DBWriteContactSettingByte(NULL, MODULNAME, "InfiniteDelay", PopUpOptions.InfiniteDelay);
+ db_set_b(NULL, MODULNAME, "InfiniteDelay", PopUpOptions.InfiniteDelay);
DBWriteContactSettingWord(NULL, MODULNAME, "Seconds", (WORD)PopUpOptions.Seconds);
- DBWriteContactSettingByte(NULL, MODULNAME, "LeaveHovered", PopUpOptions.LeaveHovered);
+ db_set_b(NULL, MODULNAME, "LeaveHovered", PopUpOptions.LeaveHovered);
//Dynamic Resize
- DBWriteContactSettingByte(NULL, MODULNAME, "DynamicResize", PopUpOptions.DynamicResize);
- DBWriteContactSettingByte(NULL, MODULNAME, "UseMinimumWidth", PopUpOptions.UseMinimumWidth);
+ db_set_b(NULL, MODULNAME, "DynamicResize", PopUpOptions.DynamicResize);
+ db_set_b(NULL, MODULNAME, "UseMinimumWidth", PopUpOptions.UseMinimumWidth);
DBWriteContactSettingWord(NULL, MODULNAME, "MinimumWidth", PopUpOptions.MinimumWidth);
- DBWriteContactSettingByte(NULL, MODULNAME, "UseMaximumWidth", PopUpOptions.UseMaximumWidth);
+ db_set_b(NULL, MODULNAME, "UseMaximumWidth", PopUpOptions.UseMaximumWidth);
DBWriteContactSettingWord(NULL, MODULNAME, "MaximumWidth", PopUpOptions.MaximumWidth);
//Position
- DBWriteContactSettingByte(NULL, MODULNAME, "Position", (BYTE)PopUpOptions.Position);
+ db_set_b(NULL, MODULNAME, "Position", (BYTE)PopUpOptions.Position);
//Configure popup area
DBWriteContactSettingWord(NULL, MODULNAME, "gapTop", (WORD)PopUpOptions.gapTop);
DBWriteContactSettingWord(NULL, MODULNAME, "gapBottom", (WORD)PopUpOptions.gapBottom);
@@ -531,12 +531,12 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM DBWriteContactSettingWord(NULL, MODULNAME, "gapRight", (WORD)PopUpOptions.gapRight);
DBWriteContactSettingWord(NULL, MODULNAME, "spacing", (WORD)PopUpOptions.spacing);
//Spreading
- DBWriteContactSettingByte(NULL, MODULNAME, "Spreading", (BYTE)PopUpOptions.Spreading);
+ db_set_b(NULL, MODULNAME, "Spreading", (BYTE)PopUpOptions.Spreading);
//miscellaneous
- //DBWriteContactSettingByte(NULL, MODULNAME, "ReorderPopUps", PopUpOptions.ReorderPopUps);
+ //db_set_b(NULL, MODULNAME, "ReorderPopUps", PopUpOptions.ReorderPopUps);
Check_ReorderPopUps(hwnd); //this save also PopUpOptions.ReorderPopUps
//disable When
- DBWriteContactSettingByte(NULL, MODULNAME, "DisableWhenFullscreen", PopUpOptions.DisableWhenFullscreen);
+ db_set_b(NULL, MODULNAME, "DisableWhenFullscreen", PopUpOptions.DisableWhenFullscreen);
//new status options
{
int protocolCount;
@@ -554,7 +554,7 @@ INT_PTR CALLBACK DlgProcPopUpGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
//Debug
#if defined(_DEBUG)
- DBWriteContactSettingByte(NULL, MODULNAME, "debug", PopUpOptions.debug);
+ db_set_b(NULL, MODULNAME, "debug", PopUpOptions.debug);
#endif
}//end PSN_APPLY:
@@ -636,8 +636,8 @@ void Check_ReorderPopUps(HWND hwnd) { return;
}
}
- DBWriteContactSettingByte(NULL, MODULNAME, "ReorderPopUps", PopUpOptions.ReorderPopUps);
- DBWriteContactSettingByte(NULL, MODULNAME, "ReorderPopUpsWarning", PopUpOptions.ReorderPopUpsWarning);
+ db_set_b(NULL, MODULNAME, "ReorderPopUps", PopUpOptions.ReorderPopUps);
+ db_set_b(NULL, MODULNAME, "ReorderPopUpsWarning", PopUpOptions.ReorderPopUpsWarning);
if (hwnd) CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopUpOptions.ReorderPopUps);
}
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 3110a6283b..ab8e518835 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -299,12 +299,12 @@ void LoadOption_Skins() { //skin pack
PopUpOptions.SkinPack = (LPTSTR)DBGetContactSettingStringX(NULL,MODULNAME, "SkinPack", "* Popup Classic",DBVT_TCHAR);
//more Skin options
- PopUpOptions.DisplayTime = DBGetContactSettingByte(NULL,MODULNAME, "DisplayTime", TRUE);
- PopUpOptions.DropShadow = DBGetContactSettingByte(NULL,MODULNAME, "DropShadow", TRUE);
- PopUpOptions.EnableFreeformShadows = DBGetContactSettingByte(NULL,MODULNAME, "EnableShadowRegion", 1);
- PopUpOptions.EnableAeroGlass = DBGetContactSettingByte(NULL,MODULNAME, "EnableAeroGlass", 1);
- PopUpOptions.UseWinColors = DBGetContactSettingByte(NULL,MODULNAME, "UseWinColors", FALSE);
- PopUpOptions.UseMText = DBGetContactSettingByte(NULL,MODULNAME, "UseMText", TRUE);
+ PopUpOptions.DisplayTime = db_get_b(NULL,MODULNAME, "DisplayTime", TRUE);
+ PopUpOptions.DropShadow = db_get_b(NULL,MODULNAME, "DropShadow", TRUE);
+ PopUpOptions.EnableFreeformShadows = db_get_b(NULL,MODULNAME, "EnableShadowRegion", 1);
+ PopUpOptions.EnableAeroGlass = db_get_b(NULL,MODULNAME, "EnableAeroGlass", 1);
+ PopUpOptions.UseWinColors = db_get_b(NULL,MODULNAME, "UseWinColors", FALSE);
+ PopUpOptions.UseMText = db_get_b(NULL,MODULNAME, "UseMText", TRUE);
}
INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -499,11 +499,11 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR skin->saveOpts();
skins.freeAllButActive();
//more Skin options
- DBWriteContactSettingByte(NULL, MODULNAME, "DisplayTime", PopUpOptions.DisplayTime);
- DBWriteContactSettingByte(NULL, MODULNAME, "DropShadow", PopUpOptions.DropShadow);
- DBWriteContactSettingByte(NULL, MODULNAME, "EnableShadowRegion", PopUpOptions.EnableFreeformShadows);
- DBWriteContactSettingByte(NULL, MODULNAME, "EnableAeroGlass", PopUpOptions.EnableAeroGlass);
- DBWriteContactSettingByte(NULL, MODULNAME, "UseMText", PopUpOptions.UseMText);
+ db_set_b(NULL, MODULNAME, "DisplayTime", PopUpOptions.DisplayTime);
+ db_set_b(NULL, MODULNAME, "DropShadow", PopUpOptions.DropShadow);
+ db_set_b(NULL, MODULNAME, "EnableShadowRegion", PopUpOptions.EnableFreeformShadows);
+ db_set_b(NULL, MODULNAME, "EnableAeroGlass", PopUpOptions.EnableAeroGlass);
+ db_set_b(NULL, MODULNAME, "UseMText", PopUpOptions.UseMText);
}//end PSN_APPLY:
return TRUE;
}//switch (((LPNMHDR)lParam)->code)
diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 711a65ab95..13a44268ab 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -153,7 +153,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA switch (message) {
case UTM_STOP_THREAD:
gTerminating = true;
- if (DBGetContactSettingByte(NULL, MODULNAME, "FastExit", 0))
+ if (db_get_b(NULL, MODULNAME, "FastExit", 0))
for (int i=0; i < popupList.getCount(); ++i)
PUDeletePopUp(popupList[i]->getHwnd());
PostQuitMessage(0);
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 02a48befd3..e14ed3bda9 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -624,7 +624,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && isIm && IsActionEnabled("General/Send message")) ++m_actionCount;
if (enableDefaultUsr && IsActionEnabled("General/User details")) ++m_actionCount;
if (enableDefaultUsr && IsActionEnabled("General/Contact menu")) ++m_actionCount;
- if (enableDefaultUsr && DBGetContactSettingByte(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) ++m_actionCount;
+ if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) ++m_actionCount;
if (enableDefaultGen && (m_iTimeout != -1) && IsActionEnabled("General/Pin popup")) ++m_actionCount;
if (enableDefaultGen && IsActionEnabled("General/Dismiss popup")) ++m_actionCount;
if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) ++m_actionCount;
@@ -667,7 +667,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) ++iAction;
}
- if (enableDefaultUsr && DBGetContactSettingByte(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) {
+ if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_ADD,iconSize);
lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Add permanently");
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 9e3c4ca797..befd0638a1 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -177,7 +177,7 @@ INT_PTR PopUp_AddPopUp2(WPARAM wParam, LPARAM lParam) if (ppd->lchContact)
proto = GetContactProto(ppd->lchContact);
- BYTE bShowMode = proto ? DBGetContactSettingByte(ppd->lchContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO) : PU_SHOWMODE_AUTO;
+ BYTE bShowMode = proto ? db_get_b(ppd->lchContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO) : PU_SHOWMODE_AUTO;
if (bShowMode == PU_SHOWMODE_BLOCK)
return -1;
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index d85f8bedfd..cee1bfe592 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -625,7 +625,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o if (textAreaWidth <= 0) textAreaWidth = wnd->getRenderInfo()->realtextw;
drawActionBar(bmp, wnd,
- DBGetContactSettingByte(NULL, MODULNAME, "CenterActions", 0) ?
+ db_get_b(NULL, MODULNAME, "CenterActions", 0) ?
(pos.x + (textAreaWidth - wnd->getRenderInfo()->actw)/2) :
(PopUpOptions.actions&ACT_RIGHTICONS) ?
(pos.x + textAreaWidth - wnd->getRenderInfo()->actw) :
@@ -1269,7 +1269,7 @@ void PopupSkin::saveOpts() const mir_snprintf(buf, sizeof(buf), "skin.%.120S", m_name);
- DBWriteContactSettingDword(NULL, MODULNAME, buf, m_flags);
+ db_set_dw(NULL, MODULNAME, buf, m_flags);
}
void PopupSkin::loadOpts() const
diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 2e289a1fc4..b22785143a 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -88,7 +88,7 @@ static void SrmmMenu_UpdateIcon(HANDLE hContact) {
if (!hContact) return;
- int mode = DBGetContactSettingByte(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO);
+ int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO);
StatusIconData sid = {0};
sid.cbSize = sizeof(sid);
@@ -131,7 +131,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) HANDLE hContact = (HANDLE)wParam;
if (!hContact) return 0;
- int mode = DBGetContactSettingByte(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO);
+ int mode = db_get_b(hContact, MODULNAME, "ShowMode", PU_SHOWMODE_AUTO);
if (sicd->flags&MBCF_RIGHTBUTTON)
{
@@ -148,12 +148,12 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) if (mode)
{
- DBWriteContactSettingByte(hContact, MODULNAME, "ShowMode", mode-1);
+ db_set_b(hContact, MODULNAME, "ShowMode", mode-1);
SrmmMenu_UpdateIcon(hContact);
}
} else
{
- DBWriteContactSettingByte(hContact, MODULNAME, "ShowMode",
+ db_set_b(hContact, MODULNAME, "ShowMode",
(mode == PU_SHOWMODE_AUTO) ? PU_SHOWMODE_BLOCK : PU_SHOWMODE_AUTO);
SrmmMenu_UpdateIcon(hContact);
}
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index f8de40fc35..5895a51b04 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -2,14 +2,12 @@ HINSTANCE g_hInst, g_hIconInst;
-LPCSTR szModuleName = MODULENAME;
LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")";
char TEMP[MAX_PATH];
int TEMP_SIZE = 0;
HANDLE g_hEvent[2], g_hMenu[15], g_hCLIcon=0, g_hFolders=0;
-HANDLE *g_hService=NULL;
-HANDLE *g_hHook=NULL;
+
int iService=0;
int iHook=0;
@@ -76,30 +74,30 @@ int myDBWriteStringEncode(HANDLE hContact,const char *szModule,const char *szSet void GetFlags()
{
- bSFT = db_get_b(0, szModuleName, "sft", 0);
- bSOM = db_get_b(0, szModuleName, "som", 0);
- bASI = db_get_b(0, szModuleName, "asi", 0);
- bMCD = db_get_b(0, szModuleName, "mcd", 0);
- bSCM = db_get_b(0, szModuleName, "scm", 0);
- bDGP = db_get_b(0, szModuleName, "dgp", 0);
- bAIP = db_get_b(0, szModuleName, "aip", 0);
- bNOL = db_get_b(0, szModuleName, "nol", 0);
- bAAK = db_get_b(0, szModuleName, "aak", 0);
- bMCM = db_get_b(0, szModuleName, "mcm", 0);
+ bSFT = db_get_b(0, MODULENAME, "sft", 0);
+ bSOM = db_get_b(0, MODULENAME, "som", 0);
+ bASI = db_get_b(0, MODULENAME, "asi", 0);
+ bMCD = db_get_b(0, MODULENAME, "mcd", 0);
+ bSCM = db_get_b(0, MODULENAME, "scm", 0);
+ bDGP = db_get_b(0, MODULENAME, "dgp", 0);
+ bAIP = db_get_b(0, MODULENAME, "aip", 0);
+ bNOL = db_get_b(0, MODULENAME, "nol", 0);
+ bAAK = db_get_b(0, MODULENAME, "aak", 0);
+ bMCM = db_get_b(0, MODULENAME, "mcm", 0);
}
void SetFlags()
{
- db_set_b(0, szModuleName, "sft", bSFT);
- db_set_b(0, szModuleName, "som", bSOM);
- db_set_b(0, szModuleName, "asi", bASI);
- db_set_b(0, szModuleName, "mcd", bMCD);
- db_set_b(0, szModuleName, "scm", bSCM);
- db_set_b(0, szModuleName, "dgp", bDGP);
- db_set_b(0, szModuleName, "aip", bAIP);
- db_set_b(0, szModuleName, "nol", bNOL);
- db_set_b(0, szModuleName, "aak", bAAK);
- db_set_b(0, szModuleName, "mcm", bMCM);
+ db_set_b(0, MODULENAME, "sft", bSFT);
+ db_set_b(0, MODULENAME, "som", bSOM);
+ db_set_b(0, MODULENAME, "asi", bASI);
+ db_set_b(0, MODULENAME, "mcd", bMCD);
+ db_set_b(0, MODULENAME, "scm", bSCM);
+ db_set_b(0, MODULENAME, "dgp", bDGP);
+ db_set_b(0, MODULENAME, "aip", bAIP);
+ db_set_b(0, MODULENAME, "nol", bNOL);
+ db_set_b(0, MODULENAME, "aak", bAAK);
+ db_set_b(0, MODULENAME, "mcm", bMCM);
}
struct A2U {
@@ -161,8 +159,8 @@ HANDLE hNetlibUser; void InitNetlib()
{
NETLIBUSER nl_user = { sizeof(nl_user) };
- nl_user.szSettingsModule = (LPSTR)szModuleName;
- nl_user.szDescriptiveName = (LPSTR)szModuleName;
+ nl_user.szSettingsModule = (LPSTR)MODULENAME;
+ nl_user.szDescriptiveName = (LPSTR)MODULENAME;
nl_user.flags = NUF_NOOPTIONS;
hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nl_user);
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index d803db21b2..3965536da0 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -72,7 +72,6 @@ #define MODULENAME "SecureIM"
-extern LPCSTR szModuleName;
extern LPCSTR szVersionStr;
extern char TEMP[MAX_PATH];
extern int TEMP_SIZE;
@@ -85,8 +84,6 @@ extern PLUGININFOEX pluginInfoEx; #define PREF_SIMNOMETA 0x4000 //!< Flag to indicate message should not be inspected by filter on metacontact
extern HANDLE g_hEvent[2], g_hMenu[15], g_hCLIcon, g_hFolders;
-extern HANDLE *g_hService;
-extern HANDLE *g_hHook;
extern int iService, iHook;
extern HICON g_hICO[ICO_CNT], g_hIEC[1+IEC_CNT*MODE_CNT], g_hPOP[POP_CNT];
extern HANDLE g_IEC[1+IEC_CNT*MODE_CNT];
@@ -103,10 +100,6 @@ int onModulesLoaded(WPARAM, LPARAM); int onSystemOKToExit(WPARAM, LPARAM);
int ModuleLoad(WPARAM wParam, LPARAM lParam);
-void AddServiceFunction(LPCSTR,MIRANDASERVICE);
-void AddProtoServiceFunction(LPCSTR,MIRANDASERVICE);
-void AddHookFunction(LPCSTR,MIRANDAHOOK);
-
LPSTR myDBGetString(HANDLE,const char *,const char *);
LPSTR myDBGetStringDecode(HANDLE,const char *,const char *);
int myDBWriteStringEncode(HANDLE,const char *,const char *,const char *);
diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index b1bb9512ce..a8d3ebf2a5 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -38,12 +38,12 @@ BYTE isContactSecured(HANDLE hContact) { if (cpp_keyx(clist[j].cntx)!=0) r|=SECURED;
break;
case MODE_PGP:
- DBGetContactSetting(hContact,szModuleName,"pgp",&dbv);
+ DBGetContactSetting(hContact,MODULENAME,"pgp",&dbv);
if ( dbv.type!=0 ) r|=SECURED;
DBFreeVariant(&dbv);
break;
case MODE_GPG:
- DBGetContactSetting(hContact,szModuleName,"gpg",&dbv);
+ DBGetContactSetting(hContact,MODULENAME,"gpg",&dbv);
if ( dbv.type!=0 ) r|=SECURED;
DBFreeVariant(&dbv);
break;
@@ -157,7 +157,7 @@ BOOL isContactPGP(HANDLE hContact) { if ( !clist[j].proto->inspecting ) break;
if ( clist[j].mode!=MODE_PGP ) break;
DBVARIANT dbv;
- DBGetContactSetting(hContact,szModuleName,"pgp",&dbv);
+ DBGetContactSetting(hContact,MODULENAME,"pgp",&dbv);
BOOL r=(dbv.type!=0);
DBFreeVariant(&dbv);
return r;
@@ -176,7 +176,7 @@ BOOL isContactGPG(HANDLE hContact) { if ( !clist[j].proto->inspecting ) break;
if ( clist[j].mode!=MODE_GPG ) break;
DBVARIANT dbv;
- DBGetContactSetting(hContact,szModuleName,"gpg",&dbv);
+ DBGetContactSetting(hContact,MODULENAME,"gpg",&dbv);
BOOL r=(dbv.type!=0);
DBFreeVariant(&dbv);
return r;
diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index f81ea8ad3a..3a2e5ad6a3 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -9,7 +9,7 @@ LPSTR InitKeyA(pUinKey ptr,int features) { if ( !ptr->cntx )
ptr->cntx = cpp_create_context(isProtoSmallPackets(ptr->hContact)?CPP_MODE_BASE64:0);
- char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK");
+ char *tmp = myDBGetString(ptr->hContact,MODULENAME,"PSK");
if (tmp) {
cpp_init_keyp(ptr->cntx,tmp); // make pre-shared key from password
mir_free(tmp);
@@ -50,7 +50,7 @@ int InitKeyB(pUinKey ptr,LPCSTR key) { ptr->cntx = cpp_create_context(isProtoSmallPackets(ptr->hContact)?CPP_MODE_BASE64:0);
if (!cpp_keyp(ptr->cntx)) {
- char *tmp = myDBGetString(ptr->hContact,szModuleName,"PSK");
+ char *tmp = myDBGetString(ptr->hContact,MODULENAME,"PSK");
if (tmp) {
cpp_init_keyp(ptr->cntx,tmp); // make pre-shared key from password
mir_free(tmp);
@@ -88,7 +88,7 @@ BOOL CalculateKeyX(pUinKey ptr,HANDLE hContact) { cpp_get_keyx(ptr->cntx,buffer);
DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
// store key in database
cws.szSetting = "offlineKey";
@@ -100,7 +100,7 @@ BOOL CalculateKeyX(pUinKey ptr,HANDLE hContact) { // store timeout of key in database (2 days)
cws.szSetting = "offlineKeyTimeout";
cws.value.type = DBVT_DWORD;
- cws.value.dVal = gettime()+(60*60*24*DBGetContactSettingWord(0,szModuleName,"okt",2));
+ cws.value.dVal = gettime()+(60*60*24*DBGetContactSettingWord(0,MODULENAME,"okt",2));
CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (LPARAM)&cws);
// key exchange is finished
@@ -200,10 +200,10 @@ LPSTR decodeMsg(pUinKey ptr, LPARAM lParam, LPSTR szEncMsg) { BOOL LoadKeyPGP(pUinKey ptr) {
- int mode = db_get_b(ptr->hContact,szModuleName,"pgp_mode",255);
+ int mode = db_get_b(ptr->hContact,MODULENAME,"pgp_mode",255);
if (mode==0) {
DBVARIANT dbv;
- DBGetContactSetting(ptr->hContact,szModuleName,"pgp",&dbv);
+ DBGetContactSetting(ptr->hContact,MODULENAME,"pgp",&dbv);
BOOL r=(dbv.type==DBVT_BLOB);
if (r) pgp_set_keyid(ptr->cntx,(PVOID)dbv.pbVal);
DBFreeVariant(&dbv);
@@ -211,7 +211,7 @@ BOOL LoadKeyPGP(pUinKey ptr) { }
else
if (mode==1) {
- LPSTR key = myDBGetStringDecode(ptr->hContact,szModuleName,"pgp");
+ LPSTR key = myDBGetStringDecode(ptr->hContact,MODULENAME,"pgp");
if ( key ) {
pgp_set_key(ptr->cntx,key);
mir_free(key);
@@ -224,7 +224,7 @@ BOOL LoadKeyPGP(pUinKey ptr) { BOOL LoadKeyGPG(pUinKey ptr) {
- LPSTR key = myDBGetString(ptr->hContact,szModuleName,"gpg");
+ LPSTR key = myDBGetString(ptr->hContact,MODULENAME,"gpg");
if ( key ) {
gpg_set_keyid(ptr->cntx,key);
mir_free(key);
diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp index c155c0525a..b22fc909cf 100644 --- a/plugins/SecureIM/src/crypt_icons.cpp +++ b/plugins/SecureIM/src/crypt_icons.cpp @@ -77,7 +77,7 @@ void ShowStatusIcon(HANDLE hContact, int mode) if ( ServiceExists(MS_MSG_MODIFYICON)) { // обновить иконки в srmm
StatusIconData sid = {sizeof(sid) };
- sid.szModule = (char*)szModuleName;
+ sid.szModule = (char*)MODULENAME;
for(int i = MODE_NATIVE; i < MODE_CNT; i++) {
sid.dwId = i;
sid.flags = (mode & SECURED) ? 0 : MBF_DISABLED;
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index fc77021775..964cb7b4ff 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -9,7 +9,7 @@ int clist_inc = 100; void loadSupportedProtocols() {
int numberOfProtocols;
PROTOACCOUNT **protos;
- LPSTR szNames = myDBGetString(0,szModuleName,"protos");
+ LPSTR szNames = myDBGetString(0,MODULENAME,"protos");
if ( szNames && strchr(szNames,':') == NULL ) {
LPSTR tmp = (LPSTR) mir_alloc(2048); int j=0;
for(int i=0; szNames[i]; i++) {
@@ -20,13 +20,13 @@ void loadSupportedProtocols() { }
tmp[j] = '\0';
SAFE_FREE(szNames); szNames = tmp;
- DBWriteContactSettingString(0,szModuleName,"protos",szNames);
+ DBWriteContactSettingString(0,MODULENAME,"protos",szNames);
}
ProtoEnumAccounts(&numberOfProtocols, &protos);
- for (int i=0;i<numberOfProtocols;i++) {
- if (protos[i]->szModuleName && CallProtoService(protos[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0)) {
+ for (int i=0; i < numberOfProtocols; i++) {
+ if (protos[i]->szModuleName && CallProtoService(protos[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)) {
int j = proto_cnt; proto_cnt++;
proto = (pSupPro) mir_realloc(proto,sizeof(SupPro)*proto_cnt);
memset(&proto[j],0,sizeof(SupPro));
@@ -51,9 +51,7 @@ void loadSupportedProtocols() { }
}
}
- else {
- proto[j].inspecting = true;
- }
+ else proto[j].inspecting = true;
}
}
SAFE_FREE(szNames);
@@ -95,17 +93,17 @@ pUinKey addContact(HANDLE hContact) { clist[j].footer = FOOTER;
clist[j].hContact = hContact;
clist[j].proto = proto;
- clist[j].mode = db_get_b(hContact, szModuleName, "mode", 99);
+ clist[j].mode = db_get_b(hContact, MODULENAME, "mode", 99);
if ( clist[j].mode == 99 ) {
if ( isContactPGP(hContact)) clist[j].mode = MODE_PGP;
else
if ( isContactGPG(hContact)) clist[j].mode = MODE_GPG;
else
clist[j].mode = MODE_RSAAES;
- db_set_b(hContact, szModuleName, "mode", clist[j].mode);
+ db_set_b(hContact, MODULENAME, "mode", clist[j].mode);
}
- clist[j].status = db_get_b(hContact, szModuleName, "StatusID", STATUS_ENABLED);
- clist[j].gpgMode = db_get_b(hContact, szModuleName, "gpgANSI", 0);
+ clist[j].status = db_get_b(hContact, MODULENAME, "StatusID", STATUS_ENABLED);
+ clist[j].gpgMode = db_get_b(hContact, MODULENAME, "gpgANSI", 0);
return &clist[j];
}
}
diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp index fb65f29798..4b82746279 100644 --- a/plugins/SecureIM/src/crypt_misc.cpp +++ b/plugins/SecureIM/src/crypt_misc.cpp @@ -43,7 +43,7 @@ unsigned __stdcall sttWaitForExchange( LPVOID param ) { if ( !ptr ) return 0;
- for(int i=0;i<DBGetContactSettingWord(0,szModuleName,"ket",10)*10; i++) {
+ for(int i=0;i<DBGetContactSettingWord(0,MODULENAME,"ket",10)*10; i++) {
Sleep( 100 );
if ( ptr->waitForExchange != 1 ) break;
} // for
@@ -53,7 +53,7 @@ unsigned __stdcall sttWaitForExchange( LPVOID param ) { #endif
// if keyexchange failed or timeout
if ( ptr->waitForExchange==1 || ptr->waitForExchange==3 ) { // Їа®вге«® - ®вЇа ў«пҐ¬ Ґ§ иЁда®ў ®, Ґб«Ё ¤®
- if ( ptr->msgQueue && msgbox1(0,sim104,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDYES ) {
+ if ( ptr->msgQueue && msgbox1(0,sim104,MODULENAME,MB_YESNO|MB_ICONQUESTION)==IDYES ) {
EnterCriticalSection(&localQueueMutex);
ptr->sendQueue = true;
pWM ptrMessage = ptr->msgQueue;
diff --git a/plugins/SecureIM/src/crypt_popups.cpp b/plugins/SecureIM/src/crypt_popups.cpp index 4d91ab8f8d..6f217273c1 100644 --- a/plugins/SecureIM/src/crypt_popups.cpp +++ b/plugins/SecureIM/src/crypt_popups.cpp @@ -41,32 +41,32 @@ void showPopUp(LPCSTR lpzText,HANDLE hContact,HICON hIcon, UINT type) { DBVARIANT dbv_timeout;
if (type==0) {
- colorBack=DBGetContactSettingDword(0,szModuleName,"colorKeyb",(UINT)-1);
- colorText=DBGetContactSettingDword(0,szModuleName,"colorKeyt",(UINT)-1);
+ colorBack=DBGetContactSettingDword(0,MODULENAME,"colorKeyb",(UINT)-1);
+ colorText=DBGetContactSettingDword(0,MODULENAME,"colorKeyt",(UINT)-1);
if (colorBack==(UINT)-1) colorBack=colorBackKey;
if (colorText==(UINT)-1) colorText=colorTextKey;
- res=DBGetContactSetting(0,szModuleName,"timeoutKey",&dbv_timeout);
+ res=DBGetContactSetting(0,MODULENAME,"timeoutKey",&dbv_timeout);
if (res==0) timeout=atoi(dbv_timeout.pszVal);
DBFreeVariant(&dbv_timeout);
}
else if (type==1) {
- colorBack=DBGetContactSettingDword(0,szModuleName,"colorSecb",(UINT)-1);
- colorText=DBGetContactSettingDword(0,szModuleName,"colorSect",(UINT)-1);
+ colorBack=DBGetContactSettingDword(0,MODULENAME,"colorSecb",(UINT)-1);
+ colorText=DBGetContactSettingDword(0,MODULENAME,"colorSect",(UINT)-1);
if (colorBack==(UINT)-1) colorBack=colorBackSec;
if (colorText==(UINT)-1) colorText=colorTextSec;
- res=DBGetContactSetting(0,szModuleName,"timeoutSec",&dbv_timeout);
+ res=DBGetContactSetting(0,MODULENAME,"timeoutSec",&dbv_timeout);
if (res==0) timeout=atoi(dbv_timeout.pszVal);
DBFreeVariant(&dbv_timeout);
}
else if (type>=2) {
- colorBack=DBGetContactSettingDword(0, szModuleName, "colorSRb", (UINT)-1);
- colorText=DBGetContactSettingDword(0, szModuleName, "colorSRt", (UINT)-1);
+ colorBack=DBGetContactSettingDword(0, MODULENAME, "colorSRb", (UINT)-1);
+ colorText=DBGetContactSettingDword(0, MODULENAME, "colorSRt", (UINT)-1);
if (colorBack==(UINT)-1) colorBack=colorBackSR;
if (colorText==(UINT)-1) colorText=colorTextSR;
- res=DBGetContactSetting(0,szModuleName,"timeoutSR",&dbv_timeout);
+ res=DBGetContactSetting(0,MODULENAME,"timeoutSR",&dbv_timeout);
if (res==0) timeout=atoi(dbv_timeout.pszVal);
DBFreeVariant(&dbv_timeout);
}
@@ -90,36 +90,36 @@ void showPopUp(LPCSTR lpzText,HANDLE hContact,HICON hIcon, UINT type) { void showPopUpDCmsg(HANDLE hContact,LPCSTR msg) {
- int indic=db_get_b(0, szModuleName, "dc",1);
+ int indic=db_get_b(0, MODULENAME, "dc",1);
if (indic==1) showPopUp(msg,hContact,g_hPOP[POP_PU_DIS],1);
}
void showPopUpDC(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "dc",1);
+ int indic=db_get_b(0, MODULENAME, "dc",1);
if (indic==1) showPopUp(sim006,hContact,g_hPOP[POP_PU_DIS],1);
}
void showPopUpEC(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "ec",1);
+ int indic=db_get_b(0, MODULENAME, "ec",1);
if (indic==1) showPopUp(sim001,hContact,g_hPOP[POP_PU_EST],1);
}
void showPopUpKS(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "ks",1);
+ int indic=db_get_b(0, MODULENAME, "ks",1);
if (indic==1) showPopUp(sim007,hContact,g_hPOP[POP_PU_PRC],0);
}
void showPopUpKRmsg(HANDLE hContact,LPCSTR msg) {
- int indic=db_get_b(0, szModuleName, "kr",1);
+ int indic=db_get_b(0, MODULENAME, "kr",1);
if (indic==1) showPopUp(msg,hContact,g_hPOP[POP_PU_PRC],0);
}
void showPopUpKR(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "kr",1);
+ int indic=db_get_b(0, MODULENAME, "kr",1);
if (indic==1) showPopUp(sim008,hContact,g_hPOP[POP_PU_PRC],0);
}
void showPopUpSM(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "ss",0);
+ int indic=db_get_b(0, MODULENAME, "ss",0);
if (indic==1) showPopUp(sim009,hContact,g_hPOP[POP_PU_MSS],2);
SkinPlaySound("OutgoingSecureMessage");
}
void showPopUpRM(HANDLE hContact) {
- int indic=db_get_b(0, szModuleName, "sr",0);
+ int indic=db_get_b(0, MODULENAME, "sr",0);
if (indic==1) showPopUp(sim010,hContact,g_hPOP[POP_PU_MSR],2);
SkinPlaySound("IncomingSecureMessage");
}
diff --git a/plugins/SecureIM/src/loadicons.cpp b/plugins/SecureIM/src/loadicons.cpp index ba6ca81727..cf86cb77dc 100644 --- a/plugins/SecureIM/src/loadicons.cpp +++ b/plugins/SecureIM/src/loadicons.cpp @@ -116,7 +116,7 @@ void InitIcons(void) g_hPOP[icons[i].idx] = hIcon;
}
- AddHookFunction(ME_SKIN2_ICONSCHANGED, ReloadIcons);
+ HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons);
}
// EOF
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 87370c7260..3c3d08aa64 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -16,27 +16,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfoEx;
}
-void AddServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction) {
-
- g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1));
- g_hService[iService] = CreateServiceFunction(serviceName, serviceFunction);
- iService++;
-}
-
-void AddProtoServiceFunction(LPCSTR serviceName, MIRANDASERVICE serviceFunction)
-{
- g_hService = (HANDLE*) mir_realloc(g_hService,sizeof(HANDLE)*(iService+1));
- g_hService[iService] = CreateProtoServiceFunction(szModuleName, serviceName, serviceFunction);
- iService++;
-}
-
-void AddHookFunction(LPCSTR eventName, MIRANDAHOOK hookFunction)
-{
- g_hHook = (HANDLE*) mir_realloc(g_hHook,sizeof(HANDLE)*(iHook+1));
- g_hHook[iHook] = HookEvent(eventName, hookFunction);
- iHook++;
-}
-
HANDLE AddMenuItem(LPCSTR name,int pos,HICON hicon,LPCSTR service,int flags=0,WPARAM wParam=0)
{
CLISTMENUITEM mi = { sizeof(mi) };
@@ -102,7 +81,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) // load crypo++ dll
if ( !loadlib()) {
- msgbox1(0,sim107,szModuleName,MB_OK|MB_ICONSTOP);
+ msgbox1(0,sim107,MODULENAME,MB_OK|MB_ICONSTOP);
return 1;
}
@@ -110,33 +89,33 @@ extern "C" __declspec(dllexport) int __cdecl Load(void) // register plugin module
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
- pd.szName = (char*)szModuleName;
+ pd.szName = (char*)MODULENAME;
pd.type = PROTOTYPE_ENCRYPTION;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
// hook events
- AddHookFunction(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
- AddHookFunction(ME_SYSTEM_OKTOEXIT, onSystemOKToExit);
- AddHookFunction(ME_SYSTEM_MODULELOAD, ModuleLoad);
- AddHookFunction(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+ HookEvent(ME_SYSTEM_OKTOEXIT, onSystemOKToExit);
+ HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad);
+ HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad);
g_hEvent[0] = CreateHookableEvent(MODULENAME"/Disabled");
g_hEvent[1] = CreateHookableEvent(MODULENAME"/Established");
- AddServiceFunction(MODULENAME"/IsContactSecured",Service_IsContactSecured);
- AddServiceFunction(MODULENAME"/SIM_EST",Service_CreateIM);
- AddServiceFunction(MODULENAME"/SIM_DIS",Service_DisableIM);
- AddServiceFunction(MODULENAME"/SIM_ST_DIS",Service_StatusDis);
- AddServiceFunction(MODULENAME"/SIM_ST_ENA",Service_StatusEna);
- AddServiceFunction(MODULENAME"/SIM_ST_TRY",Service_StatusTry);
- AddServiceFunction(MODULENAME"/PGP_SET",Service_PGPsetKey);
- AddServiceFunction(MODULENAME"/PGP_DEL",Service_PGPdelKey);
- AddServiceFunction(MODULENAME"/GPG_SET",Service_GPGsetKey);
- AddServiceFunction(MODULENAME"/GPG_DEL",Service_GPGdelKey);
- AddServiceFunction(MODULENAME"/MODE_NAT",Service_ModeNative);
- AddServiceFunction(MODULENAME"/MODE_PGP",Service_ModePGP);
- AddServiceFunction(MODULENAME"/MODE_GPG",Service_ModeGPG);
- AddServiceFunction(MODULENAME"/MODE_RSA",Service_ModeRSAAES);
+ CreateServiceFunction(MODULENAME"/IsContactSecured",Service_IsContactSecured);
+ CreateServiceFunction(MODULENAME"/SIM_EST",Service_CreateIM);
+ CreateServiceFunction(MODULENAME"/SIM_DIS",Service_DisableIM);
+ CreateServiceFunction(MODULENAME"/SIM_ST_DIS",Service_StatusDis);
+ CreateServiceFunction(MODULENAME"/SIM_ST_ENA",Service_StatusEna);
+ CreateServiceFunction(MODULENAME"/SIM_ST_TRY",Service_StatusTry);
+ CreateServiceFunction(MODULENAME"/PGP_SET",Service_PGPsetKey);
+ CreateServiceFunction(MODULENAME"/PGP_DEL",Service_PGPdelKey);
+ CreateServiceFunction(MODULENAME"/GPG_SET",Service_GPGsetKey);
+ CreateServiceFunction(MODULENAME"/GPG_DEL",Service_GPGdelKey);
+ CreateServiceFunction(MODULENAME"/MODE_NAT",Service_ModeNative);
+ CreateServiceFunction(MODULENAME"/MODE_PGP",Service_ModePGP);
+ CreateServiceFunction(MODULENAME"/MODE_GPG",Service_ModeGPG);
+ CreateServiceFunction(MODULENAME"/MODE_RSA",Service_ModeRSAAES);
return 0;
}
@@ -156,75 +135,73 @@ int ModuleLoad(WPARAM wParam, LPARAM lParam) int onModulesLoaded(WPARAM wParam, LPARAM lParam)
{
#if defined(_DEBUG) || defined(NETLIB_LOG)
- InitNetlib();
- Sent_NetLog("onModuleLoaded begin");
+ InitNetlib();
+ Sent_NetLog("onModuleLoaded begin");
#endif
- g_hFolders = FoldersRegisterCustomPathT(szModuleName, LPGEN("Icons"), _T(MIRANDA_PATH"\\icons"));
+ g_hFolders = FoldersRegisterCustomPathT(MODULENAME, LPGEN("Icons"), _T(MIRANDA_PATH"\\icons"));
- InitIcons();
- GetFlags();
- ModuleLoad(0, 0);
+ InitIcons();
+ GetFlags();
+ ModuleLoad(0, 0);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_init");
#endif
- { // RSA/AES
- rsa_init(&exp,&imp);
-
- DBVARIANT dbv;
- dbv.type = DBVT_BLOB;
+ // RSA/AES
+ rsa_init(&exp, &imp);
- if ( DBGetContactSetting(0,szModuleName,"rsa_priv",&dbv) == 0 ) {
- exp->rsa_set_keypair(CPP_MODE_RSA_4096,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
- rsa_4096=1;
- }
- else
- if ( DBGetContactSetting(0,szModuleName,"rsa_priv_4096",&dbv) == 0 ) {
- exp->rsa_set_keypair(CPP_MODE_RSA_4096|CPP_MODE_RSA_BER,dbv.pbVal,dbv.cpbVal);
- DBFreeVariant(&dbv);
+ DBVARIANT dbv;
+ dbv.type = DBVT_BLOB;
- char priv_key[4096]; int priv_len;
- char pub_key[4096]; int pub_len;
+ if ( DBGetContactSetting(0,MODULENAME,"rsa_priv",&dbv) == 0 ) {
+ exp->rsa_set_keypair(CPP_MODE_RSA_4096,dbv.pbVal,dbv.cpbVal);
+ DBFreeVariant(&dbv);
+ rsa_4096=1;
+ }
+ else if ( DBGetContactSetting(0,MODULENAME,"rsa_priv_4096",&dbv) == 0 ) {
+ exp->rsa_set_keypair(CPP_MODE_RSA_4096|CPP_MODE_RSA_BER,dbv.pbVal,dbv.cpbVal);
+ DBFreeVariant(&dbv);
- DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
- cws.value.type = DBVT_BLOB;
+ char priv_key[4096]; int priv_len;
+ char pub_key[4096]; int pub_len;
- exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
+ DBCONTACTWRITESETTING cws;
+ cws.szModule = MODULENAME;
+ cws.value.type = DBVT_BLOB;
- cws.szSetting = "rsa_priv";
- cws.value.pbVal = (PBYTE)&priv_key;
- cws.value.cpbVal = priv_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
- cws.szSetting = "rsa_pub";
- cws.value.pbVal = (PBYTE)&pub_key;
- cws.value.cpbVal = pub_len;
- CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
+ cws.szSetting = "rsa_priv";
+ cws.value.pbVal = (PBYTE)&priv_key;
+ cws.value.cpbVal = priv_len;
+ CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
- DBDeleteContactSetting(0, szModuleName, "rsa_priv_2048");
- DBDeleteContactSetting(0, szModuleName, "rsa_pub_2048");
- rsa_4096 = 1;
- }
+ cws.szSetting = "rsa_pub";
+ cws.value.pbVal = (PBYTE)&pub_key;
+ cws.value.cpbVal = pub_len;
+ CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws);
- if ( !rsa_4096 ) {
- unsigned int tID;
- CloseHandle( (HANDLE) _beginthreadex(NULL, 0, sttGenerateRSA, NULL, 0, &tID));
- }
+ db_unset(0, MODULENAME, "rsa_priv_2048");
+ db_unset(0, MODULENAME, "rsa_pub_2048");
+ rsa_4096 = 1;
+ }
- exp->rsa_set_timeout( DBGetContactSettingWord(0,szModuleName,"ket",10));
+ if ( !rsa_4096 ) {
+ unsigned int tID;
+ CloseHandle( (HANDLE) _beginthreadex(NULL, 0, sttGenerateRSA, NULL, 0, &tID));
}
+ exp->rsa_set_timeout( DBGetContactSettingWord(0,MODULENAME,"ket",10));
+
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("pgp_init");
#endif
- bPGP = db_get_b(0, szModuleName, "pgp", 0);
+ bPGP = db_get_b(0, MODULENAME, "pgp", 0);
if (bPGP) { //PGP
bPGPloaded = pgp_init();
- bUseKeyrings = db_get_b(0,szModuleName,"ukr",1);
- LPSTR priv = myDBGetStringDecode(0,szModuleName,"pgpPrivKey");
+ bUseKeyrings = db_get_b(0,MODULENAME,"ukr",1);
+ LPSTR priv = myDBGetStringDecode(0,MODULENAME,"pgpPrivKey");
if (priv) {
bPGPprivkey = true;
if (bPGPloaded)
@@ -239,12 +216,12 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) }
else {
LPSTR tmp;
- tmp = myDBGetString(0,szModuleName,"pgpPubRing");
+ tmp = myDBGetString(0,MODULENAME,"pgpPubRing");
if (tmp) {
strncpy(PubRingPath,tmp,sizeof(PubRingPath));
mir_free(tmp);
}
- tmp = myDBGetString(0,szModuleName,"pgpSecRing");
+ tmp = myDBGetString(0,MODULENAME,"pgpSecRing");
if (tmp) {
strncpy(SecRingPath,tmp,sizeof(SecRingPath));
mir_free(tmp);
@@ -252,12 +229,12 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) if (PubRingPath[0] && SecRingPath[0]) {
bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath);
if (bPGPkeyrings) {
- DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath);
- DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpPubRing",PubRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpSecRing",SecRingPath);
}
else {
- DBDeleteContactSetting(0, szModuleName, "pgpPubRing");
- DBDeleteContactSetting(0, szModuleName, "pgpSecRing");
+ db_unset(0, MODULENAME, "pgpPubRing");
+ db_unset(0, MODULENAME, "pgpSecRing");
}
}
}
@@ -267,37 +244,34 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("gpg_init");
#endif
- bGPG = db_get_b(0, szModuleName, "gpg", 0);
+ bGPG = db_get_b(0, MODULENAME, "gpg", 0);
if (bGPG) { //GPG
-
- LPSTR tmp;
-
bGPGloaded = gpg_init();
- char gpgexec[MAX_PATH], gpghome[MAX_PATH];
- gpgexec[0]='\0'; gpghome[0]='\0';
+ char gpgexec[MAX_PATH], gpghome[MAX_PATH];
+ gpgexec[0]='\0'; gpghome[0]='\0';
- tmp = myDBGetString(0,szModuleName,"gpgExec");
+ LPSTR tmp = myDBGetString(0,MODULENAME,"gpgExec");
if (tmp) {
strncpy(gpgexec,tmp,sizeof(gpgexec));
mir_free(tmp);
}
- tmp = myDBGetString(0,szModuleName,"gpgHome");
+ tmp = myDBGetString(0,MODULENAME,"gpgHome");
if (tmp) {
strncpy(gpghome,tmp,sizeof(gpghome));
mir_free(tmp);
}
- if (db_get_b(0, szModuleName, "gpgLogFlag",0)) {
- tmp = myDBGetString(0,szModuleName,"gpgLog");
+ if (db_get_b(0, MODULENAME, "gpgLogFlag",0)) {
+ tmp = myDBGetString(0,MODULENAME,"gpgLog");
if (tmp) {
gpg_set_log(tmp);
mir_free(tmp);
}
}
- if (db_get_b(0, szModuleName, "gpgTmpFlag",0)) {
- tmp = myDBGetString(0,szModuleName,"gpgTmp");
+ if (db_get_b(0, MODULENAME, "gpgTmpFlag",0)) {
+ tmp = myDBGetString(0,MODULENAME,"gpgTmp");
if (tmp) {
gpg_set_tmp(tmp);
mir_free(tmp);
@@ -306,17 +280,17 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) bGPGkeyrings = gpg_open_keyrings(gpgexec,gpghome);
if (bGPGkeyrings) {
- DBWriteContactSettingString(0,szModuleName,"gpgExec",gpgexec);
- DBWriteContactSettingString(0,szModuleName,"gpgHome",gpghome);
+ DBWriteContactSettingString(0,MODULENAME,"gpgExec",gpgexec);
+ DBWriteContactSettingString(0,MODULENAME,"gpgHome",gpghome);
}
else {
- DBDeleteContactSetting(0, szModuleName, "gpgExec");
- DBDeleteContactSetting(0, szModuleName, "gpgHome");
+ db_unset(0, MODULENAME, "gpgExec");
+ db_unset(0, MODULENAME, "gpgHome");
}
- bSavePass = db_get_b(0,szModuleName,"gpgSaveFlag",0);
+ bSavePass = db_get_b(0,MODULENAME,"gpgSaveFlag",0);
if (bSavePass) {
- tmp = myDBGetString(0,szModuleName,"gpgSave");
+ tmp = myDBGetString(0,MODULENAME,"gpgSave");
if (tmp) {
gpg_set_passphrases(tmp);
mir_free(tmp);
@@ -343,24 +317,24 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("hook events");
#endif
- AddHookFunction(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onRebuildContactMenu);
- g_hCLIcon = ExtraIcon_Register(szModuleName, Translate("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
+ g_hCLIcon = ExtraIcon_Register(MODULENAME, Translate("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
// hook init options
- AddHookFunction(ME_OPT_INITIALISE, onRegisterOptions);
+ HookEvent(ME_OPT_INITIALISE, onRegisterOptions);
if (bPopupExists)
- AddHookFunction(ME_OPT_INITIALISE, onRegisterPopOptions);
- AddHookFunction(ME_PROTO_ACK, onProtoAck);
- AddHookFunction(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
- AddHookFunction(ME_DB_CONTACT_ADDED, onContactAdded);
- AddHookFunction(ME_DB_CONTACT_DELETED, onContactDeleted);
+ HookEvent(ME_OPT_INITIALISE, onRegisterPopOptions);
+ HookEvent(ME_PROTO_ACK, onProtoAck);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
+ HookEvent(ME_DB_CONTACT_ADDED, onContactAdded);
+ HookEvent(ME_DB_CONTACT_DELETED, onContactDeleted);
// hook message transport
- AddProtoServiceFunction(PSR_MESSAGE, onRecvMsg);
- AddProtoServiceFunction(PSS_MESSAGE, onSendMsg);
- AddProtoServiceFunction(PSS_MESSAGE"W", onSendMsgW);
- AddProtoServiceFunction(PSS_FILE, onSendFile);
+ CreateProtoServiceFunction(MODULENAME, PSR_MESSAGE, onRecvMsg);
+ CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE, onSendMsg);
+ CreateProtoServiceFunction(MODULENAME, PSS_MESSAGE"W", onSendMsgW);
+ CreateProtoServiceFunction(MODULENAME, PSS_FILE, onSendFile);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create Native/RSA menu");
@@ -370,16 +344,16 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) g_hMenu[1] = AddMenuItem(sim302,110001,g_hICO[ICO_CM_DIS],MODULENAME"/SIM_DIS",CMIF_NOTOFFLINE);
if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
- g_hMenu[2] = AddMenuItem(sim312[0],110002,NULL,NULL,CMIF_ROOTPOPUP);
- g_hMenu[3] = AddSubItem(g_hMenu[2],sim232[0],110003,110002,MODULENAME"/SIM_ST_DIS");
- g_hMenu[4] = AddSubItem(g_hMenu[2],sim232[1],110004,110002,MODULENAME"/SIM_ST_ENA");
- g_hMenu[5] = AddSubItem(g_hMenu[2],sim232[2],110005,110002,MODULENAME"/SIM_ST_TRY");
+ g_hMenu[2] = AddMenuItem(sim312[0],110002,NULL,NULL,CMIF_ROOTPOPUP);
+ g_hMenu[3] = AddSubItem(g_hMenu[2],sim232[0],110003,110002,MODULENAME"/SIM_ST_DIS");
+ g_hMenu[4] = AddSubItem(g_hMenu[2],sim232[1],110004,110002,MODULENAME"/SIM_ST_ENA");
+ g_hMenu[5] = AddSubItem(g_hMenu[2],sim232[2],110005,110002,MODULENAME"/SIM_ST_TRY");
}
else {
- g_hMenu[2] = 0;
- g_hMenu[3] = AddMenuItem(sim232[0],110003,NULL,MODULENAME"/SIM_ST_DIS");
- g_hMenu[4] = AddMenuItem(sim232[1],110004,NULL,MODULENAME"/SIM_ST_ENA");
- g_hMenu[5] = AddMenuItem(sim232[2],110005,NULL,MODULENAME"/SIM_ST_TRY");
+ g_hMenu[2] = 0;
+ g_hMenu[3] = AddMenuItem(sim232[0],110003,NULL,MODULENAME"/SIM_ST_DIS");
+ g_hMenu[4] = AddMenuItem(sim232[1],110004,NULL,MODULENAME"/SIM_ST_ENA");
+ g_hMenu[5] = AddMenuItem(sim232[2],110005,NULL,MODULENAME"/SIM_ST_TRY");
}
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -393,42 +367,38 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) g_hMenu[7] = AddMenuItem(sim307,110007,icon,MODULENAME"/PGP_DEL",0);
}
- if (bGPGloaded) {
+ if (bGPGloaded) {
icon=mode2icon(MODE_GPG|SECURED,2);
g_hMenu[8] = AddMenuItem(sim308,110008,icon,MODULENAME"/GPG_SET",0);
icon=mode2icon(MODE_GPG,2);
g_hMenu[9] = AddMenuItem(sim309,110009,icon,MODULENAME"/GPG_DEL",0);
- }
+ }
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create Mode menu");
#endif
if (ServiceExists(MS_CLIST_MENUBUILDSUBGROUP)) {
- g_hMenu[10] = AddMenuItem(sim311[0],110010,NULL,NULL,CMIF_ROOTPOPUP);
- g_hMenu[11] = AddSubItem(g_hMenu[10],sim231[0],110011,110010,MODULENAME"/MODE_NAT");
- g_hMenu[12] = AddSubItem(g_hMenu[10],sim231[1],110012,110010,MODULENAME"/MODE_PGP");
- g_hMenu[13] = AddSubItem(g_hMenu[10],sim231[2],110013,110010,MODULENAME"/MODE_GPG");
- g_hMenu[14] = AddSubItem(g_hMenu[10],sim231[3],110014,110010,MODULENAME"/MODE_RSA");
+ g_hMenu[10] = AddMenuItem(sim311[0],110010,NULL,NULL,CMIF_ROOTPOPUP);
+ g_hMenu[11] = AddSubItem(g_hMenu[10],sim231[0],110011,110010,MODULENAME"/MODE_NAT");
+ g_hMenu[12] = AddSubItem(g_hMenu[10],sim231[1],110012,110010,MODULENAME"/MODE_PGP");
+ g_hMenu[13] = AddSubItem(g_hMenu[10],sim231[2],110013,110010,MODULENAME"/MODE_GPG");
+ g_hMenu[14] = AddSubItem(g_hMenu[10],sim231[3],110014,110010,MODULENAME"/MODE_RSA");
}
else {
- g_hMenu[10] = 0;
- g_hMenu[11] = AddMenuItem(sim231[0],110011,NULL,MODULENAME"/MODE_NAT");
- g_hMenu[12] = AddMenuItem(sim231[1],110012,NULL,MODULENAME"/MODE_PGP");
- g_hMenu[13] = AddMenuItem(sim231[2],110013,NULL,MODULENAME"/MODE_GPG");
- g_hMenu[14] = AddMenuItem(sim231[3],110014,NULL,MODULENAME"/MODE_RSA");
+ g_hMenu[10] = 0;
+ g_hMenu[11] = AddMenuItem(sim231[0],110011,NULL,MODULENAME"/MODE_NAT");
+ g_hMenu[12] = AddMenuItem(sim231[1],110012,NULL,MODULENAME"/MODE_PGP");
+ g_hMenu[13] = AddMenuItem(sim231[2],110013,NULL,MODULENAME"/MODE_GPG");
+ g_hMenu[14] = AddMenuItem(sim231[3],110014,NULL,MODULENAME"/MODE_RSA");
}
-
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("create srmm icons");
#endif
// add icon to srmm status icons
if (ServiceExists(MS_MSG_ADDICON)) {
-
- StatusIconData sid;
- memset(&sid,0,sizeof(sid));
- sid.cbSize = sizeof(sid);
- sid.szModule = (char*)szModuleName;
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = (char*)MODULENAME;
sid.flags = MBF_DISABLED|MBF_HIDDEN;
// Native
sid.dwId = MODE_NATIVE;
@@ -456,8 +426,8 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
// hook the window events so that we can can change the status of the icon
- AddHookFunction(ME_MSG_WINDOWEVENT, onWindowEvent);
- AddHookFunction(ME_MSG_ICONPRESSED, onIconPressed);
+ HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent);
+ HookEvent(ME_MSG_ICONPRESSED, onIconPressed);
}
#if defined(_DEBUG) || defined(NETLIB_LOG)
@@ -466,26 +436,22 @@ int onModulesLoaded(WPARAM wParam, LPARAM lParam) return 0;
}
-
int onSystemOKToExit(WPARAM wParam, LPARAM lParam)
{
- if (bSavePass) {
- LPSTR tmp = gpg_get_passphrases();
- DBWriteContactSettingString(0,szModuleName,"gpgSave",tmp);
- LocalFree(tmp);
- }
- else {
- DBDeleteContactSetting(0,szModuleName,"gpgSave");
- }
+ if (bSavePass) {
+ LPSTR tmp = gpg_get_passphrases();
+ DBWriteContactSettingString(0,MODULENAME,"gpgSave",tmp);
+ LocalFree(tmp);
+ }
+ else db_unset(0,MODULENAME,"gpgSave");
+
if (bPGPloaded) pgp_done();
if (bGPGloaded) gpg_done();
rsa_done();
- while(iHook--) UnhookEvent(g_hHook[iHook]);
- mir_free(g_hHook);
- while(iService--) DestroyServiceFunction(g_hService[iService]);
- mir_free(g_hService);
+
DestroyHookableEvent(g_hEvent[0]);
DestroyHookableEvent(g_hEvent[1]);
+
freeContactList();
free_rtfconv();
#if defined(_DEBUG) || defined(NETLIB_LOG)
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index f3ac91a328..719fb2fc87 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -9,14 +9,14 @@ BOOL hasKey(pUinKey ptr) {
BOOL ret = 0;
if ( ptr->mode==MODE_NATIVE ) {
- LPSTR str = myDBGetString(ptr->hContact,szModuleName,"PSK");
+ LPSTR str = myDBGetString(ptr->hContact,MODULENAME,"PSK");
ret = (str!=NULL); SAFE_FREE(str);
}
else
if ( ptr->mode==MODE_RSAAES ) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0 ) {
ret = 1;
DBFreeVariant(&dbv);
}
@@ -304,7 +304,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR int res = DialogBoxParam(g_hInst,MAKEINTRESOURCE(IDD_PSK),NULL,DlgProcSetPSK,(LPARAM)buffer);
if (res == IDOK) {
setListViewPSK(hLV,idx,1);
- DBWriteContactSettingString(ptr->hContact,szModuleName,"tPSK",buffer);
+ DBWriteContactSettingString(ptr->hContact,MODULENAME,"tPSK",buffer);
}
}
}
@@ -315,7 +315,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR ptr = (pUinKey) getListViewParam(hLV,idx);
if (ptr) {
setListViewPSK(hLV,idx,0);
- DBDeleteContactSetting(ptr->hContact, szModuleName, "tPSK");
+ db_unset(ptr->hContact, MODULENAME, "tPSK");
}
}
break;
@@ -341,7 +341,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR LPSTR buffer = (LPSTR) alloca(RSASIZE);
exp->rsa_export_pubkey(ptr->cntx,buffer);
if ( !SaveExportRSAKeyDlg(hDlg,buffer,0))
- msgbox(hDlg,sim114,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim114,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
}
}
return TRUE;
@@ -360,7 +360,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR exp->rsa_get_pubkey(ptr->cntx,(PBYTE)pub,&len);
DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
cws.szSetting = "rsa_pub";
cws.value.type = DBVT_BLOB;
cws.value.pbVal = (PBYTE)pub;
@@ -370,7 +370,7 @@ INT_PTR CALLBACK DlgProcOptionsGeneral(HWND hDlg, UINT wMsg, WPARAM wParam, LPAR setListViewPUB(hLV,idx,1);
}
else
- msgbox(hDlg,sim115,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim115,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
}
return TRUE;
}
@@ -577,7 +577,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM LPSTR pub = (LPSTR) alloca(RSASIZE);
exp->rsa_export_keypair(CPP_MODE_RSA,NULL,pub,NULL);
if ( !SaveExportRSAKeyDlg(hDlg,pub,0))
- msgbox(hDlg,sim114,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim114,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
return TRUE;
} break;
case IDC_RSA_EXPPRIV: {
@@ -587,7 +587,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM LPSTR priv = (LPSTR) alloca(RSASIZE);
exp->rsa_export_keypair(CPP_MODE_RSA,priv,NULL,passphrase);
if ( !SaveExportRSAKeyDlg(hDlg,priv,1))
- msgbox(hDlg,sim112,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim112,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
}
return TRUE;
} break;
@@ -599,7 +599,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM int res = DialogBoxParam(g_hInst,MAKEINTRESOURCE(IDD_PASSPHRASE),NULL,DlgProcSetPassphrase,(LPARAM)passphrase);
if ( res==IDOK ) {
if ( !exp->rsa_import_keypair(CPP_MODE_RSA,priv,passphrase)) {
- msgbox(hDlg,sim113,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox(hDlg,sim113,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
}
else {
// обновить SHA1 значение
@@ -738,8 +738,8 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l PubRingPath[0]='\0'; SecRingPath[0]='\0';
bPGPkeyrings = pgp_open_keyrings(PubRingPath,SecRingPath);
if (bPGPkeyrings && PubRingPath[0] && SecRingPath[0]) {
- DBWriteContactSettingString(0,szModuleName,"pgpPubRing",PubRingPath);
- DBWriteContactSettingString(0,szModuleName,"pgpSecRing",SecRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpPubRing",PubRingPath);
+ DBWriteContactSettingString(0,MODULENAME,"pgpSecRing",SecRingPath);
}
SetDlgItemText(hDlg, IDC_KEYRING_STATUS, bPGPkeyrings?Translate(sim216):Translate(sim217));
// EnableWindow(hLV, bPGPkeyrings);
@@ -759,11 +759,11 @@ INT_PTR CALLBACK DlgProcOptionsPGP(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l if (ShowSelectKeyDlg(hDlg,KeyPath)) {
char *priv = LoadKeys(KeyPath,true);
if (priv) {
- DBWriteContactSettingString(0,szModuleName,"tpgpPrivKey",priv);
+ DBWriteContactSettingString(0,MODULENAME,"tpgpPrivKey",priv);
mir_free(priv);
}
else {
- DBDeleteContactSetting(0,szModuleName,"tpgpPrivKey");
+ db_unset(0,MODULENAME,"tpgpPrivKey");
}
}
}
@@ -890,11 +890,11 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l if (ShowSelectKeyDlg(hDlg,KeyPath)) {
char *priv = LoadKeys(KeyPath,true);
if (priv) {
- DBWriteContactSettingString(0,szModuleName,"tpgpPrivKey",priv);
+ DBWriteContactSettingString(0,MODULENAME,"tpgpPrivKey",priv);
mir_free(priv);
}
else {
- DBDeleteContactSetting(0,szModuleName,"tpgpPrivKey");
+ db_unset(0,MODULENAME,"tpgpPrivKey");
}
}
}
@@ -1003,7 +1003,7 @@ INT_PTR CALLBACK DlgProcSetPSK(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) case IDOK: {
int len = GetDlgItemTextA(hDlg,IDC_EDIT1,buffer,PSKSIZE);
if (len<8) {
- msgbox1(hDlg,sim211,szModuleName,MB_OK|MB_ICONEXCLAMATION);
+ msgbox1(hDlg,sim211,MODULENAME,MB_OK|MB_ICONEXCLAMATION);
return TRUE;
}
else {
@@ -1070,12 +1070,12 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) { Sent_NetLog("RefreshGeneralDlg");
#endif
// Key Exchange Timeout
- data = DBGetContactSettingWord(0, szModuleName, "ket", 10);
+ data = DBGetContactSettingWord(0, MODULENAME, "ket", 10);
mir_itoa(data,timeout,10);
SetDlgItemText(hDlg,IDC_KET,timeout);
// Offline Key Timeout
- data = DBGetContactSettingWord(0, szModuleName, "okt", 2);
+ data = DBGetContactSettingWord(0, MODULENAME, "okt", 2);
mir_itoa(data,timeout,10);
SetDlgItemText(hDlg,IDC_OKT,timeout);
@@ -1214,7 +1214,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) { pUinKey ptr = getUinKey(hContact);
if (ptr && ptr->mode==MODE_PGP && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) {
- LPSTR szKeyID = myDBGetString(hContact,szModuleName,"pgp_abbr");
+ LPSTR szKeyID = myDBGetString(hContact,MODULENAME,"pgp_abbr");
lvi.iItem++;
lvi.iImage = (szKeyID!=0);
@@ -1243,27 +1243,27 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) { #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("RefreshGPGDlg");
#endif
- path = myDBGetString(0,szModuleName,"gpgExec");
+ path = myDBGetString(0,MODULENAME,"gpgExec");
if (path) {
SetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, path);
mir_free(path);
}
- path = myDBGetString(0,szModuleName,"gpgHome");
+ path = myDBGetString(0,MODULENAME,"gpgHome");
if (path) {
SetDlgItemText(hDlg, IDC_GPGHOME_EDIT, path);
mir_free(path);
}
- BOOL bGPGLogFlag = db_get_b(0, szModuleName, "gpgLogFlag",0);
+ BOOL bGPGLogFlag = db_get_b(0, MODULENAME, "gpgLogFlag",0);
SendMessage(GetDlgItem(hDlg,IDC_LOGGINGON_CBOX),BM_SETCHECK,(bGPGLogFlag)?BST_CHECKED:BST_UNCHECKED,0L);
- path = myDBGetString(0,szModuleName,"gpgLog");
+ path = myDBGetString(0,MODULENAME,"gpgLog");
if (path) {
SetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, path);
mir_free(path);
}
SendMessage(GetDlgItem(hDlg,IDC_SAVEPASS_CBOX),BM_SETCHECK,(bSavePass)?BST_CHECKED:BST_UNCHECKED,0L);
- BOOL bGPGTmpFlag = db_get_b(0, szModuleName, "gpgTmpFlag",0);
+ BOOL bGPGTmpFlag = db_get_b(0, MODULENAME, "gpgTmpFlag",0);
SendMessage(GetDlgItem(hDlg,IDC_TMPPATHON_CBOX),BM_SETCHECK,(bGPGTmpFlag)?BST_CHECKED:BST_UNCHECKED,0L);
- path = myDBGetString(0,szModuleName,"gpgTmp");
+ path = myDBGetString(0,MODULENAME,"gpgTmp");
if (path) {
SetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, path);
mir_free(path);
@@ -1288,7 +1288,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) { ptr->tgpgMode = ptr->gpgMode;
}
- LPSTR szKeyID = myDBGetString(hContact,szModuleName,"gpg");
+ LPSTR szKeyID = myDBGetString(hContact,MODULENAME,"gpg");
lvi.iItem++;
lvi.iImage = (szKeyID!=0);
@@ -1389,15 +1389,15 @@ void ApplyGeneralSettings(HWND hDlg) { // Key Exchange Timeout
GetDlgItemText(hDlg,IDC_KET,timeout,5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- DBWriteContactSettingWord(0,szModuleName,"ket",tmp);
- exp->rsa_set_timeout( DBGetContactSettingWord(0,szModuleName,"ket",10));
+ DBWriteContactSettingWord(0,MODULENAME,"ket",tmp);
+ exp->rsa_set_timeout( DBGetContactSettingWord(0,MODULENAME,"ket",10));
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_KET,timeout);
// Offline Key Timeout
GetDlgItemText(hDlg,IDC_OKT,timeout,5);
tmp = atoi(timeout); if (tmp > 65535) tmp = 65535;
- DBWriteContactSettingWord(0,szModuleName,"okt",tmp);
+ DBWriteContactSettingWord(0,MODULENAME,"okt",tmp);
mir_itoa(tmp,timeout,10);
SetDlgItemText(hDlg,IDC_OKT,timeout);
@@ -1420,14 +1420,14 @@ void ApplyGeneralSettings(HWND hDlg) { i = SendMessage(GetDlgItem(hDlg, IDC_PGP),BM_GETCHECK,0L,0L)==BST_CHECKED;
if (i!=bPGP) {
bPGP = i; tmp++;
- db_set_b(0, szModuleName, "pgp", bPGP);
+ db_set_b(0, MODULENAME, "pgp", bPGP);
}
i = SendMessage(GetDlgItem(hDlg, IDC_GPG),BM_GETCHECK,0L,0L)==BST_CHECKED;
if (i!=bGPG) {
bGPG = i; tmp++;
- db_set_b(0, szModuleName, "gpg", bGPG);
+ db_set_b(0, MODULENAME, "gpg", bGPG);
}
- if (tmp) msgbox1(hDlg, sim224, szModuleName, MB_OK|MB_ICONINFORMATION);
+ if (tmp) msgbox1(hDlg, sim224, MODULENAME, MB_OK|MB_ICONINFORMATION);
}
HWND hLV = GetDlgItem(hDlg,IDC_STD_USERLIST);
@@ -1437,28 +1437,28 @@ void ApplyGeneralSettings(HWND hDlg) { if ( !ptr ) continue;
if ( ptr->mode!=ptr->tmode ) {
ptr->mode = ptr->tmode;
- db_set_b(ptr->hContact, szModuleName, "mode", ptr->mode);
+ db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
}
if ( ptr->status!=ptr->tstatus ) {
ptr->status = ptr->tstatus;
- if (ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID");
- else db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
+ if (ptr->status==STATUS_ENABLED) db_unset(ptr->hContact, MODULENAME, "StatusID");
+ else db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status);
}
if ( ptr->mode==MODE_NATIVE ) {
if ( getListViewPSK(hLV,i)) {
- LPSTR tmp = myDBGetString(ptr->hContact,szModuleName,"tPSK");
- DBWriteContactSettingString(ptr->hContact, szModuleName, "PSK", tmp);
+ LPSTR tmp = myDBGetString(ptr->hContact,MODULENAME,"tPSK");
+ DBWriteContactSettingString(ptr->hContact, MODULENAME, "PSK", tmp);
mir_free(tmp);
}
else {
- DBDeleteContactSetting(ptr->hContact, szModuleName, "PSK");
+ db_unset(ptr->hContact, MODULENAME, "PSK");
}
- DBDeleteContactSetting(ptr->hContact, szModuleName, "tPSK");
+ db_unset(ptr->hContact, MODULENAME, "tPSK");
}
else
if ( ptr->mode==MODE_RSAAES ) {
if ( !getListViewPUB(hLV,i)) {
- DBDeleteContactSetting(ptr->hContact, szModuleName, "rsa_pub");
+ db_unset(ptr->hContact, MODULENAME, "rsa_pub");
}
}
i = ListView_GetNextItem(hLV,i,LVNI_ALL);
@@ -1483,22 +1483,22 @@ void ApplyProtoSettings(HWND hDlg) { i = ListView_GetNextItem(hLV,i,LVNI_ALL);
}
- DBWriteContactSettingString(0,szModuleName,"protos",szNames);
+ DBWriteContactSettingString(0,MODULENAME,"protos",szNames);
}
void ApplyPGPSettings(HWND hDlg) {
bUseKeyrings = !(SendMessage(GetDlgItem(hDlg, IDC_NO_KEYRINGS),BM_GETCHECK,0L,0L)==BST_CHECKED);
- db_set_b(0,szModuleName,"ukr",bUseKeyrings);
+ db_set_b(0,MODULENAME,"ukr",bUseKeyrings);
- char *priv = myDBGetString(0,szModuleName,"tpgpPrivKey");
+ char *priv = myDBGetString(0,MODULENAME,"tpgpPrivKey");
if (priv) {
bPGPprivkey = true;
pgp_set_priv_key(priv);
- myDBWriteStringEncode(0,szModuleName,"pgpPrivKey",priv);
+ myDBWriteStringEncode(0,MODULENAME,"pgpPrivKey",priv);
mir_free(priv);
- DBDeleteContactSetting(0,szModuleName,"tpgpPrivKey");
+ db_unset(0,MODULENAME,"tpgpPrivKey");
}
}
@@ -1508,24 +1508,24 @@ void ApplyGPGSettings(HWND hDlg) { char tmp[256];
GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, tmp, sizeof(tmp));
- DBWriteContactSettingString(0,szModuleName,"gpgExec",tmp);
+ DBWriteContactSettingString(0,MODULENAME,"gpgExec",tmp);
GetDlgItemText(hDlg, IDC_GPGHOME_EDIT, tmp, sizeof(tmp));
- DBWriteContactSettingString(0,szModuleName,"gpgHome",tmp);
+ DBWriteContactSettingString(0,MODULENAME,"gpgHome",tmp);
bSavePass = (SendMessage(GetDlgItem(hDlg, IDC_SAVEPASS_CBOX),BM_GETCHECK,0L,0L)==BST_CHECKED);
- db_set_b(0,szModuleName,"gpgSaveFlag",bSavePass);
+ db_set_b(0,MODULENAME,"gpgSaveFlag",bSavePass);
BOOL bgpgLogFlag = (SendMessage(GetDlgItem(hDlg, IDC_LOGGINGON_CBOX),BM_GETCHECK,0L,0L)==BST_CHECKED);
- db_set_b(0,szModuleName,"gpgLogFlag",bgpgLogFlag);
+ db_set_b(0,MODULENAME,"gpgLogFlag",bgpgLogFlag);
GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, sizeof(tmp));
- DBWriteContactSettingString(0,szModuleName,"gpgLog",tmp);
+ DBWriteContactSettingString(0,MODULENAME,"gpgLog",tmp);
if (bgpgLogFlag) gpg_set_log(tmp);
else gpg_set_log(0);
BOOL bgpgTmpFlag = (SendMessage(GetDlgItem(hDlg, IDC_TMPPATHON_CBOX),BM_GETCHECK,0L,0L)==BST_CHECKED);
- db_set_b(0,szModuleName,"gpgTmpFlag",bgpgTmpFlag);
+ db_set_b(0,MODULENAME,"gpgTmpFlag",bgpgTmpFlag);
GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, sizeof(tmp));
- DBWriteContactSettingString(0,szModuleName,"gpgTmp",tmp);
+ DBWriteContactSettingString(0,MODULENAME,"gpgTmp",tmp);
if (bgpgTmpFlag) gpg_set_tmp(tmp);
else gpg_set_tmp(0);
@@ -1536,8 +1536,8 @@ void ApplyGPGSettings(HWND hDlg) { if ( !ptr ) continue;
if ( ptr->gpgMode != ptr->tgpgMode ) {
ptr->gpgMode = ptr->tgpgMode;
- if ( ptr->gpgMode ) db_set_b(ptr->hContact,szModuleName,"gpgANSI",1);
- else DBDeleteContactSetting(ptr->hContact,szModuleName,"gpgANSI");
+ if ( ptr->gpgMode ) db_set_b(ptr->hContact,MODULENAME,"gpgANSI",1);
+ else db_unset(ptr->hContact,MODULENAME,"gpgANSI");
}
i = ListView_GetNextItem(hLV,i,LVNI_ALL);
@@ -1632,7 +1632,7 @@ void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus) { DBVARIANT dbv;
dbv.type = DBVT_BLOB;
pUinKey ptr = (pUinKey) getListViewParam(hLV, iItem);
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0 ) {
int len;
exp->rsa_get_hash((PBYTE)dbv.pbVal,dbv.cpbVal,(PBYTE)str,&len);
sha = mir_strdup(to_hex((PBYTE)str,len));
@@ -1678,8 +1678,8 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { return (s-d)*m;
} break;
case 0x13: {
- DBGetContactSetting(pUinKey(lParam1)->hContact,szModuleName,"pgp_abbr",&dbv1);
- DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"pgp_abbr",&dbv2);
+ DBGetContactSetting(pUinKey(lParam1)->hContact,MODULENAME,"pgp_abbr",&dbv1);
+ DBGetContactSetting(pUinKey(lParam2)->hContact,MODULENAME,"pgp_abbr",&dbv2);
s=(dbv1.type==DBVT_ASCIIZ);
d=(dbv2.type==DBVT_ASCIIZ);
if (s && d) {
@@ -1691,8 +1691,8 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { return (s-d)*m;
} break;
case 0x23: {
- DBGetContactSetting(pUinKey(lParam1)->hContact,szModuleName,"gpg",&dbv1);
- DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"gpg",&dbv2);
+ DBGetContactSetting(pUinKey(lParam1)->hContact,MODULENAME,"gpg",&dbv1);
+ DBGetContactSetting(pUinKey(lParam2)->hContact,MODULENAME,"gpg",&dbv2);
s=(dbv1.type==DBVT_ASCIIZ);
d=(dbv2.type==DBVT_ASCIIZ);
if (s && d) {
@@ -1709,10 +1709,10 @@ int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { return (s-d)*m;
} break;
case 0x05: {
- DBGetContactSetting(pUinKey(lParam1)->hContact,szModuleName,"PSK",&dbv1);
+ DBGetContactSetting(pUinKey(lParam1)->hContact,MODULENAME,"PSK",&dbv1);
s=(dbv1.type==DBVT_ASCIIZ);
DBFreeVariant(&dbv1);
- DBGetContactSetting(pUinKey(lParam2)->hContact,szModuleName,"PSK",&dbv2);
+ DBGetContactSetting(pUinKey(lParam2)->hContact,MODULENAME,"PSK",&dbv2);
d=(dbv2.type==DBVT_ASCIIZ);
DBFreeVariant(&dbv2);
return (s-d)*m;
@@ -1728,14 +1728,14 @@ void ListView_Sort(HWND hLV, LPARAM lParamSort) { // restore sort column
sprintf(t,"os%02x",(UINT)lParamSort&0xF0);
if ((lParamSort&0x0F)==0) {
- lParamSort=(int)db_get_b(0, szModuleName, t, lParamSort+1);
+ lParamSort=(int)db_get_b(0, MODULENAME, t, lParamSort+1);
}
- db_set_b(0, szModuleName, t, (BYTE)lParamSort);
+ db_set_b(0, MODULENAME, t, (BYTE)lParamSort);
// restore sort order
sprintf(t,"os%02x",(UINT)lParamSort);
- int m=db_get_b(0, szModuleName, t, 0);
- if (bChangeSortOrder){ m=!m; db_set_b(0, szModuleName, t, m); }
+ int m=db_get_b(0, MODULENAME, t, 0);
+ if (bChangeSortOrder){ m=!m; db_set_b(0, MODULENAME, t, m); }
ListView_SortItems(hLV,&CompareFunc,lParamSort|(m<<8));
}
@@ -1882,7 +1882,7 @@ int onRegisterOptions(WPARAM wParam, LPARAM) odp.cbSize = sizeof(odp);
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSTAB);
- odp.pszTitle = (char*)szModuleName;
+ odp.pszTitle = (char*)MODULENAME;
odp.pszGroup = LPGEN("Services");
odp.pfnDlgProc = OptionsDlgProc;
Options_AddPage(wParam, &odp);
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp index 572ed34b99..9095c3c482 100644 --- a/plugins/SecureIM/src/popupOptions.cpp +++ b/plugins/SecureIM/src/popupOptions.cpp @@ -21,22 +21,22 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l switch(LOWORD(wParam)) {
case IDC_BACKKEY:
- DBWriteContactSettingDword(0, szModuleName, "colorKeyb", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorKeyb", color);
break;
case IDC_TEXTKEY:
- DBWriteContactSettingDword(0, szModuleName, "colorKeyt", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorKeyt", color);
break;
case IDC_BACKSEC:
- DBWriteContactSettingDword(0, szModuleName, "colorSecb", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorSecb", color);
break;
case IDC_TEXTSEC:
- DBWriteContactSettingDword(0, szModuleName, "colorSect", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorSect", color);
break;
case IDC_BACKSR:
- DBWriteContactSettingDword(0, szModuleName, "colorSRb", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorSRb", color);
break;
case IDC_TEXTSR:
- DBWriteContactSettingDword(0, szModuleName, "colorSRt", color);
+ DBWriteContactSettingDword(0, MODULENAME, "colorSRt", color);
break;
}
return TRUE;
@@ -52,53 +52,53 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l break;
case IDC_EC: {
//set ec checkbox value
- db_set_b(0, szModuleName, "ec", (BYTE)(SendMessage(hec,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "ec", (BYTE)(SendMessage(hec,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_DC: {
//set dc checkbox value
- db_set_b(0, szModuleName, "dc", (BYTE)(SendMessage(hdc,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "dc", (BYTE)(SendMessage(hdc,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_SS: {
//set ss checkbox value
- db_set_b(0, szModuleName, "ss", (BYTE)(SendMessage(hss,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "ss", (BYTE)(SendMessage(hss,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_SR: {
//set sr checkbox value
- db_set_b(0, szModuleName, "sr", (BYTE)(SendMessage(hsr,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "sr", (BYTE)(SendMessage(hsr,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_KS: {
//set indicator checkbox value
- db_set_b(0, szModuleName, "ks", (BYTE)(SendMessage(hks,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "ks", (BYTE)(SendMessage(hks,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_KR: {
//set indicator checkbox value
- db_set_b(0, szModuleName, "kr", (BYTE)(SendMessage(hkr,BM_GETCHECK,0L,0L)==BST_CHECKED));
+ db_set_b(0, MODULENAME, "kr", (BYTE)(SendMessage(hkr,BM_GETCHECK,0L,0L)==BST_CHECKED));
}
break;
case IDC_TIMEKEY: {
//set timeout value
GetDlgItemText(hDlg,IDC_TIMEKEY,getTimeout,sizeof(getTimeout));
mir_itoa(atoi(getTimeout),getTimeout,10);
- DBWriteContactSettingString(0, szModuleName, "timeoutKey", getTimeout);
+ DBWriteContactSettingString(0, MODULENAME, "timeoutKey", getTimeout);
}
break;
case IDC_TIMESEC: {
//set timeout value
GetDlgItemText(hDlg,IDC_TIMESEC,getTimeout,sizeof(getTimeout));
mir_itoa(atoi(getTimeout),getTimeout,10);
- DBWriteContactSettingString(0, szModuleName, "timeoutSec", getTimeout);
+ DBWriteContactSettingString(0, MODULENAME, "timeoutSec", getTimeout);
}
break;
case IDC_TIMESR: {
//set timeout value
GetDlgItemText(hDlg,IDC_TIMESR,getTimeout,sizeof(getTimeout));
mir_itoa(atoi(getTimeout),getTimeout,10);
- DBWriteContactSettingString(0, szModuleName, "timeoutSR", getTimeout);
+ DBWriteContactSettingString(0, MODULENAME, "timeoutSR", getTimeout);
}
break;
} //switch
@@ -118,34 +118,34 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l char *timeout;
//set timeout value for Key
- if (DBGetContactSetting(0, szModuleName, "timeoutKey", &dbv) == 0) timeout=dbv.pszVal;
+ if (DBGetContactSetting(0, MODULENAME, "timeoutKey", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMEKEY, timeout);
DBFreeVariant(&dbv);
//set timeout value for SEC
- if (DBGetContactSetting(0, szModuleName, "timeoutSec", &dbv) == 0) timeout=dbv.pszVal;
+ if (DBGetContactSetting(0, MODULENAME, "timeoutSec", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMESEC, timeout);
DBFreeVariant(&dbv);
//set timeout value for SR
- if (DBGetContactSetting(0, szModuleName, "timeoutSR", &dbv) == 0) timeout=dbv.pszVal;
+ if (DBGetContactSetting(0, MODULENAME, "timeoutSR", &dbv) == 0) timeout=dbv.pszVal;
else timeout="0";
SetDlgItemText(hDlg, IDC_TIMESR, timeout);
DBFreeVariant(&dbv);
//key color
- SendDlgItemMessage(hDlg,IDC_BACKKEY,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorKeyb", RGB(230,230,255)));
- SendDlgItemMessage(hDlg,IDC_TEXTKEY,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorKeyt", RGB(0,0,0)));
+ SendDlgItemMessage(hDlg,IDC_BACKKEY,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorKeyb", RGB(230,230,255)));
+ SendDlgItemMessage(hDlg,IDC_TEXTKEY,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorKeyt", RGB(0,0,0)));
//Session color
- SendDlgItemMessage(hDlg,IDC_BACKSEC,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorSecb", RGB(255,255,200)));
- SendDlgItemMessage(hDlg,IDC_TEXTSEC,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorSect", RGB(0,0,0)));
+ SendDlgItemMessage(hDlg,IDC_BACKSEC,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorSecb", RGB(255,255,200)));
+ SendDlgItemMessage(hDlg,IDC_TEXTSEC,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorSect", RGB(0,0,0)));
//SR color
- SendDlgItemMessage(hDlg,IDC_BACKSR,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorSRb", RGB(200,255,200)));
- SendDlgItemMessage(hDlg,IDC_TEXTSR,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, szModuleName, "colorSRt", RGB(0,0,0)));
+ SendDlgItemMessage(hDlg,IDC_BACKSR,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorSRb", RGB(200,255,200)));
+ SendDlgItemMessage(hDlg,IDC_TEXTSR,CPM_SETCOLOUR,0,DBGetContactSettingDword(0, MODULENAME, "colorSRt", RGB(0,0,0)));
break;
}
@@ -166,7 +166,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk int indic;
// ec checkbox
- if (DBGetContactSetting(0, szModuleName, "ec", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "ec", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=1;
@@ -175,7 +175,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk else SendMessage(hec,BM_SETCHECK,BST_UNCHECKED,0L);
// dc checkbox
- if (DBGetContactSetting(0, szModuleName, "dc", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "dc", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=1;
@@ -184,7 +184,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk else SendMessage(hdc,BM_SETCHECK,BST_UNCHECKED,0L);
// ks checkbox
- if (DBGetContactSetting(0, szModuleName, "ks", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "ks", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=1;
@@ -193,7 +193,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk else SendMessage(hks,BM_SETCHECK,BST_UNCHECKED,0L);
// kr checkbox
- if (DBGetContactSetting(0, szModuleName, "kr", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "kr", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=1;
@@ -202,7 +202,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk else SendMessage(hkr,BM_SETCHECK,BST_UNCHECKED,0L);
//ss checkbox
- if (DBGetContactSetting(0, szModuleName, "ss", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "ss", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=0;
@@ -211,7 +211,7 @@ void RefreshPopupOptionsDlg(HWND hec,HWND hdc,HWND hss,HWND hsr,HWND hks,HWND hk else SendMessage(hss,BM_SETCHECK,BST_UNCHECKED,0L);
//sr checkbox
- if (DBGetContactSetting(0, szModuleName, "sr", &dbv) == 0)
+ if (DBGetContactSetting(0, MODULENAME, "sr", &dbv) == 0)
{indic=dbv.bVal;
}
else indic=0;
@@ -230,7 +230,7 @@ int onRegisterPopOptions(WPARAM wParam, LPARAM) odp.cbSize = sizeof(odp);
odp.hInstance = g_hInst;
odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUP);
- odp.pszTitle = (char*)szModuleName;
+ odp.pszTitle = (char*)MODULENAME;
odp.pszGroup = LPGEN("PopUps");
odp.pfnDlgProc = PopOptionsDlgProc;
Options_AddPage(wParam, &odp);
diff --git a/plugins/SecureIM/src/splitmsg.cpp b/plugins/SecureIM/src/splitmsg.cpp index 944393025b..4cf6e5f91d 100644 --- a/plugins/SecureIM/src/splitmsg.cpp +++ b/plugins/SecureIM/src/splitmsg.cpp @@ -11,8 +11,8 @@ LPSTR splitMsg(LPSTR szMsg, int iLen) { LPSTR out = (LPSTR) mir_alloc(len*2);
LPSTR buf = out;
- WORD msg_id = DBGetContactSettingWord(0, szModuleName, "msgid", 0) + 1;
- DBWriteContactSettingWord(0, szModuleName, "msgid", msg_id);
+ WORD msg_id = DBGetContactSettingWord(0, MODULENAME, "msgid", 0) + 1;
+ DBWriteContactSettingWord(0, MODULENAME, "msgid", msg_id);
int part_all = (len+iLen-1)/iLen;
for(int part_num=0; part_num<part_all; part_num++) {
diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp index d2b37b8155..45cd9a9eea 100644 --- a/plugins/SecureIM/src/svcs_menu.cpp +++ b/plugins/SecureIM/src/svcs_menu.cpp @@ -28,8 +28,8 @@ INT_PTR __cdecl Service_Status(WPARAM wParam, LPARAM lParam) { pUinKey ptr = getUinKey((HANDLE)wParam);
if (ptr) {
ptr->status=ptr->tstatus=(BYTE)lParam;
- if (ptr->status==STATUS_ENABLED) DBDeleteContactSetting(ptr->hContact, szModuleName, "StatusID");
- else db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
+ if (ptr->status==STATUS_ENABLED) db_unset(ptr->hContact, MODULENAME, "StatusID");
+ else db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status);
}
break;
}
@@ -59,9 +59,9 @@ INT_PTR __cdecl Service_StatusTry(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) {
if (bPGPloaded) {
- DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp");
- DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp_mode");
- DBDeleteContactSetting((HANDLE)wParam, szModuleName, "pgp_abbr");
+ db_unset((HANDLE)wParam, MODULENAME, "pgp");
+ db_unset((HANDLE)wParam, MODULENAME, "pgp_mode");
+ db_unset((HANDLE)wParam, MODULENAME, "pgp_abbr");
}
{
pUinKey ptr = getUinKey((HANDLE)wParam);
@@ -80,17 +80,17 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { char szKeyID[128]; szKeyID[0]='\0';
PVOID KeyID = pgp_select_keyid(GetForegroundWindow(),szKeyID);
if (szKeyID[0]) {
- DBDeleteContactSetting((HANDLE)wParam,szModuleName,"pgp");
+ db_unset((HANDLE)wParam,MODULENAME,"pgp");
DBCONTACTWRITESETTING cws;
memset(&cws,0,sizeof(cws));
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
cws.szSetting = "pgp";
cws.value.type = DBVT_BLOB;
cws.value.pbVal = (LPBYTE)KeyID;
cws.value.cpbVal = pgp_size_keyid();
CallService(MS_DB_CONTACT_WRITESETTING,wParam,(LPARAM)&cws);
- db_set_b((HANDLE)wParam,szModuleName,"pgp_mode",0);
- DBWriteContactSettingString((HANDLE)wParam,szModuleName,"pgp_abbr",szKeyID);
+ db_set_b((HANDLE)wParam,MODULENAME,"pgp_mode",0);
+ DBWriteContactSettingString((HANDLE)wParam,MODULENAME,"pgp_abbr",szKeyID);
del = false;
}
}
@@ -100,10 +100,10 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { if (ShowSelectKeyDlg(0,KeyPath)) {
char *publ = LoadKeys(KeyPath,false);
if (publ) {
- DBDeleteContactSetting((HANDLE)wParam,szModuleName,"pgp");
- myDBWriteStringEncode((HANDLE)wParam,szModuleName,"pgp",publ);
- db_set_b((HANDLE)wParam,szModuleName,"pgp_mode",1);
- DBWriteContactSettingString((HANDLE)wParam,szModuleName,"pgp_abbr","(binary)");
+ db_unset((HANDLE)wParam,MODULENAME,"pgp");
+ myDBWriteStringEncode((HANDLE)wParam,MODULENAME,"pgp",publ);
+ db_set_b((HANDLE)wParam,MODULENAME,"pgp_mode",1);
+ DBWriteContactSettingString((HANDLE)wParam,MODULENAME,"pgp_abbr","(binary)");
mir_free(publ);
del = false;
}
@@ -124,7 +124,7 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) { INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM lParam) {
if (bGPGloaded) {
- DBDeleteContactSetting((HANDLE)wParam, szModuleName, "gpg");
+ db_unset((HANDLE)wParam, MODULENAME, "gpg");
}
{
pUinKey ptr = getUinKey((HANDLE)wParam);
@@ -142,7 +142,7 @@ INT_PTR __cdecl Service_GPGsetKey(WPARAM wParam, LPARAM lParam) { char szKeyID[128]; szKeyID[0]='\0';
gpg_select_keyid(GetForegroundWindow(),szKeyID);
if (szKeyID[0]) {
- DBWriteContactSettingString((HANDLE)wParam,szModuleName,"gpg",szKeyID);
+ DBWriteContactSettingString((HANDLE)wParam,MODULENAME,"gpg",szKeyID);
del = false;
}
}
@@ -165,7 +165,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) { case MODE_NATIVE:
case MODE_RSAAES:
if ( isContactSecured((HANDLE)wParam)&SECURED ) {
- msgbox(NULL, sim111, szModuleName, MB_OK);
+ msgbox(NULL, sim111, MODULENAME, MB_OK);
return 0;
}
if ( lParam!=MODE_NATIVE && ptr->status>STATUS_ENABLED ) {
@@ -181,7 +181,7 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) { ptr->keyLoaded = 0;
}
ptr->mode=(BYTE)lParam;
- db_set_b((HANDLE)wParam, szModuleName, "mode", (BYTE)lParam);
+ db_set_b((HANDLE)wParam, MODULENAME, "mode", (BYTE)lParam);
}
ShowStatusIcon((HANDLE)wParam);
break;
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index 803ba30c8a..509cb9ecf6 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -188,7 +188,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { #endif
szEncMsg = ppre->szMessage;
if ( !ptr->cntx ) {
- ptr->cntx = cpp_create_context(((bGPGloaded && bGPGkeyrings)?CPP_MODE_GPG:CPP_MODE_PGP) | ((db_get_b(pccsd->hContact,szModuleName,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
+ ptr->cntx = cpp_create_context(((bGPGloaded && bGPGkeyrings)?CPP_MODE_GPG:CPP_MODE_PGP) | ((db_get_b(pccsd->hContact,MODULENAME,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
ptr->keyLoaded = 0;
}
@@ -245,7 +245,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { if ( ptr->mode==MODE_NATIVE ) {
ptr->mode = MODE_RSAAES;
deleteRSAcntx(ptr);
- db_set_b(ptr->hContact, szModuleName, "mode", ptr->mode);
+ db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
}
createRSAcntx(ptr);
loadRSAkey(ptr);
@@ -322,7 +322,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"offlineKey",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,MODULENAME,"offlineKey",&dbv) == 0 ) {
// if valid key is succefully retrieved
ptr->offlineKey = true;
InitKeyX(ptr,dbv.pbVal);
@@ -361,7 +361,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { Sent_NetLog("onRecvMsg: Native SiG_DISA message");
#endif
// ptr->status=ptr->tstatus=STATUS_DISABLED;
-// db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
+// db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status);
}
case SiG_DEIN: { // deinit message
// other user has disabled SecureIM with you
@@ -382,7 +382,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { cpp_delete_context(ptr->cntx);
ptr->cntx = 0;
ptr->keyLoaded = 0;
- db_set_b(ptr->hContact, szModuleName, "mode", ptr->mode);
+ db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
}
switch(ssig) {
case SiG_KEYR: { // key3 message
@@ -419,7 +419,7 @@ INT_PTR __cdecl onRecvMsg(WPARAM wParam, LPARAM lParam) { if ( ptr->features & CPP_FEATURES_RSA ) {
// switch to RSAAES mode
ptr->mode = MODE_RSAAES;
- db_set_b(ptr->hContact, szModuleName, "mode", ptr->mode);
+ db_set_b(ptr->hContact, MODULENAME, "mode", ptr->mode);
resetRSAcntx(ptr);
loadRSAkey(ptr);
@@ -586,10 +586,10 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { int ssig = getSecureSig((LPCSTR)pccsd->lParam);
int stat = getContactStatus(pccsd->hContact);
-// HANDLE hMetaContact = getMetaContact(pccsd->hContact);
-// if ( hMetaContact ) {
-// ptr = getUinKey(hMetaContact);
-// }
+ // HANDLE hMetaContact = getMetaContact(pccsd->hContact);
+ // if ( hMetaContact ) {
+ // ptr = getUinKey(hMetaContact);
+ // }
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSend: %s",(LPSTR)pccsd->lParam);
#endif
@@ -597,14 +597,14 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { if ( !ptr ||
ssig==SiG_GAME || ssig==SiG_PGPM || ssig==SiG_SECU || ssig==SiG_SECP ||
isChatRoom(pccsd->hContact) ||
-/* (ssig!=SiG_NONE && hMetaContact && (pccsd->wParam & PREF_METANODB)) || */
+ /* (ssig!=SiG_NONE && hMetaContact && (pccsd->wParam & PREF_METANODB)) || */
stat==-1 ||
(ssig==SiG_NONE && ptr->sendQueue) ||
(ssig==SiG_NONE && ptr->status==STATUS_DISABLED) // Disabled - pass unhandled
- ) {
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ ) {
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSendMsg: pass unhandled");
+ Sent_NetLog("onSendMsg: pass unhandled");
#endif
}
@@ -613,52 +613,43 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { //
if ( ptr->mode==MODE_PGP || ptr->mode==MODE_GPG ) {
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSendMsg: PGP|GPG mode");
+ Sent_NetLog("onSendMsg: PGP|GPG mode");
#endif
- // если можно зашифровать - шифруем
- if ( isContactPGP(ptr->hContact) || isContactGPG(ptr->hContact)) {
-/*
- if (stat==ID_STATUS_OFFLINE) {
- if (msgbox1(0,sim110,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDNO) {
- return returnNoError(pccsd->hContact);
+ // если можно зашифровать - шифруем
+ if ( isContactPGP(ptr->hContact) || isContactGPG(ptr->hContact)) {
+ if ( !ptr->cntx ) {
+ ptr->cntx = cpp_create_context((isContactGPG(ptr->hContact)?CPP_MODE_GPG:CPP_MODE_PGP) | ((db_get_b(ptr->hContact,MODULENAME,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
+ ptr->keyLoaded = 0;
}
- // exit and send unencrypted message
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- }
-*/
- if ( !ptr->cntx ) {
- ptr->cntx = cpp_create_context((isContactGPG(ptr->hContact)?CPP_MODE_GPG:CPP_MODE_PGP) | ((db_get_b(ptr->hContact,szModuleName,"gpgANSI",0))?CPP_MODE_GPG_ANSI:0));
- ptr->keyLoaded = 0;
- }
- if ( !ptr->keyLoaded && bPGPloaded ) ptr->keyLoaded = LoadKeyPGP(ptr);
- if ( !ptr->keyLoaded && bGPGloaded ) ptr->keyLoaded = LoadKeyGPG(ptr);
- if ( !ptr->keyLoaded ) return returnError(pccsd->hContact,Translate(sim108));
+ if ( !ptr->keyLoaded && bPGPloaded ) ptr->keyLoaded = LoadKeyPGP(ptr);
+ if ( !ptr->keyLoaded && bGPGloaded ) ptr->keyLoaded = LoadKeyGPG(ptr);
+ if ( !ptr->keyLoaded ) return returnError(pccsd->hContact,Translate(sim108));
- LPSTR szNewMsg = NULL;
- LPSTR szUtfMsg = miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam);
- if ( ptr->keyLoaded == 1 ) { // PGP
- szNewMsg = pgp_encode(ptr->cntx,szUtfMsg);
- }
- else
- if ( ptr->keyLoaded == 2 ) { // GPG
- szNewMsg = gpg_encode(ptr->cntx,szUtfMsg);
- }
- mir_free(szUtfMsg);
- if ( !szNewMsg ) {
- return returnError(pccsd->hContact,Translate(sim109));
- }
+ LPSTR szNewMsg = NULL;
+ LPSTR szUtfMsg = miranda_to_utf8((LPCSTR)pccsd->lParam,pccsd->wParam);
+ if ( ptr->keyLoaded == 1 ) { // PGP
+ szNewMsg = pgp_encode(ptr->cntx,szUtfMsg);
+ }
+ else
+ if ( ptr->keyLoaded == 2 ) { // GPG
+ szNewMsg = gpg_encode(ptr->cntx,szUtfMsg);
+ }
+ mir_free(szUtfMsg);
+ if ( !szNewMsg ) {
+ return returnError(pccsd->hContact,Translate(sim109));
+ }
- // отправляем зашифрованное сообщение
- splitMessageSend(ptr,szNewMsg);
+ // отправляем зашифрованное сообщение
+ splitMessageSend(ptr,szNewMsg);
- showPopUpSM(ptr->hContact);
+ showPopUpSM(ptr->hContact);
- return returnNoError(pccsd->hContact);
- }
- else {
- // отправляем незашифрованное
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- }
+ return returnNoError(pccsd->hContact);
+ }
+ else {
+ // отправляем незашифрованное
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ }
}
// get contact SecureIM status
@@ -673,17 +664,17 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { #endif
// contact is offline
if ( stat==ID_STATUS_OFFLINE ) {
- if ( ptr->cntx ) {
- if ( exp->rsa_get_state(ptr->cntx)!=0 ) {
- resetRSAcntx(ptr);
+ if ( ptr->cntx ) {
+ if ( exp->rsa_get_state(ptr->cntx)!=0 ) {
+ resetRSAcntx(ptr);
}
- }
- else {
- createRSAcntx(ptr);
- }
+ }
+ else {
+ createRSAcntx(ptr);
+ }
if ( !bSOM || (!isClientMiranda(ptr,1) && !isSecureIM(ptr,1)) || !loadRSAkey(ptr)) {
if ( ssig==SiG_NONE ) {
- // просто шлем незашифрованное в оффлайн
+ // просто шлем незашифрованное в оффлайн
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
else {
@@ -705,8 +696,8 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { deleteRSAcntx(ptr);
}
if ( ssig==SiG_NONE ) {
- // просто шлем незашифрованное
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ // просто шлем незашифрованное
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
// ничего не шлем дальше - это служебное сообщение
return returnNoError(pccsd->hContact);
@@ -773,7 +764,7 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { CCSDATA ccsd;
memcpy(&ccsd, (HLOCAL)lParam, sizeof(CCSDATA));
- pccsd->wParam |= PREF_METANODB;
+ pccsd->wParam |= PREF_METANODB;
ccsd.lParam = (LPARAM) SIG_DEIN;
ccsd.szProtoService = PSS_MESSAGE;
CallService(MS_PROTO_CHAINSEND, wParam, (LPARAM)&ccsd);
@@ -795,29 +786,29 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { }
if ( !bSOM ) {
- if ( ssig!=SiG_NONE ) {
+ if ( ssig!=SiG_NONE ) {
return returnNoError(pccsd->hContact);
- }
- // exit and send unencrypted message
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ }
+ // exit and send unencrypted message
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
BOOL isMiranda = isClientMiranda(ptr->hContact);
if ( stid==STATUS_ALWAYSTRY && isMiranda ) { // always try && Miranda
// set key for offline user
DBVARIANT dbv; dbv.type = DBVT_BLOB;
- if ( DBGetContactSettingDword(ptr->hContact, szModuleName, "offlineKeyTimeout", 0) > gettime() &&
- DBGetContactSetting(ptr->hContact, szModuleName, "offlineKey", &dbv) == 0
- ) {
- // if valid key is succefully retrieved
- ptr->offlineKey = true;
- InitKeyX(ptr,dbv.pbVal);
- DBFreeVariant(&dbv);
+ if ( DBGetContactSettingDword(ptr->hContact, MODULENAME, "offlineKeyTimeout", 0) > gettime() &&
+ DBGetContactSetting(ptr->hContact, MODULENAME, "offlineKey", &dbv) == 0
+ ) {
+ // if valid key is succefully retrieved
+ ptr->offlineKey = true;
+ InitKeyX(ptr,dbv.pbVal);
+ DBFreeVariant(&dbv);
}
else {
- DBDeleteContactSetting(ptr->hContact,szModuleName,"offlineKey");
- DBDeleteContactSetting(ptr->hContact,szModuleName,"offlineKeyTimeout");
- if (msgbox1(0,sim106,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDNO) {
+ db_unset(ptr->hContact,MODULENAME,"offlineKey");
+ db_unset(ptr->hContact,MODULENAME,"offlineKeyTimeout");
+ if (msgbox1(0,sim106,MODULENAME,MB_YESNO|MB_ICONQUESTION)==IDNO) {
return returnNoError(pccsd->hContact);
}
// exit and send unencrypted message
@@ -825,13 +816,13 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { }
}
else {
-/* if (stid==STATUS_ALWAYSTRY && !isMiranda || stid!=STATUS_ALWAYSTRY && isMiranda) {
- int res=msgbox1(0,"User is offline now, Do you want to send your message ?\nIt will be unencrypted !","Can't Send Encrypted Message !",MB_YESNO);
- if (res==IDNO) return 1;
+ /* if (stid==STATUS_ALWAYSTRY && !isMiranda || stid!=STATUS_ALWAYSTRY && isMiranda) {
+ int res=msgbox1(0,"User is offline now, Do you want to send your message ?\nIt will be unencrypted !","Can't Send Encrypted Message !",MB_YESNO);
+ if (res==IDNO) return 1;
}*/
- if ( ssig!=SiG_NONE ) {
- return returnNoError(pccsd->hContact);
- }
+ if ( ssig!=SiG_NONE ) {
+ return returnNoError(pccsd->hContact);
+ }
// exit and send unencrypted message
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
@@ -885,83 +876,62 @@ INT_PTR __cdecl onSendMsg(WPARAM wParam, LPARAM lParam) { #if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("onSendMsg: cryptokey exist");
#endif
-/* if ( !hMetaContact && isProtoMetaContacts(pccsd->hContact) && (db_get_b(NULL, "MetaContacts", "SubcontactHistory", 1) == 1)) {
- // add sent event to subcontact
- DBEVENTINFO dbei; HANDLE hC = getMostOnline(pccsd->hContact);
- ZeroMemory(&dbei, sizeof(dbei));
- dbei.cbSize = sizeof(dbei);
- dbei.szModule = GetContactProto(hC, 0);
- dbei.flags = DBEF_SENT;
- dbei.timestamp = time(NULL);
- dbei.eventType = EVENTTYPE_MESSAGE;
- if (pccsd->wParam & PREF_RTL) dbei.flags |= DBEF_RTL;
- if (pccsd->wParam & PREF_UTF) dbei.flags |= DBEF_UTF;
- dbei.cbBlob = strlen((char *)pccsd->lParam) + 1;
- if ( pccsd->wParam & PREF_UNICODE )
- dbei.cbBlob *= ( sizeof( wchar_t )+1 );
- dbei.pBlob = (PBYTE)pccsd->lParam;
-
- CallService(MS_DB_EVENT_ADD, (WPARAM)hC, (LPARAM)&dbei);
- } */
-
- LPSTR szNewMsg = encodeMsg(ptr,(LPARAM)pccsd);
+ LPSTR szNewMsg = encodeMsg(ptr,(LPARAM)pccsd);
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSend: encrypted msg '%s'",szNewMsg);
+ Sent_NetLog("onSend: encrypted msg '%s'",szNewMsg);
#endif
- pccsd->wParam |= PREF_METANODB;
- pccsd->lParam = (LPARAM) szNewMsg;
- pccsd->szProtoService = PSS_MESSAGE;
- int ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ pccsd->wParam |= PREF_METANODB;
+ pccsd->lParam = (LPARAM) szNewMsg;
+ pccsd->szProtoService = PSS_MESSAGE;
+ int ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- mir_free(szNewMsg);
+ mir_free(szNewMsg);
- showPopUpSM(ptr->hContact);
+ showPopUpSM(ptr->hContact);
- return ret;
+ return ret;
}
- else {
+
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSendMsg: cryptokey not exist, try establishe connection");
+ Sent_NetLog("onSendMsg: cryptokey not exist, try establishe connection");
#endif
- // send KeyA if init || always_try || waitkey || always_if_possible
- if ( ssig==SiG_INIT || (stid==STATUS_ALWAYSTRY && isClientMiranda(ptr->hContact)) || isSecureIM(ptr->hContact) || ptr->waitForExchange ) {
- if (ssig==SiG_NONE) {
- addMsg2Queue(ptr, pccsd->wParam, (LPSTR)pccsd->lParam);
- }
- if ( !ptr->waitForExchange ) {
- // init || always_try || always_if_possible
- LPSTR keyToSend = InitKeyA(ptr,0); // calculate public and private key & fill KeyA
+ // send KeyA if init || always_try || waitkey || always_if_possible
+ if ( ssig==SiG_INIT || (stid==STATUS_ALWAYSTRY && isClientMiranda(ptr->hContact)) || isSecureIM(ptr->hContact) || ptr->waitForExchange ) {
+ if (ssig==SiG_NONE) {
+ addMsg2Queue(ptr, pccsd->wParam, (LPSTR)pccsd->lParam);
+ }
+ if ( !ptr->waitForExchange ) {
+ // init || always_try || always_if_possible
+ LPSTR keyToSend = InitKeyA(ptr,0); // calculate public and private key & fill KeyA
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("Sending KEY3: %s", keyToSend);
+ Sent_NetLog("Sending KEY3: %s", keyToSend);
#endif
- pccsd->wParam &= ~PREF_UNICODE;
- pccsd->wParam |= PREF_METANODB;
- pccsd->lParam = (LPARAM) keyToSend;
- pccsd->szProtoService = PSS_MESSAGE;
- CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- mir_free(keyToSend);
-
- showPopUpKS(pccsd->hContact);
- ShowStatusIconNotify(pccsd->hContact);
-
- waitForExchange(ptr); // запускаем ожидание
- }
- return returnNoError(pccsd->hContact);
- }
+ pccsd->wParam &= ~PREF_UNICODE;
+ pccsd->wParam |= PREF_METANODB;
+ pccsd->lParam = (LPARAM) keyToSend;
+ pccsd->szProtoService = PSS_MESSAGE;
+ CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ mir_free(keyToSend);
+
+ showPopUpKS(pccsd->hContact);
+ ShowStatusIconNotify(pccsd->hContact);
+
+ waitForExchange(ptr); // запускаем ожидание
+ }
+ return returnNoError(pccsd->hContact);
+ }
#if defined(_DEBUG) || defined(NETLIB_LOG)
- Sent_NetLog("onSendMsg: pass unchanged to chain");
+ Sent_NetLog("onSendMsg: pass unchanged to chain");
#endif
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
- }
+ return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
-
int file_idx = 0;
-INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) {
-
+INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam)
+{
CCSDATA *pccsd=(CCSDATA*)lParam;
pUinKey ptr = getUinKey(pccsd->hContact);
@@ -976,9 +946,9 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { if (strstr(file[i],".AESHELL")) continue;
- char *name = strrchr(file[i],'\\');
- if ( !name ) name = file[i];
- else name++;
+ char *name = strrchr(file[i],'\\');
+ if ( !name ) name = file[i];
+ else name++;
char *file_out = (char*) mir_alloc(TEMP_SIZE+strlen(name)+20);
sprintf(file_out,"%s\\%s.AESHELL(%d)",TEMP,name,file_idx++);
@@ -987,12 +957,10 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { sprintf(buf,"%s\n%s",Translate(sim011),file[i]);
showPopUp(buf,NULL,g_hPOP[POP_PU_MSS],2);
- if ( ptr->mode==MODE_RSAAES ) {
+ if (ptr->mode == MODE_RSAAES)
exp->rsa_encrypt_file(ptr->cntx,file[i],file_out);
- }
- else {
+ else
cpp_encrypt_file(ptr->cntx,file[i],file_out);
- }
mir_free(file[i]);
file[i]=file_out;
@@ -1014,27 +982,8 @@ INT_PTR __cdecl onSendFile(WPARAM wParam, LPARAM lParam) { return CallService(PSS_FILE, wParam, lParam);
}
-
-/*
-typedef struct {
- size_t cbSize;
- HANDLE hContact;
- int sending; //true if sending, false if receiving
- char **files;
- int totalFiles;
- int currentFileNumber;
- unsigned long totalBytes;
- unsigned long totalProgress;
- char *workingDir;
- char *currentFile;
- unsigned long currentFileSize;
- unsigned long currentFileProgress;
- unsigned long currentFileTime; //as seconds since 1970
-} PROTOFILETRANSFERSTATUS;
-*/
-
-int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) {
-
+int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam)
+{
ACKDATA *ack=(ACKDATA*)lParam;
if (ack->type!=ACKTYPE_FILE) return 0; //quit if not file transfer event
PROTOFILETRANSFERSTATUS *f = (PROTOFILETRANSFERSTATUS*) ack->lParam;
@@ -1044,21 +993,20 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { if ( isContactSecured(ack->hContact)&SECURED ) {
switch(ack->result) {
-// case ACKRESULT_FILERESUME:
- case ACKRESULT_DATA: {
+ case ACKRESULT_DATA:
if ( !( f->flags & PFTS_SENDING )) {
ptr->finFileRecv = (f->currentFileSize == f->currentFileProgress);
if ( !ptr->lastFileRecv ) ptr->lastFileRecv = mir_strdup(f->szCurrentFile);
}
else
- if ( f->flags & PFTS_SENDING ) {
- ptr->finFileSend = (f->currentFileSize == f->currentFileProgress);
- if ( !ptr->lastFileSend ) ptr->lastFileSend = mir_strdup(f->szCurrentFile);
- }
- } break;
-// case ACKRESULT_INITIALISING:
+ if ( f->flags & PFTS_SENDING ) {
+ ptr->finFileSend = (f->currentFileSize == f->currentFileProgress);
+ if ( !ptr->lastFileSend ) ptr->lastFileSend = mir_strdup(f->szCurrentFile);
+ }
+ break;
+
case ACKRESULT_DENIED:
- case ACKRESULT_FAILED: {
+ case ACKRESULT_FAILED:
if ( ptr->lastFileRecv ) {
if (strstr(ptr->lastFileRecv,".AESHELL")) mir_unlink(ptr->lastFileRecv);
SAFE_FREE(ptr->lastFileRecv);
@@ -1069,16 +1017,16 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { }
if ( ptr->fileSend ) {
char **file=ptr->fileSend;
- for(int j=0;file[j];j++) {
+ for(int j=0;file[j];j++) {
if ( strstr(file[j],".AESHELL")) mir_unlink(file[j]);
mir_free(file[j]);
}
SAFE_FREE(ptr->fileSend);
}
return 0;
- } break;
+
case ACKRESULT_NEXTFILE:
- case ACKRESULT_SUCCESS: {
+ case ACKRESULT_SUCCESS:
if ( ptr->finFileRecv && ptr->lastFileRecv ) {
if ( strstr(ptr->lastFileRecv,".AESHELL")) {
char buf[MAX_PATH];
@@ -1120,11 +1068,10 @@ int __cdecl onProtoAck(WPARAM wParam,LPARAM lParam) { SAFE_FREE(ptr->lastFileSend);
ptr->finFileSend = false;
}
- } break;
+ break;
} // switch
}
return 0;
}
-
// EOF
diff --git a/plugins/SecureIM/src/svcs_rsa.cpp b/plugins/SecureIM/src/svcs_rsa.cpp index 18daf53c62..ed7430b16d 100644 --- a/plugins/SecureIM/src/svcs_rsa.cpp +++ b/plugins/SecureIM/src/svcs_rsa.cpp @@ -42,7 +42,7 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int #endif
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0 ) {
k = 1;
PBYTE buf = (PBYTE) alloca(sigLen); int len;
exp->rsa_get_hash((PBYTE)dbv.pbVal,dbv.cpbVal,(PBYTE)buf,&len);
@@ -62,14 +62,14 @@ int __cdecl rsa_check_pub(HANDLE context, PBYTE pub, int pubLen, PBYTE sig, int else {
if ( k ) mir_snprintf(msg,MSGSIZE,Translate(sim522),cnm,sha,sha_old);
else mir_snprintf(msg,MSGSIZE,Translate(sim520),cnm,sha);
- v = (msgbox(0,msg,szModuleName,MB_YESNO|MB_ICONQUESTION)==IDYES);
+ v = (msgbox(0,msg,MODULENAME,MB_YESNO|MB_ICONQUESTION)==IDYES);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("rsa_check_pub: manual accepted %d",v);
#endif
}
if (v) {
DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
cws.szSetting = "rsa_pub";
cws.value.type = DBVT_BLOB;
cws.value.pbVal = pub;
@@ -112,7 +112,7 @@ void __cdecl rsa_notify(HANDLE context, int state) { case -8: { // сессия разорвана по причине "disabled"
msg=sim508;
// ptr->status=ptr->tstatus=STATUS_DISABLED;
-// db_set_b(ptr->hContact, szModuleName, "StatusID", ptr->status);
+// db_set_b(ptr->hContact, MODULENAME, "StatusID", ptr->status);
} break;
case -0x10: // сессия разорвана по ошибке
case -0x21:
@@ -159,7 +159,7 @@ unsigned __stdcall sttGenerateRSA( LPVOID param ) { exp->rsa_gen_keypair(CPP_MODE_RSA_4096);
DBCONTACTWRITESETTING cws;
- cws.szModule = szModuleName;
+ cws.szModule = MODULENAME;
cws.value.type = DBVT_BLOB;
exp->rsa_get_keypair(CPP_MODE_RSA_4096,(PBYTE)&priv_key,&priv_len,(PBYTE)&pub_key,&pub_len);
@@ -185,7 +185,7 @@ BYTE loadRSAkey(pUinKey ptr) { if ( !ptr->keyLoaded ) {
DBVARIANT dbv;
dbv.type = DBVT_BLOB;
- if ( DBGetContactSetting(ptr->hContact,szModuleName,"rsa_pub",&dbv) == 0 ) {
+ if ( DBGetContactSetting(ptr->hContact,MODULENAME,"rsa_pub",&dbv) == 0 ) {
ptr->keyLoaded = exp->rsa_set_pubkey(ptr->cntx,dbv.pbVal,dbv.cpbVal);
#if defined(_DEBUG) || defined(NETLIB_LOG)
Sent_NetLog("loadRSAkey %d", ptr->keyLoaded);
diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index 6504a209ac..005f93f76e 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -17,7 +17,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { hContact = getMostOnline(hContact); // возьмем тот, через который пойдет сообщение
StatusIconClickData *sicd = (StatusIconClickData *)lParam;
- if ( strcmp(sicd->szModule, szModuleName) != 0 ||
+ if ( strcmp(sicd->szModule, MODULENAME) != 0 ||
!isSecureProtocol(hContact)) return 0; // not our event
BOOL isPGP = isContactPGP(hContact);
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index 5ef89dae92..aeb03b4b86 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -984,12 +984,15 @@ void GetAvaibleDictionaries(LIST<Dictionary> &dicts, TCHAR *path, TCHAR *user_pa void FreeDictionaries(LIST<Dictionary> &dicts)
{
for (int i = 0; i < dicts.getCount(); i++)
- {
delete dicts[i];
- }
+
dicts.destroy();
}
+Dictionary::~Dictionary()
+{
+ delete autoReplace;
+}
// Free the list returned by GetAvaibleDictionaries
void FreeSuggestions(Suggestions &suggestions)
diff --git a/plugins/SpellChecker/src/dictionary.h b/plugins/SpellChecker/src/dictionary.h index 3add2d739c..09902435f6 100644 --- a/plugins/SpellChecker/src/dictionary.h +++ b/plugins/SpellChecker/src/dictionary.h @@ -40,35 +40,35 @@ public: AutoReplaceMap *autoReplace;
HANDLE hIcolib;
- virtual ~Dictionary() {}
+ virtual ~Dictionary();
// Return TRUE if the word is correct
- virtual BOOL spell(const TCHAR *) =0;
+ virtual BOOL spell(const TCHAR *) = 0;
// Return a list of suggestions to a word
- virtual Suggestions suggest(const TCHAR * word) =0;
+ virtual Suggestions suggest(const TCHAR * word) = 0;
// Return a list of auto suggestions to a word
- virtual Suggestions autoSuggest(const TCHAR * word) =0;
+ virtual Suggestions autoSuggest(const TCHAR * word) = 0;
// Return a auto suggestions to a word
// You have to free the item
- virtual TCHAR * autoSuggestOne(const TCHAR * word) =0;
+ virtual TCHAR * autoSuggestOne(const TCHAR * word) = 0;
// Return TRUE if the char is a word char
- virtual BOOL isWordChar(TCHAR c) =0;
+ virtual BOOL isWordChar(TCHAR c) = 0;
// Add a word to the user custom dict
- virtual void addWord(const TCHAR * word) =0;
+ virtual void addWord(const TCHAR * word) = 0;
// Add a word to the list of ignored words
- virtual void ignoreWord(const TCHAR * word) =0;
+ virtual void ignoreWord(const TCHAR * word) = 0;
// Assert that all needed data is loaded
- virtual void load() =0;
+ virtual void load() = 0;
// Return TRUE if the dict is fully loaded
- virtual BOOL isLoaded() =0;
+ virtual BOOL isLoaded() = 0;
};
|