#define TYPE_STR 1
#define TYPE_LONG 2
#define TYPE_PREFSTR 3
-#define TYPE_PREFINT 4
-#define TYPE_GETTEXT 5
-#define TYPE_BSTR 6
-#define TYPE_SUBTEMPLATE 7
-#define TYPE_INTDEFINE 8
+#define TYPE_ROOMPREFSTR 4
+#define TYPE_PREFINT 5
+#define TYPE_GETTEXT 6
+#define TYPE_BSTR 7
+#define TYPE_SUBTEMPLATE 8
+#define TYPE_INTDEFINE 9
#define MAXPARAM 25
#define IS_NUMBER(a) ((a == TYPE_LONG) || (a == TYPE_PREFINT) || (a == TYPE_INTDEFINE))
};
#define CTX_NONE 0
-#define CTX_SITECFG 1
-#define CTX_SESSION 2
-#define CTX_INETCFG 3
-#define CTX_VNOTE 4
-#define CTX_WHO 5
-#define CTX_PREF 6
-#define CTX_NODECONF 7
-#define CTX_USERLIST 8
-#define CTX_MAILSUM 9
-#define CTX_MIME_ATACH 10
-#define CTX_FILELIST 11
-#define CTX_STRBUF 12
-#define CTX_STRBUFARR 13
-#define CTX_LONGVECTOR 14
-#define CTX_ROOMS 15
-#define CTX_FLOORS 16
-#define CTX_ITERATE 17
-#define CTX_ICAL 18
-#define CTX_DAVNS 19
-#define CTX_TAB 20
-#define CTX_VCARD 21
-#define CTX_SIEVELIST 22
-#define CTX_SIEVESCRIPT 23
-#define CTX_MAILQITEM 24
-#define CTX_MAILQ_RCPT 25
-#define CTX_SRVLOG 26
-
-#define CTX_UNKNOWN 27
+typedef int CtxType;
+typedef struct __CtxTypeStruct {
+ CtxType Type;
+ StrBuf *Name;
+} CtxTypeStruct;
+
+CtxTypeStruct *GetContextType(CtxType Type);
+void RegisterContextType(const char *name, long len, CtxType *TheCtx);
+#define RegisterCTX(a) RegisterContextType(#a, sizeof(#a) - 1, &a)
+
+extern CtxType CTX_STRBUF;
+extern CtxType CTX_STRBUFARR;
+extern CtxType CTX_LONGVECTOR;
/**
* @ingroup subst
* if not, we will log/print an error and refuse to call it.
*/
typedef struct _contexts {
- int ContextType; /* do we require a User Context ? */
+ CtxType ContextType; /* do we require a User Context ? */
int nMinArgs; /* How many arguments do we need at least? */
int nMaxArgs; /* up to how many arguments can we handle? */
} ContextFilter;
/* make a template token a lookup key: */
#define TKEY(a) TP->Tokens->Params[a]->Start, TP->Tokens->Params[a]->len
-void *GetContextPayload(WCTemplputParams *TP, int ContextType);
+void *GetContextPayload(WCTemplputParams *TP, CtxType ContextType);
#define CTX(a) GetContextPayload(TP, a)
/**
RetrieveHashlistFunc GetHash, /* else retrieve the hashlist by calling this function */
SubTemplFunc DoSubTempl, /* call this function on each iteration for svput & friends */
HashDestructorFunc Destructor, /* use this function to shut down the hash; NULL if its a reference */
- int ContextType, /* which context do we provide to the subtemplate? */
- int XPectContextType, /* which context do we expct to be called in? */
+ CtxType ContextType, /* which context do we provide to the subtemplate? */
+ CtxType XPectContextType, /* which context do we expct to be called in? */
int Flags);
void StackContext(WCTemplputParams *Super,
WCTemplputParams *Sub,
void *Context,
- int ContextType,
+ CtxType ContextType,
int nArgs,
WCTemplateToken *Tokens);
CompareFunc Forward,
CompareFunc Reverse,
CompareFunc GroupChange,
- long ContextType);
+ CtxType ContextType);
void dbg_print_longvector(long *LongVector);