* src/procmsg.c
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 19 Jul 2003 18:41:15 +0000 (18:41 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 19 Jul 2003 18:41:15 +0000 (18:41 +0000)
* src/compose.c
* src/common/utils.[ch]
subject_get_reply_prefix_length() <- subject_get_prefix_length()

ChangeLog.claws
configure.ac
src/common/utils.c
src/common/utils.h
src/compose.c
src/procmsg.c

index 8bca5e5..2911bc0 100644 (file)
@@ -1,3 +1,10 @@
+2003-07-19 [alfons]    0.9.3claws30
+
+       * src/procmsg.c
+       * src/compose.c
+       * src/common/utils.[ch]
+               subject_get_reply_prefix_length() <- subject_get_prefix_length()
+
 2003-07-19 [alfons]    0.9.3claws29
 
        * src/prefs_folder_item.c
index 42bbce7..a76cfee 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=29
+EXTRA_VERSION=30
 VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}claws${EXTRA_VERSION}
 
 dnl set $target
index dd29497..9950bd2 100644 (file)
@@ -582,7 +582,7 @@ void trim_subject_for_compare(gchar *str)
        eliminate_parenthesis(str, '(', ')');
        g_strstrip(str);
 
-       srcp = str + subject_get_reply_prefix_length(str);
+       srcp = str + subject_get_prefix_length(str);
        if (srcp != str)
                memmove(str, srcp, strlen(srcp) + 1);
 }
@@ -593,7 +593,7 @@ void trim_subject_for_sort(gchar *str)
 
        g_strstrip(str);
 
-       srcp = str + subject_get_reply_prefix_length(str);
+       srcp = str + subject_get_prefix_length(str);
        if (srcp != str)        
                memmove(str, srcp, strlen(srcp) + 1);
 }
@@ -604,7 +604,7 @@ void trim_subject(gchar *str)
        gchar op, cl;
        gint in_brace;
 
-       destp = str + subject_get_reply_prefix_length(str);
+       destp = str + subject_get_prefix_length(str);
 
        if (*destp == '[') {
                op = '[';
@@ -3254,7 +3254,7 @@ void * subject_table_lookup(GHashTable *subject_table, gchar * subject)
        if (subject == NULL)
                subject = "";
        else
-               subject += subject_get_reply_prefix_length(subject);
+               subject += subject_get_prefix_length(subject);
 
        return g_hash_table_lookup(subject_table, subject);
 }
@@ -3264,7 +3264,7 @@ void subject_table_insert(GHashTable *subject_table, gchar * subject,
 {
        if (subject == NULL || *subject == 0)
                return;
-       subject += subject_get_reply_prefix_length(subject);
+       subject += subject_get_prefix_length(subject);
        g_hash_table_insert(subject_table, subject, data);
 }
 
@@ -3273,13 +3273,13 @@ void subject_table_remove(GHashTable *subject_table, gchar * subject)
        if (subject == NULL)
                return;
 
-       subject += subject_get_reply_prefix_length(subject);    
+       subject += subject_get_prefix_length(subject);  
        g_hash_table_remove(subject_table, subject);
 }
 
 /*!
  *\brief       Check if a string is prefixed with known (combinations) 
- *             of reply prefixes. The function assumes that each prefix 
+ *             of prefixes. The function assumes that each prefix 
  *             is terminated by zero or exactly _one_ space.
  *
  *\param       str String to check for a prefixes
@@ -3288,20 +3288,21 @@ void subject_table_remove(GHashTable *subject_table, gchar * subject)
  *             for a "clean" subject line. If no prefix was found, 0
  *             is returned.
  */            
