if (already_seen == 0) {
// Compose the message text
+ // FIXME ajc 2023jan06 - this can create lines longer than 1024 characters which chokes the client message parsers
StrBuf *TheMessage = NewStrBuf();
StrBufAppendPrintf(TheMessage,
"Content-type: text/html\n\n"
"\n\n"
"<html><head></head><body>"
);
-
+
if (r->description != NULL) {
StrBufAppendPrintf(TheMessage, "%s<br><br>\r\n", r->description);
free(r->description);
r->description = NULL;
}
-
+
if (r->link != NULL) {
StrBufAppendPrintf(TheMessage, "<a href=\"%s\">%s</a>\r\n", r->link, r->link);
free(r->link);
r->link = NULL;
}
-
+
StrBufAppendPrintf(TheMessage, "</body></html>\r\n");
CM_SetField(r->msg, eMesageText, ChrPtr(TheMessage), StrLength(TheMessage));
FreeStrBuf(&TheMessage);
-
+
if (CM_IsEmpty(r->msg, eAuthor)) {
CM_SetField(r->msg, eAuthor, HKEY("rss"));
}
-
+
if (CM_IsEmpty(r->msg, eTimestamp)) {
CM_SetFieldLONG(r->msg, eTimestamp, time(NULL));
}
-
+
// Save it to the room(s)
struct rssroom *rr = NULL;
long msgnum = (-1);
else {
syslog(LOG_DEBUG, "rssclient: already seen %s", r->item_id);
}
-
+
CM_Free(r->msg);
r->msg = NULL;
}
-// Copyright (c) 1987-2022 by the citadel.org team
+// Copyright (c) 1987-2023 by the citadel.org team
//
// This program is open source software. Use, duplication, or disclosure
// is subject to the terms of the GNU General Public License, version 3.
#ifdef HAVE_ZLIB
#include <zlib.h>
-int ZEXPORT compress_gzip(Bytef * dest, size_t * destLen,
- const Bytef * source, uLong sourceLen, int level);
+int ZEXPORT compress_gzip(Bytef * dest, size_t * destLen, const Bytef * source, uLong sourceLen, int level);
#endif
int BaseStrBufSize = 64;
int EnableSplice = 0;
return (*target)->BufUsed;;
}
-/**
- * Quoted-Printable encode a message; make it < 80 columns width.
- * source Source string to be encoded.
- * @returns buffer with encoded message.
- */
-StrBuf *StrBufRFC2047encodeMessage(const StrBuf *EncodeMe)
-{
+// Quoted-Printable encode a message; make it < 80 columns width.
+// source Source string to be encoded.
+// returns buffer with encoded message.
+StrBuf *StrBufQuotedPrintableEncode(const StrBuf *EncodeMe) {
StrBuf *OutBuf;
char *Optr, *OEptr;
const char *ptr, *eptr;
eptr = EncodeMe->buf + EncodeMe->BufUsed;
LinePos = 0;
- while (ptr < eptr)
- {
- if (Optr + 4 >= OEptr)
- {
+ while (ptr < eptr) {
+ if (Optr + 4 >= OEptr) {
long Offset;
Offset = Optr - OutBuf->buf;
OutBuf->BufUsed = Optr - OutBuf->buf;
Optr = OutBuf->buf + Offset;
OEptr = OutBuf->buf + OutBuf->BufSize;
}
- if (*ptr == '\r')
- {
- /* ignore carriage returns */
+ if (*ptr == '\r') { // ignore carriage returns
ptr ++;
}
- else if (*ptr == '\n') {
- /* hard line break */
+ else if (*ptr == '\n') { // hard line break
memcpy(Optr, HKEY("=0A"));
Optr += 3;
LinePos += 3;
ptr ++;
}
- else if (( (*ptr >= 32) && (*ptr <= 60) ) ||
- ( (*ptr >= 62) && (*ptr <= 126) ))
- {
+ else if (( (*ptr >= 32) && (*ptr <= 60) ) || ( (*ptr >= 62) && (*ptr <= 126) )) {
*Optr = *ptr;
Optr ++;
ptr ++;
ptr ++;
}
- if (LinePos > 72) {
- /* soft line break */
+ if (LinePos > 72) { // soft line break
if (isspace(*(Optr - 1))) {
ch = *(Optr - 1);
Optr --;
}
-static void AddRecipient(StrBuf *Target,
- StrBuf *UserName,
- StrBuf *EmailAddress,
- StrBuf *EncBuf)
-{
+static void AddRecipient(StrBuf *Target, StrBuf *UserName, StrBuf *EmailAddress, StrBuf *EncBuf) {
int QuoteMe = 0;
if (StrLength(Target) > 0) StrBufAppendBufPlain(Target, HKEY(", "), 0);
* \param EncBuf Temporary buffer for internal use; Please provide valid buffer.
* \returns encoded & sanitized buffer with the contents of Recp; Caller owns this memory.
*/
-StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp,
- StrBuf *UserName,
- StrBuf *EmailAddress,
- StrBuf *EncBuf)
-{
+StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp, StrBuf *UserName, StrBuf *EmailAddress, StrBuf *EncBuf) {
StrBuf *Target;
const char *pch, *pche;
const char *UserStart, *UserEnd, *EmailStart, *EmailEnd, *At;
* search character to search
* replace character to replace search by
*/
-void StrBufReplaceChars(StrBuf *buf, char search, char replace)
-{
+void StrBufReplaceChars(StrBuf *buf, char search, char replace) {
long i;
if (buf == NULL)
return;