From 92cc16119fa35f79f6e5bcf4f017a176bfbda4e1 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 18 Oct 2010 23:47:53 -0400 Subject: [PATCH] Added some comments to the code to jog my memory when I start to write the renderer. --- webcit/blogview_renderer.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/webcit/blogview_renderer.c b/webcit/blogview_renderer.c index 95e79f7dc..7e79fc7bd 100644 --- a/webcit/blogview_renderer.c +++ b/webcit/blogview_renderer.c @@ -32,9 +32,12 @@ struct blogpost { int alloc_msgs; /* Currently allocated size of array */ }; + /* * Destructor for 'struct blogpost' which does the rendering first. - * By rendering from here, we eliminate the need for a separate iterator. + * By rendering from here, we eliminate the need for a separate iterator, although + * we might run into trouble when we get around to displaying newest-to-oldest... + * FIXME do the needful with regard to gettext */ void blogpost_render_and_destroy(struct blogpost *bp) { if (bp->num_msgs > 0) wc_printf("Blog post %ld
\n", bp->msgs[0]); @@ -47,7 +50,6 @@ void blogpost_render_and_destroy(struct blogpost *bp) { } - /* * Data which gets returned from a call to blogview_learn_thread_references() */ @@ -81,7 +83,6 @@ int blogview_GetParamsGetServerCall(SharedMessageStatus *Stat, } - /* * Given a 'struct blogpost' containing a msgnum, populate the id * and refs fields by fetching them from the Citadel server @@ -114,7 +115,6 @@ struct bltr blogview_learn_thread_references(long msgnum) } - /* * This function is called for every message in the list. */ @@ -129,6 +129,13 @@ int blogview_LoadMsgFromServer(SharedMessageStatus *Stat, struct blogpost *bp = NULL; b = blogview_learn_thread_references(Msg->msgnum); + + /* FIXME an optimization here -- one we ought to perform -- is to exit this + * function immediately if the viewer is only interested in a single post and + * that message ID is neither the id nor the refs. Actually, that might *be* + * the way to display only a single message (with or without comments). + */ + if (b.refs == 0) { bp = malloc(sizeof(struct blogpost)); if (!bp) return(200); @@ -164,7 +171,6 @@ int blogview_LoadMsgFromServer(SharedMessageStatus *Stat, } - /* * Sort a list of 'struct blogpost' objects by newest-to-oldest msgnum. */ @@ -178,9 +184,6 @@ int blogview_sortfunc(const void *s1, const void *s2) { } - - - int blogview_render(SharedMessageStatus *Stat, void **ViewSpecific, long oper) { /*HashList *BLOG = (HashList *) *ViewSpecific;*/ -- 2.30.2