[gmime: 14/21] Removed g_mime_message_[get,set]_date_as_string()



commit 2951c752cbdba94d8fc4c1abb54ff835642658ff
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Sun Mar 26 07:15:13 2017 -0400

    Removed g_mime_message_[get,set]_date_as_string()

 PORTING                         |    3 ++
 docs/reference/changes-3.0.sgml |    1 +
 examples/imap-example.c         |    5 +--
 gmime/gmime-message.c           |   43 ---------------------------------------
 gmime/gmime-message.h           |    2 -
 5 files changed, 6 insertions(+), 48 deletions(-)
---
diff --git a/PORTING b/PORTING
index 963d18d..6740374 100644
--- a/PORTING
+++ b/PORTING
@@ -38,6 +38,9 @@ Porting from GMime 2.6 to GMime 3.0
   the subject into rfc2047 encoded-word tokens (if needed). Use `NULL` to
   get the old behavior of using a best-fit charset.
 
+- Removed g_mime_message_[get,set]_date_as_string(). This is unnecessary since
+  this can be done using g_mime_object_[get,set]_header().
+
 - g_mime_set_user_charsets() and g_mime_user_charsets() have been removed.
   All encoding API's now have a way to specify a charset to use and all
   decoder API's take a GMimeParserOptions argument that allows for
diff --git a/docs/reference/changes-3.0.sgml b/docs/reference/changes-3.0.sgml
index 08e9c7d..ba1015d 100644
--- a/docs/reference/changes-3.0.sgml
+++ b/docs/reference/changes-3.0.sgml
@@ -19,6 +19,7 @@
       <listitem><para><function>g_mime_message_get_recipients()</function> has been replaced by 
<function>g_mime_message_get_addresses()</function> which allows you to access the address lists of any 
address header.</para></listitem>
       <listitem><para><function>g_mime_message_add_recipient()</function> has been renamed to 
<function>g_mime_message_add_mailbox()</function> due to the fact that it can now be used to add mailbox 
addresses to the Sender, From, and Reply-To headers as well.</para></listitem>
       <listitem><para><function>g_mime_message_set_subject()</function> now takes a charset argument used 
when encoding the subject into rfc2047 encoded-word tokens (if needed). Use NULL to get the old behavior of 
using a best-fit charset.</para></listitem>
+      <listitem><para>Removed <function>g_mime_message_get_date_as_string()</para> and 
<function>g_mime_message_get_date_as_string()</function>. This is unnecessary since this can be done using 
<function>g_mime_object_get_header()</function> and <function>g_mime_object_set_header()</function>.
     </itemizedlist>
     <para>Cryptography related API changes:</para>
     <itemizedlist>
diff --git a/examples/imap-example.c b/examples/imap-example.c
index 106d6bd..4378e9f 100644
--- a/examples/imap-example.c
+++ b/examples/imap-example.c
@@ -131,9 +131,8 @@ write_part_bodystructure (GMimeObject *part, FILE *fp)
                /* print envelope */
                fputc ('(', fp);
                
-               nstring = g_mime_message_get_date_as_string (message);
-               fprintf (fp, "\"%s\" ", nstring);
-               g_free (nstring);
+               str = g_mime_object_get_header ((GMimeObject *) message, "Date");
+               fprintf (fp, "\"%s\" ", str);
                
                if ((str = g_mime_object_get_header ((GMimeObject *) message, "Subject")))
                        nstring = escape_string (str);
diff --git a/gmime/gmime-message.c b/gmime/gmime-message.c
index ad6f7e0..277d449 100644
--- a/gmime/gmime-message.c
+++ b/gmime/gmime-message.c
@@ -958,49 +958,6 @@ g_mime_message_get_date (GMimeMessage *message, time_t *date, int *tz_offset)
 
 
 /**
- * g_mime_message_get_date_as_string:
- * @message: A #GMimeMessage
- *
- * Gets the message's sent-date in string format.
- * 
- * Returns: a newly allocated string containing the Date header value.
- **/
-char *
-g_mime_message_get_date_as_string (GMimeMessage *message)
-{
-       g_return_val_if_fail (GMIME_IS_MESSAGE (message), NULL);
-       
-       return g_mime_utils_header_format_date (message->date, message->tz_offset);
-}
-
-
-/**
- * g_mime_message_set_date_as_string:
- * @message: A #GMimeMessage
- * @str: a date string
- *
- * Sets the sent-date of the message.
- **/
-void
-g_mime_message_set_date_as_string (GMimeMessage *message, const char *str)
-{
-       int tz_offset;
-       time_t date;
-       char *buf;
-       
-       g_return_if_fail (GMIME_IS_MESSAGE (message));
-       
-       date = g_mime_utils_header_decode_date (str, &tz_offset);
-       message->tz_offset = tz_offset;
-       message->date = date;
-       
-       buf = g_mime_utils_header_format_date (date, tz_offset);
-       g_mime_object_set_header ((GMimeObject *) message, "Date", buf, NULL);
-       g_free (buf);
-}
-
-
-/**
  * g_mime_message_set_message_id: 
  * @message: A #GMimeMessage
  * @message_id: message-id (addr-spec portion)
diff --git a/gmime/gmime-message.h b/gmime/gmime-message.h
index bd59f22..85a04ac 100644
--- a/gmime/gmime-message.h
+++ b/gmime/gmime-message.h
@@ -118,8 +118,6 @@ const char *g_mime_message_get_subject (GMimeMessage *message);
 
 void g_mime_message_set_date (GMimeMessage *message, time_t date, int tz_offset);
 void g_mime_message_get_date (GMimeMessage *message, time_t *date, int *tz_offset);
-void g_mime_message_set_date_as_string (GMimeMessage *message, const char *str);
-char *g_mime_message_get_date_as_string (GMimeMessage *message);
 
 void g_mime_message_set_message_id (GMimeMessage *message, const char *message_id);
 const char *g_mime_message_get_message_id (GMimeMessage *message);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]