summaryrefslogtreecommitdiff
path: root/libmu_scm
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2001-08-18 17:30:13 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2001-08-18 17:30:13 +0000
commit55dfffacc957af32b017b1e3dcefbb7d59743f89 (patch)
treef9e0de64fe830a93f9740f2fcab0027119cea243 /libmu_scm
parent17c5c45bfd3c8bb8aa82e6f7ddb46a435f4ac1da (diff)
downloadmailutils-55dfffacc957af32b017b1e3dcefbb7d59743f89.tar.gz
mailutils-55dfffacc957af32b017b1e3dcefbb7d59743f89.tar.bz2
mu_scm_message_add_owner() - add new object to the owner chain of the message.
Diffstat (limited to 'libmu_scm')
-rw-r--r--libmu_scm/mu_message.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/libmu_scm/mu_message.c b/libmu_scm/mu_message.c
index 5f4cd3652..4f4d30523 100644
--- a/libmu_scm/mu_message.c
+++ b/libmu_scm/mu_message.c
@@ -22,7 +22,7 @@ long message_tag;
struct mu_message
{
message_t msg; /* Message itself */
- SCM mbox; /* Mailbox it belong to */
+ SCM mbox; /* Mailbox it belongs to */
};
/* SMOB functions: */
@@ -39,8 +39,6 @@ mu_scm_message_free (SCM message_smob)
{
struct mu_message *mum = (struct mu_message *) SCM_CDR (message_smob);
free (mum);
- /* NOTE: Currently there is no way for this function to return the
- amount of memory *actually freed* by mailbox_destroy */
return sizeof (struct mu_message);
}
@@ -122,6 +120,33 @@ mu_scm_message_create (SCM owner, message_t msg)
SCM_RETURN_NEWSMOB (message_tag, mum);
}
+void
+mu_scm_message_add_owner (SCM MESG, SCM owner)
+{
+ struct mu_message *mum = (struct mu_message *) SCM_CDR (MESG);
+ SCM cell;
+
+ if (SCM_IMP (mum->mbox) && SCM_BOOLP (mum->mbox))
+ {
+ mum->mbox = owner;
+ return;
+ }
+
+ SCM_NEWCELL (cell);
+ SCM_SETCAR (cell, owner);
+ if (SCM_NIMP (mum->mbox) && SCM_CONSP (mum->mbox))
+ SCM_SETCDR (cell, mum->mbox);
+ else
+ {
+ SCM scm;
+ SCM_NEWCELL (scm);
+ SCM_SETCAR (scm, mum->mbox);
+ SCM_SETCDR (scm, SCM_EOL);
+ SCM_SETCDR (cell, scm);
+ }
+ mum->mbox = cell;
+}
+
const message_t
mu_scm_message_get (SCM MESG)
{
@@ -330,7 +355,7 @@ SCM_DEFINE (mu_message_get_header_fields, "mu-message-get-header-fields", 1, 1,
message_t msg;
header_t hdr = NULL;
SCM scm_first = SCM_EOL, scm_last;
- SCM headers = NULL;
+ SCM headers = SCM_EOL;
SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME);
msg = mu_scm_message_get (MESG);
@@ -349,7 +374,7 @@ SCM_DEFINE (mu_message_get_header_fields, "mu-message-get-header-fields", 1, 1,
char *name, *value;
header_aget_field_name (hdr, i, &name);
- if (headers && string_sloppy_member (headers, name) == 0)
+ if (headers != SCM_EOL && string_sloppy_member (headers, name) == 0)
continue;
header_aget_field_value (hdr, i, &value);

Return to:

Send suggestions and report system problems to the System administrator.