summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-07-02 14:16:46 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-07-02 14:16:46 +0300
commitc35263939085f5f3bef0c6517afff335a55acf30 (patch)
treea043517114581e980e397aced08d7db5008dc834 /src
parente85d491fa6ef340f19a5b757ae8d7c0b7c6a2677 (diff)
Further canonical URIs
Diffstat (limited to 'src')
-rw-r--r--src/feeds.c8
-rw-r--r--src/history.c6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/feeds.c b/src/feeds.c
index a68fd726..3bb6ad89 100644
--- a/src/feeds.c
+++ b/src/feeds.c
@@ -241,7 +241,7 @@ static void parseResult_FeedJob_(iFeedJob *d) {
241 entry->bookmarkId = d->bookmarkId; 241 entry->bookmarkId = d->bookmarkId;
242 iString *title = newRange_String(line); 242 iString *title = newRange_String(line);
243 set_String(&entry->title, title); 243 set_String(&entry->title, title);
244 set_String(&entry->url, canonicalUrl_String(&d->url)); 244 set_String(&entry->url, canonicalUrl_String(&d->url));
245 appendChar_String(&entry->url, '#'); 245 appendChar_String(&entry->url, '#');
246 append_String(&entry->url, collect_String(urlEncode_String(title))); 246 append_String(&entry->url, collect_String(urlEncode_String(title)));
247 delete_String(title); 247 delete_String(title);
@@ -498,8 +498,9 @@ static void load_Feeds_(iFeeds *d) {
498 break; 498 break;
499 } 499 }
500 case 2: { 500 case 2: {
501 /* TODO: All right, this could maybe use a bit more robust, structured 501 /* TODO: Cleanup needed...
502 format. The code below is messy. */ 502 All right, this could maybe use a bit more robust, structured format.
503 The code below is messy. */
503 const uint32_t feedId = strtoul(line.start, NULL, 16); 504 const uint32_t feedId = strtoul(line.start, NULL, 16);
504 if (!nextSplit_Rangecc(range_Block(src), "\n", &line)) { 505 if (!nextSplit_Rangecc(range_Block(src), "\n", &line)) {
505 goto aborted; 506 goto aborted;
@@ -535,6 +536,7 @@ static void load_Feeds_(iFeeds *d) {
535 entry->discovered.ts.tv_sec = discovered; 536 entry->discovered.ts.tv_sec = discovered;
536 set_String(&entry->url, url); 537 set_String(&entry->url, url);
537 stripDefaultUrlPort_String(&entry->url); 538 stripDefaultUrlPort_String(&entry->url);
539 set_String(&entry->url, canonicalUrl_String(&entry->url));
538 set_String(&entry->title, title); 540 set_String(&entry->title, title);
539 insert_SortedArray(&d->entries, &entry); 541 insert_SortedArray(&d->entries, &entry);
540 } 542 }
diff --git a/src/history.c b/src/history.c
index 2cea393d..208c239d 100644
--- a/src/history.c
+++ b/src/history.c
@@ -194,6 +194,7 @@ void deserialize_History(iHistory *d, iStream *ins) {
194 iRecentUrl item; 194 iRecentUrl item;
195 init_RecentUrl(&item); 195 init_RecentUrl(&item);
196 deserialize_String(&item.url, ins); 196 deserialize_String(&item.url, ins);
197 set_String(&item.url, canonicalUrl_String(&item.url));
197 item.normScrollY = (float) read32_Stream(ins) / 1.0e6f; 198 item.normScrollY = (float) read32_Stream(ins) / 1.0e6f;
198 if (version_Stream(ins) >= addedRecentUrlFlags_FileVersion) { 199 if (version_Stream(ins) >= addedRecentUrlFlags_FileVersion) {
199 uint16_t flags = readU16_Stream(ins); 200 uint16_t flags = readU16_Stream(ins);
@@ -246,6 +247,7 @@ const iString *url_History(const iHistory *d, size_t pos) {
246} 247}
247 248
248iRecentUrl *findUrl_History(iHistory *d, const iString *url) { 249iRecentUrl *findUrl_History(iHistory *d, const iString *url) {
250 url = canonicalUrl_String(url);
249 lock_Mutex(d->mtx); 251 lock_Mutex(d->mtx);
250 iReverseForEach(Array, i, &d->recent) { 252 iReverseForEach(Array, i, &d->recent) {
251 if (cmpStringCase_String(url, &((iRecentUrl *) i.value)->url) == 0) { 253 if (cmpStringCase_String(url, &((iRecentUrl *) i.value)->url) == 0) {
@@ -258,6 +260,7 @@ iRecentUrl *findUrl_History(iHistory *d, const iString *url) {
258} 260}
259 261
260void replace_History(iHistory *d, const iString *url) { 262void replace_History(iHistory *d, const iString *url) {
263 url = canonicalUrl_String(url);
261 lock_Mutex(d->mtx); 264 lock_Mutex(d->mtx);
262 /* Update in the history. */ 265 /* Update in the history. */
263 iRecentUrl *item = mostRecentUrl_History(d); 266 iRecentUrl *item = mostRecentUrl_History(d);
@@ -267,7 +270,8 @@ void replace_History(iHistory *d, const iString *url) {
267 unlock_Mutex(d->mtx); 270 unlock_Mutex(d->mtx);
268} 271}
269 272
270void add_History(iHistory *d, const iString *url ){ 273void add_History(iHistory *d, const iString *url) {
274 url = canonicalUrl_String(url);
271 lock_Mutex(d->mtx); 275 lock_Mutex(d->mtx);
272 /* Cut the trailing history items. */ 276 /* Cut the trailing history items. */
273 if (d->recentPos > 0) { 277 if (d->recentPos > 0) {