aboutsummaryrefslogtreecommitdiffstats
path: root/mail/message-list.c
diff options
context:
space:
mode:
authorSankarasivasubramanian Pasupathilingam <psankar@src.gnome.org>2008-09-30 15:59:12 +0800
committerSankarasivasubramanian Pasupathilingam <psankar@src.gnome.org>2008-09-30 15:59:12 +0800
commit4fd6e00afa491bd490f5c44f5abe6858b860e5ff (patch)
tree35e50a0856d4e4aad081a6e6d1a05e89a42417b7 /mail/message-list.c
parentdaed271924f589e8e500a74decf8a25276a283f4 (diff)
downloadgsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.tar
gsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.tar.gz
gsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.tar.bz2
gsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.tar.lz
gsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.tar.xz
gsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.tar.zst
gsoc2013-evolution-4fd6e00afa491bd490f5c44f5abe6858b860e5ff.zip
Added new column "Subject - Trimmed". Patch by hpj.
svn path=/trunk/; revision=36498
Diffstat (limited to 'mail/message-list.c')
-rw-r--r--mail/message-list.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index ab3b1c0922..4819528945 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1269,6 +1269,61 @@ get_all_labels (CamelMessageInfo *msg_info, char **label_str, gboolean get_tags)
return count;
}
+static const char *
+get_trimmed_subject (CamelMessageInfo *info)
+{
+ const char *subject;
+ const char *mlist;
+ int mlist_len = 0;
+ gboolean found_mlist;
+
+ subject = camel_message_info_subject (info);
+ if (!subject || !*subject)
+ return subject;
+
+ mlist = camel_message_info_mlist (info);
+
+ if (mlist && *mlist) {
+ const char *mlist_end;
+
+ mlist_end = strchr (mlist, '@');
+ if (mlist_end)
+ mlist_len = mlist_end - mlist;
+ else
+ mlist_len = strlen (mlist);
+ }
+
+ do {
+ found_mlist = FALSE;
+
+ while (!g_ascii_strncasecmp ((char *) subject, "Re:", 3)) {
+ subject += 3;
+
+ /* jump over any spaces */
+ while (*subject && isspace ((int) *subject))
+ subject++;
+ }
+
+ if (mlist_len &&
+ *subject == '[' &&
+ !g_ascii_strncasecmp ((char *) subject + 1, mlist, mlist_len) &&
+ subject [1 + mlist_len] == ']') {
+ subject += 1 + mlist_len + 1; /* jump over "[mailing-list]" */
+ found_mlist = TRUE;
+
+ /* jump over any spaces */
+ while (*subject && isspace ((int) *subject))
+ subject++;
+ }
+ } while (found_mlist);
+
+ /* jump over any spaces */
+ while (*subject && isspace ((int) *subject))
+ subject++;
+
+ return subject;
+}
+
static void *
ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
{
@@ -1353,6 +1408,12 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
case COL_SUBJECT:
str = camel_message_info_subject (msg_info);
return (void *)(str ? str : "");
+ case COL_SUBJECT_TRIMMED:
+ /* FIXME: "Trimmed subject" is not normalized yet.
+ I do not find a way in evo gui to configure the normalized columns like from_norm
+ Hence this FIXME should remain until we have a COL_SUBJECT_TRIMMED_NORM. */
+ str = get_trimmed_subject (msg_info);
+ return (void *)(str ? str : "");
case COL_SUBJECT_NORM:
return (void *) get_normalised_string (message_list, msg_info, col);
case COL_SENT: {