]> code.citadel.org Git - citadel.git/blobdiff - citadel/msgbase.c
Allow MSGS command to operate in guest mode.
[citadel.git] / citadel / msgbase.c
index 8f13a44d9f8563c1b1f89eef9f2c0821e60fc21d..a62daa15ceaff2ceb338888740e29af3bd4a0dc6 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id$
- *
  * Implements the message store.
  *
  * Copyright (c) 1987-2010 by the citadel.org team
@@ -356,7 +354,7 @@ int CtdlMsgCmp(struct CtdlMessage *msg, struct CtdlMessage *template) {
  * Retrieve the "seen" message list for the current room.
  */
 void CtdlGetSeen(char *buf, int which_set) {
-       struct visit vbuf;
+       visit vbuf;
 
        /* Learn about the user and room in question */
        CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
@@ -381,7 +379,7 @@ void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
        int was_seen = 0;
        long lo = (-1L);
        long hi = (-1L);
-       struct visit vbuf;
+       visit vbuf;
        long *msglist;
        int num_msgs = 0;
        StrBuf *vset;
@@ -607,7 +605,7 @@ int CtdlForEachMessage(int mode, long ref, char *search_string,
 {
 
        int a, i, j;
-       struct visit vbuf;
+       visit vbuf;
        struct cdbdata *cdbfr;
        long *msglist = NULL;
        int num_msgs = 0;
@@ -799,6 +797,8 @@ void cmd_msgs(char *cmdbuf)
        char search_string[1024];
        ForEachMsgCallback CallBack;
 
+       if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
+
        extract_token(which, cmdbuf, 0, '|', sizeof which);
        cm_ref = extract_int(cmdbuf, 1);
        extract_token(search_string, cmdbuf, 1, '|', sizeof search_string);
@@ -835,11 +835,6 @@ void cmd_msgs(char *cmdbuf)
        else
                mode = MSGS_ALL;
 
-       if ((!(CC->logged_in)) && (!(CC->internal_pgm))) {
-               cprintf("%d not logged in\n", ERROR + NOT_LOGGED_IN);
-               return;
-       }
-
        if ( (mode == MSGS_SEARCH) && (!config.c_enable_fulltext) ) {
                cprintf("%d Full text index is not enabled on this server.\n",
                        ERROR + CMD_NOT_SUPPORTED);
@@ -933,14 +928,14 @@ void memfmout(
        const char *nl          /* string to terminate lines with */
 ) {
        int column = 0;
-       char ch = 0;
+       unsigned char ch = 0;
        char outbuf[1024];
        int len = 0;
        int nllen = 0;
 
        if (!mptr) return;
        nllen = strlen(nl);
-       while (ch=*(mptr++), ch > 0) {
+       while (ch=*(mptr++), ch != 0) {
 
                if (ch == '\n') {
                        client_write(outbuf, len);
@@ -1891,6 +1886,9 @@ void OutputRFC822MsgHeaders(
                                        }
                                }
                        }
+                       else if (i == 'K') {
+                               cprintf("Reply-To: <%s>%s", mptr, nl);
+                       }
                        if (mptr != mpptr)
                                free (mptr);
                }
@@ -2854,7 +2852,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        struct addresses_to_be_filed *aptr = NULL;
        StrBuf *saved_rfc822_version = NULL;
        int qualified_for_journaling = 0;
-       CitContext *CCC = CC;           /* CachedCitContext - performance boost */
+       CitContext *CCC = MyContext();
        char bounce_to[1024] = "";
        size_t tmp = 0;
        int rv = 0;
@@ -4940,5 +4938,5 @@ CTDL_MODULE_INIT(msgbase)
        }
 
         /* return our Subversion id for the Log */
-       return "$Id$";
+       return "msgbase";
 }