X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmsgbase.c;h=081be8980a2aba77e5dd44121e083e57f8e4027e;hb=79d6eafd2a8bb379b3e13ff071a000d9bf36771b;hp=45be98173f3d0094642d1a7a9d87be586f1fef51;hpb=a4951de6e6b4115c2af3d8780182e363ab1a9adb;p=citadel.git diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 45be98173..081be8980 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -140,14 +140,12 @@ eMsgField FieldOrder[] = { 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')); } -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]); } @@ -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); @@ -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; @@ -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; @@ -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) { @@ -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]); @@ -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; @@ -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]); } @@ -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]); } @@ -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]; @@ -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) @@ -329,8 +317,7 @@ void CM_FreeContents(struct CtdlMessage *msg) /* * '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; @@ -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); @@ -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; @@ -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); - } else { + } + else { return; /* No messages at all? No further action. */ } @@ -1054,14 +1040,14 @@ void mime_download(char *name, char *filename, char *partnum, char *disp, ) { CC->download_fp = tmpfile(); if (CC->download_fp == NULL) { - syslog(LOG_EMERG, "msgbase: mime_download() couldn't write: %m"); + syslog(LOG_ERR, "msgbase: mime_download() couldn't write: %m"); cprintf("%d cannot open temporary file: %s\n", ERROR + INTERNAL_ERROR, strerror(errno)); return; } rv = fwrite(content, length, 1, CC->download_fp); if (rv <= 0) { - syslog(LOG_EMERG, "msgbase: mime_download() Couldn't write: %m"); + syslog(LOG_ERR, "msgbase: mime_download() Couldn't write: %m"); cprintf("%d unable to write tempfile.\n", ERROR + TOO_BIG); fclose(CC->download_fp); CC->download_fp = NULL; @@ -1809,6 +1795,7 @@ void OutputRFC822MsgHeaders( break; case erFc822Addr: safestrncpy(fuser, mptr, sizeof_fuser); + break; 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 @@ -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 */ - recptypes *recps, /* recipients (if mail) */ + struct recptypes *recps, /* recipients (if mail) */ 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; - recptypes *recp = NULL; + struct recptypes *recp = NULL; msg = malloc(sizeof(struct CtdlMessage)); memset(msg, 0, sizeof(struct CtdlMessage));