X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fblogview_renderer.c;h=83a8359882bc309437dcb55d0fb50e9c1e2762f4;hb=7178ddb5e858af2ebff93944c2e09b671a85ceb2;hp=16a5116be578c45b2084ab17a64b926c840fe6a2;hpb=9410731556b7041aa980a0384ece2c08754f6f5d;p=citadel.git diff --git a/webcit/blogview_renderer.c b/webcit/blogview_renderer.c index 16a5116be..83a835988 100644 --- a/webcit/blogview_renderer.c +++ b/webcit/blogview_renderer.c @@ -249,10 +249,16 @@ int blogview_render(SharedMessageStatus *Stat, void **ViewSpecific, long oper) int num_blogposts = 0; int num_blogposts_alloc = 0; int with_comments = 0; + int firstp = 0; + int maxp = 0; /* Comments are shown if we are only viewing a single blog post */ if (atoi(BSTR("p"))) with_comments = 1; + firstp = atoi(BSTR("firstp")); /* start reading at... */ + maxp = atoi(BSTR("maxp")); /* max posts to show... */ + if (maxp < 1) maxp = 5; /* default; move somewhere else? */ + /* Iterate through the hash list and copy the data pointers into an array */ it = GetNewHashPos(BLOG, 0); while (GetNextHashPos(BLOG, it, &len, &Key, &Data)) { @@ -273,16 +279,21 @@ int blogview_render(SharedMessageStatus *Stat, void **ViewSpecific, long oper) * which they point are still owned by the hash list. */ if (num_blogposts > 0) { - /* Sort newest-to-oldest */ qsort(blogposts, num_blogposts, sizeof(void *), blogview_sortfunc); - /* FIXME -- allow the user to select a starting point in the list */ + /* allow the user to select a starting point in the list */ + int start_here = 0; + for (i=0; itop_level_id == firstp) { + start_here = i; + } + } /* FIXME -- allow the user (or a default setting) to select a maximum number of posts to display */ /* Now go through the list and render what we've got */ - for (i=0; i