- /* Add the room name to the request */
- if (use_this_rncptr != NULL) {
- if (use_this_rncptr->rooms == NULL) {
- rncptr->rooms = strdup(qrbuf->QRname);
- }
- else {
- len = strlen(use_this_rncptr->rooms) + strlen(qrbuf->QRname) + 5;
- ptr = realloc(use_this_rncptr->rooms, len);
- if (ptr != NULL) {
- strcat(ptr, "|");
- strcat(ptr, qrbuf->QRname);
- use_this_rncptr->rooms = ptr;
- }
- }
- }
+ 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, '|');
+
+ pthread_mutex_lock(&RSSQueueMutex);
+ GetHash(RSSFetchUrls, SKEY(rncptr->Url), &vptr);
+ use_this_rncptr = (rss_aggregator *)vptr;
+ if (use_this_rncptr != NULL)
+ {
+ 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++;
+
+ pthread_mutex_unlock(&RSSQueueMutex);
+
+ FreeStrBuf(&rncptr->Url);
+ free(rncptr);
+ rncptr = NULL;
+ continue;
+ }
+ pthread_mutex_unlock(&RSSQueueMutex);
+
+ rncptr->ItemType = RSS_UNSET;
+
+ rncptr->rooms = NewStrBufPlain(qrbuf->QRname, -1);
+
+ pthread_mutex_lock(&RSSQueueMutex);
+ Put(RSSFetchUrls, SKEY(rncptr->Url), rncptr, DeleteRssCfg);
+ pthread_mutex_unlock(&RSSQueueMutex);