-void AppendLink(StrBuf *Message,
- StrBuf *link,
- StrBuf *LinkTitle,
- const char *Title)
-{
- if (StrLength(link) > 0)
- {
- StrBufAppendBufPlain(Message, HKEY("<a href=\""), 0);
- StrBufAppendBuf(Message, link, 0);
- StrBufAppendBufPlain(Message, HKEY("\">"), 0);
- if (StrLength(LinkTitle) > 0)
- StrBufAppendBuf(Message, LinkTitle, 0);
- else if ((Title != NULL) && !IsEmptyStr(Title))
- StrBufAppendBufPlain(Message, Title, -1, 0);
- else
- StrBufAppendBuf(Message, link, 0);
- StrBufAppendBufPlain(Message, HKEY("</a><br>\n"), 0);
- }
-}
-
-
-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;
- }
-
- CM_Flush(&SaveMsg->Msg);
-
- if (SaveMsg->author_or_creator != NULL) {
-
- char *From;
- StrBuf *Encoded = NULL;
- int FromAt;
-
- From = html_to_ascii(ChrPtr(SaveMsg->author_or_creator),
- StrLength(SaveMsg->author_or_creator),
- 512, 0);
- StrBufPlain(SaveMsg->author_or_creator, From, -1);
- StrBufTrim(SaveMsg->author_or_creator);
- free(From);
-
- FromAt = strchr(ChrPtr(SaveMsg->author_or_creator), '@') != NULL;
- if (!FromAt && StrLength (SaveMsg->author_email) > 0)
- {
- StrBufRFC2047encode(&Encoded, SaveMsg->author_or_creator);
- CM_SetAsFieldSB(&SaveMsg->Msg, eAuthor, &Encoded);
- CM_SetAsFieldSB(&SaveMsg->Msg, eMessagePath, &SaveMsg->author_email);
- }
- else
- {
- if (FromAt)
- {
- CM_SetAsFieldSB(&SaveMsg->Msg, eAuthor, &SaveMsg->author_or_creator);
- CM_CopyField(&SaveMsg->Msg, eMessagePath, eAuthor);
- }
- else
- {
- StrBufRFC2047encode(&Encoded,
- SaveMsg->author_or_creator);
- CM_SetAsFieldSB(&SaveMsg->Msg, eAuthor, &Encoded);
- CM_SetField(&SaveMsg->Msg, eMessagePath, HKEY("rss@localhost"));
-
- }
- }
- }
- else {
- CM_SetField(&SaveMsg->Msg, eAuthor, HKEY("rss"));
- }
-
- CM_SetField(&SaveMsg->Msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
- if (SaveMsg->title != NULL) {
- long len;
- char *Sbj;
- StrBuf *Encoded, *QPEncoded;
-
- QPEncoded = NULL;
- StrBufSpaceToBlank(SaveMsg->title);
- len = StrLength(SaveMsg->title);
- Sbj = html_to_ascii(ChrPtr(SaveMsg->title), len, 512, 0);
- len = strlen(Sbj);
- if ((len > 0) && (Sbj[len - 1] == '\n'))
- {
- len --;
- Sbj[len] = '\0';
- }
- Encoded = NewStrBufPlain(Sbj, len);
- free(Sbj);
-
- StrBufTrim(Encoded);
- StrBufRFC2047encode(&QPEncoded, Encoded);
-
- CM_SetAsFieldSB(&SaveMsg->Msg, eMsgSubject, &QPEncoded);
- FreeStrBuf(&Encoded);