[balsa/70-libbalsa-message-structure] 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] message: Remove MESSAGE_COPY_CONTENT macro
- Date: Mon, 21 Mar 2022 21:40:59 +0000 (UTC)
commit ce42cdc74979b45fb56bea7a474dc1b516938834
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 6b1343a79..bd5fb771d 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
@@ -106,9 +107,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;
@@ -203,9 +202,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);
@@ -937,65 +934,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. */
@@ -1117,7 +1061,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);
@@ -1125,7 +1068,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);
@@ -1263,9 +1205,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;
@@ -1294,11 +1234,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,
@@ -1769,7 +1707,6 @@ libbalsa_message_set_has_all_headers(LibBalsaMessage *message,
}
-#if MESSAGE_COPY_CONTENT
void
libbalsa_message_set_length(LibBalsaMessage *message,
glong length)
@@ -1780,8 +1717,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 f8d7640df..0ba1ebf4b 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,
@@ -239,10 +237,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);
@@ -305,13 +299,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]