X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fserv_func.c;h=ddc94f9af91bc57f29be7da6fb17289590126c4b;hb=49961a114060cea882cbc726ad6f2d6bb8e0cafd;hp=9e12d1afbbe8710fbcd23db46c3910af59a3fda3;hpb=c737597d6d7311c79bcdde922fb9f822e3dda614;p=citadel.git diff --git a/webcit/serv_func.c b/webcit/serv_func.c index 9e12d1afb..ddc94f9af 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -1,4 +1,4 @@ -/* + /* * $Id$ */ @@ -8,6 +8,23 @@ int is_uds = 0; char serv_sock_name[PATH_MAX] = ""; +HashList *EmbeddableMimes = NULL; +StrBuf *EmbeddableMimeStrs = NULL; + + +void SetInlinMimeRenderers(void) +{ + StrBuf *Buf; + + Buf = NewStrBuf(); + /** Tell the server what kind of richtext we prefer */ + serv_putbuf(EmbeddableMimeStrs); + StrBuf_ServGetln(Buf); + + FreeStrBuf(&Buf); +} + + void DeleteServInfo(ServInfo **FreeMe) { if (*FreeMe == NULL) @@ -48,10 +65,6 @@ ServInfo *get_serv_info(StrBuf *browser_host, StrBuf *user_agent) ); StrBuf_ServGetln(Buf); - /** Tell the server what kind of richtext we prefer */ - serv_puts("MSGP text/calendar|text/vnote|text/html|text/plain");//// TODO: register me... - StrBuf_ServGetln(Buf); - /* * Tell the server that when we save a calendar event, we * want invitations to be generated by the Citadel server @@ -206,6 +219,7 @@ int GetConnected (void) end_webcit_session(); return 1; } + SetInlinMimeRenderers(); } return 0; } @@ -723,6 +737,52 @@ void tmplput_mesg(StrBuf *Target, WCTemplputParams *TP) FreeStrBuf(&Line); } + +void RegisterEmbeddableMimeType(const char *MimeType, long MTLen, int Priority) +{ + StrBuf *MT; + printf("%s - %ld\n", MimeType, Priority); + MT = NewStrBufPlain(MimeType, MTLen); + Put(EmbeddableMimes, IKEY(Priority), MT, HFreeStrBuf); +} + +void CreateMimeStr(void) +{ + HashPos *it; + void *vMime; + long len = 0; + const char *Key; + + it = GetNewHashPos(EmbeddableMimes, 0); + while (GetNextHashPos(EmbeddableMimes, it, &len, &Key, &vMime) && + (vMime != NULL)) { + printf("%s - \n", ChrPtr((StrBuf*) vMime)); + if (StrLength(EmbeddableMimeStrs) > 0) + StrBufAppendBufPlain(EmbeddableMimeStrs, HKEY("|"), 0); + else + StrBufAppendBufPlain(EmbeddableMimeStrs, HKEY("MSGP "), 0); + StrBufAppendBuf(EmbeddableMimeStrs, (StrBuf*) vMime, 0); + } + printf("------%ld-------------%s------%s------------\n", len, ChrPtr(EmbeddableMimeStrs), ChrPtr((StrBuf*) vMime)); +} + +void +ServerStartModule_SERV_FUNC +(void) +{ + EmbeddableMimes = NewHash(1, Flathash); + EmbeddableMimeStrs = NewStrBuf(); +} + + +void +ServerShutdownModule_SERV_FUNC +(void) +{ + FreeStrBuf(&EmbeddableMimeStrs); + DeleteHash(&EmbeddableMimes); +} + void InitModule_SERVFUNC (void)