+ return str;
+}
+
+int ws_update_headlines(struct feed *feed)
+{
+ struct json_object *rp, *rq, *jheadline, *j;
+ int i, n, err, hid;
+ struct headline *h, **tmp;
+
+ rq = ws_request_new("getHeadlines");
+ ws_request_add_att_int(rq, "feed_id", feed->id);
+
+ rp = ws_execute(rq);
+
+ json_object_put(rq);
+
+ if (rp) {
+ n = json_object_array_length(rp);
+ for (i = 0; i < n; i++) {
+ jheadline = json_object_array_get_idx(rp, i);
+
+ j = json_object_object_get(jheadline, "id");
+ hid = json_object_get_int(j);
+ h = feed_get_headline(feed, hid);
+
+ if (!h) {
+ h = malloc(sizeof(struct headline));
+ h->id = hid;
+ h->excerpt = NULL;
+ h->content = NULL;
+
+ tmp = (struct headline **)list_add((void **)feed->headlines, h);
+ if (feed->headlines)
+ free(feed->headlines);
+ feed->headlines = tmp;
+ }
+
+ j = json_object_object_get(jheadline, "title");
+ h->title = strdup(json_object_get_string(j));
+
+ j = json_object_object_get(jheadline, "link");
+ h->url = strdup(json_object_get_string(j));