]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/rssclient/serv_rssclient.c
Re-Sort Cleanup of event io on shutdown
[citadel.git] / citadel / modules / rssclient / serv_rssclient.c
index c6f065fa9ca7497a1a38c79a13edc57a3b736397..8a3ba63549a5aadacfa2bfd88d0cc25138541a01 100644 (file)
@@ -1,20 +1,20 @@
 /*
  * Bring external RSS feeds into rooms.
  *
- * Copyright (c) 2007-2010 by the citadel.org team
+ * Copyright (c) 2007-2012 by the citadel.org team
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * 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.
+ * 
+ * 
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * 
+ * 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
  */
 
@@ -408,6 +408,7 @@ void rssclient_scan_room(struct ctdlroom *qrbuf, void *data)
                                        sizeof(rss_aggregator));
 
                                memset (RSSAggr, 0, sizeof(rss_aggregator));
+                               RSSAggr->QRnumber = qrbuf->QRnumber;
                                RSSAggr->roomlist_parts = 1;
                                RSSAggr->Url = NewStrBuf();
 
@@ -485,15 +486,15 @@ void rssclient_scan_room(struct ctdlroom *qrbuf, void *data)
  * Scan for rooms that have RSS client requests configured
  */
 void rssclient_scan(void) {
-       static int doing_rssclient = 0;
        rss_aggregator *rptr = NULL;
        void *vrptr = NULL;
        HashPos *it;
        long len;
        const char *Key;
+       time_t now = time(NULL);
 
        /* Run no more than once every 15 minutes. */
-       if ((time(NULL) - last_run) < 900) {
+       if ((now - last_run) < 900) {
                return;
        }
 
@@ -503,8 +504,7 @@ void rssclient_scan(void) {
         * don't really require extremely fine granularity here, we'll do it
         * with a static variable instead.
         */
-       if (doing_rssclient) return;
-       doing_rssclient = 1;
+
        if ((GetCount(RSSQueueRooms) > 0) || (GetCount(RSSFetchUrls) > 0))
                return;
 
@@ -526,7 +526,6 @@ void rssclient_scan(void) {
        pthread_mutex_unlock(&RSSQueueMutex);
 
        syslog(LOG_DEBUG, "rssclient ended\n");
-       doing_rssclient = 0;
        return;
 }
 
@@ -548,7 +547,7 @@ CTDL_MODULE_INIT(rssclient)
                RSSFetchUrls = NewHash(1, NULL);
                syslog(LOG_INFO, "%s\n", curl_version());
                CtdlRegisterSessionHook(rssclient_scan, EVT_TIMER);
-               CtdlRegisterCleanupHook(rss_cleanup);
+               CtdlRegisterEVCleanupHook(rss_cleanup);
        }
        return "rssclient";
 }