X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Frssclient%2Fserv_rssclient.c;h=e0fba5fdcd4237da1a7057717ae6f3f03d91c470;hp=e8098e91c9c56e9d19f2812cf4d21e167f69cfe2;hb=3334c6073b74551d18176701092179deb5b9ef06;hpb=53d8e6f8d1f18b0085dcfd46d1fc8640381513bc diff --git a/citadel/modules/rssclient/serv_rssclient.c b/citadel/modules/rssclient/serv_rssclient.c index e8098e91c..e0fba5fdc 100644 --- a/citadel/modules/rssclient/serv_rssclient.c +++ b/citadel/modules/rssclient/serv_rssclient.c @@ -3,7 +3,7 @@ * very loose parser that scrapes both kinds of feeds and is not picky about * the standards compliance of the source data. * - * Copyright (c) 2007-2020 by the citadel.org team + * Copyright (c) 2007-2021 by the citadel.org team * * This program is open source software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 3. @@ -66,11 +66,12 @@ struct rssurl *rsstodo = NULL; // This handler is called whenever an XML tag opens. // -void rss_start_element(void *data, const char *el, const char **attribute) -{ +void rss_start_element(void *data, const char *el, const char **attribute) { struct rssparser *r = (struct rssparser *)data; int i; + if (server_shutting_down) return; // shunt the whole operation if we're exiting + if ( (!strcasecmp(el, "entry")) || (!strcasecmp(el, "item")) @@ -104,11 +105,12 @@ void rss_start_element(void *data, const char *el, const char **attribute) // This handler is called whenever an XML tag closes. // -void rss_end_element(void *data, const char *el) -{ +void rss_end_element(void *data, const char *el) { struct rssparser *r = (struct rssparser *)data; StrBuf *encoded_field; + if (server_shutting_down) return; // shunt the whole operation if we're exiting + if (StrLength(r->CData) > 0) { // strip leading/trailing whitespace from field StrBufTrim(r->CData); } @@ -375,7 +377,7 @@ void rss_pull_feeds(void) struct rssurl *r; struct rssroom *rr; - while (rsstodo != NULL) { + while ((rsstodo != NULL) && (!server_shutting_down)) { rss_pull_one_feed(rsstodo); r = rsstodo; rsstodo = rsstodo->next; @@ -400,6 +402,8 @@ void rssclient_scan_room(struct ctdlroom *qrbuf, void *data) char cfgline[SIZ]; int i = 0; + if (server_shutting_down) return; + serialized_config = LoadRoomNetConfigFile(qrbuf->QRnumber); if (!serialized_config) { return;