X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsitemap.c;h=cab60d43ec01307ceef379db619a34fe0a22c485;hb=4b4dc864ede7c5d8d956febe4a0afb422b78e7c4;hp=fd94266beb64116bc293b4c641c6a8014fad25e4;hpb=759cb440bb037096f28d8d94d5c20e13ad22064c;p=citadel.git diff --git a/webcit/sitemap.c b/webcit/sitemap.c index fd94266be..cab60d43e 100644 --- a/webcit/sitemap.c +++ b/webcit/sitemap.c @@ -36,7 +36,7 @@ void sitemap_do_bbs(void) { Stat.maxload = INT_MAX; Stat.lowest_found = (-1); Stat.highest_found = (-1); - num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL); + num_msgs = load_msg_ptrs("MSGS ALL", NULL, &Stat, NULL); if (num_msgs < 1) return; for (i=0; isumm); + if (Msg != NULL) { + struct bltr bltr = blogview_learn_thread_references(Msg->msgnum); + /* Show only top level posts, not comments */ + if ((bltr.id != 0) && (bltr.refs == 0)) { + WC->bptlid = bltr.id; + wc_printf("%s", ChrPtr(site_prefix)); + tmplput_blog_permalink(NULL, NULL); + wc_printf("\r\n"); + } + } + } +} + + /* * XML sitemap generator -- go through the message list for a wiki room - * (this might work for blogs too; we'll see) */ void sitemap_do_wiki(void) { wcsession *WCC = WC; @@ -68,7 +100,7 @@ void sitemap_do_wiki(void) { Stat.maxload = INT_MAX; Stat.lowest_found = (-1); Stat.highest_found = (-1); - num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL); + num_msgs = load_msg_ptrs("MSGS ALL", NULL, &Stat, NULL); if (num_msgs < 1) return; for (i=0; iroomname = NewStrBufPlain(roomname_plain, -1); + ptr->defview = extract_int(buf, 6); + ptr->next = roomlist; + roomlist = ptr; + } + + return(roomlist); +} + + /* * Entry point for RSS feed generator */ void sitemap(void) { - + struct sitemap_room_list *roomlist = NULL; output_headers(0, 0, 0, 0, 1, 0); hprintf("Content-type: text/xml\r\n"); hprintf( @@ -111,31 +173,32 @@ void sitemap(void) { wc_printf("\r\n"); wc_printf("\r\n"); - HashList *roomlist = GetRoomListHashLKRA(NULL, NULL); - HashPos *it = GetNewHashPos(roomlist, 0); - long HKlen; - const char *HashKey; - folder *room; + roomlist = sitemap_load_roomlist(); - while (GetNextHashPos(roomlist, it, &HKlen, &HashKey, (void *)&room)) + while (roomlist != NULL) { + gotoroom(roomlist->roomname); + /* Output the messages in this room only if it's a room type we can make sense of */ - switch(room->defview) { - case VIEW_BBS: - gotoroom(room->name); - sitemap_do_bbs(); - break; - case VIEW_WIKI: - gotoroom(room->name); - sitemap_do_wiki(); - break; - default: - break; + switch(roomlist->defview) { + case VIEW_BBS: + sitemap_do_bbs(); + break; + case VIEW_WIKI: + sitemap_do_wiki(); + break; + case VIEW_BLOG: + sitemap_do_blog(); + break; + default: + break; } - } - DeleteHashPos(&it); - /* DeleteHash(&roomlist); This will be freed when the session closes */ + struct sitemap_room_list *ptr = roomlist; + roomlist = roomlist->next; + FreeStrBuf(&ptr->roomname); + free(ptr); + } wc_printf("\r\n"); wDumpContent(0);