diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2018-03-09 02:05:20 +0300 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2018-03-09 02:06:25 +0300 |
commit | fa5f0cd808f246bfb146efb233394296bed718fe (patch) | |
tree | 455e29e3174a9f9105bb615997f2f26152d9832f /plugins | |
parent | af674186fdd23be4a293db0a66b21aa890ce2fd1 (diff) |
NewsAggregator: use m_gui (mostly working)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/NewsAggregator/NewsAggregator.vcxproj | 2 | ||||
-rw-r--r-- | plugins/NewsAggregator/NewsAggregator.vcxproj.filters | 2 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/ExportImport.cpp | 689 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/NewsAggregator.cpp | 8 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Options.cpp | 1445 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Options.h | 132 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/Services.cpp | 35 | ||||
-rw-r--r-- | plugins/NewsAggregator/Src/stdafx.h | 14 |
8 files changed, 1116 insertions, 1211 deletions
diff --git a/plugins/NewsAggregator/NewsAggregator.vcxproj b/plugins/NewsAggregator/NewsAggregator.vcxproj index d1a5a8dbfa..174e4e1c66 100644 --- a/plugins/NewsAggregator/NewsAggregator.vcxproj +++ b/plugins/NewsAggregator/NewsAggregator.vcxproj @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
diff --git a/plugins/NewsAggregator/NewsAggregator.vcxproj.filters b/plugins/NewsAggregator/NewsAggregator.vcxproj.filters index de5ad9f66c..124e51da2f 100644 --- a/plugins/NewsAggregator/NewsAggregator.vcxproj.filters +++ b/plugins/NewsAggregator/NewsAggregator.vcxproj.filters @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(ProjectDir)..\..\build\vc.common\common.filters" />
</Project>
\ No newline at end of file diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp deleted file mode 100644 index b2c22b55d3..0000000000 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ /dev/null @@ -1,689 +0,0 @@ -/*
-Copyright (C) 2012 Mataes
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-#include "stdafx.h"
-
-INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- HWND FeedsList = GetDlgItem(hwndDlg, IDC_FEEDSLIST);
- HWND FeedsImportList = GetDlgItem(hwndDlg, IDC_FEEDSIMPORTLIST);
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG)lParam);
- Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, MODULE, "ImportDlg");
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE);
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- {
- wchar_t FileName[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName, _countof(FileName));
- int bytesParsed = 0;
- HXML hXml = xmlParseFile(FileName, &bytesParsed, nullptr);
- if(hXml != nullptr) {
- HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- bool isTextUTF = false, isURLUTF = false, isSiteURLUTF = false, isGroupUTF = false;
- HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0);
- if ( !node)
- node = xmlGetChildByPath(hXml, L"body/outline", 0);
- int count = (int)SendMessage(FeedsImportList, LB_GETCOUNT, 0, 0);
- int DUPES = 0;
- if (node) {
- while (node) {
- int outlineAttr = xmlGetAttrCount(node);
- int outlineChildsCount = xmlGetChildCount(node);
- wchar_t *xmlUrl = (wchar_t *)xmlGetAttrValue(node, L"xmlUrl");
- if (!xmlUrl && !outlineChildsCount) {
- HXML tmpnode = node;
- node = xmlGetNextNode(node);
- if ( !node) {
- do {
- node = tmpnode;
- node = xmlGetParent(node);
- tmpnode = node;
- node = xmlGetNextNode(node);
- if (node)
- break;
- } while (mir_wstrcmpi(xmlGetName(node), L"body"));
- }
- }
- else if (!xmlUrl && outlineChildsCount)
- node = xmlGetFirstChild(node);
- else if (xmlUrl) {
- wchar_t *text = nullptr, *url = nullptr, *siteurl = nullptr, *group = nullptr;
- BYTE NeedToImport = FALSE;
- for (int i = 0; i < outlineAttr; i++) {
- if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"text")) {
- text = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
- if (!text) {
- isTextUTF = 0;
- text = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
- } else
- isTextUTF = 1;
-
- for (int j = 0; j < count; j++) {
- wchar_t item[MAX_PATH];
- SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)j, (LPARAM)item);
- if (!mir_wstrcmpi(item, text)) {
- NeedToImport = TRUE;
- break;
- }
- }
- continue;
- }
- if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"xmlUrl")) {
- url = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
- if ( !url) {
- isURLUTF = false;
- url = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
- } else
- isURLUTF = true;
- if (GetContactByURL(url) && NeedToImport) {
- NeedToImport = FALSE;
- DUPES++;
- }
- continue;
- }
- if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"htmlUrl")) {
- siteurl = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
- if ( !siteurl) {
- isSiteURLUTF = false;
- siteurl = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
- } else
- isSiteURLUTF = true;
- continue;
- }
- if (text && url && siteurl)
- break;
- }
-
- if (NeedToImport) {
- HXML parent = xmlGetParent(node);
- wchar_t tmpgroup[1024];
- while (mir_wstrcmpi(xmlGetName(parent), L"body")) {
- for (int i = 0; i < xmlGetAttrCount(parent); i++) {
- if (!mir_wstrcmpi(xmlGetAttrName(parent, i), L"text")) {
- if ( !group)
- group = (wchar_t *)xmlGetAttrValue(parent, xmlGetAttrName(parent, i));
- else {
- mir_snwprintf(tmpgroup, L"%s\\%s", xmlGetAttrValue(parent, xmlGetAttrName(parent, i)), group);
- group = tmpgroup;
- }
- break;
- }
- }
- parent = xmlGetParent(parent);
- }
-
- wchar_t *ptszGroup = nullptr;
- if (group) {
- ptszGroup = mir_utf8decodeW(_T2A(group));
- if ( !ptszGroup) {
- isGroupUTF = false;
- ptszGroup = group;
- } else
- isGroupUTF = 1;
- }
-
- MCONTACT hContact = db_add_contact();
- Proto_AddToContact(hContact, MODULE);
- db_set_ws(hContact, MODULE, "Nick", text);
- db_set_ws(hContact, MODULE, "URL", url);
- db_set_ws(hContact, MODULE, "Homepage", siteurl);
- db_set_b(hContact, MODULE, "CheckState", 1);
- db_set_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME);
- db_set_ws(hContact, MODULE, "MsgFormat", TAGSDEFAULT);
- db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0));
- if (ptszGroup) {
- db_set_ws(hContact, "CList", "Group", ptszGroup);
- Clist_GroupCreate(0, ptszGroup);
- }
- if (isGroupUTF)
- mir_free(ptszGroup);
- }
- if (isTextUTF)
- mir_free(text);
- if (isURLUTF)
- mir_free(url);
- if (isSiteURLUTF)
- mir_free(siteurl);
-
- HXML tmpnode = node;
- node = xmlGetNextNode(node);
- if ( !node) {
- do {
- node = tmpnode;
- node = xmlGetParent(node);
- tmpnode = node;
- node = xmlGetNextNode(node);
- if (node)
- break;
- }
- while (mir_wstrcmpi(xmlGetName(tmpnode), L"body"));
- }
- }
- }
- }
- xmlDestroyNode(hXml);
- if (hwndList) {
- DeleteAllItems(hwndList);
- UpdateList(hwndList);
- }
- wchar_t mes[MAX_PATH];
- if (DUPES)
- mir_snwprintf(mes, TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES);
- else
- mir_snwprintf(mes, TranslateT("Imported %d feed(s)."), count);
- MessageBox(hwndDlg, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION);
- }
- }
- // fall through
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
-
- case IDC_BROWSEIMPORTFILE:
- {
- wchar_t FileName[MAX_PATH];
- VARSW tszMirDir(L"%miranda_path%");
-
- OPENFILENAME ofn = {0};
- ofn.lStructSize = sizeof(ofn);
- wchar_t tmp[MAX_PATH];
- mir_snwprintf(tmp, L"%s (*.opml, *.xml)%c*.opml;*.xml%c%c", TranslateT("OPML files"), 0, 0, 0);
- ofn.lpstrFilter = tmp;
- ofn.hwndOwner = nullptr;
- ofn.lpstrFile = FileName;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY;
- ofn.lpstrInitialDir = tszMirDir;
- *FileName = '\0';
- ofn.lpstrDefExt = L"";
-
- if (GetOpenFileName(&ofn)) {
- int bytesParsed = 0;
- HXML hXml = xmlParseFile(FileName, &bytesParsed, nullptr);
- if(hXml != nullptr) {
- HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0);
- if ( !node)
- node = xmlGetChildByPath(hXml, L"body/outline", 0);
- if (node) {
- while (node) {
- int outlineAttr = xmlGetAttrCount(node);
- int outlineChildsCount = xmlGetChildCount(node);
- wchar_t *xmlUrl = (wchar_t *)xmlGetAttrValue(node, L"xmlUrl");
- if (!xmlUrl && !outlineChildsCount) {
- HXML tmpnode = node;
- node = xmlGetNextNode(node);
- if ( !node) {
- do {
- node = tmpnode;
- node = xmlGetParent(node);
- tmpnode = node;
- node = xmlGetNextNode(node);
- if (node)
- break;
- } while (mir_wstrcmpi(xmlGetName(node), L"body"));
- }
- }
- else if (!xmlUrl && outlineChildsCount)
- node = xmlGetFirstChild(node);
- else if (xmlUrl) {
- for (int i = 0; i < outlineAttr; i++) {
- if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"text")) {
- wchar_t *text = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
- bool isTextUTF;
- if (!text) {
- isTextUTF = false;
- text = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
- } else
- isTextUTF = true;
- SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)text);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE);
- if (isTextUTF)
- mir_free(text);
- }
- }
-
-
- HXML tmpnode = node;
- node = xmlGetNextNode(node);
- if ( !node) {
- do {
- node = tmpnode;
- node = xmlGetParent(node);
- tmpnode = node;
- node = xmlGetNextNode(node);
- if (node)
- break;
- } while (mir_wstrcmpi(xmlGetName(tmpnode), L"body"));
- }
- }
- }
- }
- else
- MessageBox(hwndDlg, TranslateT("Not valid import file."), TranslateT("Error"), MB_OK | MB_ICONERROR);
- xmlDestroyNode(hXml);
- SetDlgItemText(hwndDlg, IDC_IMPORTFILEPATH, FileName);
- }
- else
- MessageBox(hwndDlg, TranslateT("Not valid import file."), TranslateT("Error"), MB_OK | MB_ICONERROR);
-
- break;
- }
- break;
- }
- break;
-
- case IDC_ADDFEED:
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
- EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
- int cursel = (int)SendMessage(FeedsList, LB_GETCURSEL, 0, 0);
- wchar_t item[MAX_PATH];
- SendMessage(FeedsList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item);
- SendMessage(FeedsImportList, LB_ADDSTRING, 0, (LPARAM)item);
- SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)cursel, 0);
- if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE);
- }
- }
- break;
-
- case IDC_REMOVEFEED:
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE);
- int cursel = (int)SendMessage(FeedsImportList, LB_GETCURSEL, 0, 0);
- wchar_t item[MAX_PATH];
- SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item);
- SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item);
- SendMessage(FeedsImportList, LB_DELETESTRING, (WPARAM)cursel, 0);
- if (!SendMessage(FeedsImportList, LB_GETCOUNT, 0, 0))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- }
- }
- break;
-
- case IDC_ADDALLFEEDS:
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
- EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
- int count = (int)SendMessage(FeedsList, LB_GETCOUNT, 0, 0);
- for (int i = 0; i < count; i++) {
- wchar_t item[MAX_PATH];
- SendMessage(FeedsList, LB_GETTEXT, (WPARAM)i, (LPARAM)item);
- SendMessage(FeedsImportList, LB_ADDSTRING, 0, (LPARAM)item);
- }
- for (int i = count - 1; i > -1; i--)
- SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)i, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE);
- }
- break;
-
- case IDC_REMOVEALLFEEDS:
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE);
- int count = (int)SendMessage(FeedsImportList, LB_GETCOUNT, 0, 0);
- for (int i = 0; i < count; i++) {
- wchar_t item[MAX_PATH];
- SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)i, (LPARAM)item);
- SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item);
- }
- for (int i = count - 1; i > -1; i--)
- SendMessage(FeedsImportList, LB_DELETESTRING, (WPARAM)i, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- }
- break;
-
- case IDC_FEEDSLIST:
- {
- if (HIWORD(wParam) == LBN_DBLCLK)
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
- EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
- int cursel = (int)SendMessage(FeedsList, LB_GETCURSEL, 0, 0);
- wchar_t item[MAX_PATH];
- SendMessage(FeedsList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item);
- SendMessage(FeedsImportList, LB_ADDSTRING, 0, (LPARAM)item);
- SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)cursel, 0);
- if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE);
- }
- }
- }
- break;
-
- case IDC_FEEDSIMPORTLIST:
- {
- if (HIWORD(wParam) == LBN_DBLCLK)
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE);
- int cursel = (int)SendMessage(FeedsImportList, LB_GETCURSEL, 0, 0);
- wchar_t item[MAX_PATH];
- SendMessage(FeedsImportList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item);
- SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item);
- SendMessage(FeedsImportList, LB_DELETESTRING, (WPARAM)cursel, 0);
- if (!SendMessage(FeedsImportList, LB_GETCOUNT, 0, 0))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- }
- }
- }
- break;
- }
- break;
-
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
-
- case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "ImportDlg");
- break;
- }
-
- return FALSE;
-}
-
-INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM)
-{
- HWND FeedsList = GetDlgItem(hwndDlg, IDC_FEEDSLIST);
- HWND FeedsExportList = GetDlgItem(hwndDlg, IDC_FEEDSEXPORTLIST);
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, MODULE, "ExportDlg");
- for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
- wchar_t *message = db_get_wsa(hContact, MODULE, "Nick");
- if (message != nullptr) {
- SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)message);
- mir_free(message);
- }
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE);
- }
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- {
- wchar_t FileName[MAX_PATH];
- VARSW tszMirDir(L"%miranda_path%");
-
- OPENFILENAME ofn = {0};
- ofn.lStructSize = sizeof(ofn);
- wchar_t tmp[MAX_PATH];
- mir_snwprintf(tmp, L"%s (*.opml)%c*.opml%c%c", TranslateT("OPML files"), 0, 0, 0);
- ofn.lpstrFilter = tmp;
- ofn.hwndOwner = nullptr;
- ofn.lpstrFile = FileName;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
- ofn.lpstrInitialDir = tszMirDir;
- *FileName = '\0';
- ofn.lpstrDefExt = L"";
-
- if (GetSaveFileName(&ofn)) {
- HXML hXml = xmlCreateNode(L"opml", nullptr, FALSE);
- xmlAddAttr(hXml, L"version", L"1.0");
- HXML header = xmlAddChild(hXml, L"head", nullptr);
- xmlAddChild(header, L"title", L"Miranda NG NewsAggregator plugin export");
- header = xmlAddChild(hXml, L"body", nullptr);
-
- int count = (int)SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0);
- for (int i = 0; i < count; i++) {
- wchar_t item[MAX_PATH];
- SendMessage(FeedsExportList, LB_GETTEXT, (WPARAM)i, (LPARAM)item);
- MCONTACT hContact = GetContactByNick(item);
- wchar_t
- *title = db_get_wsa(hContact, MODULE, "Nick"),
- *url = db_get_wsa(hContact, MODULE, "URL"),
- *siteurl = db_get_wsa(hContact, MODULE, "Homepage"),
- *group = db_get_wsa(hContact, "CList", "Group");
-
- HXML elem = header;
- if (group)
- {
- wchar_t *section = wcstok(group, L"\\");
- while (section != nullptr)
- {
- HXML existgroup = xmlGetChildByAttrValue(header, L"outline", L"title", section);
- if ( !existgroup)
- {
- elem = xmlAddChild(elem, L"outline", nullptr);
- xmlAddAttr(elem, L"title", section);
- xmlAddAttr(elem, L"text", section);
- } else {
- elem = existgroup;
- }
- section = wcstok(nullptr, L"\\");
- }
- elem = xmlAddChild(elem, L"outline", nullptr);
- }
- else
- elem = xmlAddChild(elem, L"outline", nullptr);
- xmlAddAttr(elem, L"text", title);
- xmlAddAttr(elem, L"title", title);
- xmlAddAttr(elem, L"type", L"rss");
- xmlAddAttr(elem, L"xmlUrl", url);
- xmlAddAttr(elem, L"htmlUrl", siteurl);
-
- mir_free(title);
- mir_free(url);
- mir_free(siteurl);
- mir_free(group);
- }
- xmlToFile(hXml, FileName, 1);
- xmlDestroyNode(hXml);
- }
- }
- // fall through
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
-
- case IDC_ADDFEED:
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
- EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
- int cursel = (int)SendMessage(FeedsList, LB_GETCURSEL, 0, 0);
- wchar_t item[MAX_PATH];
- SendMessage(FeedsList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item);
- SendMessage(FeedsExportList, LB_ADDSTRING, 0, (LPARAM)item);
- SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)cursel, 0);
- if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE);
- }
- }
- break;
-
- case IDC_REMOVEFEED:
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE);
- int cursel = (int)SendMessage(FeedsExportList, LB_GETCURSEL, 0, 0);
- wchar_t item[MAX_PATH];
- SendMessage(FeedsExportList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item);
- SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item);
- SendMessage(FeedsExportList, LB_DELETESTRING, (WPARAM)cursel, 0);
- if (!SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- }
- }
- break;
-
- case IDC_ADDALLFEEDS:
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
- EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
- int count = (int)SendMessage(FeedsList, LB_GETCOUNT, 0, 0);
- for (int i = 0; i < count; i++) {
- wchar_t item[MAX_PATH];
- SendMessage(FeedsList, LB_GETTEXT, (WPARAM)i, (LPARAM)item);
- SendMessage(FeedsExportList, LB_ADDSTRING, 0, (LPARAM)item);
- }
- for (int i = count - 1; i > -1; i--)
- SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)i, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE);
- }
- break;
-
- case IDC_REMOVEALLFEEDS:
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE);
- int count = (int)SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0);
- for (int i = 0; i < count; i++) {
- wchar_t item[MAX_PATH];
- SendMessage(FeedsExportList, LB_GETTEXT, (WPARAM)i, (LPARAM)item);
- SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item);
- }
- for (int i = count - 1; i > -1; i--)
- SendMessage(FeedsExportList, LB_DELETESTRING, (WPARAM)i, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- }
- break;
-
- case IDC_FEEDSLIST:
- {
- if (HIWORD(wParam) == LBN_DBLCLK)
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDOK)))
- EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
- int cursel = (int)SendMessage(FeedsList, LB_GETCURSEL, 0, 0);
- wchar_t item[MAX_PATH];
- SendMessage(FeedsList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item);
- SendMessage(FeedsExportList, LB_ADDSTRING, 0, (LPARAM)item);
- SendMessage(FeedsList, LB_DELETESTRING, (WPARAM)cursel, 0);
- if (!SendMessage(FeedsList, LB_GETCOUNT, 0, 0)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), FALSE);
- }
- }
- }
- break;
-
- case IDC_FEEDSEXPORTLIST:
- {
- if (HIWORD(wParam) == LBN_DBLCLK)
- {
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDFEED)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDFEED), TRUE);
- if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS)))
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADDALLFEEDS), TRUE);
- int cursel = (int)SendMessage(FeedsExportList, LB_GETCURSEL, 0, 0);
- wchar_t item[MAX_PATH];
- SendMessage(FeedsExportList, LB_GETTEXT, (WPARAM)cursel, (LPARAM)item);
- SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)item);
- SendMessage(FeedsExportList, LB_DELETESTRING, (WPARAM)cursel, 0);
- if (!SendMessage(FeedsExportList, LB_GETCOUNT, 0, 0))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEFEED), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEALLFEEDS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- }
- }
- }
- break;
- }
- break;
-
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
-
- case WM_DESTROY:
- Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "ExportDlg");
- break;
- }
-
- return FALSE;
-}
\ No newline at end of file diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index bc9d91ac3a..c96acd118c 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -23,8 +23,8 @@ HINSTANCE hInst = nullptr; int hLangpack;
HANDLE hPrebuildMenuHook = nullptr;
-HWND hAddFeedDlg;
-MWindowList hChangeFeedDlgList = nullptr;
+CDlgBase *pAddFeedDialog = nullptr, *pChangeFeedDialog = nullptr, *pImportDialog = nullptr, *pExportDialog = nullptr;
+//MWindowList hChangeFeedDlgList = nullptr;
wchar_t tszRoot[MAX_PATH] = {0};
HANDLE hUpdateMutex;
@@ -62,7 +62,7 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, NewsAggrPreShutdown);
hUpdateMutex = CreateMutex(nullptr, FALSE, nullptr);
- hChangeFeedDlgList = WindowList_Create();
+ //hChangeFeedDlgList = WindowList_Create();
// register weather protocol
PROTOCOLDESCRIPTOR pd = { 0 };
@@ -104,7 +104,7 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
- WindowList_Destroy(hChangeFeedDlgList);
+ //WindowList_Destroy(hChangeFeedDlgList);
DestroyUpdateList();
CloseHandle(hUpdateMutex);
return 0;
diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index e5061b1e38..8abf2657e8 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -19,576 +19,1033 @@ Boston, MA 02111-1307, USA. #include "stdafx.h"
-INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
- SetWindowText(hwndDlg, TranslateT("Add Feed"));
- SetDlgItemText(hwndDlg, IDC_FEEDURL, L"http://");
- SetDlgItemText(hwndDlg, IDC_TAGSEDIT, TAGSDEFAULT);
- SendDlgItemMessage(hwndDlg, IDC_CHECKTIME, EM_LIMITTEXT, 3, 0);
- SetDlgItemInt(hwndDlg, IDC_CHECKTIME, DEFAULT_UPDATE_TIME, TRUE);
- SendDlgItemMessage(hwndDlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, 0, 999);
- Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, MODULE, "AddDlg");
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- wchar_t str[MAX_PATH];
- char passw[MAX_PATH];
- {
- if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) {
- MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
- break;
- }
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_wstrcmp(str, L"http://") == 0) {
- MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
- break;
- }
- if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) {
- MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK);
- break;
- }
-
- MCONTACT hContact = db_add_contact();
- Proto_AddToContact(hContact, MODULE);
- GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
- db_set_ws(hContact, MODULE, "Nick", str);
-
- HWND hwndList = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str));
- db_set_ws(hContact, MODULE, "URL", str);
- db_set_b(hContact, MODULE, "CheckState", 1);
- db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
- GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
- db_set_ws(hContact, MODULE, "MsgFormat", str);
- db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0));
- if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- db_set_b(hContact, MODULE, "UseAuth", 1);
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
- db_set_ws(hContact, MODULE, "Login", str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw));
- db_set_s(hContact, MODULE, "Password", passw);
- }
- DeleteAllItems(hwndList);
- UpdateList(hwndList);
- }
- // fall through
-
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
-
- case IDC_USEAUTH:
- if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE);
- }
- else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE);
- }
- break;
-
- case IDC_TAGHELP:
- wchar_t tszTagHelp[1024];
- mir_snwprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
- L"#<title>#", TranslateT("The title of the item."),
- L"#<description>#", TranslateT("The item synopsis."),
- L"#<link>#", TranslateT("The URL of the item."),
- L"#<author>#", TranslateT("Email address of the author of the item."),
- L"#<comments>#", TranslateT("URL of a page for comments relating to the item."),
- L"#<guid>#", TranslateT("A string that uniquely identifies the item."),
- L"#<category>#", TranslateT("Specify one or more categories that the item belongs to."));
- MessageBox(hwndDlg, tszTagHelp, TranslateT("Feed Tag Help"), MB_OK);
- break;
-
- case IDC_RESET:
- if (MessageBox(hwndDlg, TranslateT("Are you sure?"), TranslateT("Tags Mask Reset"), MB_YESNO | MB_ICONWARNING) == IDYES)
- SetDlgItemText(hwndDlg, IDC_TAGSEDIT, TAGSDEFAULT);
- break;
+CExportFeed::CExportFeed()
+ : CSuper(hInst, IDD_FEEDEXPORT),
+ m_feedslist(this, IDC_FEEDSLIST), m_feedsexportlist(this, IDC_FEEDSEXPORTLIST),
+ m_addfeed(this, IDC_ADDFEED), m_removefeed(this, IDC_REMOVEFEED),
+ m_addallfeeds(this, IDC_ADDALLFEEDS), m_removeallfeeds(this, IDC_REMOVEALLFEEDS),
+ m_ok(this, IDOK)
+{
+ m_addfeed.OnClick = Callback(this, &CExportFeed::OnAddFeed);
+ m_removefeed.OnClick = Callback(this, &CExportFeed::OnRemoveFeed);
+ m_addallfeeds.OnClick = Callback(this, &CExportFeed::OnAddAllFeeds);
+ m_removeallfeeds.OnClick = Callback(this, &CExportFeed::OnRemoveAllFeeds);
+ m_ok.OnClick = Callback(this, &CExportFeed::OnOk);
+
+ m_feedslist.OnDblClick = Callback(this, &CExportFeed::OnFeedsList);
+ m_feedsexportlist.OnDblClick = Callback(this, &CExportFeed::OnFeedsExportList);
+}
- case IDC_DISCOVERY:
- EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
- SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
- wchar_t tszURL[MAX_PATH] = { 0 };
- wchar_t *tszTitle = nullptr;
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_wstrcmp(tszURL, L"http://") != 0)
- tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg);
- else
- MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
- SetDlgItemText(hwndDlg, IDC_FEEDTITLE, tszTitle);
- mir_free(tszTitle);
- EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), TRUE);
- SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Check Feed"));
+void CExportFeed::OnInitDialog()
+{
+ Utils_RestoreWindowPositionNoSize(m_hwnd, NULL, MODULE, "ExportDlg");
+ for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
+ wchar_t *message = db_get_wsa(hContact, MODULE, "Nick");
+ if (message != nullptr) {
+ m_feedslist.AddString(message);
+ mir_free(message);
}
- break;
-
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
+ }
+ m_removefeed.Disable();
+ m_removeallfeeds.Disable();
+ m_ok.Disable();
+ if (!m_feedslist.GetCount()) {
+ m_addfeed.Disable();
+ m_addallfeeds.Disable();
+ }
+}
- case WM_DESTROY:
- hAddFeedDlg = nullptr;
- Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "AddDlg");
- break;
+void CExportFeed::OnAddFeed(CCtrlBase*)
+{
+ if (!m_removefeed.Enabled())
+ m_removefeed.Enable();
+ if (!m_removeallfeeds.Enabled())
+ m_removeallfeeds.Enable();
+ if (!m_ok.Enabled())
+ m_ok.Enable();
+ int cursel = m_feedslist.GetCurSel();
+ wchar_t item[MAX_PATH];
+ m_feedslist.GetItemText(cursel, item, _countof(item));
+ m_feedsexportlist.AddString(item);
+ m_feedslist.DeleteString(cursel);
+ if (!m_feedslist.GetCount()) {
+ m_addfeed.Disable();
+ m_addallfeeds.Disable();
}
+}
- return FALSE;
+void CExportFeed::OnRemoveFeed(CCtrlBase*)
+{
+ if (!m_addfeed.Enabled())
+ m_addfeed.Enable();
+ if (!m_addallfeeds.Enabled())
+ m_addallfeeds.Enable();
+ int cursel = m_feedsexportlist.GetCurSel();
+ wchar_t item[MAX_PATH];
+ m_feedsexportlist.GetItemText(cursel, item, _countof(item));
+ m_feedslist.AddString(item);
+ m_feedsexportlist.DeleteString(cursel);
+ if (!m_feedsexportlist.GetCount()) {
+ m_removefeed.Disable();
+ m_removeallfeeds.Disable();
+ m_ok.Disable();
+ }
}
-INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+void CExportFeed::OnAddAllFeeds(CCtrlBase*)
{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- ItemInfo &SelItem = *(ItemInfo*)lParam;
- SetWindowText(hwndDlg, TranslateT("Change Feed"));
- SendDlgItemMessage(hwndDlg, IDC_CHECKTIME, EM_LIMITTEXT, 3, 0);
- SendDlgItemMessage(hwndDlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, 0, 999);
+ if (!m_removefeed.Enabled())
+ m_removefeed.Enable();
+ if (!m_removeallfeeds.Enabled())
+ m_removeallfeeds.Enable();
+ if (!m_ok.Enabled())
+ m_ok.Enable();
+ int count = m_feedslist.GetCount();
+ for (int i = 0; i < count; i++) {
+ wchar_t item[MAX_PATH];
+ m_feedslist.GetItemText(i, item, _countof(item));
+ m_feedsexportlist.AddString(item);
+ }
+ for (int i = count - 1; i > -1; i--)
+ m_feedslist.DeleteString(i);
+ m_addfeed.Disable();
+ m_addallfeeds.Disable();
+}
- for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
- ptrW dbNick(db_get_wsa(hContact, MODULE, "Nick"));
- if ((dbNick == NULL) || (mir_wstrcmp(dbNick, SelItem.nick) != 0))
- continue;
+void CExportFeed::OnRemoveAllFeeds(CCtrlBase*)
+{
+ if (!m_addfeed.Enabled())
+ m_addfeed.Enable();
+ if (!m_addallfeeds.Enabled())
+ m_addallfeeds.Enable();
+ int count = m_feedsexportlist.GetCount();
+ for (int i = 0; i < count; i++) {
+ wchar_t item[MAX_PATH];
+ m_feedsexportlist.GetItemText(i, item, _countof(item));
+ m_feedslist.AddString(item);
+ }
+ for (int i = count - 1; i > -1; i--)
+ m_feedsexportlist.DeleteString(i);
+ m_removefeed.Disable();
+ m_removeallfeeds.Disable();
+ m_ok.Disable();
+}
- ptrW dbURL(db_get_wsa(hContact, MODULE, "URL"));
- if ((dbURL == NULL) || (mir_wstrcmp(dbURL, SelItem.url) != 0))
- continue;
+void CExportFeed::OnFeedsList(CCtrlBase*)
+{
+ if (!m_removefeed.Enabled())
+ m_removefeed.Enable();
+ if (!m_removeallfeeds.Enabled())
+ m_removeallfeeds.Enable();
+ if (!m_ok.Enabled())
+ m_ok.Enable();
+ int cursel = m_feedslist.GetCurSel();
+ wchar_t item[MAX_PATH];
+ m_feedslist.GetItemText(cursel, item, _countof(item));
+ m_feedsexportlist.AddString(item);
+ m_feedslist.DeleteString(cursel);
+ if (!m_feedslist.GetCount()) {
+ m_addfeed.Disable();
+ m_addallfeeds.Disable();
+ }
+}
- ItemInfo *nSelItem = new ItemInfo(SelItem);
- nSelItem->hContact = hContact;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)nSelItem);
- SetDlgItemText(hwndDlg, IDC_FEEDURL, SelItem.url);
- SetDlgItemText(hwndDlg, IDC_FEEDTITLE, SelItem.nick);
- SetDlgItemInt(hwndDlg, IDC_CHECKTIME, db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME), TRUE);
+void CExportFeed::OnFeedsExportList(CCtrlBase*)
+{
+ if (!m_addfeed.Enabled())
+ m_addfeed.Enable();
+ if (!m_addallfeeds.Enabled())
+ m_addallfeeds.Enable();
+ int cursel = m_feedsexportlist.GetCurSel();
+ wchar_t item[MAX_PATH];
+ m_feedsexportlist.GetItemText(cursel, item, _countof(item));
+ m_feedslist.AddString(item);
+ m_feedsexportlist.DeleteString(cursel);
+ if (!m_feedsexportlist.GetCount()) {
+ m_removefeed.Disable();
+ m_removeallfeeds.Disable();
+ m_ok.Disable();
+ }
+}
- wchar_t *szMsgFormat = db_get_wsa(hContact, MODULE, "MsgFormat");
- if (szMsgFormat) {
- SetDlgItemText(hwndDlg, IDC_TAGSEDIT, szMsgFormat);
- mir_free(szMsgFormat);
- }
- if (db_get_b(hContact, MODULE, "UseAuth", 0)) {
- CheckDlgButton(hwndDlg, IDC_USEAUTH, BST_CHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE);
-
- wchar_t *szLogin = db_get_wsa(hContact, MODULE, "Login");
- if (szLogin) {
- SetDlgItemText(hwndDlg, IDC_LOGIN, szLogin);
- mir_free(szLogin);
+void CExportFeed::OnOk(CCtrlBase*)
+{
+ wchar_t FileName[MAX_PATH];
+ VARSW tszMirDir(L"%miranda_path%");
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = sizeof(ofn);
+ wchar_t tmp[MAX_PATH];
+ mir_snwprintf(tmp, L"%s (*.opml)%c*.opml%c%c", TranslateT("OPML files"), 0, 0, 0);
+ ofn.lpstrFilter = tmp;
+ ofn.hwndOwner = nullptr;
+ ofn.lpstrFile = FileName;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
+ ofn.lpstrInitialDir = tszMirDir;
+ *FileName = '\0';
+ ofn.lpstrDefExt = L"";
+
+ if (GetSaveFileName(&ofn)) {
+ HXML hXml = xmlCreateNode(L"opml", nullptr, FALSE);
+ xmlAddAttr(hXml, L"version", L"1.0");
+ HXML header = xmlAddChild(hXml, L"head", nullptr);
+ xmlAddChild(header, L"title", L"Miranda NG NewsAggregator plugin export");
+ header = xmlAddChild(hXml, L"body", nullptr);
+
+ int count = m_feedsexportlist.GetCount();
+ for (int i = 0; i < count; i++) {
+ wchar_t item[MAX_PATH];
+ m_feedsexportlist.GetItemText(i, item, _countof(item));
+ MCONTACT hContact = GetContactByNick(item);
+ wchar_t
+ *title = db_get_wsa(hContact, MODULE, "Nick"),
+ *url = db_get_wsa(hContact, MODULE, "URL"),
+ *siteurl = db_get_wsa(hContact, MODULE, "Homepage"),
+ *group = db_get_wsa(hContact, "CList", "Group");
+
+ HXML elem = header;
+ if (group)
+ {
+ wchar_t *section = wcstok(group, L"\\");
+ while (section != nullptr)
+ {
+ HXML existgroup = xmlGetChildByAttrValue(header, L"outline", L"title", section);
+ if (!existgroup)
+ {
+ elem = xmlAddChild(elem, L"outline", nullptr);
+ xmlAddAttr(elem, L"title", section);
+ xmlAddAttr(elem, L"text", section);
}
- pass_ptrA pwd(db_get_sa(hContact, MODULE, "Password"));
- SetDlgItemTextA(hwndDlg, IDC_PASSWORD, pwd);
+ else {
+ elem = existgroup;
+ }
+ section = wcstok(nullptr, L"\\");
}
- WindowList_Add(hChangeFeedDlgList, hwndDlg, hContact);
- Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, MODULE, "ChangeDlg");
- break;
+ elem = xmlAddChild(elem, L"outline", nullptr);
}
+ else
+ elem = xmlAddChild(elem, L"outline", nullptr);
+ xmlAddAttr(elem, L"text", title);
+ xmlAddAttr(elem, L"title", title);
+ xmlAddAttr(elem, L"type", L"rss");
+ xmlAddAttr(elem, L"xmlUrl", url);
+ xmlAddAttr(elem, L"htmlUrl", siteurl);
+
+ mir_free(title);
+ mir_free(url);
+ mir_free(siteurl);
+ mir_free(group);
}
- return TRUE;
+ xmlToFile(hXml, FileName, 1);
+ xmlDestroyNode(hXml);
+ }
+}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- wchar_t str[MAX_PATH];
- {
- ItemInfo *SelItem = (ItemInfo*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- char passw[MAX_PATH];
- if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) {
- MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
- break;
- }
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_wstrcmp(str, L"http://") == 0) {
- MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
- break;
- }
- if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) {
- MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK);
- break;
- }
+void CExportFeed::OnClose()
+{
+ Utils_SaveWindowPosition(m_hwnd, NULL, MODULE, "ExportDlg");
+ if (pExportDialog)
+ pExportDialog = nullptr;
+}
- GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str));
- db_set_ws(SelItem->hContact, MODULE, "URL", str);
- GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
- db_set_ws(SelItem->hContact, MODULE, "Nick", str);
- db_set_dw(SelItem->hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
- GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
- db_set_ws(SelItem->hContact, MODULE, "MsgFormat", str);
- if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- db_set_b(SelItem->hContact, MODULE, "UseAuth", 1);
-
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
- db_set_ws(SelItem->hContact, MODULE, "Login", str);
-
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw));
- db_set_s(SelItem->hContact, MODULE, "Password", passw);
- }
- else {
- db_unset(SelItem->hContact, MODULE, "UseAuth");
- db_unset(SelItem->hContact, MODULE, "Login");
- db_unset(SelItem->hContact, MODULE, "Password");
- }
- DeleteAllItems(SelItem->hwndList);
- UpdateList(SelItem->hwndList);
- }
- // fall through
+CImportFeed::CImportFeed(CCtrlListView *m_feeds)
+ : CSuper(hInst, IDD_FEEDIMPORT),
+ m_importfile(this, IDC_IMPORTFILEPATH), m_browsefile(this, IDC_BROWSEIMPORTFILE),
+ m_feedslist(this, IDC_FEEDSLIST), m_feedsimportlist(this, IDC_FEEDSIMPORTLIST),
+ m_addfeed(this, IDC_ADDFEED), m_removefeed(this, IDC_REMOVEFEED),
+ m_addallfeeds(this, IDC_ADDALLFEEDS), m_removeallfeeds(this, IDC_REMOVEALLFEEDS),
+ m_ok(this, IDOK)
+{
+ m_list = m_feeds;
+ m_browsefile.OnClick = Callback(this, &CImportFeed::OnBrowseFile);
+ m_addfeed.OnClick = Callback(this, &CImportFeed::OnAddFeed);
+ m_removefeed.OnClick = Callback(this, &CImportFeed::OnRemoveFeed);
+ m_addallfeeds.OnClick = Callback(this, &CImportFeed::OnAddAllFeeds);
+ m_removeallfeeds.OnClick = Callback(this, &CImportFeed::OnRemoveAllFeeds);
+ m_ok.OnClick = Callback(this, &CImportFeed::OnOk);
+
+ m_feedslist.OnDblClick = Callback(this, &CImportFeed::OnFeedsList);
+ m_feedsimportlist.OnDblClick = Callback(this, &CImportFeed::OnFeedsImportList);
+}
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
+void CImportFeed::OnInitDialog()
+{
+ Utils_RestoreWindowPositionNoSize(m_hwnd, NULL, MODULE, "ImportDlg");
+ m_removefeed.Disable();
+ m_removeallfeeds.Disable();
+ m_ok.Disable();
+ m_addfeed.Disable();
+ m_addallfeeds.Disable();
+}
- case IDC_USEAUTH:
- if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE);
- }
- else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE);
+void CImportFeed::OnBrowseFile(CCtrlBase*)
+{
+ wchar_t FileName[MAX_PATH];
+ VARSW tszMirDir(L"%miranda_path%");
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = sizeof(ofn);
+ wchar_t tmp[MAX_PATH];
+ mir_snwprintf(tmp, L"%s (*.opml, *.xml)%c*.opml;*.xml%c%c", TranslateT("OPML files"), 0, 0, 0);
+ ofn.lpstrFilter = tmp;
+ ofn.hwndOwner = nullptr;
+ ofn.lpstrFile = FileName;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY;
+ ofn.lpstrInitialDir = tszMirDir;
+ *FileName = '\0';
+ ofn.lpstrDefExt = L"";
+
+ if (GetOpenFileName(&ofn)) {
+ int bytesParsed = 0;
+ HXML hXml = xmlParseFile(FileName, &bytesParsed, nullptr);
+ if (hXml != nullptr) {
+ HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0);
+ if (!node)
+ node = xmlGetChildByPath(hXml, L"body/outline", 0);
+ if (node) {
+ while (node) {
+ int outlineAttr = xmlGetAttrCount(node);
+ int outlineChildsCount = xmlGetChildCount(node);
+ wchar_t *xmlUrl = (wchar_t *)xmlGetAttrValue(node, L"xmlUrl");
+ if (!xmlUrl && !outlineChildsCount) {
+ HXML tmpnode = node;
+ node = xmlGetNextNode(node);
+ if (!node) {
+ do {
+ node = tmpnode;
+ node = xmlGetParent(node);
+ tmpnode = node;
+ node = xmlGetNextNode(node);
+ if (node)
+ break;
+ } while (mir_wstrcmpi(xmlGetName(node), L"body"));
+ }
+ }
+ else if (!xmlUrl && outlineChildsCount)
+ node = xmlGetFirstChild(node);
+ else if (xmlUrl) {
+ for (int i = 0; i < outlineAttr; i++) {
+ if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"text")) {
+ wchar_t *text = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
+ bool isTextUTF;
+ if (!text) {
+ isTextUTF = false;
+ text = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
+ }
+ else
+ isTextUTF = true;
+ m_feedslist.AddString(text);
+ m_addfeed.Enable();
+ m_addallfeeds.Enable();
+ if (isTextUTF)
+ mir_free(text);
+ }
+ }
+
+ HXML tmpnode = node;
+ node = xmlGetNextNode(node);
+ if (!node) {
+ do {
+ node = tmpnode;
+ node = xmlGetParent(node);
+ tmpnode = node;
+ node = xmlGetNextNode(node);
+ if (node)
+ break;
+ } while (mir_wstrcmpi(xmlGetName(tmpnode), L"body"));
+ }
+ }
+ }
}
- break;
-
- case IDC_TAGHELP:
- wchar_t tszTagHelp[1024];
- mir_snwprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
- L"#<title>#", TranslateT("The title of the item."),
- L"#<description>#", TranslateT("The item synopsis."),
- L"#<link>#", TranslateT("The URL of the item."),
- L"#<author>#", TranslateT("Email address of the author of the item."),
- L"#<comments>#", TranslateT("URL of a page for comments relating to the item."),
- L"#<guid>#", TranslateT("A string that uniquely identifies the item."),
- L"#<category>#", TranslateT("Specify one or more categories that the item belongs to."));
- MessageBox(hwndDlg, tszTagHelp, TranslateT("Feed Tag Help"), MB_OK);
- break;
+ else
+ MessageBox(m_hwnd, TranslateT("Not valid import file."), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ xmlDestroyNode(hXml);
+ m_importfile.SetText(FileName);
+ }
+ else
+ MessageBox(m_hwnd, TranslateT("Not valid import file."), TranslateT("Error"), MB_OK | MB_ICONERROR);
+ }
+}
- case IDC_RESET:
- if (MessageBox(hwndDlg, TranslateT("Are you sure?"), TranslateT("Tags Mask Reset"), MB_YESNO | MB_ICONWARNING) == IDYES)
- SetDlgItemText(hwndDlg, IDC_TAGSEDIT, TAGSDEFAULT);
- break;
+void CImportFeed::OnAddFeed(CCtrlBase*)
+{
+ if (!m_removefeed.Enabled())
+ m_removefeed.Enable();
+ if (!m_removeallfeeds.Enabled())
+ m_removeallfeeds.Enable();
+ if (!m_ok.Enabled())
+ m_ok.Enable();
+ int cursel = m_feedslist.GetCurSel();
+ wchar_t item[MAX_PATH];
+ m_feedslist.GetItemText(cursel, item, _countof(item));
+ m_feedsimportlist.AddString(item);
+ m_feedslist.DeleteString(cursel);
+ if (!m_feedslist.GetCount()) {
+ m_addfeed.Disable();
+ m_addallfeeds.Disable();
+ }
+}
- case IDC_DISCOVERY:
- wchar_t tszURL[MAX_PATH] = { 0 };
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_wstrcmp(tszURL, L"http://") != 0) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
- SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
- wchar_t *tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg);
- SetDlgItemText(hwndDlg, IDC_FEEDTITLE, tszTitle);
- mir_free(tszTitle);
- EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), TRUE);
- SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Check Feed"));
- }
- else MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
- }
- break;
+void CImportFeed::OnRemoveFeed(CCtrlBase*)
+{
+ if (!m_addfeed.Enabled())
+ m_addfeed.Enable();
+ if (!m_addallfeeds.Enabled())
+ m_addallfeeds.Enable();
+ int cursel = m_feedsimportlist.GetCurSel();
+ wchar_t item[MAX_PATH];
+ m_feedsimportlist.GetItemText(cursel, item, _countof(item));
+ m_feedslist.AddString(item);
+ m_feedsimportlist.DeleteString(cursel);
+ if (!m_feedsimportlist.GetCount()) {
+ m_removefeed.Disable();
+ m_removeallfeeds.Disable();
+ m_ok.Disable();
+ }
+}
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
+void CImportFeed::OnAddAllFeeds(CCtrlBase*)
+{
+ if (!m_removefeed.Enabled())
+ m_removefeed.Enable();
+ if (!m_removeallfeeds.Enabled())
+ m_removeallfeeds.Enable();
+ if (!m_ok.Enabled())
+ m_ok.Enable();
+ int count = m_feedslist.GetCount();
+ for (int i = 0; i < count; i++) {
+ wchar_t item[MAX_PATH];
+ m_feedslist.GetItemText(i, item, _countof(item));
+ m_feedsimportlist.AddString(item);
+ }
+ for (int i = count - 1; i > -1; i--)
+ m_feedslist.DeleteString(i);
+ m_addfeed.Disable();
+ m_addallfeeds.Disable();
+}
- case WM_DESTROY:
- ItemInfo *SelItem = (ItemInfo *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- Utils_SaveWindowPosition(hwndDlg, SelItem->hContact, MODULE, "ChangeDlg");
- WindowList_Remove(hChangeFeedDlgList, hwndDlg);
- delete SelItem;
- break;
+void CImportFeed::OnRemoveAllFeeds(CCtrlBase*)
+{
+ if (!m_addfeed.Enabled())
+ m_addfeed.Enable();
+ if (!m_addallfeeds.Enabled())
+ m_addallfeeds.Enable();
+ int count = m_feedsimportlist.GetCount();
+ for (int i = 0; i < count; i++) {
+ wchar_t item[MAX_PATH];
+ m_feedsimportlist.GetItemText(i, item, _countof(item));
+ m_feedslist.AddString(item);
}
+ for (int i = count - 1; i > -1; i--)
+ m_feedsimportlist.DeleteString(i);
+ m_removefeed.Disable();
+ m_removeallfeeds.Disable();
+ m_ok.Disable();
+}
- return FALSE;
+void CImportFeed::OnFeedsList(CCtrlBase*)
+{
+ if (!m_removefeed.Enabled())
+ m_removefeed.Enable();
+ if (!m_removeallfeeds.Enabled())
+ m_removeallfeeds.Enable();
+ if (!m_ok.Enabled())
+ m_ok.Enable();
+ int cursel = m_feedslist.GetCurSel();
+ wchar_t item[MAX_PATH];
+ m_feedslist.GetItemText(cursel, item, _countof(item));
+ m_feedsimportlist.AddString(item);
+ m_feedslist.DeleteString(cursel);
+ if (!m_feedslist.GetCount()) {
+ m_addfeed.Disable();
+ m_addallfeeds.Disable();
+ }
}
-INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+void CImportFeed::OnFeedsImportList(CCtrlBase*)
{
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- SetWindowText(hwndDlg, TranslateT("Change Feed"));
- SendDlgItemMessage(hwndDlg, IDC_CHECKTIME, UDM_SETRANGE32, 0, 999);
+ if (!m_addfeed.Enabled())
+ m_addfeed.Enable();
+ if (!m_addallfeeds.Enabled())
+ m_addallfeeds.Enable();
+ int cursel = m_feedsimportlist.GetCurSel();
+ wchar_t item[MAX_PATH];
+ m_feedsimportlist.GetItemText(cursel, item, _countof(item));
+ m_feedslist.AddString(item);
+ m_feedsimportlist.DeleteString(cursel);
+ if (!m_feedsimportlist.GetCount()) {
+ m_removefeed.Disable();
+ m_removeallfeeds.Disable();
+ m_ok.Disable();
+ }
+}
- MCONTACT hContact = (MCONTACT)lParam;
- WindowList_Add(hChangeFeedDlgList, hwndDlg, hContact);
- Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, MODULE, "ChangeDlg");
+void CImportFeed::OnOk(CCtrlBase*)
+{
+ wchar_t FileName[MAX_PATH];
+ m_importfile.GetText(FileName, _countof(FileName));
+ int bytesParsed = 0;
+ HXML hXml = xmlParseFile(FileName, &bytesParsed, nullptr);
+ if (hXml != nullptr) {
+ bool isTextUTF = false, isURLUTF = false, isSiteURLUTF = false, isGroupUTF = false;
+ HXML node = xmlGetChildByPath(hXml, L"opml/body/outline", 0);
+ if (!node)
+ node = xmlGetChildByPath(hXml, L"body/outline", 0);
+ int count = m_feedsimportlist.GetCount();
+ int DUPES = 0;
+ if (node) {
+ while (node) {
+ int outlineAttr = xmlGetAttrCount(node);
+ int outlineChildsCount = xmlGetChildCount(node);
+ wchar_t *xmlUrl = (wchar_t *)xmlGetAttrValue(node, L"xmlUrl");
+ if (!xmlUrl && !outlineChildsCount) {
+ HXML tmpnode = node;
+ node = xmlGetNextNode(node);
+ if (!node) {
+ do {
+ node = tmpnode;
+ node = xmlGetParent(node);
+ tmpnode = node;
+ node = xmlGetNextNode(node);
+ if (node)
+ break;
+ } while (mir_wstrcmpi(xmlGetName(node), L"body"));
+ }
+ }
+ else if (!xmlUrl && outlineChildsCount)
+ node = xmlGetFirstChild(node);
+ else if (xmlUrl) {
+ wchar_t *text = nullptr, *url = nullptr, *siteurl = nullptr, *group = nullptr;
+ BYTE NeedToImport = FALSE;
+ for (int i = 0; i < outlineAttr; i++) {
+ if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"text")) {
+ text = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
+ if (!text) {
+ isTextUTF = 0;
+ text = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
+ }
+ else
+ isTextUTF = 1;
+
+ for (int j = 0; j < count; j++) {
+ wchar_t item[MAX_PATH];
+ m_feedsimportlist.GetItemText(j, item, _countof(item));
+ if (!mir_wstrcmpi(item, text)) {
+ NeedToImport = TRUE;
+ break;
+ }
+ }
+ continue;
+ }
+ if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"xmlUrl")) {
+ url = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
+ if (!url) {
+ isURLUTF = false;
+ url = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
+ }
+ else
+ isURLUTF = true;
+ if (GetContactByURL(url) && NeedToImport) {
+ NeedToImport = FALSE;
+ DUPES++;
+ }
+ continue;
+ }
+ if (!mir_wstrcmpi(xmlGetAttrName(node, i), L"htmlUrl")) {
+ siteurl = mir_utf8decodeW(_T2A(xmlGetAttrValue(node, xmlGetAttrName(node, i))));
+ if (!siteurl) {
+ isSiteURLUTF = false;
+ siteurl = (wchar_t *)xmlGetAttrValue(node, xmlGetAttrName(node, i));
+ }
+ else
+ isSiteURLUTF = true;
+ continue;
+ }
+ if (text && url && siteurl)
+ break;
+ }
- wchar_t *ptszNick = db_get_wsa(hContact, MODULE, "Nick");
- if (ptszNick) {
- SetDlgItemText(hwndDlg, IDC_FEEDTITLE, ptszNick);
- mir_free(ptszNick);
+ if (NeedToImport) {
+ HXML parent = xmlGetParent(node);
+ wchar_t tmpgroup[1024];
+ while (mir_wstrcmpi(xmlGetName(parent), L"body")) {
+ for (int i = 0; i < xmlGetAttrCount(parent); i++) {
+ if (!mir_wstrcmpi(xmlGetAttrName(parent, i), L"text")) {
+ if (!group)
+ group = (wchar_t *)xmlGetAttrValue(parent, xmlGetAttrName(parent, i));
+ else {
+ mir_snwprintf(tmpgroup, L"%s\\%s", xmlGetAttrValue(parent, xmlGetAttrName(parent, i)), group);
+ group = tmpgroup;
+ }
+ break;
+ }
+ }
+ parent = xmlGetParent(parent);
+ }
+
+ wchar_t *ptszGroup = nullptr;
+ if (group) {
+ ptszGroup = mir_utf8decodeW(_T2A(group));
+ if (!ptszGroup) {
+ isGroupUTF = false;
+ ptszGroup = group;
+ }
+ else
+ isGroupUTF = 1;
+ }
+
+ MCONTACT hContact = db_add_contact();
+ Proto_AddToContact(hContact, MODULE);
+ db_set_ws(hContact, MODULE, "Nick", text);
+ db_set_ws(hContact, MODULE, "URL", url);
+ db_set_ws(hContact, MODULE, "Homepage", siteurl);
+ db_set_b(hContact, MODULE, "CheckState", 1);
+ db_set_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME);
+ db_set_ws(hContact, MODULE, "MsgFormat", TAGSDEFAULT);
+ db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0));
+
+ if (m_list != nullptr) {
+ int iItem = m_list->AddItem(text, -1);
+ m_list->SetItem(iItem, 1, url);
+ m_list->SetCheckState(iItem, 1);
+ }
+
+ if (ptszGroup) {
+ db_set_ws(hContact, "CList", "Group", ptszGroup);
+ Clist_GroupCreate(0, ptszGroup);
+ }
+ if (isGroupUTF)
+ mir_free(ptszGroup);
+ }
+ if (isTextUTF)
+ mir_free(text);
+ if (isURLUTF)
+ mir_free(url);
+ if (isSiteURLUTF)
+ mir_free(siteurl);
+
+ HXML tmpnode = node;
+ node = xmlGetNextNode(node);
+ if (!node) {
+ do {
+ node = tmpnode;
+ node = xmlGetParent(node);
+ tmpnode = node;
+ node = xmlGetNextNode(node);
+ if (node)
+ break;
+ } while (mir_wstrcmpi(xmlGetName(tmpnode), L"body"));
+ }
+ }
}
+ }
+ xmlDestroyNode(hXml);
+ wchar_t mes[MAX_PATH];
+ if (DUPES)
+ mir_snwprintf(mes, TranslateT("Imported %d feed(s)\r\nNot imported %d duplicate(s)."), count - DUPES, DUPES);
+ else
+ mir_snwprintf(mes, TranslateT("Imported %d feed(s)."), count);
+ MessageBox(m_hwnd, mes, TranslateT("News Aggregator"), MB_OK | MB_ICONINFORMATION);
+ }
+}
- wchar_t *ptszURL = db_get_wsa(hContact, MODULE, "URL");
- if (ptszNick) {
- SetDlgItemText(hwndDlg, IDC_FEEDURL, ptszURL);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
- mir_free(ptszURL);
- }
+void CImportFeed::OnClose()
+{
+ Utils_SaveWindowPosition(m_hwnd, NULL, MODULE, "ImportDlg");
+ if (pImportDialog)
+ pImportDialog = nullptr;
+}
- SetDlgItemInt(hwndDlg, IDC_CHECKTIME, db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME), TRUE);
+CFeedEditor::CFeedEditor(int iItem, CCtrlListView *m_feeds, MCONTACT Contact)
+ : CSuper(hInst, IDD_ADDFEED),
+ m_feedtitle(this, IDC_FEEDTITLE), m_feedurl(this, IDC_FEEDURL),
+ m_checktime(this, IDC_CHECKTIME), m_checktimespin(this, IDC_TIMEOUT_VALUE_SPIN),
+ m_checkfeed(this, IDC_DISCOVERY), m_useauth(this, IDC_USEAUTH),
+ m_login(this, IDC_LOGIN), m_password(this, IDC_PASSWORD),
+ m_tagedit(this, IDC_TAGSEDIT), m_reset(this, IDC_RESET),
+ m_help(this, IDC_TAGHELP), m_ok(this, IDOK), m_iItem(iItem)
+{
+ m_list = m_feeds;
+ m_hContact = Contact;
+ m_checkfeed.OnClick = Callback(this, &CFeedEditor::OnCheckFeed);
+ m_useauth.OnChange = Callback(this, &CFeedEditor::OnUseAuth);
+ m_reset.OnClick = Callback(this, &CFeedEditor::OnReset);
+ m_help.OnClick = Callback(this, &CFeedEditor::OnHelp);
+ m_ok.OnClick = Callback(this, &CFeedEditor::OnOk);
+}
- wchar_t *ptszMsgFormat = db_get_wsa(hContact, MODULE, "MsgFormat");
- if (ptszMsgFormat) {
- SetDlgItemText(hwndDlg, IDC_TAGSEDIT, ptszMsgFormat);
- mir_free(ptszMsgFormat);
+void CFeedEditor::OnInitDialog()
+{
+ if (m_iItem == -1 && m_hContact == NULL)
+ SetWindowText(m_hwnd, TranslateT("Add Feed"));
+ else
+ SetWindowText(m_hwnd, TranslateT("Change Feed"));
+ m_checktime.SetMaxLength(3);
+ m_checktimespin.SetRange(999, 0);
+
+ if (m_iItem > -1 && m_hContact == NULL) {
+ wchar_t SelNick[MAX_PATH], SelUrl[MAX_PACKAGE_NAME];
+ m_list->GetItemText(m_iItem, 0, SelNick, _countof(SelNick));
+ m_list->GetItemText(m_iItem, 1, SelUrl, _countof(SelNick));
+
+ for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
+ ptrW dbNick(db_get_wsa(hContact, MODULE, "Nick"));
+ if ((dbNick == NULL) || (mir_wstrcmp(dbNick, SelNick) != 0))
+ continue;
+
+ ptrW dbURL(db_get_wsa(hContact, MODULE, "URL"));
+ if ((dbURL == NULL) || (mir_wstrcmp(dbURL, SelUrl) != 0))
+ continue;
+
+ m_hContact = hContact;
+ m_feedtitle.SetText(SelNick);
+ m_feedurl.SetText(SelUrl);
+ m_checktime.SetInt(db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME));
+
+ wchar_t *szMsgFormat = db_get_wsa(hContact, MODULE, "MsgFormat");
+ if (szMsgFormat) {
+ m_tagedit.SetText(szMsgFormat);
+ mir_free(szMsgFormat);
}
-
if (db_get_b(hContact, MODULE, "UseAuth", 0)) {
- CheckDlgButton(hwndDlg, IDC_USEAUTH, BST_CHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE);
- wchar_t *ptszLogin = db_get_wsa(hContact, MODULE, "Login");
- if (ptszLogin) {
- SetDlgItemText(hwndDlg, IDC_LOGIN, ptszLogin);
- mir_free(ptszLogin);
+ m_useauth.SetState(1);
+ m_login.Enable();
+ m_password.Enable();
+
+ wchar_t *szLogin = db_get_wsa(hContact, MODULE, "Login");
+ if (szLogin) {
+ m_login.SetText(szLogin);
+ mir_free(szLogin);
}
pass_ptrA pwd(db_get_sa(hContact, MODULE, "Password"));
- SetDlgItemTextA(hwndDlg, IDC_PASSWORD, pwd);
+ m_password.SetTextA(pwd);
}
+ //WindowList_Add(hChangeFeedDlgList, m_hwnd, hContact);
+ Utils_RestoreWindowPositionNoSize(m_hwnd, hContact, MODULE, "ChangeDlg");
+ break;
}
- return TRUE;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- wchar_t str[MAX_PATH];
- {
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- char passw[MAX_PATH];
- if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str))) {
- MessageBox(hwndDlg, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
- break;
- }
- if (!GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str)) || mir_wstrcmp(str, L"http://") == 0) {
- MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
- break;
- }
- if (!GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str))) {
- MessageBox(hwndDlg, TranslateT("Enter message format"), TranslateT("Error"), MB_OK);
- break;
- }
-
- GetDlgItemText(hwndDlg, IDC_FEEDURL, str, _countof(str));
- db_set_ws(hContact, MODULE, "URL", str);
- GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, _countof(str));
- db_set_ws(hContact, MODULE, "Nick", str);
- db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)GetDlgItemInt(hwndDlg, IDC_CHECKTIME, nullptr, false));
- GetDlgItemText(hwndDlg, IDC_TAGSEDIT, str, _countof(str));
- db_set_ws(hContact, MODULE, "MsgFormat", str);
- if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- db_set_b(hContact, MODULE, "UseAuth", 1);
-
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
- db_set_ws(hContact, MODULE, "Login", str);
-
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, passw, _countof(passw));
- db_set_s(hContact, MODULE, "Password", passw);
- }
- else {
- db_unset(hContact, MODULE, "UseAuth");
- db_unset(hContact, MODULE, "Login");
- db_unset(hContact, MODULE, "Password");
- }
+ }
+ else if (m_iItem == -1 && m_hContact == NULL) {
+ m_feedurl.SetText(L"http://");
+ m_tagedit.SetText(TAGSDEFAULT);
+ m_checktime.SetInt(DEFAULT_UPDATE_TIME);
+ Utils_RestoreWindowPositionNoSize(m_hwnd, NULL, MODULE, "AddDlg");
+ }
+ else if (m_hContact != NULL) {
+ ptrW dbNick(db_get_wsa(m_hContact, MODULE, "Nick"));
+ ptrW dbURL(db_get_wsa(m_hContact, MODULE, "URL"));
+
+ m_feedtitle.SetText(dbNick);
+ m_feedurl.SetText(dbURL);
+ m_checktime.SetInt(db_get_dw(m_hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME));
+
+ wchar_t *szMsgFormat = db_get_wsa(m_hContact, MODULE, "MsgFormat");
+ if (szMsgFormat) {
+ m_tagedit.SetText(szMsgFormat);
+ mir_free(szMsgFormat);
+ }
+ if (db_get_b(m_hContact, MODULE, "UseAuth", 0)) {
+ m_useauth.SetState(1);
+ m_login.Enable();
+ m_password.Enable();
+
+ wchar_t *szLogin = db_get_wsa(m_hContact, MODULE, "Login");
+ if (szLogin) {
+ m_login.SetText(szLogin);
+ mir_free(szLogin);
}
- // fall through
+ pass_ptrA pwd(db_get_sa(m_hContact, MODULE, "Password"));
+ m_password.SetTextA(pwd);
+ }
+ //WindowList_Add(hChangeFeedDlgList, m_hwnd, m_hContact);
+ Utils_RestoreWindowPositionNoSize(m_hwnd, m_hContact, MODULE, "ChangeDlg");
+ }
+}
- case IDCANCEL:
- DestroyWindow(hwndDlg);
- break;
+void CFeedEditor::OnCheckFeed(CCtrlBase*)
+{
+ m_checkfeed.Disable();
+ m_checkfeed.SetText(TranslateT("Wait..."));
+ wchar_t *tszTitle = nullptr;
+ ptrW strfeedurl(m_feedurl.GetText());
+ if (strfeedurl || mir_wstrcmp(strfeedurl, L"http://") != 0 || mir_wstrcmp(strfeedurl, L"") != 0)
+ tszTitle = (wchar_t*)CheckFeed(strfeedurl, m_hwnd);
+ else
+ MessageBox(m_hwnd, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
+ m_feedtitle.SetText(tszTitle);
+ mir_free(tszTitle);
+ m_checkfeed.Enable();
+ m_checkfeed.SetText(TranslateT("Check Feed"));
+}
- case IDC_USEAUTH:
- if (IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE);
- }
- else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGIN), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE);
- }
- break;
+void CFeedEditor::OnReset(CCtrlBase*)
+{
+ if (MessageBox(m_hwnd, TranslateT("Are you sure?"), TranslateT("Tags Mask Reset"), MB_YESNO | MB_ICONWARNING) == IDYES)
+ m_tagedit.SetText(TAGSDEFAULT);
+}
- case IDC_TAGHELP:
- wchar_t tszTagHelp[1024];
- mir_snwprintf(tszTagHelp, L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
- L"#<title>#", TranslateT("The title of the item."),
- L"#<description>#", TranslateT("The item synopsis."),
- L"#<link>#", TranslateT("The URL of the item."),
- L"#<author>#", TranslateT("Email address of the author of the item."),
- L"#<comments>#", TranslateT("URL of a page for comments relating to the item."),
- L"#<guid>#", TranslateT("A string that uniquely identifies the item."),
- L"#<category>#", TranslateT("Specify one or more categories that the item belongs to."));
- MessageBox(hwndDlg, tszTagHelp, TranslateT("Feed Tag Help"), MB_OK);
- break;
+void CFeedEditor::OnHelp(CCtrlBase*)
+{
+ CMStringW wszTagHelp;
+ wszTagHelp.Format(L"%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s\n%s - %s",
+ L"#<title>#", TranslateT("The title of the item."),
+ L"#<description>#", TranslateT("The item synopsis."),
+ L"#<link>#", TranslateT("The URL of the item."),
+ L"#<author>#", TranslateT("Email address of the author of the item."),
+ L"#<comments>#", TranslateT("URL of a page for comments relating to the item."),
+ L"#<guid>#", TranslateT("A string that uniquely identifies the item."),
+ L"#<category>#", TranslateT("Specify one or more categories that the item belongs to."));
+ MessageBox(m_hwnd, wszTagHelp, TranslateT("Feed Tag Help"), MB_OK);
+}
- case IDC_RESET:
- if (MessageBox(hwndDlg, TranslateT("Are you sure?"), TranslateT("Tags Mask Reset"), MB_YESNO | MB_ICONWARNING) == IDYES)
- SetDlgItemText(hwndDlg, IDC_TAGSEDIT, TAGSDEFAULT);
- break;
+void CFeedEditor::OnOk(CCtrlBase*)
+{
+ ptrW strfeedtitle(m_feedtitle.GetText());
+ if (!strfeedtitle || mir_wstrcmp(strfeedtitle, L"") == 0) {
+ MessageBox(m_hwnd, TranslateT("Enter Feed name"), TranslateT("Error"), MB_OK);
+ return;
+ }
- case IDC_DISCOVERY:
- wchar_t tszURL[MAX_PATH] = { 0 };
- if (GetDlgItemText(hwndDlg, IDC_FEEDURL, tszURL, _countof(tszURL)) || mir_wstrcmp(tszURL, L"http://") != 0) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), FALSE);
- SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Wait..."));
- wchar_t *tszTitle = (wchar_t*)CheckFeed(tszURL, hwndDlg);
- SetDlgItemText(hwndDlg, IDC_FEEDTITLE, tszTitle);
- mir_free(tszTitle);
- EnableWindow(GetDlgItem(hwndDlg, IDC_DISCOVERY), TRUE);
- SetDlgItemText(hwndDlg, IDC_DISCOVERY, TranslateT("Check Feed"));
- }
- else MessageBox(hwndDlg, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
- }
- break;
+ ptrW strfeedurl(m_feedurl.GetText());
+ if (!strfeedurl || mir_wstrcmp(strfeedurl, L"http://") == 0 || mir_wstrcmp(strfeedurl, L"") == 0) {
+ MessageBox(m_hwnd, TranslateT("Enter Feed URL"), TranslateT("Error"), MB_OK);
+ return;
+ }
- case WM_CLOSE:
- DestroyWindow(hwndDlg);
- break;
+ ptrW strtagedit(m_tagedit.GetText());
+ if (!strtagedit || mir_wstrcmp(strtagedit, L"") == 0) {
+ MessageBox(m_hwnd, TranslateT("Enter message format"), TranslateT("Error"), MB_OK);
+ return;
+ }
- case WM_DESTROY:
- MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- Utils_SaveWindowPosition(hwndDlg, hContact, MODULE, "ChangeDlg");
- WindowList_Remove(hChangeFeedDlgList, hwndDlg);
+ MCONTACT hContact;
+ if (m_iItem == -1 && m_hContact == NULL) {
+ hContact = db_add_contact();
+ Proto_AddToContact(hContact, MODULE);
+ db_set_b(hContact, MODULE, "CheckState", 1);
+ }
+ else
+ hContact = m_hContact;
+
+ db_set_ws(hContact, MODULE, "Nick", strfeedtitle);
+ db_set_ws(hContact, MODULE, "URL", strfeedurl);
+ db_set_dw(hContact, MODULE, "UpdateTime", (DWORD)m_checktime.GetInt());
+ db_set_ws(hContact, MODULE, "MsgFormat", strtagedit);
+ db_set_w(hContact, MODULE, "Status", CallProtoService(MODULE, PS_GETSTATUS, 0, 0));
+ if (m_useauth.IsChecked()) {
+ db_set_b(hContact, MODULE, "UseAuth", 1);
+ db_set_ws(hContact, MODULE, "Login", m_login.GetText());
+ db_set_s(hContact, MODULE, "Password", m_password.GetTextA());
+ }
+ else {
+ db_unset(hContact, MODULE, "UseAuth");
+ db_unset(hContact, MODULE, "Login");
+ db_unset(hContact, MODULE, "Password");
}
- return FALSE;
+ if (m_iItem == -1 && m_list != nullptr && m_hContact == NULL) {
+ int iItem = m_list->AddItem(strfeedtitle, -1);
+ m_list->SetItem(iItem, 1, strfeedurl);
+ m_list->SetCheckState(iItem, 1);
+ }
+ else if (m_iItem > -1) {
+ m_list->SetItem(m_iItem, 0, strfeedtitle);
+ m_list->SetItem(m_iItem, 1, strfeedurl);
+ }
}
-INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+void CFeedEditor::OnClose()
{
- HWND hwndList = GetDlgItem(hwndDlg, IDC_FEEDLIST);
- int sel;
+ Utils_SaveWindowPosition(m_hwnd, NULL, MODULE, m_iItem == -1 ? "AddDlg" : "ChangeDlg");
+ if (pChangeFeedDialog)
+ pChangeFeedDialog = nullptr;
+ if (pAddFeedDialog)
+ pAddFeedDialog = nullptr;
+}
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), FALSE);
- CreateList(hwndList);
- UpdateList(hwndList);
- CheckDlgButton(hwndDlg, IDC_STARTUPRETRIEVE, db_get_b(NULL, MODULE, "StartupRetrieve", 1) ? BST_CHECKED : BST_UNCHECKED);
- return TRUE;
+void CFeedEditor::OnUseAuth(CCtrlBase*)
+{
+ m_login.Enable(m_useauth.GetState());
+ m_password.Enable(m_useauth.GetState());
+}
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_ADD:
- if (hAddFeedDlg == nullptr)
- hAddFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcAddFeedOpts, (LPARAM)hwndList);
- return FALSE;
+void COptionsMain::UpdateList()
+{
+ for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
+ UpdateListFlag = TRUE;
+ wchar_t *ptszNick = db_get_wsa(hContact, MODULE, "Nick");
+ if (ptszNick) {
+ int iItem = m_feeds.AddItem(ptszNick, -1);
- case IDC_CHANGE:
- sel = ListView_GetSelectionMark(hwndList);
- {
- ItemInfo SelItem = {};
- ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick));
- ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url));
- SelItem.hwndList = hwndList;
- SelItem.SelNumber = sel;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcChangeFeedOpts, (LPARAM)&SelItem);
- }
- return FALSE;
-
- case IDC_REMOVE:
- if (MessageBox(hwndDlg, TranslateT("Are you sure?"), TranslateT("Contact deleting"), MB_YESNO | MB_ICONWARNING) == IDYES) {
- wchar_t nick[MAX_PATH], url[MAX_PATH];
- sel = ListView_GetSelectionMark(hwndList);
- ListView_GetItemText(hwndList, sel, 0, nick, _countof(nick));
- ListView_GetItemText(hwndList, sel, 1, url, _countof(url));
-
- for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
- ptrW dbNick(db_get_wsa(hContact, MODULE, "Nick"));
- if (dbNick == NULL)
- break;
- if (mir_wstrcmp(dbNick, nick))
- continue;
-
- ptrW dbURL(db_get_wsa(hContact, MODULE, "URL"));
- if (dbURL == NULL)
- break;
- if (mir_wstrcmp(dbURL, url))
- continue;
-
- db_delete_contact(hContact);
- ListView_DeleteItem(hwndList, sel);
- break;
- }
+ wchar_t *ptszURL = db_get_wsa(hContact, MODULE, "URL");
+ if (ptszURL) {
+ m_feeds.SetItem(iItem, 1, ptszURL);
+ m_feeds.SetCheckState(iItem, db_get_b(hContact, MODULE, "CheckState", 1));
+ mir_free(ptszURL);
}
- return FALSE;
+ mir_free(ptszNick);
+ }
+ }
+ UpdateListFlag = FALSE;
+}
- case IDC_IMPORT:
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FEEDIMPORT), hwndDlg, DlgProcImportOpts, (LPARAM)hwndList);
- return FALSE;
+COptionsMain::COptionsMain()
+ : CPluginDlgBase(hInst, IDD_OPTIONS, MODULE),
+ m_feeds(this, IDC_FEEDLIST),
+ m_add(this, IDC_ADD),
+ m_change(this, IDC_CHANGE),
+ m_delete(this, IDC_REMOVE),
+ m_import(this, IDC_IMPORT),
+ m_export(this, IDC_EXPORT),
+ m_checkonstartup(this, IDC_STARTUPRETRIEVE)
+{
+ CreateLink(m_checkonstartup, "AutoUpdate", DBVT_BYTE, 1);
- case IDC_EXPORT:
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDEXPORT), hwndDlg, DlgProcExportOpts);
- return FALSE;
+ m_add.OnClick = Callback(this, &COptionsMain::OnAddButtonClick);
+ m_change.OnClick = Callback(this, &COptionsMain::OnChangeButtonClick);
+ m_delete.OnClick = Callback(this, &COptionsMain::OnDeleteButtonClick);
+ m_import.OnClick = Callback(this, &COptionsMain::OnImportButtonClick);
+ m_export.OnClick = Callback(this, &COptionsMain::OnExportButtonClick);
- case IDC_STARTUPRETRIEVE:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- break;
+ m_feeds.OnItemChanged = Callback(this, &COptionsMain::OnFeedListItemChanged);
+ m_feeds.OnDoubleClick = Callback(this, &COptionsMain::OnFeedListDoubleClick);
- case WM_NOTIFY:
- NMHDR *hdr = (NMHDR *)lParam;
- switch (hdr->code) {
- case PSN_APPLY:
- db_set_b(NULL, MODULE, "StartupRetrieve", IsDlgButtonChecked(hwndDlg, IDC_STARTUPRETRIEVE));
+}
+
+void COptionsMain::OnInitDialog()
+{
+ CDlgBase::OnInitDialog();
+ m_change.Disable();
+ m_delete.Disable();
+ m_feeds.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
+ m_feeds.AddColumn(0, TranslateT("Feed"), 160);
+ m_feeds.AddColumn(1, TranslateT("URL"), 276);
+ UpdateList();
+}
+
+void COptionsMain::OnApply()
+{
+ for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
+ ptrW dbNick(db_get_wsa(hContact, MODULE, "Nick"));
+ for (int i = 0; i < m_feeds.GetItemCount(); i++) {
+ wchar_t nick[MAX_PATH];
+ m_feeds.GetItemText(i, 0, nick, _countof(nick));
+ if (mir_wstrcmp(dbNick, nick) == 0)
{
- int i = 0;
- for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
- db_set_b(hContact, MODULE, "CheckState", ListView_GetCheckState(hwndList, i));
- if (!ListView_GetCheckState(hwndList, i))
- db_set_b(hContact, "CList", "Hidden", 1);
- else
- db_unset(hContact, "CList", "Hidden");
- i++;
- }
+ db_set_b(hContact, MODULE, "CheckState", m_feeds.GetCheckState(i));
+ if (!m_feeds.GetCheckState(i))
+ db_set_b(hContact, "CList", "Hidden", 1);
+ else
+ db_unset(hContact, "CList", "Hidden");
}
- break;
+ }
+ }
+}
- case NM_DBLCLK:
- sel = ListView_GetHotItem(hwndList);
- if (sel != -1) {
- ItemInfo SelItem = {};
- ListView_GetItemText(hwndList, sel, 0, SelItem.nick, _countof(SelItem.nick));
- ListView_GetItemText(hwndList, sel, 1, SelItem.url, _countof(SelItem.url));
- SelItem.hwndList = hwndList;
- SelItem.SelNumber = sel;
- CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), hwndDlg, DlgProcChangeFeedOpts, (LPARAM)&SelItem);
- }
- break;
+void COptionsMain::OnAddButtonClick(CCtrlBase*)
+{
+ if (pAddFeedDialog == nullptr) {
+ pAddFeedDialog = new CFeedEditor(-1, &m_feeds, NULL);
+ pAddFeedDialog->Show();
+ pAddFeedDialog->SetParent(m_hwnd);
+ }
+}
- case LVN_ITEMCHANGED:
- NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- sel = ListView_GetSelectionMark(hwndList);
- if (sel == -1) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), FALSE);
- }
- else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), TRUE);
- }
- if (((nmlv->uNewState ^ nmlv->uOldState) & LVIS_STATEIMAGEMASK) && !UpdateListFlag)
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+void COptionsMain::OnChangeButtonClick(CCtrlBase*)
+{
+ if (pChangeFeedDialog == nullptr) {
+ int isel = m_feeds.GetSelectionMark();
+ pChangeFeedDialog = new CFeedEditor(isel, &m_feeds, NULL);
+ pChangeFeedDialog->Show();
+ pChangeFeedDialog->SetParent(m_hwnd);
+ }
+}
+
+void COptionsMain::OnDeleteButtonClick(CCtrlBase*)
+{
+ if (MessageBox(m_hwnd, TranslateT("Are you sure?"), TranslateT("Contact deleting"), MB_YESNO | MB_ICONWARNING) == IDYES) {
+ wchar_t nick[MAX_PATH], url[MAX_PATH];
+ int isel = m_feeds.GetSelectionMark();
+ m_feeds.GetItemText(isel, 0, nick, _countof(nick));
+ m_feeds.GetItemText(isel, 1, url, _countof(url));
+
+ for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
+ ptrW dbNick(db_get_wsa(hContact, MODULE, "Nick"));
+ if (dbNick == NULL)
+ break;
+ if (mir_wstrcmp(dbNick, nick))
+ continue;
+
+ ptrW dbURL(db_get_wsa(hContact, MODULE, "URL"));
+ if (dbURL == NULL)
+ break;
+ if (mir_wstrcmp(dbURL, url))
+ continue;
+
+ db_delete_contact(hContact);
+ m_feeds.DeleteItem(isel);
break;
}
}
- return FALSE;
+}
+
+void COptionsMain::OnImportButtonClick(CCtrlBase*)
+{
+ if (pImportDialog == nullptr) {
+ pImportDialog = new CImportFeed(&m_feeds);
+ pImportDialog->Show();
+ pImportDialog->SetParent(m_hwnd);
+ }
+}
+
+void COptionsMain::OnExportButtonClick(CCtrlBase*)
+{
+ if (pExportDialog == nullptr) {
+ pExportDialog = new CExportFeed();
+ pExportDialog->Show();
+ pExportDialog->SetParent(m_hwnd);
+ }
+}
+
+void COptionsMain::OnFeedListItemChanged(CCtrlListView::TEventInfo *evt)
+{
+ int isel = m_feeds.GetSelectionMark();
+ if (isel == -1) {
+ m_change.Disable();
+ m_delete.Disable();
+ }
+ else {
+ m_change.Enable();
+ m_delete.Enable();
+ }
+ if (((evt->nmlv->uNewState ^ evt->nmlv->uOldState) & LVIS_STATEIMAGEMASK) && !UpdateListFlag)
+ NotifyChange();
+}
+
+void COptionsMain::OnFeedListDoubleClick(CCtrlBase*)
+{
+ if (pChangeFeedDialog == nullptr) {
+ int isel = m_feeds.GetHotItem();
+ if (isel != -1) {
+ pChangeFeedDialog = new CFeedEditor(isel, &m_feeds, NULL);
+ pChangeFeedDialog->Show();
+ pChangeFeedDialog->SetParent(m_hwnd);
+ }
+ }
}
int OptInit(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
- odp.flags = ODPF_BOLDGROUPS;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
- odp.szGroup.a = LPGEN("Network");
- odp.szTitle.a = LPGEN("News Aggregator");
- odp.pfnDlgProc = UpdateNotifyOptsProc;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE;
+ odp.szGroup.w = LPGENW("Network");
+ odp.szTitle.w = LPGENW("News Aggregator");
+ odp.pDialog = new COptionsMain();
Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/NewsAggregator/Src/Options.h b/plugins/NewsAggregator/Src/Options.h new file mode 100644 index 0000000000..41d2274db5 --- /dev/null +++ b/plugins/NewsAggregator/Src/Options.h @@ -0,0 +1,132 @@ +#ifndef _OPTIONS_H_ +#define _OPTIONS_H_ + +class COptionsMain : public CPluginDlgBase +{ +private: + CCtrlListView m_feeds; + CCtrlButton m_add; + CCtrlButton m_change; + CCtrlButton m_delete; + CCtrlButton m_import; + CCtrlButton m_export; + CCtrlCheck m_checkonstartup; + +protected: + void OnInitDialog(); + void OnApply(); + + void OnAddButtonClick(CCtrlBase*); + void OnChangeButtonClick(CCtrlBase*); + void OnDeleteButtonClick(CCtrlBase*); + void OnImportButtonClick(CCtrlBase*); + void OnExportButtonClick(CCtrlBase*); + + void OnFeedListItemChanged(CCtrlListView::TEventInfo *evt); + void OnFeedListDoubleClick(CCtrlBase*); + + void UpdateList(); + +public: + COptionsMain(); +}; + +class CFeedEditor : public CDlgBase +{ +private: + typedef CDlgBase CSuper; + + int m_iItem; + CCtrlListView *m_list; + MCONTACT m_hContact; + + CCtrlEdit m_feedtitle; + CCtrlEdit m_feedurl; + CCtrlEdit m_checktime; + CCtrlSpin m_checktimespin; + CCtrlButton m_checkfeed; + CCtrlCheck m_useauth; + CCtrlEdit m_login; + CCtrlEdit m_password; + CCtrlEdit m_tagedit; + CCtrlButton m_reset; + CCtrlButton m_help; + CCtrlButton m_ok; + +protected: + void OnInitDialog(); + void OnCheckFeed(CCtrlBase*); + void OnReset(CCtrlBase*); + void OnHelp(CCtrlBase*); + void OnOk(CCtrlBase*); + void OnClose(); + void OnUseAuth(CCtrlBase*); + +public: + CFeedEditor(int iItem, CCtrlListView *m_list, MCONTACT Contact); +}; + +class CImportFeed : public CDlgBase +{ +private: + typedef CDlgBase CSuper; + + CCtrlListView *m_list; + + CCtrlEdit m_importfile; + CCtrlButton m_browsefile; + CCtrlListBox m_feedslist; + CCtrlListBox m_feedsimportlist; + CCtrlButton m_addfeed; + CCtrlButton m_removefeed; + CCtrlButton m_addallfeeds; + CCtrlButton m_removeallfeeds; + CCtrlButton m_ok; + +protected: + void OnInitDialog(); + void OnBrowseFile(CCtrlBase*); + void OnAddFeed(CCtrlBase*); + void OnRemoveFeed(CCtrlBase*); + void OnAddAllFeeds(CCtrlBase*); + void OnRemoveAllFeeds(CCtrlBase*); + void OnOk(CCtrlBase*); + void OnClose(); + + void OnFeedsList(CCtrlBase*); + void OnFeedsImportList(CCtrlBase*); + +public: + CImportFeed(CCtrlListView *m_list); +}; + +class CExportFeed : public CDlgBase +{ +private: + typedef CDlgBase CSuper; + + CCtrlListBox m_feedslist; + CCtrlListBox m_feedsexportlist; + CCtrlButton m_addfeed; + CCtrlButton m_removefeed; + CCtrlButton m_addallfeeds; + CCtrlButton m_removeallfeeds; + CCtrlButton m_ok; + +protected: + void OnInitDialog(); + void OnAddFeed(CCtrlBase*); + void OnRemoveFeed(CCtrlBase*); + void OnAddAllFeeds(CCtrlBase*); + void OnRemoveAllFeeds(CCtrlBase*); + void OnOk(CCtrlBase*); + void OnClose(); + + void OnFeedsList(CCtrlBase*); + void OnFeedsExportList(CCtrlBase*); + +public: + CExportFeed(); +}; + +#endif //_OPTIONS_H_
\ No newline at end of file diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 68f7dedd05..ad96232894 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -56,10 +56,7 @@ int NewsAggrInit(WPARAM, LPARAM) int NewsAggrPreShutdown(WPARAM, LPARAM)
{
- if (hAddFeedDlg)
- SendMessage(hAddFeedDlg, WM_CLOSE, 0, 0);
-
- WindowList_Broadcast(hChangeFeedDlgList, WM_CLOSE, 0, 0);
+ //WindowList_Broadcast(hChangeFeedDlgList, WM_CLOSE, 0, 0);
KillTimer(nullptr, timerId);
NetlibUnInit();
@@ -152,34 +149,48 @@ INT_PTR CheckAllFeeds(WPARAM, LPARAM lParam) INT_PTR AddFeed(WPARAM, LPARAM)
{
- if (hAddFeedDlg == nullptr)
- hAddFeedDlg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_ADDFEED), nullptr, DlgProcAddFeedOpts);
- ShowWindow(hAddFeedDlg, SW_SHOW);
+ if (pAddFeedDialog == nullptr)
+ pAddFeedDialog = new CFeedEditor(-1, nullptr, NULL);
+ pAddFeedDialog->Show();
return 0;
}
INT_PTR ChangeFeed(WPARAM hContact, LPARAM)
{
- HWND hChangeFeedDlg = WindowList_Find(hChangeFeedDlgList, hContact);
- if (!hChangeFeedDlg) {
+ //HWND hChangeFeedDlg = WindowList_Find(hChangeFeedDlgList, hContact);
+
+ if (pChangeFeedDialog == nullptr) {
+ pChangeFeedDialog = new CFeedEditor(-1, nullptr, hContact);
+ pChangeFeedDialog->Show();
+ }
+
+ /*if (!hChangeFeedDlg) {
hChangeFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), nullptr, DlgProcChangeFeedMenu, hContact);
ShowWindow(hChangeFeedDlg, SW_SHOW);
} else {
SetForegroundWindow(hChangeFeedDlg);
SetFocus(hChangeFeedDlg);
- }
+ }*/
return 0;
}
INT_PTR ImportFeeds(WPARAM, LPARAM)
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDIMPORT), nullptr, DlgProcImportOpts);
+ if (pImportDialog == nullptr)
+ pImportDialog = new CImportFeed(nullptr);
+ pImportDialog->Show();
+
+ //CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDIMPORT), nullptr, DlgProcImportOpts);
return 0;
}
INT_PTR ExportFeeds(WPARAM, LPARAM)
{
- CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDEXPORT), nullptr, DlgProcExportOpts);
+ if (pExportDialog == nullptr)
+ pExportDialog = new CExportFeed();
+ pExportDialog->Show();
+
+ //CreateDialog(hInst, MAKEINTRESOURCE(IDD_FEEDEXPORT), nullptr, DlgProcExportOpts);
return 0;
}
diff --git a/plugins/NewsAggregator/Src/stdafx.h b/plugins/NewsAggregator/Src/stdafx.h index 27fdfd2195..bbce47d74d 100644 --- a/plugins/NewsAggregator/Src/stdafx.h +++ b/plugins/NewsAggregator/Src/stdafx.h @@ -44,11 +44,13 @@ Boston, MA 02111-1307, USA. #include <m_xml.h>
#include <m_avatars.h>
#include <m_hotkeys.h>
+#include <m_gui.h>
#include <m_folders.h>
#include <m_toptoolbar.h>
#include <m_string.h>
+#include "Options.h"
#include "version.h"
#include "resource.h"
@@ -58,8 +60,8 @@ Boston, MA 02111-1307, USA. #define DEFAULT_UPDATE_TIME 60
extern HINSTANCE hInst;
-extern HWND hAddFeedDlg;
-extern MWindowList hChangeFeedDlgList;
+extern CDlgBase *pAddFeedDialog, *pChangeFeedDialog, *pImportDialog, *pExportDialog;
+//extern MWindowList hChangeFeedDlgList;
extern HNETLIBUSER hNetlibUser;
extern UINT_PTR timerId;
// check if Feeds is currently updating
@@ -121,17 +123,11 @@ INT_PTR ExportFeeds(WPARAM wParam, LPARAM lParam); INT_PTR CheckFeed(WPARAM wParam, LPARAM lParam);
INT_PTR EnableDisable(WPARAM wParam, LPARAM lParam);
int OnToolbarLoaded(WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
void CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
void CALLBACK timerProc2(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
bool IsMyContact(MCONTACT hContact);
void GetNewsData(wchar_t *szUrl, char **szData, MCONTACT hContact, HWND hwndDlg);
-void CreateList(HWND hwndList);
-void UpdateList(HWND hwndList);
-void DeleteAllItems(HWND hwndList);
time_t __stdcall DateToUnixTime(const wchar_t *stamp, bool FeedType);
void CheckCurrentFeed(MCONTACT hContact);
void CheckCurrentFeedAvatar(MCONTACT hContact);
@@ -141,8 +137,6 @@ LPCTSTR ClearText(CMStringW &value, const wchar_t *message); bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal);
void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg);
INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
MCONTACT GetContactByNick(const wchar_t *nick);
MCONTACT GetContactByURL(const wchar_t *url);
|