projects
/
citadel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
When exporting a message, write to the client 10 KB at a time.
[citadel.git]
/
citadel
/
msgbase.c
diff --git
a/citadel/msgbase.c
b/citadel/msgbase.c
index aff45e097fdce1fbc20fb1155fb28ed636d371de..081be8980a2aba77e5dd44121e083e57f8e4027e 100644
(file)
--- a/
citadel/msgbase.c
+++ b/
citadel/msgbase.c
@@
-140,14
+140,12
@@
eMsgField FieldOrder[] = {
static const long NDiskFields = sizeof(FieldOrder) / sizeof(eMsgField);
static const long NDiskFields = sizeof(FieldOrder) / sizeof(eMsgField);
-int CM_IsEmpty(struct CtdlMessage *Msg, eMsgField which)
-{
+int CM_IsEmpty(struct CtdlMessage *Msg, eMsgField which) {
return !((Msg->cm_fields[which] != NULL) && (Msg->cm_fields[which][0] != '\0'));
}
return !((Msg->cm_fields[which] != NULL) && (Msg->cm_fields[which][0] != '\0'));
}
-void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length)
-{
+void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length) {
if (Msg->cm_fields[which] != NULL) {
free (Msg->cm_fields[which]);
}
if (Msg->cm_fields[which] != NULL) {
free (Msg->cm_fields[which]);
}
@@
-161,8
+159,7
@@
void CM_SetField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long
}
}
-void CM_SetFieldLONG(struct CtdlMessage *Msg, eMsgField which, long lvalue)
-{
+void CM_SetFieldLONG(struct CtdlMessage *Msg, eMsgField which, long lvalue) {
char buf[128];
long len;
len = snprintf(buf, sizeof(buf), "%ld", lvalue);
char buf[128];
long len;
len = snprintf(buf, sizeof(buf), "%ld", lvalue);
@@
-170,8
+167,7
@@
void CM_SetFieldLONG(struct CtdlMessage *Msg, eMsgField which, long lvalue)
}
}
-void CM_CutFieldAt(struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen)
-{
+void CM_CutFieldAt(struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen) {
if (Msg->cm_fields[WhichToCut] == NULL)
return;
if (Msg->cm_fields[WhichToCut] == NULL)
return;
@@
-183,8
+179,7
@@
void CM_CutFieldAt(struct CtdlMessage *Msg, eMsgField WhichToCut, long maxlen)
}
}
-void CM_FlushField(struct CtdlMessage *Msg, eMsgField which)
-{
+void CM_FlushField(struct CtdlMessage *Msg, eMsgField which) {
if (Msg->cm_fields[which] != NULL)
free (Msg->cm_fields[which]);
Msg->cm_fields[which] = NULL;
if (Msg->cm_fields[which] != NULL)
free (Msg->cm_fields[which]);
Msg->cm_fields[which] = NULL;
@@
-192,8
+187,7
@@
void CM_FlushField(struct CtdlMessage *Msg, eMsgField which)
}
}
-void CM_Flush(struct CtdlMessage *Msg)
-{
+void CM_Flush(struct CtdlMessage *Msg) {
int i;
if (CM_IsValidMsg(Msg) == 0) {
int i;
if (CM_IsValidMsg(Msg) == 0) {
@@
-206,8
+200,7
@@
void CM_Flush(struct CtdlMessage *Msg)
}
}
-void CM_CopyField(struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy)
-{
+void CM_CopyField(struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField WhichtToCopy) {
long len;
if (Msg->cm_fields[WhichToPutTo] != NULL) {
free (Msg->cm_fields[WhichToPutTo]);
long len;
if (Msg->cm_fields[WhichToPutTo] != NULL) {
free (Msg->cm_fields[WhichToPutTo]);
@@
-227,8
+220,7
@@
void CM_CopyField(struct CtdlMessage *Msg, eMsgField WhichToPutTo, eMsgField Whi
}
}
-void CM_PrependToField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length)
-{
+void CM_PrependToField(struct CtdlMessage *Msg, eMsgField which, const char *buf, long length) {
if (Msg->cm_fields[which] != NULL) {
long oldmsgsize;
long newmsgsize;
if (Msg->cm_fields[which] != NULL) {
long oldmsgsize;
long newmsgsize;
@@
-253,8
+245,7
@@
void CM_PrependToField(struct CtdlMessage *Msg, eMsgField which, const char *buf
}
}
-void CM_SetAsField(struct CtdlMessage *Msg, eMsgField which, char **buf, long length)
-{
+void CM_SetAsField(struct CtdlMessage *Msg, eMsgField which, char **buf, long length) {
if (Msg->cm_fields[which] != NULL) {
free (Msg->cm_fields[which]);
}
if (Msg->cm_fields[which] != NULL) {
free (Msg->cm_fields[which]);
}
@@
-270,8
+261,7
@@
void CM_SetAsField(struct CtdlMessage *Msg, eMsgField which, char **buf, long le
}
}
-void CM_SetAsFieldSB(struct CtdlMessage *Msg, eMsgField which, StrBuf **buf)
-{
+void CM_SetAsFieldSB(struct CtdlMessage *Msg, eMsgField which, StrBuf **buf) {
if (Msg->cm_fields[which] != NULL) {
free (Msg->cm_fields[which]);
}
if (Msg->cm_fields[which] != NULL) {
free (Msg->cm_fields[which]);
}
@@
-281,8
+271,7
@@
void CM_SetAsFieldSB(struct CtdlMessage *Msg, eMsgField which, StrBuf **buf)
}
}
-void CM_GetAsField(struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen)
-{
+void CM_GetAsField(struct CtdlMessage *Msg, eMsgField which, char **ret, long *retlen) {
if (Msg->cm_fields[which] != NULL) {
*retlen = Msg->cm_lengths[which];
*ret = Msg->cm_fields[which];
if (Msg->cm_fields[which] != NULL) {
*retlen = Msg->cm_lengths[which];
*ret = Msg->cm_fields[which];
@@
-312,8
+301,7
@@
int CM_IsValidMsg(struct CtdlMessage *msg) {
}
}
-void CM_FreeContents(struct CtdlMessage *msg)
-{
+void CM_FreeContents(struct CtdlMessage *msg) {
int i;
for (i = 0; i < 256; ++i)
int i;
for (i = 0; i < 256; ++i)
@@
-329,8
+317,7
@@
void CM_FreeContents(struct CtdlMessage *msg)
/*
* 'Destructor' for struct CtdlMessage
*/
/*
* 'Destructor' for struct CtdlMessage
*/
-void CM_Free(struct CtdlMessage *msg)
-{
+void CM_Free(struct CtdlMessage *msg) {
if (CM_IsValidMsg(msg) == 0) {
if (msg != NULL) free (msg);
return;
if (CM_IsValidMsg(msg) == 0) {
if (msg != NULL) free (msg);
return;
@@
-340,8
+327,7
@@
void CM_Free(struct CtdlMessage *msg)
}
}
-int CM_DupField(eMsgField i, struct CtdlMessage *OrgMsg, struct CtdlMessage *NewMsg)
-{
+int CM_DupField(eMsgField i, struct CtdlMessage *OrgMsg, struct CtdlMessage *NewMsg) {
long len;
len = OrgMsg->cm_lengths[i];
NewMsg->cm_fields[i] = malloc(len + 1);
long len;
len = OrgMsg->cm_lengths[i];
NewMsg->cm_fields[i] = malloc(len + 1);
@@
-355,8
+341,7
@@
int CM_DupField(eMsgField i, struct CtdlMessage *OrgMsg, struct CtdlMessage *New
}
}
-struct CtdlMessage * CM_Duplicate(struct CtdlMessage *OrgMsg)
-{
+struct CtdlMessage *CM_Duplicate(struct CtdlMessage *OrgMsg) {
int i;
struct CtdlMessage *NewMsg;
int i;
struct CtdlMessage *NewMsg;
@@
-488,7
+473,8
@@
void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
cdbfr->ptr = NULL; /* CtdlSetSeen() now owns this memory */
num_msgs = cdbfr->len / sizeof(long);
cdb_free(cdbfr);
cdbfr->ptr = NULL; /* CtdlSetSeen() now owns this memory */
num_msgs = cdbfr->len / sizeof(long);
cdb_free(cdbfr);
- } else {
+ }
+ else {
return; /* No messages at all? No further action. */
}
return; /* No messages at all? No further action. */
}
@@
-1809,6
+1795,7
@@
void OutputRFC822MsgHeaders(
break;
case erFc822Addr:
safestrncpy(fuser, mptr, sizeof_fuser);
break;
case erFc822Addr:
safestrncpy(fuser, mptr, sizeof_fuser);
+ break;
case eRecipient:
if (haschar(mptr, '@') == 0) {
sanitize_truncated_recipient(mptr);
case eRecipient:
if (haschar(mptr, '@') == 0) {
sanitize_truncated_recipient(mptr);
@@
-2569,7
+2556,7
@@
long send_message(struct CtdlMessage *msg) {
/*
/*
- * Serialize a struct CtdlMessage into the format used on disk
and network
.
+ * Serialize a struct CtdlMessage into the format used on disk.
*
* This function loads up a "struct ser_ret" (defined in server.h) which
* contains the length of the serialized message and a pointer to the
*
* This function loads up a "struct ser_ret" (defined in server.h) which
* contains the length of the serialized message and a pointer to the
@@
-2659,7
+2646,7
@@
void ReplicationChecks(struct CtdlMessage *msg) {
* Save a message to disk and submit it into the delivery system.
*/
long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */
* Save a message to disk and submit it into the delivery system.
*/
long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */
-
recptypes *recps,
/* recipients (if mail) */
+
struct recptypes *recps,
/* recipients (if mail) */
const char *force /* force a particular room? */
) {
char hold_rm[ROOMNAMELEN];
const char *force /* force a particular room? */
) {
char hold_rm[ROOMNAMELEN];
@@
-2986,7
+2973,7
@@
long quickie_message(const char *from,
const char *subject)
{
struct CtdlMessage *msg;
const char *subject)
{
struct CtdlMessage *msg;
- recptypes *recp = NULL;
+
struct
recptypes *recp = NULL;
msg = malloc(sizeof(struct CtdlMessage));
memset(msg, 0, sizeof(struct CtdlMessage));
msg = malloc(sizeof(struct CtdlMessage));
memset(msg, 0, sizeof(struct CtdlMessage));