From 5c969b20ea495f98b1639500b820d97f0793cbaa Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sun, 27 Oct 2013 15:45:23 +0100 Subject: [PATCH] save the instant message log with correct quoted printeable --- citadel/modules/instmsg/serv_instmsg.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/citadel/modules/instmsg/serv_instmsg.c b/citadel/modules/instmsg/serv_instmsg.c index 17ed7cc62..2c28600b6 100644 --- a/citadel/modules/instmsg/serv_instmsg.c +++ b/citadel/modules/instmsg/serv_instmsg.c @@ -110,9 +110,6 @@ void log_instant_message(struct CitContext *me, struct CitContext *them, char *m this_im->next = imlist; imlist = this_im; StrBufAppendBufPlain(this_im->conversation, HKEY( - "Content-type: text/html\r\n" - "Content-transfer-encoding: 7bit\r\n" - "\r\n" "\r\n" ), 0); } @@ -446,6 +443,7 @@ void flush_individual_conversation(struct imlog *im) { struct CtdlMessage *msg; long msgnum = 0; char roomname[ROOMNAMELEN]; + StrBuf *MsgBuf, *FullMsgBuf; StrBufAppendBufPlain(im->conversation, HKEY( "\r\n" @@ -453,6 +451,18 @@ void flush_individual_conversation(struct imlog *im) { ), 0 ); + MsgBuf = StrBufRFC2047encodeMessage(im->conversation); + FlushStrBuf(im->conversation); + FullMsgBuf = NewStrBufPlain(NULL, StrLength(im->conversation) + 100); + + StrBufAppendBufPlain(FullMsgBuf, HKEY( + "Content-type: text/html; charset=UTF-8\r\n" + "Content-Transfer-Encoding: quoted-printable\r\n" + "\r\n" + ), 0); + StrBufAppendBuf (FullMsgBuf, MsgBuf, 0); + FreeStrBuf(&MsgBuf); + msg = malloc(sizeof(struct CtdlMessage)); memset(msg, 0, sizeof(struct CtdlMessage)); msg->cm_magic = CTDLMESSAGE_MAGIC; @@ -469,7 +479,7 @@ void flush_individual_conversation(struct imlog *im) { CM_SetField(msg, eOriginalRoom, HKEY(PAGELOGROOM)); CM_SetField(msg, eNodeName, CFG_KEY(c_nodename)); - CM_SetAsFieldSB(msg, eMesageText, &im->conversation); /* we own this memory now */ + CM_SetAsFieldSB(msg, eMesageText, &FullMsgBuf); /* we own this memory now */ /* Start with usernums[1] because it's guaranteed to be higher than usernums[0], * so if there's only one party, usernums[0] will be zero but usernums[1] won't. -- 2.30.2