- Add new function for demo printing hashes
[citadel.git] / libcitadel / lib / libcitadel.h
index af6e16c170421fd097ee2468b26fc3d551452d60..d8f246da43f9214dadb9b6a77de5bb7c6463bc6c 100644 (file)
@@ -28,7 +28,7 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 
-#define LIBCITADEL_VERSION_NUMBER      820
+#define LIBCITADEL_VERSION_NUMBER      901
 
 /*
  * Here's a bunch of stupid magic to make the MIME parser portable.
@@ -49,16 +49,16 @@ typedef enum AXLevel {
 }eUsrAxlvl;
 
 typedef enum __RoomNetCfg {
-       subpending,
-       unsubpending,
-       lastsent, /* Server internal use only */
-       ignet_push_share,
-       listrecp,
-       digestrecp,
-       pop3client,
-       rssclient,
-       participate,
-       roommailalias,
+       subpending        = 0,
+       unsubpending      = 1,
+       lastsent          = 2, /* Server internal use only */
+       ignet_push_share  = 3,
+       listrecp          = 4,
+       digestrecp        = 5,
+       pop3client        = 6,
+       rssclient         = 7,
+       participate       = 8,
+       roommailalias     = 9,
        maxRoomNetCfg
 } RoomNetCfg;
 
@@ -100,6 +100,7 @@ typedef enum _room_views {
        VIEW_DRAFTS             = 9,    /* Drafts view */
        VIEW_BLOG               = 10,   /* Blog view */
        VIEW_QUEUE              = 11,   /* SMTP/... QUEUE rooms */
+       VIEW_WIKIMD             = 12,   /* Markdown Wiki view */
        VIEW_MAX,
        VIEW_JSON_LIST,
 } ROOM_VIEWS;
@@ -107,7 +108,7 @@ typedef enum _room_views {
 #define BLOG_EUIDBUF_SIZE      40
 
 #ifndef IsEmptyStr
-#define IsEmptyStr(a) ((a)[0] == '\0')
+#define IsEmptyStr(a) ( ( (a) == NULL ) || ((a)[0] == '\0') )
 #endif
 
 
@@ -337,8 +338,23 @@ void StrBuf_RFC822_2_Utf8(StrBuf *Target,
 /* deprecated old version: */
 void StrBuf_RFC822_to_Utf8(StrBuf *Target, const StrBuf *DecodeMe, const StrBuf* DefaultCharset, StrBuf *FoundCharset);
 
+typedef enum __eStreamType {
+       eBase64Encode,
+       eBase64Decode,
+       eZLibEncode,
+       eZLibDecode,
+       eEmtyCodec
+} eStreamType;
+
+typedef struct vStreamT vStreamT;
+vStreamT *StrBufNewStreamContext(eStreamType type, const char **Err);
+int StrBufDestroyStreamContext(eStreamType type, vStreamT **Stream, const char **Err);
+int StrBufStreamTranscode(eStreamType type, IOBuffer *Target, IOBuffer *In, const char* pIn, long pInLen, vStreamT *Stream, int LastChunk, const char **Err);
+
 int StrBufDecodeBase64(StrBuf *Buf);
+int StrBufDecodeBase64To(const StrBuf *BufIn, StrBuf *BufOut);
 int StrBufDecodeHex(StrBuf *Buf);
+StrBuf *StrBufRFC2047encodeMessage(const StrBuf *EncodeMe);
 int StrBufRFC2047encode(StrBuf **target, const StrBuf *source);
 StrBuf *StrBufSanitizeEmailRecipientVector(const StrBuf *Recp, 
                                           StrBuf *UserName, 
@@ -350,8 +366,10 @@ int StrBufSanitizeAscii(StrBuf *Buf, const char Mute);
 #define QU                     (3)
 void StrBufUrlescAppend(StrBuf *OutBuf, const StrBuf *In, const char *PlainIn);
 void StrBufUrlescUPAppend(StrBuf *OutBuf, const StrBuf *In, const char *PlainIn);
+void StrBufXMLEscAppend(StrBuf *OutBuf, const StrBuf *In, const char *PlainIn, long PlainInLen, int OverrideLowChars);
 void StrBufHexescAppend(StrBuf *OutBuf, const StrBuf *In, const char *PlainIn);
 void StrBufHexEscAppend(StrBuf *OutBuf, const StrBuf *In, const unsigned char *PlainIn, long PlainInLen);
+void StrBufBase64Append(StrBuf *OutBuf, const StrBuf *In, const char *PlainIn, long PlainInLen, int linebreaks);
 long StrEscAppend(StrBuf *Target, const StrBuf *Source, const char *PlainIn, int nbsp, int nolinebreaks);
 long StrECMAEscAppend(StrBuf *Target, const StrBuf *Source, const char *PlainIn);
 long StrHtmlEcmaEscAppend(StrBuf *Target, const StrBuf *Source, const char *PlainIn, int nbsp, int nolinebreaks);
@@ -427,7 +445,6 @@ char *memreadline(char *start, char *buf, int maxlen);
 char *memreadlinelen(char *start, char *buf, int maxlen, int *retlen);
 const char *cmemreadline(const char *start, char *buf, int maxlen);
 const char *cmemreadlinelen(const char *start, char *buf, int maxlen, int *retlen);
-#define IsEmptyStr(a) ((a)[0] == '\0')
 #define num_parms(source)              num_tokens(source,(char)'|')
 int stripout(char *str, char leftboundary, char rightboundary);
 long stripallbut(char *str, char leftboundary, char rightboundary);
@@ -466,7 +483,7 @@ struct vCard {
 
 
 struct vCard *vcard_new(void);
-void vcard_add_prop(struct vCard *v, char *propname, char *propvalue);
+void vcard_add_prop(struct vCard *v, const char *propname, const char *propvalue);
 struct vCard *vcard_load(char *vtext);
 struct vCard *VCardLoad(StrBuf *vbtext);
 
@@ -495,7 +512,7 @@ typedef const char *(*PrintHashContent)(void * Data);
 typedef int (*CompareFunc)(const void* Item1, const void*Item2);
 typedef long (*HashFunc)(const char *Str, long Len);
 typedef void (*TransitionFunc) (void *Item1, void *Item2, int Odd);
-typedef void (*PrintHashDataFunc) (const char *Key, void *Item, int Odd);
+typedef const char* (*PrintHashDataFunc) (const char *Key, void *Item, int Odd);
 
 long Flathash(const char *str, long len);
 long lFlathash(const char *str, long len);
@@ -512,6 +529,7 @@ int GetHash(HashList *Hash, const char *HKey, long HKLen, void **Data);
 void Put(HashList *Hash, const char *HKey, long HKLen, void *Data, DeleteHashDataFunc DeleteIt);
 int GetKey(HashList *Hash, char *HKey, long HKLen, void **Data);
 int GetHashKeys(HashList *Hash, char ***List);
+const char *dbg_PrintStrBufPayload(const char *Key, void *Item, int Odd);
 int dbg_PrintHash(HashList *Hash, PrintHashContent first, PrintHashContent Second);
 int PrintHash(HashList *Hash, TransitionFunc Trans, PrintHashDataFunc PrintEntry);
 HashPos *GetNewHashPos(const HashList *Hash, int StepWidth);