int num_msgs = 0;
char vset[SIZ];
+ lprintf(CTDL_DEBUG, "CtdlSetSeen(%ld, %d, %d)\n",
+ target_msgnum, target_setting, which_set);
+
/* Learn about the user and room in question */
CtdlGetRelationship(&vbuf, &CC->user, &CC->room);
if (num_msgs > 0) {
if (compare != NULL) {
for (a = 0; a < num_msgs; ++a) {
- msg = CtdlFetchMessage(msglist[a]);
+ msg = CtdlFetchMessage(msglist[a], 1);
if (msg != NULL) {
if (CtdlMsgCmp(msg, compare)) {
msglist[a] = 0L;
* NOTE: Caller is responsible for freeing the returned CtdlMessage struct
* using the CtdlMessageFree() function.
*/
-struct CtdlMessage *CtdlFetchMessage(long msgnum)
+struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body)
{
struct cdbdata *dmsgtext;
struct cdbdata *dbigmsg;
return(om_not_logged_in);
}
- /* FIXME ... small security issue
- * We need to check to make sure the requested message is actually
- * in the current room, and set msg_ok to 1 only if it is. This
- * functionality is currently missing because I'm in a hurry to replace
- * broken production code with nonbroken pre-beta code. :( -- ajc
- *
- if (!msg_ok) {
- if (do_proto) cprintf("%d Message %ld is not in this room.\n",
- ERROR + MESSAGE_NOT_FOUND, msg_num);
- return(om_no_such_msg);
- }
- */
+ /* FIXME: check message id against msglist for this room */
/*
- * Fetch the message from disk.
+ * Fetch the message from disk. If we're in sooper-fast headers
+ * only mode, request that we don't even bother loading the body
+ * into memory.
*/
- TheMessage = CtdlFetchMessage(msg_num);
+ if (headers_only == HEADERS_FAST) {
+ TheMessage = CtdlFetchMessage(msg_num, 0);
+ }
+ else {
+ TheMessage = CtdlFetchMessage(msg_num, 1);
+ }
if (TheMessage == NULL) {
if (do_proto) cprintf("%d Can't locate msg %ld on disk\n",
}
msgnum = extract_long(cmdbuf, 0);
- msg = CtdlFetchMessage(msgnum);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) {
cprintf("%d Message %ld not found.\n",
ERROR + MESSAGE_NOT_FOUND, msgnum);
if ( (flags & SM_VERIFY_GOODNESS)
|| (flags & SM_DO_REPL_CHECK)
) {
- msg = CtdlFetchMessage(msgid);
+ msg = CtdlFetchMessage(msgid, 1);
if (msg == NULL) return(ERROR + ILLEGAL_VALUE);
}
retval = 0L;
} else {
if (is_bigmsg) {
- cdb_store(CDB_BIGMSGS, &newmsgid, sizeof(long),
- holdM, strlen(holdM) );
+ cdb_store(CDB_BIGMSGS,
+ &newmsgid,
+ sizeof(long),
+ holdM,
+ (strlen(holdM) + 1)
+ );
}
retval = newmsgid;
}
time_t timestamp = (-1L);
lprintf(CTDL_DEBUG, "check_repl() found message %ld\n", msgnum);
- msg = CtdlFetchMessage(msgnum);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) return;
if (msg->cm_fields['T'] != NULL) {
timestamp = atol(msg->cm_fields['T']);
*/
int CtdlCheckInternetMailPermission(struct ctdluser *who) {
+ /* Do not allow twits to send Internet mail */
+ if (who->axlevel <= 2) return(0);
+
/* Globally enabled? */
if (config.c_restrict == 0) return(1);
/* Read in the message from the client. */
cprintf("%d send message\n", SEND_LISTING);
+ flush_output();
msg = CtdlMakeMessage(&CC->user, recp,
CC->room.QRname, anonymous, format_type,
masquerade_as, subject, NULL);
conf = NULL;
}
else {
- msg = CtdlFetchMessage(msgnum);
+ msg = CtdlFetchMessage(msgnum, 1);
if (msg != NULL) {
conf = strdup(msg->cm_fields['M']);
CtdlFreeMessage(msg);