X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fttrss_model.c;h=93c94093630e0f9f240b1d4cfc80defe8e7da07d;hb=b227ac2417bd40dfab2cb376422760d7eddfc95c;hp=2c80c9e73588a377082d8301e0ef5725eb52f732;hpb=4e8c884a282bcf16f486d06164ee187faa8a2610;p=prss.git diff --git a/src/ttrss_model.c b/src/ttrss_model.c index 2c80c9e..93c9409 100644 --- a/src/ttrss_model.c +++ b/src/ttrss_model.c @@ -18,6 +18,7 @@ */ #include +#include #include #include "ttrss_model.h" @@ -161,3 +162,38 @@ void feeds_free(struct feed **feeds) free(feeds); } } + +struct feed *feeds_get_feed(struct feed **feeds, int id) +{ + struct feed **cur; + + printf("%p\n", feeds); + + if (feeds) + for (cur = feeds; *cur; cur++) + if ((*cur)->id == id) { + printf("match!\n"); + return *cur; + } + + return NULL; +} + +struct headline *feeds_get_headline(struct feed **feeds, int id) +{ + struct headline *h; + + if (!feeds) + return NULL; + + while (*feeds) { + h = feed_get_headline(*feeds, id); + + if (h) + return h; + + feeds++; + } + + return NULL; +}