HashList *RSSQueueRooms = NULL; /* rss_room_counter */
HashList *RSSFetchUrls = NULL; /* -> rss_aggregator; ->RefCount access to be locked too. */
eNextState RSSAggregatorTerminate(AsyncIO *IO);
HashList *RSSQueueRooms = NULL; /* rss_room_counter */
HashList *RSSFetchUrls = NULL; /* -> rss_aggregator; ->RefCount access to be locked too. */
eNextState RSSAggregatorTerminate(AsyncIO *IO);
struct rssnetcfg *rnclist = NULL;
void AppendLink(StrBuf *Message, StrBuf *link, StrBuf *LinkTitle, const char *Title)
struct rssnetcfg *rnclist = NULL;
void AppendLink(StrBuf *Message, StrBuf *link, StrBuf *LinkTitle, const char *Title)
if (ri->description == NULL) ri->description = NewStrBufPlain(HKEY(""));
StrBufSpaceToBlank(ri->description);
msg = malloc(sizeof(struct CtdlMessage));
if (ri->description == NULL) ri->description = NewStrBufPlain(HKEY(""));
StrBufSpaceToBlank(ri->description);
msg = malloc(sizeof(struct CtdlMessage));
else
{
StrBufRFC2047encode(&Encoded, ri->author_or_creator);
msg->cm_fields['A'] = SmashStrBuf(&Encoded);
msg->cm_fields['P'] = strdup("rss@localhost");
else
{
StrBufRFC2047encode(&Encoded, ri->author_or_creator);
msg->cm_fields['A'] = SmashStrBuf(&Encoded);
msg->cm_fields['P'] = strdup("rss@localhost");
ParseURL(&IO->ConnectMe, Cfg->Url, 80);
CurlPrepareURL(IO->ConnectMe);
ParseURL(&IO->ConnectMe, Cfg->Url, 80);
CurlPrepareURL(IO->ConnectMe);
FreeStrBuf(&rncptr->rooms);
FreeStrBuf(&rncptr->CData);
FreeStrBuf(&rncptr->Key);
FreeStrBuf(&rncptr->rooms);
FreeStrBuf(&rncptr->CData);
FreeStrBuf(&rncptr->Key);
GetHashPosFromKey(RSSFetchUrls, SKEY(rncptr->Url), At);
GetHashPos(RSSFetchUrls, At, &HKLen, &HK, &vData);
DeleteEntryFromHash(RSSFetchUrls, At);
GetHashPosFromKey(RSSFetchUrls, SKEY(rncptr->Url), At);
GetHashPos(RSSFetchUrls, At, &HKLen, &HK, &vData);
DeleteEntryFromHash(RSSFetchUrls, At);
assoc_file_name(filename, sizeof filename, qrbuf, ctdl_netcfg_dir);
assoc_file_name(filename, sizeof filename, qrbuf, ctdl_netcfg_dir);
- CtdlLogPrintf(CTDL_DEBUG, "ERROR: could not stat configfile '%s' - %s\n",
- filename, strerror(errno));
+ syslog(LOG_DEBUG, "ERROR: could not stat configfile '%s' - %s\n",
+ filename, strerror(errno));
if (StrBufReadBLOB(CfgData, &fd, 1, statbuf.st_size, &Err) < 0) {
close(fd);
FreeStrBuf(&CfgData);
if (StrBufReadBLOB(CfgData, &fd, 1, statbuf.st_size, &Err) < 0) {
close(fd);
FreeStrBuf(&CfgData);
{
lPtr = NULL;
StrBufExtract_NextToken(CfgType, Line, &lPtr, '|');
{
lPtr = NULL;
StrBufExtract_NextToken(CfgType, Line, &lPtr, '|');
rncptr->Url = NewStrBuf();
StrBufExtract_NextToken(rncptr->Url, Line, &lPtr, '|');
rncptr->Url = NewStrBuf();
StrBufExtract_NextToken(rncptr->Url, Line, &lPtr, '|');
GetHash(RSSFetchUrls, SKEY(rncptr->Url), &vptr);
use_this_rncptr = (rss_aggregator *)vptr;
if (use_this_rncptr != NULL)
GetHash(RSSFetchUrls, SKEY(rncptr->Url), &vptr);
use_this_rncptr = (rss_aggregator *)vptr;
if (use_this_rncptr != NULL)
Put(use_this_rncptr->OtherQRnumbers, LKEY(qrbuf->QRnumber), QRnumber, NULL);
use_this_rncptr->roomlist_parts++;
}
Put(use_this_rncptr->OtherQRnumbers, LKEY(qrbuf->QRnumber), QRnumber, NULL);
use_this_rncptr->roomlist_parts++;
}
rncptr->ItemType = RSS_UNSET;
rncptr->rooms = NewStrBufPlain(qrbuf->QRname, -1);
rncptr->ItemType = RSS_UNSET;
rncptr->rooms = NewStrBufPlain(qrbuf->QRname, -1);
Put(RSSFetchUrls, SKEY(rncptr->Url), rncptr, DeleteRssCfg);
Put(RSSFetchUrls, SKEY(rncptr->Url), rncptr, DeleteRssCfg);
- citthread_mutex_lock(&RSSQueueMutex);
- CtdlLogPrintf(CTDL_DEBUG, "rssclient: [%ld] %s now starting.\n",
+ pthread_mutex_lock(&RSSQueueMutex);
+ syslog(LOG_DEBUG, "rssclient: [%ld] %s now starting.\n",
qrbuf->QRnumber, qrbuf->QRname);
Put(RSSQueueRooms, LKEY(qrbuf->QRnumber), Count, NULL);
qrbuf->QRnumber, qrbuf->QRname);
Put(RSSQueueRooms, LKEY(qrbuf->QRnumber), Count, NULL);
/*
* This is a simple concurrency check to make sure only one rssclient run
* is done at a time. We could do this with a mutex, but since we
/*
* This is a simple concurrency check to make sure only one rssclient run
* is done at a time. We could do this with a mutex, but since we
- it = GetNewHashPos(RSSQueueRooms, 0);
- while (GetNextHashPos(RSSFetchUrls, it, &len, &Key, &vrptr) &&
+ it = GetNewHashPos(RSSFetchUrls, 0);
+ while (!server_shutting_down &&
+ GetNextHashPos(RSSFetchUrls, it, &len, &Key, &vrptr) &&
- citthread_mutex_init(&RSSQueueMutex, NULL);
+ CtdlFillSystemContext(&rss_CC, "rssclient");
+ pthread_mutex_init(&RSSQueueMutex, NULL);
RSSQueueRooms = NewHash(1, lFlathash);
RSSFetchUrls = NewHash(1, NULL);
RSSQueueRooms = NewHash(1, lFlathash);
RSSFetchUrls = NewHash(1, NULL);
CtdlRegisterSessionHook(rssclient_scan, EVT_TIMER);
CtdlRegisterCleanupHook(rss_cleanup);
}
CtdlRegisterSessionHook(rssclient_scan, EVT_TIMER);
CtdlRegisterCleanupHook(rss_cleanup);
}