summaryrefslogtreecommitdiff
path: root/plugins/NewsAggregator/Src/Utils.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-01-06 18:32:12 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-01-06 18:32:12 +0000
commit97b13834eec468cfceeb43cbe1eeef944f2de7bc (patch)
treec20e17b364aefb95f20f41889b16b3db46a1b0e0 /plugins/NewsAggregator/Src/Utils.cpp
parentf416a25cafc951228dd12b22af0ac53b4fb7d68f (diff)
added main menu item for disabling auto update (needs to add icons)
git-svn-id: http://svn.miranda-ng.org/main/trunk@2999 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NewsAggregator/Src/Utils.cpp')
-rw-r--r--plugins/NewsAggregator/Src/Utils.cpp91
1 files changed, 44 insertions, 47 deletions
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp
index 490f8d2464..50aa1edefa 100644
--- a/plugins/NewsAggregator/Src/Utils.cpp
+++ b/plugins/NewsAggregator/Src/Utils.cpp
@@ -722,67 +722,64 @@ TCHAR* CheckFeed(TCHAR* tszURL, HWND hwndDlg)
{
char *szData = NULL;
DBVARIANT dbVar = {0};
- if (CallProtoService(MODULE, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE)
+ GetNewsData(tszURL, &szData, NULL, hwndDlg);
+ if (szData)
{
- GetNewsData(tszURL, &szData, NULL, hwndDlg);
- if (szData)
+ TCHAR *tszData = mir_utf8decodeT(szData);
+ if (!tszData)
+ tszData = mir_a2t(szData);
+ int bytesParsed = 0;
+ HXML hXml = xi.parseString(tszData, &bytesParsed, NULL);
+ mir_free(tszData);
+ mir_free(szData);
+ if (hXml != NULL)
{
- TCHAR *tszData = mir_utf8decodeT(szData);
- if (!tszData)
- tszData = mir_a2t(szData);
- int bytesParsed = 0;
- HXML hXml = xi.parseString(tszData, &bytesParsed, NULL);
- mir_free(tszData);
- mir_free(szData);
- if (hXml != NULL)
+ int childcount = 0;
+ HXML node = xi.getChild(hXml, childcount);
+ while (node)
{
- int childcount = 0;
- HXML node = xi.getChild(hXml, childcount);
- while (node)
+ if (!lstrcmpi(xi.getName(node), _T("rss")) || !lstrcmpi(xi.getName(node), _T("rdf")))
{
- if (!lstrcmpi(xi.getName(node), _T("rss")) || !lstrcmpi(xi.getName(node), _T("rdf")))
+ HXML chan = xi.getChild(node, 0);
+ for (int j = 0; j < xi.getChildCount(chan); j++)
{
- HXML chan = xi.getChild(node, 0);
- for (int j = 0; j < xi.getChildCount(chan); j++)
+ HXML child = xi.getChild(chan, j);
+ if (!lstrcmpi(xi.getName(child), _T("title")))
{
- HXML child = xi.getChild(chan, j);
- if (!lstrcmpi(xi.getName(child), _T("title")))
- {
- TCHAR mes[MAX_PATH];
- mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a valid feed's address."), tszURL);
- MessageBox(NULL, mes, TranslateT("New Aggregator"), MB_OK|MB_ICONINFORMATION);
- TCHAR *tszTitle = (TCHAR*)xi.getText(child);
- return tszTitle;
- }
+ TCHAR mes[MAX_PATH];
+ mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a valid feed's address."), tszURL);
+ MessageBox(NULL, mes, TranslateT("New Aggregator"), MB_OK|MB_ICONINFORMATION);
+ TCHAR *tszTitle = (TCHAR*)xi.getText(child);
+ return tszTitle;
}
}
- else if (!lstrcmpi(xi.getName(node), _T("feed")))
+ }
+ else if (!lstrcmpi(xi.getName(node), _T("feed")))
+ {
+ for (int j = 0; j < xi.getChildCount(node); j++)
{
- for (int j = 0; j < xi.getChildCount(node); j++)
+ HXML child = xi.getChild(node, j);
+ if (!lstrcmpi(xi.getName(child), _T("title")))
{
- HXML child = xi.getChild(node, j);
- if (!lstrcmpi(xi.getName(child), _T("title")))
- {
- TCHAR mes[MAX_PATH];
- mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a valid feed's address."), tszURL);
- MessageBox(NULL, mes, TranslateT("New Aggregator"), MB_OK|MB_ICONINFORMATION);
- TCHAR *tszTitle = (TCHAR*)xi.getText(child);
- return tszTitle;
- }
+ TCHAR mes[MAX_PATH];
+ mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a valid feed's address."), tszURL);
+ MessageBox(NULL, mes, TranslateT("New Aggregator"), MB_OK|MB_ICONINFORMATION);
+ TCHAR *tszTitle = (TCHAR*)xi.getText(child);
+ return tszTitle;
}
}
- childcount +=1;
- node = xi.getChild(hXml, childcount);
}
+ childcount +=1;
+ node = xi.getChild(hXml, childcount);
}
- xi.destroyNode(hXml);
- }
- else
- {
- TCHAR mes[MAX_PATH];
- mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a not valid feed's address."), tszURL);
- MessageBox(NULL, mes, TranslateT("New Aggregator"), MB_OK|MB_ICONERROR);
}
+ xi.destroyNode(hXml);
+ }
+ else
+ {
+ TCHAR mes[MAX_PATH];
+ mir_sntprintf(mes, SIZEOF(mes), TranslateT("%s\nis a not valid feed's address."), tszURL);
+ MessageBox(NULL, mes, TranslateT("New Aggregator"), MB_OK|MB_ICONERROR);
}
return NULL;
}
@@ -793,7 +790,7 @@ VOID CheckCurrentFeed(HANDLE hContact)
DBVARIANT dbURL = {0};
if (DBGetContactSettingTString(hContact, MODULE, "URL", &dbURL))
return;
- else if ((DBGetContactSettingWord(hContact, MODULE, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) && DBGetContactSettingByte(hContact, MODULE, "CheckState", 1) != 0)
+ else if (db_get_b(NULL, MODULE, "AutoUpdate", 1) != 0 && db_get_b(hContact, MODULE, "CheckState", 1) != 0)
{
GetNewsData(dbURL.ptszVal, &szData, hContact, NULL);
DBFreeVariant(&dbURL);