* add StrBufSanitizeEmailRecipientVector(); it will qp encode plain names with utf...
[citadel.git] / libcitadel / lib / tools.c
index 0166f0b706df1f502737a0efa24e2239af756c2d..da37f7f080673977a96a77d0e6a5a5769e7d5ce5 100644 (file)
@@ -996,3 +996,20 @@ void convert_spaces_to_underscores(char *str)
 }
 
 
+/*
+ * check whether the provided string needs to be qp encoded or not
+ */
+int CheckEncode(const char *pch, long len, const char *pche)
+{
+       if (pche == NULL)
+               pche = pch + len;
+       while (pch < pche) {
+               if (((unsigned char) *pch < 32) || 
+                   ((unsigned char) *pch > 126)) {
+                       return 1;
+               }
+               pch++;
+       }
+       return 0;
+}
+