- if (CtdlThreadCheckStop())
- return;
- if (fstat(fd, &statbuf) == -1) {
- syslog(LOG_DEBUG, "ERROR: could not stat configfile '%s' - %s\n",
- filename, strerror(errno));
- return;
- }
- if (CtdlThreadCheckStop())
- return;
- CfgData = NewStrBufPlain(NULL, statbuf.st_size + 1);
- if (StrBufReadBLOB(CfgData, &fd, 1, statbuf.st_size, &Err) < 0) {
- close(fd);
- FreeStrBuf(&CfgData);
- syslog(LOG_DEBUG, "ERROR: reading config '%s' - %s<br>\n",
- filename, strerror(errno));
- return;
- }
- close(fd);
- if (CtdlThreadCheckStop())
- return;
-
- CfgPtr = NULL;
- CfgType = NewStrBuf();
- Line = NewStrBufPlain(NULL, StrLength(CfgData));
- Done = 0;
- while (!Done)
- {
- Done = StrBufSipLine(Line, CfgData, &CfgPtr) == 0;
- if (StrLength(Line) > 0)
- {
- lPtr = NULL;
- StrBufExtract_NextToken(CfgType, Line, &lPtr, '|');
- if (!strcasecmp("rssclient", ChrPtr(CfgType)))
- {
- if (Count == NULL)
- {
- Count = malloc(sizeof(rss_room_counter));
- Count->count = 0;
- }
- Count->count ++;
- rncptr = (rss_aggregator *) malloc(sizeof(rss_aggregator));
- memset (rncptr, 0, sizeof(rss_aggregator));
- rncptr->roomlist_parts = 1;
- rncptr->Url = NewStrBuf();
- StrBufExtract_NextToken(rncptr->Url, Line, &lPtr, '|');
-
- citthread_mutex_lock(&RSSQueueMutex);
- GetHash(RSSFetchUrls, SKEY(rncptr->Url), &vptr);
- use_this_rncptr = (rss_aggregator *)vptr;
- if (use_this_rncptr != NULL)
- {
- /* mustn't attach to an active session */
- if (use_this_rncptr->RefCount > 0)
- {
- DeleteRssCfg(rncptr);
- Count->count--;
- }
- else
- {
- long *QRnumber;
- StrBufAppendBufPlain(use_this_rncptr->rooms,
- qrbuf->QRname,
- -1, 0);
- if (use_this_rncptr->roomlist_parts == 1)
- {
- use_this_rncptr->OtherQRnumbers = NewHash(1, lFlathash);
- }
- QRnumber = (long*)malloc(sizeof(long));
- *QRnumber = qrbuf->QRnumber;
- Put(use_this_rncptr->OtherQRnumbers, LKEY(qrbuf->QRnumber), QRnumber, NULL);
- use_this_rncptr->roomlist_parts++;
- }
- citthread_mutex_unlock(&RSSQueueMutex);
- continue;
- }
- citthread_mutex_unlock(&RSSQueueMutex);
-
- rncptr->ItemType = RSS_UNSET;
-
- rncptr->rooms = NewStrBufPlain(qrbuf->QRname, -1);
-
- citthread_mutex_lock(&RSSQueueMutex);
- Put(RSSFetchUrls, SKEY(rncptr->Url), rncptr, DeleteRssCfg);
- citthread_mutex_unlock(&RSSQueueMutex);
+
+ num_configs = num_tokens(serialized_config, '\n');
+ for (i=0; i<num_configs; ++i) {
+ extract_token(cfgline, serialized_config, i, '\n', sizeof cfgline);
+ if (!strncasecmp(cfgline, HKEY("rssclient|"))) {
+ strcpy(cfgline, &cfgline[10]);
+ char *vbar = strchr(cfgline, '|');
+ if (vbar != NULL) {
+ *vbar = 0;
+ }
+ rssclient_push_todo(cfgline, qrbuf->QRname);