diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Import/src/import.cpp | 2 | ||||
-rw-r--r-- | plugins/Import/src/import.h | 6 | ||||
-rw-r--r-- | plugins/Import/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/Import/src/miranda.cpp | 174 | ||||
-rw-r--r-- | plugins/Import/src/mirandahistory.cpp | 208 | ||||
-rw-r--r-- | plugins/Import/src/progress.cpp | 44 | ||||
-rw-r--r-- | plugins/Import/src/utils.cpp | 50 | ||||
-rw-r--r-- | plugins/Import/src/version.h | 22 | ||||
-rw-r--r-- | plugins/Import/src/wizard.cpp | 37 |
9 files changed, 160 insertions, 385 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index a6411c4621..6a3c21ff37 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -2,7 +2,7 @@ Import plugin for Miranda NG
-Copyright (C) 2012 George Hazan
+Copyright (C) 2012-14 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/plugins/Import/src/import.h b/plugins/Import/src/import.h index a4b000ae05..c61299ead5 100644 --- a/plugins/Import/src/import.h +++ b/plugins/Import/src/import.h @@ -2,7 +2,7 @@ Import plugin for Miranda NG
-Copyright (C) 2012 George Hazan
+Copyright (C) 2012-14 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -103,8 +103,8 @@ INT_PTR CALLBACK MirandaOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam,LPA INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam);
INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
-BOOL IsProtocolLoaded(char* pszProtocolName);
-BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei);
+bool IsProtocolLoaded(const char* pszProtocolName);
+bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei);
int CreateGroup(const TCHAR* name, MCONTACT hContact);
diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index 593154967c..e7dcc6432d 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -2,7 +2,7 @@ Import plugin for Miranda NG
-Copyright (C) 2012 George Hazan
+Copyright (C) 2012-14 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/plugins/Import/src/miranda.cpp b/plugins/Import/src/miranda.cpp index 23a86f63a2..071ba4dc33 100644 --- a/plugins/Import/src/miranda.cpp +++ b/plugins/Import/src/miranda.cpp @@ -2,7 +2,7 @@ Import plugin for Miranda NG
-Copyright (C) 2012 George Hazan
+Copyright (C) 2012-14 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -49,7 +49,7 @@ static void SearchForLists(HWND hdlg, const TCHAR *mirandaPath, const TCHAR *mir do {
// find all subfolders except "." and ".."
- if ( !(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !_tcscmp(fd.cFileName, _T(".")) || !_tcscmp(fd.cFileName, _T("..")))
+ if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !_tcscmp(fd.cFileName, _T(".")) || !_tcscmp(fd.cFileName, _T("..")))
continue;
// skip the current profile too
@@ -58,7 +58,7 @@ static void SearchForLists(HWND hdlg, const TCHAR *mirandaPath, const TCHAR *mir TCHAR buf[MAX_PATH], profile[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s\\%s\\%s.dat"), mirandaPath, fd.cFileName, fd.cFileName);
- if ( _taccess(buf, 0) == 0) {
+ if (_taccess(buf, 0) == 0) {
mir_sntprintf(profile, SIZEOF(profile), _T("%s.dat"), fd.cFileName);
int i = SendDlgItemMessage(hdlg, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)profile);
@@ -76,52 +76,43 @@ INT_PTR CALLBACK MirandaPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPa case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
{
- REPLACEVARSDATA dat = {0};
- dat.cbSize = sizeof(dat);
- dat.dwFlags = RVF_TCHAR;
-
- TCHAR *pfd = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)_T("%miranda_path%\\Profiles"), (LPARAM)&dat);
- TCHAR *pfd1 = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)_T("%miranda_path%"), (LPARAM)&dat);
- TCHAR *pfd2 = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)_T("%miranda_profile%"), (LPARAM)&dat);
- TCHAR *pfn = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)_T("%miranda_profilename%"), (LPARAM)&dat);
+ ptrT pfd(VARST(_T("%miranda_path%\\Profiles")));
+ ptrT pfd1(VARST(_T("%miranda_path%")));
+ ptrT pfd2(VARST(_T("%miranda_profile%")));
+ ptrT pfn(VARST(_T("%miranda_profilename%")));
SearchForLists(hdlg, pfd2, pfn);
SearchForLists(hdlg, pfd1, NULL);
if (lstrcmpi(pfd, pfd2))
SearchForLists(hdlg, pfd, NULL);
-
- mir_free(pfn);
- mir_free(pfd2);
- mir_free(pfd1);
- mir_free(pfd);
}
return TRUE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_BACK:
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_WIZARDINTRO,(LPARAM)WizardIntroPageProc);
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_WIZARDINTRO, (LPARAM)WizardIntroPageProc);
break;
case IDOK:
{
TCHAR filename[MAX_PATH];
GetDlgItemText(hdlg, IDC_FILENAME, filename, SIZEOF(filename));
- if ( _taccess(filename, 4)) {
+ if (_taccess(filename, 4)) {
MessageBox(hdlg, TranslateT("The given file does not exist. Please check that you have entered the name correctly."), TranslateT("Miranda Import"), MB_OK);
break;
}
lstrcpy(importFile, filename);
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_OPTIONS,(LPARAM)MirandaOptionsPageProc);
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_OPTIONS, (LPARAM)MirandaOptionsPageProc);
}
break;
case IDCANCEL:
- PostMessage(GetParent(hdlg),WM_CLOSE,0,0);
+ PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
break;
case IDC_LIST:
- if (HIWORD(wParam)==LBN_SELCHANGE) {
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
int sel = SendDlgItemMessage(hdlg, IDC_LIST, LB_GETCURSEL, 0, 0);
if (sel == LB_ERR) break;
SetDlgItemText(hdlg, IDC_FILENAME, (TCHAR*)SendDlgItemMessage(hdlg, IDC_LIST, LB_GETITEMDATA, sel, 0));
@@ -129,17 +120,15 @@ INT_PTR CALLBACK MirandaPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPa break;
case IDC_OTHER:
- OPENFILENAME ofn;
- TCHAR str[MAX_PATH], text[256];
- TCHAR *pfd;
-
- pfd = Utils_ReplaceVarsT(_T("%miranda_profile%"));
+ ptrT pfd(Utils_ReplaceVarsT(_T("%miranda_profile%")));
+ TCHAR str[MAX_PATH], text[256];
GetDlgItemText(hdlg, IDC_FILENAME, str, SIZEOF(str));
- ZeroMemory(&ofn, sizeof(ofn));
+ mir_sntprintf(text, SIZEOF(text), _T("%s (*.dat, *.bak)%c*.dat;*.bak%c%s (*.*)%c*.*%c%c"), TranslateT("Miranda NG database"), 0, 0, TranslateT("All Files"), 0, 0, 0);
+
+ OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hdlg;
- mir_sntprintf(text, SIZEOF(text), _T("%s (*.dat, *.bak)%c*.dat;*.bak%c%s (*.*)%c*.*%c%c"), TranslateT("Miranda NG database"), 0, 0, TranslateT("All Files"), 0, 0, 0);
ofn.lpstrFilter = text;
ofn.lpstrDefExt = _T("dat");
ofn.lpstrFile = str;
@@ -148,14 +137,11 @@ INT_PTR CALLBACK MirandaPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPa ofn.lpstrInitialDir = pfd;
if (GetOpenFileName(&ofn))
SetDlgItemText(hdlg, IDC_FILENAME, str);
-
- mir_free(pfd);
- break;
}
break;
case WM_DESTROY:
- for (int i = SendDlgItemMessage(hdlg,IDC_LIST,LB_GETCOUNT,0,0)-1; i >= 0; i--)
+ for (int i = SendDlgItemMessage(hdlg, IDC_LIST, LB_GETCOUNT, 0, 0) - 1; i >= 0; i--)
mir_free((char*)SendDlgItemMessage(hdlg, IDC_LIST, LB_GETITEMDATA, i, 0));
break;
}
@@ -163,45 +149,45 @@ INT_PTR CALLBACK MirandaPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPa return FALSE;
}
-INT_PTR CALLBACK MirandaOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK MirandaOptionsPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
- EnableWindow(GetDlgItem(hdlg,IDC_RADIO_ALL), TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_STATIC_ALL), TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_RADIO_CONTACTS), TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_STATIC_CONTACTS), TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_RADIO_CUSTOM), TRUE);
- EnableWindow(GetDlgItem(hdlg,IDC_STATIC_CUSTOM), TRUE);
- CheckDlgButton(hdlg,IDC_RADIO_ALL,BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hdlg, IDC_RADIO_ALL), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATIC_ALL), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_RADIO_CONTACTS), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATIC_CONTACTS), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_RADIO_CUSTOM), TRUE);
+ EnableWindow(GetDlgItem(hdlg, IDC_STATIC_CUSTOM), TRUE);
+ CheckDlgButton(hdlg, IDC_RADIO_ALL, BST_UNCHECKED);
return TRUE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_BACK:
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_MIRANDADB,(LPARAM)MirandaPageProc);
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_MIRANDADB, (LPARAM)MirandaPageProc);
break;
case IDOK:
- if ( IsDlgButtonChecked(hdlg,IDC_RADIO_ALL)) {
+ if (IsDlgButtonChecked(hdlg, IDC_RADIO_ALL)) {
nImportOption = IMPORT_ALL;
nCustomOptions = 0;//IOPT_MSGSENT|IOPT_MSGRECV|IOPT_URLSENT|IOPT_URLRECV;
DoImport = MirandaImport;
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_PROGRESS,(LPARAM)ProgressPageProc);
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressPageProc);
break;
}
- if ( IsDlgButtonChecked(hdlg,IDC_RADIO_CONTACTS)) {
+ if (IsDlgButtonChecked(hdlg, IDC_RADIO_CONTACTS)) {
nImportOption = IMPORT_CONTACTS;
nCustomOptions = 0;
DoImport = MirandaImport;
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_PROGRESS,(LPARAM)ProgressPageProc);
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressPageProc);
break;
}
- if (IsDlgButtonChecked(hdlg,IDC_RADIO_CUSTOM)) {
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_ADVOPTIONS,(LPARAM)MirandaAdvOptionsPageProc);
+ if (IsDlgButtonChecked(hdlg, IDC_RADIO_CUSTOM)) {
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_ADVOPTIONS, (LPARAM)MirandaAdvOptionsPageProc);
break;
}
break;
@@ -215,20 +201,20 @@ INT_PTR CALLBACK MirandaOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam,LPA return FALSE;
}
-static const UINT InControls[]={IDC_IN_MSG,IDC_IN_URL,IDC_IN_FT,IDC_IN_OTHER};
-static const UINT OutControls[]={IDC_OUT_MSG,IDC_OUT_URL,IDC_OUT_FT,IDC_OUT_OTHER};
-static const UINT SysControls[]={IDC_CONTACTS, IDC_SYSTEM};
+static const UINT InControls[] = { IDC_IN_MSG, IDC_IN_URL, IDC_IN_FT, IDC_IN_OTHER };
+static const UINT OutControls[] = { IDC_OUT_MSG, IDC_OUT_URL, IDC_OUT_FT, IDC_OUT_OTHER };
+static const UINT SysControls[] = { IDC_CONTACTS, IDC_SYSTEM };
-INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
{
struct tm *TM = NULL;
- struct _SYSTEMTIME ST = {0};
+ struct _SYSTEMTIME ST = { 0 };
- dwSinceDate = db_get_dw(NULL,IMPORT_MODULE,"ImportSinceTS",time(NULL));
+ dwSinceDate = db_get_dw(NULL, IMPORT_MODULE, "ImportSinceTS", time(NULL));
TM = localtime(&dwSinceDate);
@@ -236,14 +222,14 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam, ST.wMonth = TM->tm_mon + 1;
ST.wDay = TM->tm_mday;
- DateTime_SetSystemtime(GetDlgItem(hdlg,IDC_DATETIMEPICKER),GDT_VALID,&ST);
+ DateTime_SetSystemtime(GetDlgItem(hdlg, IDC_DATETIMEPICKER), GDT_VALID, &ST);
}
return TRUE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_BACK:
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_OPTIONS,(LPARAM)MirandaOptionsPageProc);
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_OPTIONS, (LPARAM)MirandaOptionsPageProc);
break;
case IDOK:
@@ -251,39 +237,39 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam, nImportOption = IMPORT_CUSTOM;
nCustomOptions = 0;
- if (IsDlgButtonChecked(hdlg,IDC_CONTACTS))
+ if (IsDlgButtonChecked(hdlg, IDC_CONTACTS))
nCustomOptions |= IOPT_CONTACTS | IOPT_GROUPS;
- if (IsDlgButtonChecked(hdlg,IDC_SYSTEM))
+ if (IsDlgButtonChecked(hdlg, IDC_SYSTEM))
nCustomOptions |= IOPT_SYSTEM;
// incoming
- if (IsDlgButtonChecked(hdlg,IDC_IN_MSG))
+ if (IsDlgButtonChecked(hdlg, IDC_IN_MSG))
nCustomOptions |= IOPT_MSGRECV;
- if (IsDlgButtonChecked(hdlg,IDC_IN_URL))
+ if (IsDlgButtonChecked(hdlg, IDC_IN_URL))
nCustomOptions |= IOPT_URLRECV;
- if (IsDlgButtonChecked(hdlg,IDC_IN_FT))
+ if (IsDlgButtonChecked(hdlg, IDC_IN_FT))
nCustomOptions |= IOPT_FILERECV;
- if (IsDlgButtonChecked(hdlg,IDC_IN_OTHER))
+ if (IsDlgButtonChecked(hdlg, IDC_IN_OTHER))
nCustomOptions |= IOPT_OTHERRECV;
// outgoing
- if (IsDlgButtonChecked(hdlg,IDC_OUT_MSG))
+ if (IsDlgButtonChecked(hdlg, IDC_OUT_MSG))
nCustomOptions |= IOPT_MSGSENT;
- if (IsDlgButtonChecked(hdlg,IDC_OUT_URL))
+ if (IsDlgButtonChecked(hdlg, IDC_OUT_URL))
nCustomOptions |= IOPT_URLSENT;
- if (IsDlgButtonChecked(hdlg,IDC_OUT_FT))
+ if (IsDlgButtonChecked(hdlg, IDC_OUT_FT))
nCustomOptions |= IOPT_FILESENT;
- if (IsDlgButtonChecked(hdlg,IDC_OUT_OTHER))
+ if (IsDlgButtonChecked(hdlg, IDC_OUT_OTHER))
nCustomOptions |= IOPT_OTHERSENT;
// since date
dwSinceDate = 0;
- if ( IsDlgButtonChecked( hdlg, IDC_SINCE )) {
- struct _SYSTEMTIME ST = {0};
+ if (IsDlgButtonChecked(hdlg, IDC_SINCE)) {
+ struct _SYSTEMTIME ST = { 0 };
- if (DateTime_GetSystemtime(GetDlgItem(hdlg,IDC_DATETIMEPICKER), &ST) == GDT_VALID) {
- struct tm TM = {0};
+ if (DateTime_GetSystemtime(GetDlgItem(hdlg, IDC_DATETIMEPICKER), &ST) == GDT_VALID) {
+ struct tm TM = { 0 };
TM.tm_mday = ST.wDay;
TM.tm_mon = ST.wMonth - 1;
@@ -291,11 +277,12 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam, dwSinceDate = mktime(&TM);
- db_set_dw(NULL,IMPORT_MODULE,"ImportSinceTS",dwSinceDate);
- } }
+ db_set_dw(NULL, IMPORT_MODULE, "ImportSinceTS", dwSinceDate);
+ }
+ }
if (nCustomOptions)
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_PROGRESS,(LPARAM)ProgressPageProc);
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressPageProc);
break;
case IDCANCEL:
@@ -306,47 +293,46 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam, EnableWindow(GetDlgItem(hdlg, IDC_DATETIMEPICKER), IsDlgButtonChecked(hdlg, IDC_SINCE));
break;
- if (HIWORD(wParam) != STN_CLICKED)
- break;
+ if (HIWORD(wParam) != STN_CLICKED)
+ break;
case IDC_ALL:
case IDC_INCOMING:
case IDC_OUTGOING:
if (LOWORD(wParam) == IDC_ALL)
- for (int i = 0; i < sizeof(SysControls)/sizeof(SysControls[0]); i++)
- CheckDlgButton(hdlg,SysControls[i], !IsDlgButtonChecked(hdlg,SysControls[i]));
+ for (int i = 0; i < sizeof(SysControls) / sizeof(SysControls[0]); i++)
+ CheckDlgButton(hdlg, SysControls[i], !IsDlgButtonChecked(hdlg, SysControls[i]));
if (LOWORD(wParam) != IDC_OUTGOING)
- for (int i = 0; i < sizeof(InControls)/sizeof(InControls[0]); i++)
- CheckDlgButton(hdlg,InControls[i], !IsDlgButtonChecked(hdlg,InControls[i]));
+ for (int i = 0; i < sizeof(InControls) / sizeof(InControls[0]); i++)
+ CheckDlgButton(hdlg, InControls[i], !IsDlgButtonChecked(hdlg, InControls[i]));
if (LOWORD(wParam) != IDC_INCOMING)
- for (int i = 0; i < sizeof(OutControls)/sizeof(OutControls[0]); i++)
- CheckDlgButton(hdlg,OutControls[i], !IsDlgButtonChecked(hdlg,OutControls[i]));
+ for (int i = 0; i < sizeof(OutControls) / sizeof(OutControls[0]); i++)
+ CheckDlgButton(hdlg, OutControls[i], !IsDlgButtonChecked(hdlg, OutControls[i]));
break;
case IDC_MSG:
- CheckDlgButton(hdlg,IDC_IN_MSG, !IsDlgButtonChecked(hdlg,IDC_IN_MSG));
- CheckDlgButton(hdlg,IDC_OUT_MSG, !IsDlgButtonChecked(hdlg,IDC_OUT_MSG));
+ CheckDlgButton(hdlg, IDC_IN_MSG, !IsDlgButtonChecked(hdlg, IDC_IN_MSG));
+ CheckDlgButton(hdlg, IDC_OUT_MSG, !IsDlgButtonChecked(hdlg, IDC_OUT_MSG));
break;
case IDC_URL:
- CheckDlgButton(hdlg,IDC_IN_URL, !IsDlgButtonChecked(hdlg,IDC_IN_URL));
- CheckDlgButton(hdlg,IDC_OUT_URL, !IsDlgButtonChecked(hdlg,IDC_OUT_URL));
+ CheckDlgButton(hdlg, IDC_IN_URL, !IsDlgButtonChecked(hdlg, IDC_IN_URL));
+ CheckDlgButton(hdlg, IDC_OUT_URL, !IsDlgButtonChecked(hdlg, IDC_OUT_URL));
break;
case IDC_FT:
- CheckDlgButton(hdlg,IDC_IN_FT, !IsDlgButtonChecked(hdlg,IDC_IN_FT));
- CheckDlgButton(hdlg,IDC_OUT_FT, !IsDlgButtonChecked(hdlg,IDC_OUT_FT));
+ CheckDlgButton(hdlg, IDC_IN_FT, !IsDlgButtonChecked(hdlg, IDC_IN_FT));
+ CheckDlgButton(hdlg, IDC_OUT_FT, !IsDlgButtonChecked(hdlg, IDC_OUT_FT));
break;
case IDC_OTHER:
- CheckDlgButton(hdlg,IDC_IN_OTHER, !IsDlgButtonChecked(hdlg,IDC_IN_OTHER));
- CheckDlgButton(hdlg,IDC_OUT_OTHER, !IsDlgButtonChecked(hdlg,IDC_OUT_OTHER));
+ CheckDlgButton(hdlg, IDC_IN_OTHER, !IsDlgButtonChecked(hdlg, IDC_IN_OTHER));
+ CheckDlgButton(hdlg, IDC_OUT_OTHER, !IsDlgButtonChecked(hdlg, IDC_OUT_OTHER));
break;
}
break;
}
return FALSE;
}
-
diff --git a/plugins/Import/src/mirandahistory.cpp b/plugins/Import/src/mirandahistory.cpp deleted file mode 100644 index ba7a923df7..0000000000 --- a/plugins/Import/src/mirandahistory.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/*
-Miranda ICQ: the free icq client for MS Windows
-Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-#include <windows.h>
-#include <stdio.h>
-#include <time.h>
-#include "resource.h"
-#include "import.h"
-
-BOOL CALLBACK MirandaPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam);
-BOOL CALLBACK FinishedPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam);
-BOOL CALLBACK ProgressPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam);
-extern char importFile[MAX_PATH];
-extern void (*DoImport)(HWND);
-static void OldMirandaHistoryImport(HWND hdlgProgress);
-HANDLE HContactFromUIN(DWORD uin);
-HANDLE HistoryImportFindContact(HWND hdlgProgress,DWORD uin,int addUnknown);
-static DWORD importOptions;
-
-BOOL CALLBACK MirandaHistoryPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
-{
- switch(message) {
- case WM_INITDIALOG:
- CheckDlgButton(hdlg,IDC_ADDUNKNOWN,BST_CHECKED);
- CheckDlgButton(hdlg,IDC_MSGRECV,BST_CHECKED);
- CheckDlgButton(hdlg,IDC_MSGSENT,BST_CHECKED);
- CheckDlgButton(hdlg,IDC_URLRECV,BST_CHECKED);
- CheckDlgButton(hdlg,IDC_URLSENT,BST_CHECKED);
- CheckDlgButton(hdlg,IDC_AUTHREQ,BST_CHECKED);
- CheckDlgButton(hdlg,IDC_ADDED,BST_CHECKED);
- return TRUE;
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_BACK:
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_MIRANDADB,(LPARAM)MirandaPageProc);
- break;
- case IDOK:
- importOptions=0;
- if(IsDlgButtonChecked(hdlg,IDC_ADDUNKNOWN)) importOptions|=IOPT_ADDUNKNOWN;
- if(IsDlgButtonChecked(hdlg,IDC_MSGSENT)) importOptions|=IOPT_MSGSENT;
- if(IsDlgButtonChecked(hdlg,IDC_MSGRECV)) importOptions|=IOPT_MSGRECV;
- if(IsDlgButtonChecked(hdlg,IDC_URLSENT)) importOptions|=IOPT_URLSENT;
- if(IsDlgButtonChecked(hdlg,IDC_URLRECV)) importOptions|=IOPT_URLRECV;
- if(IsDlgButtonChecked(hdlg,IDC_AUTHREQ)) importOptions|=IOPT_AUTHREQ;
- if(IsDlgButtonChecked(hdlg,IDC_ADDED)) importOptions|=IOPT_ADDED;
- DoImport=OldMirandaHistoryImport;
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_PROGRESS,(LPARAM)ProgressPageProc);
- break;
- case IDCANCEL:
- PostMessage(GetParent(hdlg),WM_CLOSE,0,0);
- break;
- }
- break;
- }
- return FALSE;
-}
-
-#define HISTORY_MSGRECV 1
-#define HISTORY_MSGSEND 2
-#define HISTORY_URLRECV 3
-#define HISTORY_URLSEND 4
-#define HISTORY_AUTHREQ 5
-#define HISTORY_ADDED 6
-#define issent(t) ((t)==HISTORY_MSGSEND || (t)==HISTORY_URLSEND)
-static int historyTypeToOption[]={0,IOPT_MSGRECV,IOPT_MSGSENT,IOPT_URLRECV,IOPT_URLSENT,IOPT_AUTHREQ,IOPT_ADDED};
-
-static PBYTE ReadHistoryLines(FILE *fp,int *cbBlob)
-{
- char str[2048];
- char *blob;
- int ofs;
- *cbBlob=0;
- blob=NULL;
- while(fgets(str,sizeof(str),fp) && lstrcmp(str,"\xEE\xEE\xEE\xEE\r\n")) {
- ofs=*cbBlob;
- *cbBlob+=lstrlen(str);
- blob=(char*)realloc(blob,*cbBlob+1);
- lstrcpy(blob+ofs,str);
- }
- if (*cbBlob) {
- (*cbBlob)--;
- blob[*cbBlob-1]=0;
- }
- else {
- *cbBlob=1;
- blob=(char*)malloc(1);
- blob[0]=0;
- }
- return (PBYTE)blob;
-}
-
-static void OldMirandaHistoryImport(HWND hdlgProgress)
-{
- int fileSize;
- FILE *fp;
- char str[2048],*eol,*timeofs;
- HANDLE hContact;
- int type;
- DWORD uin;
- struct tm tmEventTime;
- DBEVENTINFO dbei;
-
- AddMessage("Old Miranda history import routines initialised");
- fp=fopen(importFile,"rb");
- AddMessage("Calibrating status support functions");
- fseek(fp,0,SEEK_END);
- fileSize=ftell(fp);
- fseek(fp,0,SEEK_SET);
- SetProgress(0);
-
- ZeroMemory(&dbei,sizeof(dbei));
- dbei.cbSize=sizeof(dbei);
- dbei.szModule=ICQOSCPROTONAME;
-
- while(!feof(fp)) {
- SetProgress(100*ftell(fp)/fileSize);
- if(fgets(str,sizeof(str),fp)==NULL) break;
- eol=str+lstrlen(str)-1;
-
- while(*eol=='\r' || *eol=='\n' && eol!=str-1)
- *(eol--)=0;
-
- if(lstrlen(str)<20) continue;
- type=*eol;
- uin=strtoul(str,NULL,10);
- if(uin==0) continue; //skip MSN
- timeofs=str+lstrlen(str)-20;
- tmEventTime.tm_hour=atoi(timeofs);
- timeofs=strchr(timeofs,':');
- if(timeofs==NULL) continue;
- tmEventTime.tm_min=atoi(timeofs+1);
- tmEventTime.tm_sec=0;
- tmEventTime.tm_isdst=-1;
- tmEventTime.tm_mday=atoi(timeofs+7);
- tmEventTime.tm_mon=atoi(timeofs+10)-1;
- tmEventTime.tm_year=atoi(timeofs+13)-1900;
- dbei.timestamp=mktime(&tmEventTime)+_timezone;
- if (!(importOptions&historyTypeToOption[type])) continue;
- hContact=HistoryImportFindContact(hdlgProgress,uin,importOptions&IOPT_ADDUNKNOWN);
- if(hContact==INVALID_HANDLE_VALUE) break;
- dbei.flags=issent(type)?DBEF_SENT:DBEF_READ;
- switch(type) {
- case HISTORY_MSGRECV:
- case HISTORY_MSGSEND:
- dbei.eventType=EVENTTYPE_MESSAGE;
- dbei.pBlob=ReadHistoryLines(fp,&dbei.cbBlob);
- CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
- break;
- case HISTORY_URLRECV:
- case HISTORY_URLSEND:
- dbei.eventType=EVENTTYPE_URL;
- dbei.pBlob=ReadHistoryLines(fp,&dbei.cbBlob);
- { char *endOfUrl;
- endOfUrl=strchr(dbei.pBlob,'\r');
- if(endOfUrl!=NULL) {
- *endOfUrl=0;
- dbei.cbBlob--;
- MoveMemory(endOfUrl+1,endOfUrl+2,dbei.cbBlob-(endOfUrl-dbei.pBlob));
- }
- }
- CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&dbei);
- break;
- case HISTORY_AUTHREQ:
- dbei.eventType=EVENTTYPE_AUTHREQUEST;
- dbei.pBlob=ReadHistoryLines(fp,&dbei.cbBlob);
- dbei.pBlob=(PBYTE)realloc(dbei.pBlob,dbei.cbBlob+8);
- MoveMemory(dbei.pBlob+8,dbei.pBlob,dbei.cbBlob);
- *(PDWORD)dbei.pBlob=uin;
- *(char*)(dbei.pBlob+4)=0; //leave nick, first, last, email blank
- *(char*)(dbei.pBlob+5)=0;
- *(char*)(dbei.pBlob+6)=0;
- *(char*)(dbei.pBlob+7)=0;
- dbei.cbBlob+=8;
- CallService(MS_DB_EVENT_ADD,(WPARAM)(HANDLE)NULL,(LPARAM)&dbei);
- break;
- case HISTORY_ADDED:
- dbei.eventType=EVENTTYPE_ADDED;
- dbei.pBlob=(PBYTE)malloc(8);
- dbei.cbBlob=8;
- *(PDWORD)dbei.pBlob=uin;
- *(char*)(dbei.pBlob+4)=0; //leave nick, first, last, email blank
- *(char*)(dbei.pBlob+5)=0;
- *(char*)(dbei.pBlob+6)=0;
- *(char*)(dbei.pBlob+7)=0;
- CallService(MS_DB_EVENT_ADD,(WPARAM)(HANDLE)NULL,(LPARAM)&dbei);
- break;
- }
- }
- AddMessage("Terminating cached I/O access");
- fclose(fp);
- AddMessage("Import completed successfully");
- SetProgress(100);
-}
\ No newline at end of file diff --git a/plugins/Import/src/progress.cpp b/plugins/Import/src/progress.cpp index 8769ba9bd2..168cb0a14c 100644 --- a/plugins/Import/src/progress.cpp +++ b/plugins/Import/src/progress.cpp @@ -2,7 +2,7 @@ Import plugin for Miranda NG
-Copyright (C) 2012 George Hazan
+Copyright (C) 2012-14 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -28,42 +28,42 @@ INT_PTR CALLBACK FinishedPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lP void (*DoImport)(HWND);
-INT_PTR CALLBACK ProgressPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK ProgressPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
- SendMessage(GetParent(hdlg),WIZM_DISABLEBUTTON,0,0);
- SendMessage(GetParent(hdlg),WIZM_DISABLEBUTTON,1,0);
- SendMessage(GetParent(hdlg),WIZM_DISABLEBUTTON,2,0);
- SendDlgItemMessage(hdlg,IDC_PROGRESS,PBM_SETRANGE,0,MAKELPARAM(0,100));
- PostMessage(hdlg,PROGM_START,0,0);
+ SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 0, 0);
+ SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 1, 0);
+ SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 2, 0);
+ SendDlgItemMessage(hdlg, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
+ PostMessage(hdlg, PROGM_START, 0, 0);
return TRUE;
case PROGM_SETPROGRESS:
- SendDlgItemMessage(hdlg,IDC_PROGRESS,PBM_SETPOS,wParam,0);
+ SendDlgItemMessage(hdlg, IDC_PROGRESS, PBM_SETPOS, wParam, 0);
break;
case PROGM_ADDMESSAGE:
{
- int i=SendDlgItemMessage(hdlg,IDC_STATUS,LB_ADDSTRING,0,lParam);
- SendDlgItemMessage(hdlg,IDC_STATUS,LB_SETTOPINDEX,i,0);
+ int i = SendDlgItemMessage(hdlg, IDC_STATUS, LB_ADDSTRING, 0, lParam);
+ SendDlgItemMessage(hdlg, IDC_STATUS, LB_SETTOPINDEX, i, 0);
}
break;
case PROGM_START:
DoImport(hdlg);
- SendMessage(GetParent(hdlg),WIZM_ENABLEBUTTON,1,0);
- SendMessage(GetParent(hdlg),WIZM_ENABLEBUTTON,2,0);
+ SendMessage(GetParent(hdlg), WIZM_ENABLEBUTTON, 1, 0);
+ SendMessage(GetParent(hdlg), WIZM_ENABLEBUTTON, 2, 0);
break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
- PostMessage(GetParent(hdlg),WIZM_GOTOPAGE,IDD_FINISHED,(LPARAM)FinishedPageProc);
+ PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_FINISHED, (LPARAM)FinishedPageProc);
break;
case IDCANCEL:
- PostMessage(GetParent(hdlg),WM_CLOSE,0,0);
+ PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
break;
}
break;
@@ -71,22 +71,22 @@ INT_PTR CALLBACK ProgressPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lP return FALSE;
}
-void AddMessage( const TCHAR* fmt, ... )
+void AddMessage(const TCHAR* fmt, ...)
{
va_list args;
- TCHAR msgBuf[ 4096 ];
- va_start( args, fmt );
+ TCHAR msgBuf[4096];
+ va_start(args, fmt);
- mir_vsntprintf( msgBuf, SIZEOF(msgBuf), TranslateTS(fmt), args );
+ mir_vsntprintf(msgBuf, SIZEOF(msgBuf), TranslateTS(fmt), args);
- #ifdef _LOGGING
+#ifdef _LOGGING
{
FILE *stream;
stream = fopen("Import Debug.log", "a");
fprintf(stream, "%S\n", msgBuf);
fclose(stream);
}
- #endif
+#endif
SendMessage(hdlgProgress, PROGM_ADDMESSAGE, 0, (LPARAM)msgBuf);
}
diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 79e92bb9cf..b3e3d7d6ed 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -2,7 +2,7 @@ Import plugin for Miranda NG
-Copyright (C) 2012 George Hazan
+Copyright (C) 2012-14 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -24,9 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////////////////////////
-BOOL IsProtocolLoaded(char* pszProtocolName)
+bool IsProtocolLoaded(const char *pszProtocolName)
{
- return CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pszProtocolName) ? TRUE : FALSE;
+ return CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pszProtocolName) != 0;
}
// ------------------------------------------------
@@ -35,25 +35,26 @@ BOOL IsProtocolLoaded(char* pszProtocolName) // If contact is specified adds it to group
// ------------------------------------------------
// Returns 1 if successful and 0 when it fails.
+
int CreateGroup(const TCHAR* group, MCONTACT hContact)
{
if (group == NULL)
return 0;
size_t cbName = _tcslen(group);
- TCHAR *tszGrpName = (TCHAR*)_alloca(( cbName+2 )*sizeof( TCHAR ));
+ TCHAR *tszGrpName = (TCHAR*)_alloca((cbName + 2)*sizeof(TCHAR));
tszGrpName[0] = 1 | GROUPF_EXPANDED;
- _tcscpy(tszGrpName+1, group);
+ _tcscpy(tszGrpName + 1, group);
// Check for duplicate & find unused id
char groupIdStr[11];
- for (int groupId = 0; ; groupId++) {
+ for (int groupId = 0;; groupId++) {
DBVARIANT dbv;
- itoa(groupId, groupIdStr,10);
+ itoa(groupId, groupIdStr, 10);
if (db_get_ts(NULL, "CListGroups", groupIdStr, &dbv))
break;
- if ( !lstrcmp(dbv.ptszVal + 1, tszGrpName + 1 )) {
+ if (!lstrcmp(dbv.ptszVal + 1, tszGrpName + 1)) {
if (hContact)
db_set_ts(hContact, "CList", "Group", tszGrpName + 1);
else
@@ -66,16 +67,24 @@ int CreateGroup(const TCHAR* group, MCONTACT hContact) db_free(&dbv);
}
- db_set_ts( NULL, "CListGroups", groupIdStr, tszGrpName );
+ db_set_ts(NULL, "CListGroups", groupIdStr, tszGrpName);
if (hContact)
- db_set_ts( hContact, "CList", "Group", tszGrpName+1 );
+ db_set_ts(hContact, "CList", "Group", tszGrpName + 1);
return 1;
}
+static bool IsEqualEvent(const DBEVENTINFO &ev1, const DBEVENTINFO &ev2)
+{
+ return (ev1.timestamp == ev2.timestamp &&
+ ev1.eventType == ev2.eventType &&
+ ev1.cbBlob == ev2.cbBlob &&
+ (ev1.flags & DBEF_SENT) == (ev2.flags & DBEF_SENT));
+}
+
// Returns TRUE if the event already exist in the database
-BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei)
+bool IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei)
{
static DWORD dwPreviousTimeStamp = -1;
static MCONTACT hPreviousContact = INVALID_CONTACT_ID;
@@ -121,7 +130,7 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei) dwPreviousTimeStamp = dwEventTimeStamp;
hPreviousDbEvent = hExistingDbEvent;
- if ( dbei.timestamp != dwEventTimeStamp )
+ if (dbei.timestamp != dwEventTimeStamp)
return FALSE;
}
}
@@ -132,10 +141,7 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei) dbeiExisting.cbSize = sizeof(dbeiExisting);
db_event_get(hPreviousDbEvent, &dbeiExisting);
- if ((dbei.timestamp == dbeiExisting.timestamp) &&
- (dbei.eventType == dbeiExisting.eventType) &&
- (dbei.cbBlob == dbeiExisting.cbBlob) &&
- ((dbei.flags & DBEF_SENT) == (dbeiExisting.flags & DBEF_SENT)))
+ if (IsEqualEvent(dbei, dbeiExisting))
return TRUE;
// find event with another timestamp
@@ -174,11 +180,7 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei) }
// Compare event with import candidate
- if ((dbei.timestamp == dbeiExisting.timestamp) &&
- (dbei.eventType == dbeiExisting.eventType) &&
- (dbei.cbBlob == dbeiExisting.cbBlob) &&
- ((dbei.flags & DBEF_SENT) == (dbeiExisting.flags & DBEF_SENT)))
- {
+ if (IsEqualEvent(dbei, dbeiExisting)) {
// remember event
hPreviousDbEvent = hExistingDbEvent;
dwPreviousTimeStamp = dbeiExisting.timestamp;
@@ -204,11 +206,7 @@ BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO dbei) }
// Compare event with import candidate
- if ((dbei.timestamp == dbeiExisting.timestamp) &&
- (dbei.eventType == dbeiExisting.eventType) &&
- (dbei.cbBlob == dbeiExisting.cbBlob) &&
- ((dbei.flags&DBEF_SENT) == (dbeiExisting.flags&DBEF_SENT)))
- {
+ if (IsEqualEvent(dbei, dbeiExisting)) {
// remember event
hPreviousDbEvent = hExistingDbEvent;
dwPreviousTimeStamp = dbeiExisting.timestamp;
diff --git a/plugins/Import/src/version.h b/plugins/Import/src/version.h index 3b136ef5d3..b3b9385a46 100644 --- a/plugins/Import/src/version.h +++ b/plugins/Import/src/version.h @@ -1,14 +1,14 @@ -#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 11
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 1
+#define __MAJOR_VERSION 0
+#define __MINOR_VERSION 95
+#define __RELEASE_NUM 3
+#define __BUILD_NUM 1
#include <stdver.h>
-#define __PLUGIN_NAME "Import contacts and messages"
-#define __FILENAME "Import.dll"
-#define __DESCRIPTION "Imports contacts and messages from another Miranda profile or from an external program."
-#define __AUTHOR "Miranda team"
-#define __AUTHOREMAIL "info@miranda-im.org"
-#define __AUTHORWEB "http://miranda-ng.org/p/Import/"
-#define __COPYRIGHT "© 2000-2010 Martin \xd6" "berg, Richard Hughes, Dmitry Kuzkin, George Hazan"
+#define __PLUGIN_NAME "Import contacts and messages"
+#define __FILENAME "Import.dll"
+#define __DESCRIPTION "Imports contacts and messages from another Miranda profile or from an external program."
+#define __AUTHOR "Miranda team"
+#define __AUTHOREMAIL "info@miranda-im.org"
+#define __AUTHORWEB "http://miranda-ng.org/p/Import/"
+#define __COPYRIGHT "© 2012-2014 George Hazan"
diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index 71dc010786..936ba18ee8 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -2,7 +2,7 @@ Import plugin for Miranda NG
-Copyright (C) 2012 George Hazan
+Copyright (C) 2012-14 George Hazan
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -24,29 +24,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR CALLBACK WizardIntroPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch( message ) {
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 0, 0);
return TRUE;
-
+
case WM_COMMAND:
- switch( LOWORD( wParam )) {
+ switch (LOWORD(wParam)) {
case IDOK:
PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_MIRANDADB, (LPARAM)MirandaPageProc);
break;
-
+
case IDCANCEL:
PostMessage(GetParent(hdlg), WM_CLOSE, 0, 0);
break;
- } }
-
+ }
+ }
+
return FALSE;
}
INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch( message ) {
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
SendMessage(GetParent(hdlg), WIZM_DISABLEBUTTON, 0, 0);
@@ -55,18 +56,16 @@ INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM return TRUE;
case WM_COMMAND:
- switch( LOWORD( wParam )) {
+ switch (LOWORD(wParam)) {
case IDOK:
PostMessage(GetParent(hdlg), WIZM_GOTOPAGE, IDD_MIRANDADB, (LPARAM)MirandaPageProc);
break;
case IDCANCEL:
- if ( IsDlgButtonChecked( hdlg, IDC_DONTLOADPLUGIN )) {
+ if (IsDlgButtonChecked(hdlg, IDC_DONTLOADPLUGIN)) {
char sModuleFileName[MAX_PATH];
- char *pszFileName;
-
GetModuleFileNameA(hInst, sModuleFileName, sizeof(sModuleFileName));
- pszFileName = strrchr(sModuleFileName, '\\' );
+ char *pszFileName = strrchr(sModuleFileName, '\\');
if (pszFileName == NULL)
pszFileName = sModuleFileName;
else
@@ -93,11 +92,11 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP {
static HWND hwndPage;
- switch ( message ) {
+ switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
hwndPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARDINTRO), hdlg, WizardIntroPageProc);
- SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
+ SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
ShowWindow(hwndPage, SW_SHOW);
ShowWindow(hdlg, SW_SHOW);
SendMessage(hdlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(hIcoHandle));
@@ -110,12 +109,12 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hdlg, IDCANCEL), TRUE);
SetDlgItemText(hdlg, IDCANCEL, TranslateT("Cancel"));
hwndPage = CreateDialog(hInst, MAKEINTRESOURCE(wParam), hdlg, (DLGPROC)lParam);
- SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
+ SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
ShowWindow(hwndPage, SW_SHOW);
break;
case WIZM_DISABLEBUTTON:
- switch ( wParam ) {
+ switch (wParam) {
case 0:
EnableWindow(GetDlgItem(hdlg, IDC_BACK), FALSE);
break;
@@ -131,7 +130,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP break;
case WIZM_ENABLEBUTTON:
- switch ( wParam ) {
+ switch (wParam) {
case 0:
EnableWindow(GetDlgItem(hdlg, IDC_BACK), TRUE);
break;
@@ -159,6 +158,6 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP DestroyWindow(hdlg);
break;
}
-
+
return FALSE;
}
|