summaryrefslogtreecommitdiff
path: root/guile
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2022-03-19 18:56:10 +0200
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2022-03-26 17:19:10 +0200
commit4c4fb1759f2991f11d8887e35ac5b70e87ef9b5c (patch)
tree99d21a956e50dbaa43372ca5566ecd21e4c755c3 /guile
parent7774261526e1b5bdd2d7bad48279d0c2d444325e (diff)
message: move to lib/message, update naming
Basically, move/rename lib/mu-message* to lib/mu-*. Add the beginnings of a Message class.
Diffstat (limited to 'guile')
-rw-r--r--guile/mu-guile-message.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/guile/mu-guile-message.cc b/guile/mu-guile-message.cc
index 25fd12d..a80f4d5 100644
--- a/guile/mu-guile-message.cc
+++ b/guile/mu-guile-message.cc
@@ -18,7 +18,7 @@
*/
#include "mu-guile-message.hh"
#include "libguile/scm.h"
-#include "mu-message-flags.hh"
+#include "mu-message.hh"
#include <config.h>
#include <glib-object.h>
@@ -213,12 +213,12 @@ SCM_DEFINE(get_field,
#undef FUNC_NAME
static SCM
-contacts_to_list(MuMsg *msg, Mu::MessageContact::Type mtype)
+contacts_to_list(MuMsg *msg, std::optional<Field::Id> field_id)
{
SCM list{SCM_EOL};
- const auto contacts{mu_msg_get_contacts(msg, mtype)};
- for (auto&& contact: mu_msg_get_contacts(msg, mtype)) {
+ const auto contacts{mu_msg_get_contacts(msg, field_id)};
+ for (auto&& contact: mu_msg_get_contacts(msg, field_id)) {
SCM item{scm_list_1(
scm_cons(mu_guile_scm_from_str(contact.name.c_str()),
mu_guile_scm_from_str(contact.email.c_str())))};
@@ -239,7 +239,7 @@ SCM_DEFINE(get_contacts,
{
MuMsgWrapper* msgwrap;
SCM list;
- Mu::MessageContact::Type mtype;
+
MU_GUILE_INITIALIZED_OR_ERROR;
@@ -252,17 +252,18 @@ SCM_DEFINE(get_contacts,
if (CONTACT_TYPE == SCM_BOOL_F)
return SCM_UNSPECIFIED; /* nothing to do */
+ std::optional<Field::Id> field_id;
if (CONTACT_TYPE == SCM_BOOL_T)
- mtype = Mu::MessageContact::Type::Unknown; /* get all */
+ field_id = {}; /* get all */
else {
if (scm_is_eq(CONTACT_TYPE, SYMB_CONTACT_TO))
- mtype = Mu::MessageContact::Type::To;
+ field_id = Field::Id::To;
else if (scm_is_eq(CONTACT_TYPE, SYMB_CONTACT_CC))
- mtype = Mu::MessageContact::Type::Cc;
+ field_id = Field::Id::Cc;
else if (scm_is_eq(CONTACT_TYPE, SYMB_CONTACT_BCC))
- mtype = Mu::MessageContact::Type::Bcc;
+ field_id = Field::Id::Bcc;
else if (scm_is_eq(CONTACT_TYPE, SYMB_CONTACT_FROM))
- mtype = Mu::MessageContact::Type::From;
+ field_id = Field::Id::From;
else {
mu_guile_error(FUNC_NAME, 0, "invalid contact type", SCM_UNDEFINED);
return SCM_UNSPECIFIED;
@@ -273,7 +274,7 @@ SCM_DEFINE(get_contacts,
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
- list = contacts_to_list(msgwrap->_msg, mtype);
+ list = contacts_to_list(msgwrap->_msg, field_id);
#pragma GCC diagnostic pop
/* explicitly close the file backend, so we won't run out of fds */