~ubuntu-branches/ubuntu/vivid/liferea/vivid-proposed

« back to all changes in this revision

Viewing changes to src/parsers/rss_item.c

  • Committer: Package Import Robot
  • Author(s): bojo42
  • Date: 2012-03-29 14:17:21 UTC
  • mfrom: (1.3.9) (3.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20120329141721-tbfopcrc5797wxt7
Tags: 1.8.3-0.1ubuntu1
* New upstream release (LP: #290666, #371754, #741543, #716688)
* Merge from Debian unstable (LP: #935147), remaining changes:
* debian/patches:
  - drop gtk-status-icon.patch & notification-append as in upstream
  - drop fix_systray_behavior as mostly upstreamed and rest seems unused
  - 01_ubuntu_feedlists: update & rename, move planets to "Open Source"  
  - add_X-Ubuntu-Gettext-Domain: rebase
  - libunity.patch: rebase, apply before indicator patch (liferea_shell.c)
  - libindicate_increase_version.patch: exclude from libindicate.patch
  - deactivate libindicate.patch, seems partly upstreamed and needs rework
* debian/control: libindicate-dev, libindicate-gtk-dev & libunity-dev
* debian/liferea.indicate & liferea.install: ship indicator desktop file
* debian/rules: enable libindicate

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
2
 * @file rss_item.c  RSS/RDF item parsing 
3
3
 *
4
 
 * Copyright (C) 2003-2008 Lars Lindner <lars.lindner@gmail.com>
 
4
 * Copyright (C) 2003-2010 Lars Lindner <lars.lindner@gmail.com>
5
5
 *
6
6
 * This program is free software; you can redistribute it and/or modify
7
7
 * it under the terms of the GNU General Public License as published by
18
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
19
 */
20
20
 
 
21
#include "rss_item.h"
 
22
 
21
23
#include <string.h>
22
24
 
23
25
#include "common.h"
 
26
#include "date.h"
24
27
#include "enclosure.h"
25
 
#include "rss_item.h"
26
28
#include "metadata.h"
27
29
#include "xml.h"
28
30
 
79
81
                /* check for metadata tags */
80
82
                tmp2 = g_hash_table_lookup(RssToMetadataMapping, cur->name);
81
83
                if (tmp2) {
82
 
                        tmp3 = common_utf8_fix((gchar *)xmlNodeListGetString(ctxt->doc, cur->xmlChildrenNode, TRUE));
 
84
                        tmp3 = (gchar *)xmlNodeListGetString(ctxt->doc, cur->xmlChildrenNode, TRUE);
83
85
                        if (tmp3) {
84
86
                                ctxt->item->metadata = metadata_list_append(ctxt->item->metadata, tmp2, tmp3);
85
87
                                g_free(tmp3);
87
89
                }
88
90
                /* check for specific tags */
89
91
                else if(!xmlStrcmp(cur->name, BAD_CAST"pubDate")) {
90
 
                        tmp = common_utf8_fix((gchar *)xmlNodeListGetString(ctxt->doc, cur->xmlChildrenNode, 1));
 
92
                        tmp = (gchar *)xmlNodeListGetString(ctxt->doc, cur->xmlChildrenNode, 1);
91
93
                        if (tmp) {
92
 
                                ctxt->item->time = parseRFC822Date(tmp);
 
94
                                ctxt->item->time = date_parse_RFC822 (tmp);
93
95
                                g_free(tmp);
94
96
                        }
95
97
                } 
97
99
                        /* RSS 0.93 allows multiple enclosures */
98
100
                        tmp = xml_get_attribute (cur, "url");
99
101
                        if (tmp) {
 
102
                                const gchar *feedURL = subscription_get_homepage (ctxt->subscription);
 
103
                                
100
104
                                gchar *type = xml_get_attribute (cur, "type");
101
105
                                gchar *lengthStr = xml_get_attribute (cur, "length");
102
106
                                gchar *enclStr = NULL;
104
108
                                if (lengthStr)
105
109
                                        length = atol (lengthStr);
106
110
                                
107
 
                                if((strstr(tmp, "://") == NULL) &&
108
 
                                   (ctxt->feed->htmlUrl != NULL) &&
109
 
                                   (ctxt->feed->htmlUrl[0] != '|') &&
110
 
                                   (strstr(ctxt->feed->htmlUrl, "://") != NULL)) {
 
111
                                if((strstr(tmp, "://") == NULL) && feedURL && (feedURL[0] != '|') &&
 
112
                                   (strstr(feedURL, "://") != NULL)) {
111
113
                                        /* add base URL if necessary and possible */
112
 
                                         tmp2 = g_strdup_printf("%s/%s", ctxt->feed->htmlUrl, tmp);
 
114
                                         tmp2 = g_strdup_printf("%s/%s", feedURL, tmp);
113
115
                                         g_free(tmp);
114
116
                                         tmp = tmp2;
115
117
                                }
156
158
                        }
157
159
                }
158
160
                else if(!xmlStrcmp(cur->name, BAD_CAST"description")) {
159
 
                        tmp = common_utf8_fix(xhtml_extract (cur, 0, NULL));
 
161
                        tmp = xhtml_extract (cur, 0, NULL);
160
162
                        if (tmp) {
161
163
                                /* don't overwrite content:encoded descriptions... */
162
164
                                if(!item_get_description(ctxt->item))