highest_msg = msglist[num_msgs - 1];
/* Write it back to disk. */
- cdb_store(CDB_MSGLISTS, &CC->room.QRnumber, (int)sizeof(long),
- msglist, (int)(num_msgs * sizeof(long)));
+ cdb_store(CDB_MSGLISTS, &CC->room.QRnumber, (int)sizeof(long), msglist, (int)(num_msgs * sizeof(long)));
/* Free up the memory we used. */
free(msglist);
* This is the same as CtdlSaveMsgPointersInRoom() but it only accepts
* a single message.
*/
-int CtdlSaveMsgPointerInRoom(char *roomname, long msgid,
- int do_repl_check, struct CtdlMessage *supplied_msg)
-{
+int CtdlSaveMsgPointerInRoom(char *roomname, long msgid, int do_repl_check, struct CtdlMessage *supplied_msg) {
return CtdlSaveMsgPointersInRoom(roomname, &msgid, 1, do_repl_check, supplied_msg, 0);
}
}
else {
if (is_bigmsg) {
- retval = cdb_store(CDB_BIGMSGS,
- &msgid,
- (int)sizeof(long),
- holdM,
- (holdMLen + 1)
- );
+ retval = cdb_store(CDB_BIGMSGS, &msgid, (int)sizeof(long), holdM, (holdMLen + 1));
if (retval < 0) {
syslog(LOG_ERR, "msgbase: failed to store message body for msgid %ld: %ld", msgid, retval);
}
/* Free the memory we used for the serialized message */
free(smr.ser);
-
return(retval);
}
#include "citadel_ldap.h"
#include "ctdl_module.h"
#include "user_ops.h"
+#include "room_ops.h"
#include "makeuserkey.h"
#include "internet_addressing.h"
char mailboxname[ROOMNAMELEN];
struct ctdlroom mailbox;
struct visit vbuf;
- struct cdbdata *cdbfr;
long *msglist = NULL;
int num_msgs = 0;
CtdlMailboxName(mailboxname, sizeof mailboxname, &CC->user, MAILROOM);
- if (CtdlGetRoom(&mailbox, mailboxname) != 0)
+ if (CtdlGetRoom(&mailbox, mailboxname) != 0) {
return(0);
+ }
CtdlGetRelationship(&vbuf, &CC->user, &mailbox);
- cdbfr = cdb_fetch(CDB_MSGLISTS, &mailbox.QRnumber, sizeof(long));
-
- if (cdbfr != NULL) {
- msglist = malloc(cdbfr->len);
- memcpy(msglist, cdbfr->ptr, cdbfr->len);
- num_msgs = cdbfr->len / sizeof(long);
- cdb_free(cdbfr);
- }
- if (num_msgs > 0)
+ num_msgs = CtdlFetchMsgList(mailbox.QRnumber, &msglist);
+ if (num_msgs > 0) {
for (a = 0; a < num_msgs; ++a) {
if (msglist[a] > 0L) {
if (msglist[a] > vbuf.v_lastseen) {
}
}
}
+ }
if (msglist != NULL)
free(msglist);