}
-void rss_format_item(networker_save_message *SaveMsg)
+int rss_format_item(AsyncIO *IO, networker_save_message *SaveMsg)
{
StrBuf *Message;
int msglen = 0;
+ if (StrLength(SaveMsg->description) +
+ StrLength(SaveMsg->link) +
+ StrLength(SaveMsg->linkTitle) +
+ StrLength(SaveMsg->reLink) +
+ StrLength(SaveMsg->reLinkTitle) +
+ StrLength(SaveMsg->title) == 0)
+ {
+ EVRSSCM_syslog(LOG_INFO, "Refusing to save empty message.");
+ return 0;
+ }
+
if (SaveMsg->author_or_creator != NULL) {
char *From;
AppendLink(Message, SaveMsg->reLink, SaveMsg->reLinkTitle, "Reply to this");
StrBufAppendBufPlain(Message, HKEY("</body></html>\n"), 0);
-
SaveMsg->Message = Message;
+ return 1;
}
eNextState RSSSaveMessage(AsyncIO *IO)
const char *Key;
rss_aggregator *RSSAggr = (rss_aggregator *) IO->Data;
- rss_format_item(RSSAggr->ThisMsg);
-
- RSSAggr->ThisMsg->Msg.cm_fields['M'] =
- SmashStrBuf(&RSSAggr->ThisMsg->Message);
-
- CtdlSubmitMsg(&RSSAggr->ThisMsg->Msg, &RSSAggr->recp, NULL, 0);
-
- /* write the uidl to the use table so we don't store this item again */
+ if (rss_format_item(IO, RSSAggr->ThisMsg))
+ {
+ RSSAggr->ThisMsg->Msg.cm_fields['M'] =
+ SmashStrBuf(&RSSAggr->ThisMsg->Message);
- CheckIfAlreadySeen("RSS Item Insert", RSSAggr->ThisMsg->MsgGUID, IO->Now, 0, eWrite, IO->ID, CCID);
+ CtdlSubmitMsg(&RSSAggr->ThisMsg->Msg, &RSSAggr->recp, NULL, 0);
+
+ /* write the uidl to the use table so we don't store this item again */
+
+ CheckIfAlreadySeen("RSS Item Insert", RSSAggr->ThisMsg->MsgGUID, IO->Now, 0, eWrite, CCID, IO->ID);
+ }
if (GetNextHashPos(RSSAggr->Messages,
RSSAggr->Pos,
IO->Now,
IO->Now - USETABLE_ANTIEXPIRE_HIRES,
eCheckUpdate,
- IO->ID, CCID)
+ CCID, IO->ID)
!= 0)
{
/* Item has already been seen */
strs[1] = ChrPtr(Ctx->rooms);
lens[1] = StrLength(Ctx->rooms);
+
+ if (IO->HttpReq.CurlError == NULL)
+ IO->HttpReq.CurlError = "";
+
StrBufPrintf(ErrMsg,
"Error while RSS-Aggregation Run of %s\n"
" need a 200, got a %ld !\n"
+ " Curl Error message: \n%s / %s\n"
" Response text was: \n"
" \n %s\n",
ChrPtr(Ctx->Url),
IO->HttpReq.httpcode,
- ChrPtr(IO->HttpReq.ReplyData));
+ IO->HttpReq.errdesc,
+ IO->HttpReq.CurlError,
+ ChrPtr(IO->HttpReq.ReplyData)
+ );
+
CtdlAideFPMessage(
ChrPtr(ErrMsg),
"RSS Aggregation run failure",
IO->Now,
IO->Now - USETABLE_ANTIEXPIRE,
eCheckUpdate,
- IO->ID, CCID)
+ CCID, IO->ID)
!= 0)
{
FreeStrBuf(&guid);
eNextState RSSAggregator_FinishHttp(AsyncIO *IO)
{
- StopCurlWatchers(IO);
return CurlQueueDBOperation(IO, RSSAggregator_AnalyseReply);
}