return 0; // No messages at all? No further action.
}
- /*
- * Now begin the traversal.
- */
+ // Now begin the traversal.
if (num_msgs > 0) for (a = 0; a < num_msgs; ++a) {
- /* If the caller is looking for a specific MIME type, filter
- * out all messages which are not of the type requested.
- */
+ // If the caller is looking for a specific MIME type, filter
+ // out all messages which are not of the type requested.
if ((content_type != NULL) && (!IsEmptyStr(content_type))) {
- /* This call to GetMetaData() sits inside this loop
- * so that we only do the extra database read per msg
- * if we need to. Doing the extra read all the time
- * really kills the server. If we ever need to use
- * metadata for another search criterion, we need to
- * move the read somewhere else -- but still be smart
- * enough to only do the read if the caller has
- * specified something that will need it.
- */
+ // This call to GetMetaData() sits inside this loop
+ // so that we only do the extra database read per msg
+ // if we need to. Doing the extra read all the time
+ // really kills the server. If we ever need to use
+ // metadata for another search criterion, we need to
+ // move the read somewhere else -- but still be smart
+ // enough to only do the read if the caller has
+ // specified something that will need it.
if (server_shutting_down) {
if (need_to_free_re) regfree(&re);
free(msglist);
}
GetMetaData(&smi, msglist[a]);
- /* if (strcasecmp(smi.meta_content_type, content_type)) { old non-regex way */
if (regexec(&re, smi.meta_content_type, 1, &pm, 0) != 0) {
msglist[a] = 0L;
}
num_msgs = sort_msglist(msglist, num_msgs);
- /* If a template was supplied, filter out the messages which
- * don't match. (This could induce some delays!)
- */
+ // If a template was supplied, filter out the messages which don't match. (This could induce some delays!)
if (num_msgs > 0) {
if (compare != NULL) {
for (a = 0; a < num_msgs; ++a) {
}
-/*
- * Convenience function to process a big block of AdjRefCount() operations
- */
-void AdjRefCountList(long *msgnum, long nmsg, int incr)
-{
+// Convenience function to process a big block of AdjRefCount() operations
+void AdjRefCountList(long *msgnum, long nmsg, int incr) {
long i;
for (i = 0; i < nmsg; i++) {
}
-/*
- * AdjRefCount - adjust the reference count for a message. We need to delete from disk any message whose reference count reaches zero.
- */
-void AdjRefCount(long msgnum, int incr)
-{
+// AdjRefCount - adjust the reference count for a message.
+// We need to delete from disk any message whose reference count reaches zero.
+void AdjRefCount(long msgnum, int incr) {
struct MetaData smi;
long delnum;
- /* This is a *tight* critical section; please keep it that way, as
- * it may get called while nested in other critical sections.
- * Complicating this any further will surely cause deadlock!
- */
+ // This is a *tight* critical section; please keep it that way, as
+ // it may get called while nested in other critical sections.
+ // Complicating this any further will surely cause deadlock!
begin_critical_section(S_SUPPMSGMAIN);
GetMetaData(&smi, msgnum);
smi.meta_refcount += incr;
end_critical_section(S_SUPPMSGMAIN);
syslog(LOG_DEBUG, "msgbase: AdjRefCount() msg %ld ref count delta %+d, is now %d", msgnum, incr, smi.meta_refcount);
- /* If the reference count is now zero, delete both the message and its metadata record.
- */
+ // If the reference count is now zero, delete both the message and its metadata record.
if (smi.meta_refcount == 0) {
syslog(LOG_DEBUG, "msgbase: deleting message <%ld>", msgnum);
- /* Call delete hooks with NULL room to show it has gone altogether */
+ // Call delete hooks with NULL room to show it has gone altogether
PerformDeleteHooks(NULL, msgnum);
- /* Remove from message base */
+ // Remove from message base
delnum = msgnum;
cdb_delete(CDB_MSGMAIN, &delnum, (int)sizeof(long));
- cdb_delete(CDB_BIGMSGS, &delnum, (int)sizeof(long));
+ cdb_delete(CDB_BIGMSGS, &delnum, (int)sizeof(long)); // There might not be a bigmsgs. Not an error.
- /* Remove metadata record */
+ // Remove metadata record
delnum = (0L - msgnum);
cdb_delete(CDB_MSGMAIN, &delnum, (int)sizeof(long));
}
}
-/*
- * Write a generic object to this room
- *
- * Returns the message number of the written object, in case you need it.
- */
-long CtdlWriteObject(char *req_room, /* Room to stuff it in */
- char *content_type, /* MIME type of this object */
- char *raw_message, /* Data to be written */
- off_t raw_length, /* Size of raw_message */
- struct ctdluser *is_mailbox, /* Mailbox room? */
- int is_binary, /* Is encoding necessary? */
- unsigned int flags /* Internal save flags */
+// Write a generic object to this room
+// Returns the message number of the written object, in case you need it.
+long CtdlWriteObject(char *req_room, // Room to stuff it in
+ char *content_type, // MIME type of this object
+ char *raw_message, // Data to be written
+ off_t raw_length, // Size of raw_message
+ struct ctdluser *is_mailbox, // Mailbox room?
+ int is_binary, // Is encoding necessary?
+ unsigned int flags // Internal save flags
) {
struct ctdlroom qrbuf;
char roomname[ROOMNAMELEN];