diff options
author | Rhinoceros | 2018-01-18 14:39:40 +1100 |
---|---|---|
committer | Rhinoceros | 2018-01-18 14:39:40 +1100 |
commit | bdc1fd4c8e304e850b972b4a05cfa6914a027f50 (patch) | |
tree | 45ad6e6c716b0c19d4bf38b715fa55bcf7a21395 | |
parent | 217c132c198d8cfa1d41ca86e75882762f272ba6 (diff) | |
parent | 00f3395633adbc217f622396d26a1bd3ca3193fe (diff) | |
download | aur-bdc1fd4c8e304e850b972b4a05cfa6914a027f50.tar.gz |
Merge branch 'master' of aur:/kalu-kde
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 9 | ||||
-rw-r--r-- | unread_news.patch | 105 |
3 files changed, 114 insertions, 4 deletions
@@ -1,7 +1,7 @@ pkgbase = kalu-kde pkgdesc = Upgrade notifier w/ AUR support, watched (AUR) packages, news; supports autohide in KDE Plasma's panel pkgver = 4.1.0 - pkgrel = 2 + pkgrel = 3 url = http://jjacky.com/kalu install = kalu.install arch = i686 @@ -22,8 +22,10 @@ pkgbase = kalu-kde conflicts = kalu source = http://jjacky.com/kalu/kalu-4.1.0.tar.gz source = statusnotifier.patch + source = unread_news.patch sha1sums = dbcc37899302d402717653f11ff303c5dc73b86d sha1sums = d58712ff827df6bea9c5eb5a7e3d9034f3cac506 + sha1sums = c1fd0bd2d77de217742358e45a3d670d11e87dbe pkgname = kalu-kde @@ -3,7 +3,7 @@ pkgname=kalu-kde pkgver=4.1.0 -pkgrel=2 +pkgrel=3 pkgdesc="Upgrade notifier w/ AUR support, watched (AUR) packages, news; supports autohide in KDE Plasma's panel" arch=('i686' 'x86_64') url="http://jjacky.com/kalu" @@ -12,16 +12,19 @@ depends=('dbus' 'polkit' 'gtk3' 'pacman>=5.0' 'pacman<5.1' 'curl' 'libnotify' 'notification-daemon' 'statusnotifier') makedepends=('perl' 'groff') source=(http://jjacky.com/${pkgname%-kde}/${pkgname%-kde}-$pkgver.tar.gz - statusnotifier.patch) + statusnotifier.patch + unread_news.patch) install=kalu.install sha1sums=('dbcc37899302d402717653f11ff303c5dc73b86d' - 'd58712ff827df6bea9c5eb5a7e3d9034f3cac506') + 'd58712ff827df6bea9c5eb5a7e3d9034f3cac506' + 'c1fd0bd2d77de217742358e45a3d670d11e87dbe') provides=(${pkgname%-kde}) conflicts=(${pkgname%-kde}) prepare() { cd "${pkgname%-kde}-$pkgver" patch -p0 -i "$srcdir/statusnotifier.patch" + patch -p1 -i "$srcdir/unread_news.patch" } build() { diff --git a/unread_news.patch b/unread_news.patch new file mode 100644 index 000000000000..85c6a695e18a --- /dev/null +++ b/unread_news.patch @@ -0,0 +1,105 @@ +From 5eba7d9b279aea3de4270947d84d619a34093fe4 Mon Sep 17 00:00:00 2001 +From: Olivier Brunel <jjk@jjacky.com> +Date: Mon, 13 Nov 2017 18:18:00 +0100 +Subject: [PATCH] news: Fix issue if title needs trimming.. + +..that is, if a news title (used to determine whether it has been read +or not) could be trimmedg, there was an issue because titles read from +news.conf are trimmed, so the two wouldn't match, and the news +incorrectly considered unread. + +To fix this we trim the titles read from the XML (RSS feed) as well. + +Thanks to Ada Joule; Also adam777 for the report. + +Fixes #57 +--- + src/kalu/news.c | 35 ++++++++++++++++++++++++++++------- + 1 file changed, 28 insertions(+), 7 deletions(-) + +diff --git a/src/kalu/news.c b/src/kalu/news.c +index 49d4058..85deecf 100644 +--- a/src/kalu/news.c ++++ b/src/kalu/news.c +@@ -24,6 +24,7 @@ + + /* C */ + #include <string.h> ++#include <ctype.h> + + #ifndef DISABLE_GUI + /* gtk */ +@@ -121,25 +122,45 @@ xml_parser_updates_text (GMarkupParseContext *context, + + if (streq ("title", list->data)) + { ++ gchar *s = (gchar *) text; ++ ++ /* if it needs trimming, let's do it. (If not we use text as-is to avoid ++ * a possibly unneeded call strdup) */ ++ if (isspace (*s) || isspace (s[strlen (s) - 1])) ++ { ++ s = strtrim (strdup (s)); ++ } ++ + /* is this the last item from last check? */ +- if (NULL != config->news_last && streq (config->news_last, text)) ++ if (NULL != config->news_last && streq (config->news_last, s)) + { + parse_updates_data->is_last_reached = TRUE; ++ if (s != text) ++ { ++ free (s); ++ } + return; + } + + /* was this item already read? */ + FOR_LIST (i, config->news_read) + { +- if (streq (i->data, text)) ++ if (streq (i->data, s)) + { ++ if (s != text) ++ { ++ free (s); ++ } + return; + } + } + + /* add title to the new news */ +- parse_updates_data->titles = alpm_list_add (parse_updates_data->titles, +- strdup (text)); ++ if (s == text) ++ { ++ s = strdup (s); ++ } ++ parse_updates_data->titles = alpm_list_add (parse_updates_data->titles, s); + } + } + +@@ -698,12 +719,12 @@ xml_parser_news_text (GMarkupParseContext *context, + { + /* make a copy of the title, and store it in list of all titles */ + /* it will not be free-d here. this is done on window_destroy_cb */ +- s = strdup (text); ++ s = strtrim (strdup (text)); + lists = parse_news_data->lists; + lists[LIST_TITLES_ALL] = alpm_list_add (lists[LIST_TITLES_ALL], s); + + /* is this the last item from last check? */ +- if (NULL != config->news_last && streq (config->news_last, text)) ++ if (NULL != config->news_last && streq (config->news_last, s)) + { + parse_news_data->is_last_reached = TRUE; + return; +@@ -712,7 +733,7 @@ xml_parser_news_text (GMarkupParseContext *context, + /* was this item already read? */ + FOR_LIST (i, config->news_read) + { +- if (streq (i->data, text)) ++ if (streq (i->data, s)) + { + /* make a note to skip its description as well */ + skip_next_description = TRUE; |