From: Art Cancro Date: Wed, 21 Oct 2009 16:42:59 +0000 (+0000) Subject: * New API function CtdlDoIHavePermissionToReadMessagesInThisRoom() X-Git-Tag: v7.86~724 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=2156c5f0607ff48ce9d2af0df4ff97f3e61e7edf * New API function CtdlDoIHavePermissionToReadMessagesInThisRoom() --- diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index 1e6a917a6..522775c4b 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -297,6 +297,8 @@ int wiki_upload_beforesave(struct CtdlMessage *msg) { */ void cmd_wiki(char *argbuf) { cprintf("%d FIXME not finished\n", ERROR); + + /* mime_parser(mptr, NULL, *mime_download, NULL, NULL, NULL, 0); */ } diff --git a/citadel/msgbase.c b/citadel/msgbase.c index d46ec6cf6..c90ef0e2c 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -1431,6 +1431,16 @@ void extract_encapsulated_message(char *name, char *filename, char *partnum, cha + + +int CtdlDoIHavePermissionToReadMessagesInThisRoom(void) { + if ((!(CC->logged_in)) && (!(CC->internal_pgm))) { + return(om_not_logged_in); + } + return(om_ok); +} + + /* * Get a message off disk. (returns om_* values found in msgbase.h) * @@ -1446,16 +1456,24 @@ int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */ struct CtdlMessage *TheMessage = NULL; int retcode = om_no_such_msg; struct encapmsg encap; + int r; - CtdlLogPrintf(CTDL_DEBUG, "CtdlOutputMsg() msgnum=%ld, mode=%d, section=%s\n", + CtdlLogPrintf(CTDL_DEBUG, "CtdlOutputMsg(msgnum=%ld, mode=%d, section=%s)\n", msg_num, mode, (section ? section : "<>") ); - if ((!(CC->logged_in)) && (!(CC->internal_pgm))) { - if (do_proto) cprintf("%d Not logged in.\n", - ERROR + NOT_LOGGED_IN); - return(om_not_logged_in); + r = CtdlDoIHavePermissionToReadMessagesInThisRoom(); + if (r != om_ok) { + if (do_proto) { + if (r == om_not_logged_in) { + cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN); + } + else { + cprintf("%d An unknown error has occurred.\n", ERROR); + } + } + return(r); } /* FIXME: check message id against msglist for this room */ diff --git a/citadel/msgbase.h b/citadel/msgbase.h index beced22ef..f43ee6003 100644 --- a/citadel/msgbase.h +++ b/citadel/msgbase.h @@ -160,11 +160,12 @@ int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */ int CtdlOutputPreLoadedMsg(struct CtdlMessage *, int mode, /* how would you like that message? */ int headers_only, /* eschew the message body? */ - int do_proto, /* do Citadel protocol responses? */ + int do_proto, /* do Citadel protocol responses? */ int crlf, /* 0=LF, 1=CRLF */ int flags /* should the bessage be exported clean? */ ); int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void); +int CtdlDoIHavePermissionToReadMessagesInThisRoom(void); enum { POST_LOGGED_IN,