-int subject_get_reply_prefix_length(const gchar *subject)
+int subject_get_prefix_length(const gchar *subject)
 {
        /*!< Array with allowable reply prefixes regexps. */
-       static const gchar * const reply_prefixes[] = {
+       static const gchar * const prefixes[] = {
                "Re\\:",                        /* "Re:" */
                "Re\\[[1-9][0-9]*\\]\\:",       /* "Re[XXX]:" (non-conforming news mail clients) */
                "Antw\\:",                      /* "Antw:" (Dutch / German Outlook) */
                "Aw\\:",                        /* "Aw:"   (German) */
                "Antwort\\:",                   /* "Antwort:" (German Lotus Notes) */
                "Res\\:",                       /* "Res:" (Brazilian Outlook) */
-               "Fw\\:"                         /* "Fw:" Forward */
+               "Fw\\:",                        /* "Fw:" Forward */
+               "Enc\\:"                        /* "Enc:" Forward (Brazilian Outlook) */
                /* add more */
        };
-       const int REPLY_PREFIXES = sizeof reply_prefixes / sizeof reply_prefixes[0];
+       const int PREFIXES = sizeof prefixes / sizeof prefixes[0];
        int n;
        regmatch_t pos;
        static regex_t regex;
@@ -3313,12 +3314,12 @@ int subject_get_reply_prefix_length(const gchar *subject)
        if (!init_) {
                GString *s = g_string_new("");
                
-               for (n = 0; n < REPLY_PREFIXES; n++)
+               for (n = 0; n < PREFIXES; n++)
                        /* Terminate each prefix regexpression by a
                         * "\ ?" (zero or ONE space), and OR them */
                        g_string_sprintfa(s, "(%s\\ ?)%s",
-                                         reply_prefixes[n],
-                                         n < REPLY_PREFIXES - 1 ? 
+                                         prefixes[n],
+                                         n < PREFIXES - 1 ? 
                                          "|" : "");
                
                g_string_prepend(s, "(");
index 725cd5a..3de9bae 100644 (file)
@@ -411,7 +411,7 @@ void * subject_table_lookup(GHashTable *subject_table, gchar * subject);
 void subject_table_insert(GHashTable *subject_table, gchar * subject,
                          void * data);
 void subject_table_remove(GHashTable *subject_table, gchar * subject);
-gint subject_get_reply_prefix_length (const gchar *subject);
+gint subject_get_prefix_length (const gchar *subject);
 
 /* The following macros have the same preconditions as the cleanless
  * functions above, but work with clean subjects (subject lines already
index 976f71d..3e85215 100644 (file)
@@ -1041,7 +1041,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                gchar *buf, *buf2, *p;
 
                buf = p = g_strdup(msginfo->subject);
-               p += subject_get_reply_prefix_length(p);
+               p += subject_get_prefix_length(p);
                memmove(buf, p, strlen(p) + 1);
 
                buf2 = g_strdup_printf("Fw: %s", buf);
@@ -1799,7 +1799,7 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
                gchar *buf, *buf2, *p;
 
                buf = p = g_strdup(msginfo->subject);
-               p += subject_get_reply_prefix_length(p);
+               p += subject_get_prefix_length(p);
                memmove(buf, p, strlen(p) + 1);
 
                buf2 = g_strdup_printf("Re: %s", buf);
index 2fdd925..e42b1cd 100644 (file)
@@ -194,7 +194,7 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
                        GNode *found_subject = NULL;
                        
                        subject  = msginfo->subject;
-                       subject += subject_get_reply_prefix_length(subject);
+                       subject += subject_get_prefix_length(subject);
                        found_subject = subject_table_lookup_clean
                                        (subject_table, (gchar *) subject);
                                                                           
@@ -239,7 +239,7 @@ GNode *procmsg_get_thread_tree(GSList *mlist)
                for (node = last; node && node != NULL;) {
                        next = node->prev;
                        msginfo = (MsgInfo *) node->data;
-                       subject = msginfo->subject + subject_get_reply_prefix_length(msginfo->subject);
+                       subject = msginfo->subject + subject_get_prefix_length(msginfo->subject);
                        
                        /* may not parentize if parent was delivered after childs */
                        if (subject != msginfo->subject)