X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=libcitadel%2Flib%2Flibcitadel.h;h=d8f246da43f9214dadb9b6a77de5bb7c6463bc6c;hb=19fb2763b48d73c87bf6852d29e84353fd941842;hp=46b103e41a7a7cdd2330e6fccf54607ff45fa543;hpb=e5b0ab22468d49791f864e1648ded8d0173a6b2e;p=citadel.git diff --git a/libcitadel/lib/libcitadel.h b/libcitadel/lib/libcitadel.h index 46b103e41..d8f246da4 100644 --- a/libcitadel/lib/libcitadel.h +++ b/libcitadel/lib/libcitadel.h @@ -1,7 +1,7 @@ /* * Header file for libcitadel * - * Copyright (c) 1987-2012 by the citadel.org team + * Copyright (c) 1987-2013 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. @@ -28,7 +28,7 @@ #include #include -#define LIBCITADEL_VERSION_NUMBER 813 +#define LIBCITADEL_VERSION_NUMBER 901 /* * Here's a bunch of stupid magic to make the MIME parser portable. @@ -48,18 +48,19 @@ typedef enum AXLevel { AxAideU = 6 }eUsrAxlvl; -enum RoomNetCfg { - subpending, - unsubpending, - lastsent, /* Server internal use only */ - ignet_push_share, - listrecp, - digestrecp, - pop3client, - rssclient, - participate, +typedef enum __RoomNetCfg { + 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; enum GNET_POP3_PARTS { /* pop3client splits into these columns: */ GNET_POP3_HOST = 1, @@ -99,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; @@ -106,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 @@ -206,6 +208,7 @@ int FLUSHStrBuf(StrBuf *buf); /* expensive but doesn't leave content behind for const char *ChrPtr(const StrBuf *Str); int StrLength(const StrBuf *Str); #define SKEY(a) ChrPtr(a), StrLength(a) +void StrBufAsciify(StrBuf *Buf, const char repl); long StrBufPeek(StrBuf *Buf, const char* ptr, long nThChar, char PeekValue); long StrBufPook(StrBuf *Buf, const char* ptr, long nThChar, long nChars, char PookValue); @@ -257,8 +260,8 @@ typedef struct __fd_iobuffer { int SplicePipe[2]; int PipeSize; long TotalSendSize; - long TotalSentAlready; - long TotalReadAlready; + loff_t TotalSentAlready; + loff_t TotalReadAlready; long ChunkSize; long ChunkSendRemain; StrBuf *ChunkBuffer; /* just used if we don't have sendfile */ @@ -335,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, @@ -348,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); @@ -425,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); @@ -439,7 +458,7 @@ char *bmstrcasestr_len(char *text, size_t textlen, const char *pattern, size_t p const char *cbmstrcasestr(const char *text, const char *pattern); const char *cbmstrcasestr_len(const char *text, size_t textlen, const char *pattern, size_t patlen); void CtdlMakeTempFileName(char *name, int len); -char *rfc2047encode(char *line, long length); +char *rfc2047encode(const char *line, long length); int is_msg_in_mset(const char *mset, long msgnum); int pattern2(char *search, char *patn); void stripltlen(char *, int *); @@ -464,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); @@ -493,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); @@ -510,16 +529,18 @@ 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(HashList *Hash, int StepWidth); +HashPos *GetNewHashPos(const HashList *Hash, int StepWidth); +void RewindHashPos(const HashList *Hash, HashPos *it, int StepWidth); int GetHashPosFromKey(HashList *Hash, const char *HKey, long HKLen, HashPos *At); int DeleteEntryFromHash(HashList *Hash, HashPos *At); int GetHashPosCounter(HashList *Hash, HashPos *At); void DeleteHashPos(HashPos **DelMe); int NextHashPos(HashList *Hash, HashPos *At); int GetHashPos(HashList *Hash, HashPos *At, long *HKLen, const char **HashKey, void **Data); -int GetNextHashPos(HashList *Hash, HashPos *At, long *HKLen, const char **HashKey, void **Data); +int GetNextHashPos(const HashList *Hash, HashPos *At, long *HKLen, const char **HashKey, void **Data); int GetHashAt(HashList *Hash,long At, long *HKLen, const char **HashKey, void **Data); void SortByHashKey(HashList *Hash, int Order); void SortByHashKeyStr(HashList *Hash); @@ -659,6 +680,10 @@ extern ConstStr RoomNetCfgStrs[maxRoomNetCfg]; extern "C" { #endif +#define CFG_SMTP_FROM_FILTERALL 0 +#define CFG_SMTP_FROM_NOFILTER 1 +#define CFG_SMTP_FROM_CORRECT 2 +#define CFG_SMTP_FROM_REJECT 3 /* * MIME types used in Citadel for configuration stuff */ @@ -671,6 +696,8 @@ extern "C" { #define XMPPMORTUARY "application/x-citadel-xmpp-mortuary" #define INTERNETCFG "application/x-citadel-internet-config" +#define FILE_MAILALIAS "__MAIL_ALIAS__" + #define LISTING_FOLLOWS 100 #define CIT_OK 200 #define MORE_DATA 300 @@ -718,7 +745,7 @@ extern "C" { #define QR_ANONOPT 1024 /* Anonymous-Option room */ #define QR_NETWORK 2048 /* Shared network room */ #define QR_PREFONLY 4096 /* Preferred status needed to enter */ -#define QR_READONLY 8192 /* Aide status required to post */ +#define QR_READONLY 8192 /* Admin status required to post */ #define QR_MAILBOX 16384 /* Set if this is a private mailbox */ #define QR2_SYSTEM 1 /* System room; hide by default */ @@ -751,9 +778,11 @@ extern "C" { #define UA_HASNEWMSGS 8 /* Unread messages exist in this room */ #define UA_ZAPPED 16 /* User has forgotten (zapped) this room */ #define UA_POSTALLOWED 32 /* User may post top-level messages here */ -#define UA_ADMINALLOWED 64 /* Aide or Room Aide rights exist here */ +#define UA_ADMINALLOWED 64 /* Admin or Room Admin rights exist here */ #define UA_DELETEALLOWED 128 /* User is allowed to delete messages from this room */ #define UA_REPLYALLOWED 256 /* User is allowed to reply to existing messages here */ +/* runtime flag extracted from goto reply; not db persistant, should be moved if new flags added */ +#define UA_ISTRASH 512 /* Only available in room view... */ #ifdef __cplusplus }