dnl Ensure that libcitadel is configured with autoconf 2.52 or newer
AC_PREREQ(2.52)
-AC_INIT(libcitadel, 903, http://uncensored.citadel.org)
+AC_INIT(libcitadel, 904, http://uncensored.citadel.org)
AC_CONFIG_SRCDIR(Makefile.in)
AC_CONFIG_AUX_DIR(conftools)
dnl
LIBCURRENT=4
-LIBREVISION=903
+LIBREVISION=904
LIBAGE=0
sinclude(conftools/libtool.m4)
/*
* Header file for libcitadel
*
- * Copyright (c) 1987-2016 by the citadel.org team
+ * Copyright (c) 1987-2017 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
#include <sys/types.h>
#include <netinet/in.h>
-#define LIBCITADEL_VERSION_NUMBER 903
+#define LIBCITADEL_VERSION_NUMBER 904
/*
* Here's a bunch of stupid magic to make the MIME parser portable.
int StrBufStreamTranscode(eStreamType type, IOBuffer *Target, IOBuffer *In, const char* pIn, long pInLen, vStreamT *Stream, int LastChunk, const char **Err);
int StrBufDecodeBase64(StrBuf *Buf);
+void StrBufDecodeQP(StrBuf *Buf);
int StrBufDecodeBase64To(const StrBuf *BufIn, StrBuf *BufOut);
int StrBufDecodeHex(StrBuf *Buf);
StrBuf *StrBufRFC2047encodeMessage(const StrBuf *EncodeMe);
/*
- * Copyright (c) 1987-2013 by the citadel.org team
+ * Copyright (c) 1987-2017 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
+/*
+ * Decode a quoted-printable encoded StrBuf buffer "in place"
+ * This is possible because the decoded will always be shorter than the encoded
+ * so we don't have to worry about the buffer being to small.
+ */
+void StrBufDecodeQP(StrBuf *Buf)
+{
+ if (!Buf) { // sanity check #1
+ return;
+ }
+
+ int source_len = StrLength(Buf);
+ if (source_len < 1) { // sanity check #2
+ return;
+ }
+
+ int spos = 0; // source position
+ int tpos = 0; // target position
+
+ while (spos < source_len) {
+ if (!strncmp(&Buf->buf[spos], "=\r\n", 3)) {
+ spos += 3;
+ }
+ else if (!strncmp(&Buf->buf[spos], "=\n", 2)) {
+ spos += 2;
+ }
+ else if (Buf->buf[spos] == '=') {
+ ++spos;
+ int ch;
+ sscanf(&Buf->buf[spos], "%02x", &ch);
+ Buf->buf[tpos++] = ch;
+ spos +=2;
+ }
+ else {
+ Buf->buf[tpos++] = Buf->buf[spos++];
+ }
+ }
+
+ Buf->buf[tpos] = 0;
+ Buf->BufUsed = tpos;
+}