projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2c960cf
)
Rename StrBufRFC2047encodeMessage() to StrBufQuotedPrintableEncode()
author
Art Cancro
<ajc@citadel.org>
Fri, 6 Jan 2023 18:44:32 +0000
(13:44 -0500)
committer
Art Cancro
<ajc@citadel.org>
Fri, 6 Jan 2023 18:44:32 +0000
(13:44 -0500)
citadel/server/modules/instmsg/serv_instmsg.c
patch
|
blob
|
history
citadel/server/modules/rssclient/serv_rssclient.c
patch
|
blob
|
history
libcitadel/lib/libcitadel.h
patch
|
blob
|
history
libcitadel/lib/stringbuf.c
patch
|
blob
|
history
webcit/serv_func.c
patch
|
blob
|
history
diff --git
a/citadel/server/modules/instmsg/serv_instmsg.c
b/citadel/server/modules/instmsg/serv_instmsg.c
index 978efef6dade7ff7a6cd37e1b6e984ac3f93dab0..6726e2355461742aad35fca1ff58057f736ec2db 100644
(file)
--- a/
citadel/server/modules/instmsg/serv_instmsg.c
+++ b/
citadel/server/modules/instmsg/serv_instmsg.c
@@
-428,7
+428,7
@@
void flush_individual_conversation(struct imlog *im) {
), 0
);
), 0
);
- MsgBuf = StrBuf
RFC2047encodeMessag
e(im->conversation);
+ MsgBuf = StrBuf
QuotedPrintableEncod
e(im->conversation);
FlushStrBuf(im->conversation);
FullMsgBuf = NewStrBufPlain(NULL, StrLength(im->conversation) + 100);
FlushStrBuf(im->conversation);
FullMsgBuf = NewStrBufPlain(NULL, StrLength(im->conversation) + 100);
diff --git
a/citadel/server/modules/rssclient/serv_rssclient.c
b/citadel/server/modules/rssclient/serv_rssclient.c
index 66d0d13a056c20cb5ebf341c5cc7bfbc74c7e580..4f4db62fc07875fc0b9103cbd242a4aeb2780208 100644
(file)
--- a/
citadel/server/modules/rssclient/serv_rssclient.c
+++ b/
citadel/server/modules/rssclient/serv_rssclient.c
@@
-126,37
+126,38
@@
void rss_end_element(void *data, const char *el) {
if (already_seen == 0) {
// Compose the message text
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>"
);
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->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;
}
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);
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, eAuthor)) {
CM_SetField(r->msg, eAuthor, HKEY("rss"));
}
-
+
if (CM_IsEmpty(r->msg, eTimestamp)) {
CM_SetFieldLONG(r->msg, eTimestamp, time(NULL));
}
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);
// Save it to the room(s)
struct rssroom *rr = NULL;
long msgnum = (-1);
@@
-173,7
+174,7
@@
void rss_end_element(void *data, const char *el) {
else {
syslog(LOG_DEBUG, "rssclient: already seen %s", r->item_id);
}
else {
syslog(LOG_DEBUG, "rssclient: already seen %s", r->item_id);
}
-
+
CM_Free(r->msg);
r->msg = NULL;
}
CM_Free(r->msg);
r->msg = NULL;
}
diff --git
a/libcitadel/lib/libcitadel.h
b/libcitadel/lib/libcitadel.h
index f309aa59319414a9ccc6aa3cf5c4e24e91b3dd08..cb59c485c971b0a14edd2a6fc4e1824dc7f2f764 100644
(file)
--- a/
libcitadel/lib/libcitadel.h
+++ b/
libcitadel/lib/libcitadel.h
@@
-320,7
+320,7
@@
int StrBufDecodeBase64(StrBuf *Buf);
void StrBufDecodeQP(StrBuf *Buf);
int StrBufDecodeBase64To(const StrBuf *BufIn, StrBuf *BufOut);
int StrBufDecodeHex(StrBuf *Buf);
void StrBufDecodeQP(StrBuf *Buf);
int StrBufDecodeBase64To(const StrBuf *BufIn, StrBuf *BufOut);
int StrBufDecodeHex(StrBuf *Buf);
-StrBuf *StrBuf
RFC2047encodeMessag
e(const StrBuf *EncodeMe);
+StrBuf *StrBuf
QuotedPrintableEncod
e(const StrBuf *EncodeMe);
int StrBufRFC2047encode(StrBuf **target, const StrBuf *source);
StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp,
StrBuf *UserName,
int StrBufRFC2047encode(StrBuf **target, const StrBuf *source);
StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp,
StrBuf *UserName,
diff --git
a/libcitadel/lib/stringbuf.c
b/libcitadel/lib/stringbuf.c
index e4824cf369fd5d64ac8dfd8bf253c2b5cd0ad531..d31c227c53059edb6e74c4958b5c1b6d7e459a1e 100644
(file)
--- a/
libcitadel/lib/stringbuf.c
+++ b/
libcitadel/lib/stringbuf.c
@@
-1,4
+1,4
@@
-// Copyright (c) 1987-202
2
by the citadel.org team
+// Copyright (c) 1987-202
3
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.
//
// This program is open source software. Use, duplication, or disclosure
// is subject to the terms of the GNU General Public License, version 3.
@@
-33,8
+33,7
@@
#ifdef HAVE_ZLIB
#include <zlib.h>
#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;
#endif
int BaseStrBufSize = 64;
int EnableSplice = 0;
@@
-3097,13
+3096,10
@@
int StrBufRFC2047encode(StrBuf **target, const StrBuf *source)
return (*target)->BufUsed;;
}
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;
StrBuf *OutBuf;
char *Optr, *OEptr;
const char *ptr, *eptr;
@@
-3117,10
+3113,8
@@
StrBuf *StrBufRFC2047encodeMessage(const StrBuf *EncodeMe)
eptr = EncodeMe->buf + EncodeMe->BufUsed;
LinePos = 0;
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;
long Offset;
Offset = Optr - OutBuf->buf;
OutBuf->BufUsed = Optr - OutBuf->buf;
@@
-3128,21
+3122,16
@@
StrBuf *StrBufRFC2047encodeMessage(const StrBuf *EncodeMe)
Optr = OutBuf->buf + Offset;
OEptr = OutBuf->buf + OutBuf->BufSize;
}
Optr = OutBuf->buf + Offset;
OEptr = OutBuf->buf + OutBuf->BufSize;
}
- if (*ptr == '\r')
- {
- /* ignore carriage returns */
+ if (*ptr == '\r') { // ignore carriage returns
ptr ++;
}
ptr ++;
}
- else if (*ptr == '\n') {
- /* hard line break */
+ else if (*ptr == '\n') { // hard line break
memcpy(Optr, HKEY("=0A"));
Optr += 3;
LinePos += 3;
ptr ++;
}
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 ++;
*Optr = *ptr;
Optr ++;
ptr ++;
@@
-3160,8
+3149,7
@@
StrBuf *StrBufRFC2047encodeMessage(const StrBuf *EncodeMe)
ptr ++;
}
ptr ++;
}
- if (LinePos > 72) {
- /* soft line break */
+ if (LinePos > 72) { // soft line break
if (isspace(*(Optr - 1))) {
ch = *(Optr - 1);
Optr --;
if (isspace(*(Optr - 1))) {
ch = *(Optr - 1);
Optr --;
@@
-3187,11
+3175,7
@@
StrBuf *StrBufRFC2047encodeMessage(const StrBuf *EncodeMe)
}
}
-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);
int QuoteMe = 0;
if (StrLength(Target) > 0) StrBufAppendBufPlain(Target, HKEY(", "), 0);
@@
-3219,11
+3203,7
@@
static void AddRecipient(StrBuf *Target,
* \param EncBuf Temporary buffer for internal use; Please provide valid buffer.
* \returns encoded & sanitized buffer with the contents of Recp; Caller owns this memory.
*/
* \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;
StrBuf *Target;
const char *pch, *pche;
const char *UserStart, *UserEnd, *EmailStart, *EmailEnd, *At;
@@
-3362,8
+3342,7
@@
StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp,
* search character to search
* replace character to replace search by
*/
* 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;
long i;
if (buf == NULL)
return;
diff --git
a/webcit/serv_func.c
b/webcit/serv_func.c
index 88af2024f5c8d6dcc6d4324c2f6af25b0ec01c22..02e68794694fd4a8ade1ca4c1286b00947f3438f 100644
(file)
--- a/
webcit/serv_func.c
+++ b/
webcit/serv_func.c
@@
-380,7
+380,7
@@
void text_to_server(char *ptr) {
void text_to_server_qp(const StrBuf *SendMeEncoded) {
StrBuf *ServBuf;
void text_to_server_qp(const StrBuf *SendMeEncoded) {
StrBuf *ServBuf;
- ServBuf = StrBuf
RFC2047encodeMessag
e(SendMeEncoded);
+ ServBuf = StrBuf
QuotedPrintableEncod
e(SendMeEncoded);
serv_putbuf(ServBuf);
FreeStrBuf(&ServBuf);
}
serv_putbuf(ServBuf);
FreeStrBuf(&ServBuf);
}