mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-05 21:07:52 +00:00
Oops, forgot to add rss.c file.
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@866 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
85fdf4bf7e
commit
904d5c9afa
41
src/rss.c
Normal file
41
src/rss.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* rss.c
|
||||
* RSS stuff
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <mrss.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
GList*
|
||||
get_rss_info(char *uri, int count)
|
||||
{
|
||||
mrss_t *data;
|
||||
mrss_item_t *item;
|
||||
mrss_error_t ret;
|
||||
GList *titles = NULL;
|
||||
int i = 0;
|
||||
|
||||
ret = mrss_parse_url(uri, &data);
|
||||
|
||||
if (ret) {
|
||||
titles = g_list_append(titles, mrss_strerror(ret));
|
||||
return titles;
|
||||
}
|
||||
|
||||
for (item = data->item; item; item = item->next) {
|
||||
char *tmp = strdup(item->title);
|
||||
titles = g_list_append(titles, tmp);
|
||||
|
||||
if ((count > 0) && (++i > count - 1))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
mrss_free(data);
|
||||
|
||||
return titles;
|
||||
}
|
Loading…
Reference in New Issue
Block a user