}
field_header = *mptr++;
}
+ if (mptr >= upper_bound) {
+ break;
+ }
which = field_header;
len = strlen(mptr);
+
CM_SetField(ret, which, mptr, len);
mptr += len + 1; /* advance to next field */
*
*/
int CtdlOutputMsg(long msg_num, /* message number (local) to fetch */
- int mode, /* how would you like that message? */
- int headers_only, /* eschew the message body? */
- int do_proto, /* do Citadel protocol responses? */
- int crlf, /* Use CRLF newlines instead of LF? */
- char *section, /* NULL or a message/rfc822 section */
- int flags, /* various flags; see msgbase.h */
- char **Author,
- char **Address
+ int mode, /* how would you like that message? */
+ int headers_only, /* eschew the message body? */
+ int do_proto, /* do Citadel protocol responses? */
+ int crlf, /* Use CRLF newlines instead of LF? */
+ char *section, /* NULL or a message/rfc822 section */
+ int flags, /* various flags; see msgbase.h */
+ char **Author,
+ char **Address,
+ char **MessageID
) {
struct CitContext *CCC = CC;
struct CtdlMessage *TheMessage = NULL;
long len;
CM_GetAsField(TheMessage, erFc822Addr, Address, &len);
}
+ if ((MessageID != NULL) && (*MessageID == NULL))
+ {
+ long len;
+ CM_GetAsField(TheMessage, emessageId, MessageID, &len);
+ }
CM_Free(TheMessage);
TheMessage = NULL;
long len;
CM_GetAsField(TheMessage, erFc822Addr, Address, &len);
}
+ if ((MessageID != NULL) && (*MessageID == NULL))
+ {
+ long len;
+ CM_GetAsField(TheMessage, emessageId, MessageID, &len);
+ }
CM_Free(TheMessage);
MSG_syslog(LOG_INFO, "Final selection: %s (%s)\n", actual_rm, room);
if (strcasecmp(actual_rm, CCC->room.QRname)) {
/* CtdlGetRoom(&CCC->room, actual_rm); */
- CtdlUserGoto(actual_rm, 0, 1, NULL, NULL);
+ CtdlUserGoto(actual_rm, 0, 1, NULL, NULL, NULL, NULL);
}
/*
/* Bump this user's messages posted counter. */
MSGM_syslog(LOG_DEBUG, "Updating user\n");
- CtdlGetUserLock(&CCC->user, CCC->curr_user);
+ CtdlLockGetCurrentUser();
CCC->user.posted = CCC->user.posted + 1;
- CtdlPutUserLock(&CCC->user);
+ CtdlPutCurrentUserLock();
/* Decide where bounces need to be delivered */
if ((recps != NULL) && (recps->bounce_to == NULL))
/* Go back to the room we started from */
MSG_syslog(LOG_DEBUG, "Returning to original room %s\n", hold_rm);
if (strcasecmp(hold_rm, CCC->room.QRname))
- CtdlUserGoto(hold_rm, 0, 1, NULL, NULL);
+ CtdlUserGoto(hold_rm, 0, 1, NULL, NULL, NULL, NULL);
/*
* Any addresses to harvest for someone's address book?
const char *subject,
int nCriterions,
const char **CritStr,
- long *CritStrLen,
+ const long *CritStrLen,
long ccid,
long ioid,
time_t NOW)
StrBuf *guid;
char timestamp[64];
long tslen;
- time_t tsday = NOW / (8*60*60); /* just care for a day... */
+ static const time_t tsday = (8*60*60); /* just care for a day... */
+ time_t seenstamp;
tslen = snprintf(timestamp, sizeof(timestamp), "%ld", tsday);
MD5Init(&md5context);
if (StrLength(guid) > 40)
StrBufCutAt(guid, 40, NULL);
- if (CheckIfAlreadySeen("FPAideMessage",
- guid,
- NOW,
- tsday,
- eUpdate,
- ccid,
- ioid)!= 0)
+ seenstamp = CheckIfAlreadySeen("FPAideMessage",
+ guid,
+ NOW,
+ tsday,
+ eUpdate,
+ ccid,
+ ioid);
+ if ((seenstamp > 0) && (seenstamp < tsday))
{
FreeStrBuf(&guid);
/* yes, we did. flood protection kicks in. */
syslog(LOG_DEBUG,
- "not sending message again\n");
+ "not sending message again - %ld < %ld \n", seenstamp, tsday);
return;
}
- FreeStrBuf(&guid);
- /* no, this message isn't sent recently; go ahead. */
- quickie_message(from,
- fromaddr,
- to,
- room,
- text,
- format_type,
- subject);
+ else
+ {
+ syslog(LOG_DEBUG,
+ "sending message. %ld >= %ld", seenstamp, tsday);
+ FreeStrBuf(&guid);
+ /* no, this message isn't sent recently; go ahead. */
+ quickie_message(from,
+ fromaddr,
+ to,
+ room,
+ text,
+ format_type,
+ subject);
+ }
}
IO->SendBuf.fd);
fd = fopen(fn, "a+");
+ if (fd == NULL) {
+ syslog(LOG_EMERG, "failed to open file %s: %s", fn, strerror(errno));
+ cit_backtrace();
+ exit(1);
+ }
#endif
ReadMsg = IO->ReadMsg;
if (MsgFinished)
return eReadSuccess;
else
- return eAbort;
+ return eReadFail;
}