]> code.citadel.org Git - citadel.git/blobdiff - citadel/user_ops.c
* Did most of the migration from save_message() to CtdlSaveMsg(). The
[citadel.git] / citadel / user_ops.c
index e627c16d08888faf5da0e45bf0313d71339e0330..5815f1a2aafea9a454a6a2065e4f40464df12870 100644 (file)
@@ -790,7 +790,7 @@ void cmd_invt_kick(char *iuser, int op)
        lputuser(&USscratch);
 
        /* post a message in Aide> saying what we just did */
-       sprintf(bbb,"%s %s %s> by %s",
+       sprintf(bbb,"%s %s %s> by %s\n",
                iuser,
                ((op == 1) ? "invited to" : "kicked out of"),
                CC->quickroom.QRname,
@@ -1344,22 +1344,35 @@ void cmd_asup(char *cmdbuf) {
 int NewMailCount() {
        int num_newmsgs = 0;
        int a;
-       char mailboxname[32];
+       char mailboxname[ROOMNAMELEN];
        struct quickroom mailbox;
        struct visit vbuf;
+        struct cdbdata *cdbfr;
+       long *msglist = NULL;
+       int num_msgs = 0;
 
        MailboxName(mailboxname, &CC->usersupp, MAILROOM);
        if (getroom(&mailbox, mailboxname)!=0) return(0);
        CtdlGetRelationship(&vbuf, &CC->usersupp, &mailbox);
 
-       get_msglist(&mailbox);
-       for (a=0; a<CC->num_msgs; ++a) {
-               if (MessageFromList(a)>0L) {
-                       if (MessageFromList(a) > vbuf.v_lastseen) {
+        cdbfr = cdb_fetch(CDB_MSGLISTS, &mailbox.QRnumber, sizeof(long));
+
+        if (cdbfr != NULL) {
+               msglist = mallok(cdbfr->len);
+               memcpy(msglist, cdbfr->ptr, cdbfr->len);
+               num_msgs = cdbfr->len / sizeof(long);
+               cdb_free(cdbfr);
+       }
+
+       if (num_msgs > 0) for (a=0; a<num_msgs; ++a) {
+               if (msglist[a]>0L) {
+                       if (msglist[a] > vbuf.v_lastseen) {
                                ++num_newmsgs;
                                }
                        }
                }
 
+       if (msglist != NULL) phree(msglist);
+
        return(num_newmsgs);
        }