[balsa/70-libbalsa-message-structure: 17/18] message: Remove MESSAGE_COPY_CONTENT macro
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/70-libbalsa-message-structure: 17/18] message: Remove MESSAGE_COPY_CONTENT macro
- Date: Wed, 6 Apr 2022 18:10:18 +0000 (UTC)
commit fb644fba7f625bebc99aca3179622b04ed73dc76
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Mon Mar 21 17:39:05 2022 -0400
message: Remove MESSAGE_COPY_CONTENT macro
and the code that was compiled conditionally on !defined(MESSAGE_COPY_CONTENT).
libbalsa/message.c | 67 +-----------------------------------------------------
libbalsa/message.h | 11 ---------
2 files changed, 1 insertion(+), 77 deletions(-)
---
diff --git a/libbalsa/message.c b/libbalsa/message.c
index 24f6f0faf..84f953c53 100644
--- a/libbalsa/message.c
+++ b/libbalsa/message.c
@@ -26,6 +26,7 @@
- Lack of inline functions in C increases program complexity. This cost
can be accepted.
- thorough analysis of memory usage is needed.
+ 2022-03-21: All code conditional on MESSAGE_COPY_CONTENT is removed.
*/
#if defined(HAVE_CONFIG_H) && HAVE_CONFIG_H
@@ -115,9 +116,7 @@ struct _LibBalsaMessage {
guint msgno; /* message no; always copy for faster sorting;
* counting starts at 1. */
-#if MESSAGE_COPY_CONTENT
glong length; /* byte len */
-#endif /* MESSAGE_COPY_CONTENT */
/* GPG sign and/or encrypt message (sending) */
guint gpg_mode;
@@ -216,9 +215,7 @@ libbalsa_message_finalize(GObject * object)
g_free(message->message_id);
g_free(message->subtype);
-#if MESSAGE_COPY_CONTENT
g_free(message->subj);
-#endif /* MESSAGE_COPY_CONTENT */
libbalsa_message_body_free(message->body_list);
@@ -950,65 +947,12 @@ libbalsa_message_set_dispnotify(LibBalsaMessage * message,
/* libbalsa_message_get_subject:
get constant pointer to the subject of the message;
*/
-#ifdef MESSAGE_COPY_CONTENT
const gchar *
libbalsa_message_get_subject(LibBalsaMessage *message)
{
return message->subj != NULL ? message->subj : _("(No subject)");
}
-
-#else /* MESSAGE_COPY_CONTENT */
-const gchar *
-libbalsa_message_get_subject(LibBalsaMessage* msg)
-{
- const gchar *ret;
- if(msg->subj == NULL &&
- msg->mime_msg != NULL && msg->mailbox != NULL) { /* a message in a mailbox... */
- g_return_val_if_fail(MAILBOX_OPEN(msg->mailbox), NULL);
- ret = g_mime_message_get_subject(msg->mime_msg);
- libbalsa_message_set_subject_from_header(msg, ret);
- } else
- ret = msg->subj;
-
- return ret ? ret : _("(No subject)");
-}
-
-
-guint
-libbalsa_message_get_lines(LibBalsaMessage* msg)
-{
- /* set the line count */
- const char *value;
- if (msg->mime_msg == NULL)
- return 0;
- value = g_mime_object_get_header(msg->mime_msg, "Lines");
- if (value == NULL)
- return 0;
- return atoi(value);
-}
-glong
-libbalsa_message_get_length(LibBalsaMessage* msg)
-{
- /* set the length */
- const char *value;
- if (msg->mime_msg == NULL)
- return 0;
- value = g_mime_object_get_header(msg->mime_msg, "Content-Length");
- if (value == NULL)
- return 0;
- return atoi(value);
-}
-
-glong
-libbalsa_message_get_no(LibBalsaMessage* msg)
-{
- return msg->msgno;
-}
-
-
-#endif /* MESSAGE_COPY_CONTENT */
-
/* Populate headers from mime_msg, but only the members that are needed
* all the time. */
@@ -1130,7 +1074,6 @@ libbalsa_message_init_from_gmime(LibBalsaMessage * message,
g_return_if_fail(LIBBALSA_IS_MESSAGE(message));
g_return_if_fail(GMIME_IS_MESSAGE(mime_msg));
-#ifdef MESSAGE_COPY_CONTENT
header = g_mime_message_get_subject(mime_msg);
libbalsa_message_set_subject_from_header(message, header);
@@ -1138,7 +1081,6 @@ libbalsa_message_init_from_gmime(LibBalsaMessage * message,
if (header)
message->length = atoi(header);
-#endif /* MESSAGE_COPY_CONTENT */
header = g_mime_message_get_message_id(mime_msg);
if (header)
message->message_id = g_strdup(header);
@@ -1276,9 +1218,7 @@ lbmsg_set_header(LibBalsaMessage *message,
g_free(val);
return FALSE;
}
-#if MESSAGE_COPY_CONTENT
libbalsa_message_set_subject_from_header(message, value);
-#endif /* MESSAGE_COPY_CONTENT */
} else if (g_ascii_strcasecmp(name, "Date") == 0) {
GDateTime *datetime;
@@ -1307,11 +1247,9 @@ lbmsg_set_header(LibBalsaMessage *message,
(g_ascii_strcasecmp(name, "Disposition-Notification-To") == 0)) {
headers->dispnotify_to = internet_address_list_parse(libbalsa_parser_options(), value);
} else
-#ifdef MESSAGE_COPY_CONTENT
if (g_ascii_strcasecmp(name, "Content-Length") == 0) {
message->length = atoi(value);
} else
-#endif /* MESSAGE_COPY_CONTENT */
if (all) {
headers->user_hdrs =
g_list_prepend(headers->user_hdrs,
@@ -1782,7 +1720,6 @@ libbalsa_message_set_has_all_headers(LibBalsaMessage *message,
}
-#if MESSAGE_COPY_CONTENT
void
libbalsa_message_set_length(LibBalsaMessage *message,
glong length)
@@ -1793,8 +1730,6 @@ libbalsa_message_set_length(LibBalsaMessage *message,
}
-#endif /* MESSAGE_COPY_CONTENT */
-
void
libbalsa_message_set_mime_message(LibBalsaMessage *message,
GMimeMessage *mime_message)
diff --git a/libbalsa/message.h b/libbalsa/message.h
index b54f368a1..4a396180a 100644
--- a/libbalsa/message.h
+++ b/libbalsa/message.h
@@ -33,8 +33,6 @@
#include "rfc3156.h"
-#define MESSAGE_COPY_CONTENT 1
-
#define LIBBALSA_TYPE_MESSAGE libbalsa_message_get_type()
G_DECLARE_FINAL_TYPE(LibBalsaMessage,
@@ -262,10 +260,6 @@ void libbalsa_message_set_subject_from_header(LibBalsaMessage * message,
function out if we find a way.
*/
const gchar* libbalsa_message_get_subject(LibBalsaMessage* message);
-#ifndef MESSAGE_COPY_CONTENT
-guint libbalsa_message_get_lines(LibBalsaMessage* msg);
-glong libbalsa_message_get_length(LibBalsaMessage* msg);
-#endif /* !MESSAGE_COPY_CONTENT */
glong libbalsa_message_get_no(LibBalsaMessage* msg);
LibBalsaMessageAttach libbalsa_message_get_attach_icon(LibBalsaMessage *
message);
@@ -328,13 +322,8 @@ void libbalsa_message_set_msgno(LibBalsaMessage *message,
guint msgno);
void libbalsa_message_set_has_all_headers(LibBalsaMessage *message,
gboolean has_all_headers);
-
-#if MESSAGE_COPY_CONTENT
void libbalsa_message_set_length(LibBalsaMessage *message,
glong length);
-
-#endif /* MESSAGE_COPY_CONTENT */
-
void libbalsa_message_set_mime_message(LibBalsaMessage *message,
GMimeMessage *mime_message);
void libbalsa_message_set_sender(LibBalsaMessage *message,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]