aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-09-23 05:56:38 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-09-23 05:56:38 +0800
commit3cb2a48944aaea3cb6e37a468a25d76c65ce544c (patch)
treec83997ea685eed29b17947f6754f2a546d484383 /mail
parent402c6cc0feb0c86d68aa5e5bbb117e61c77f859a (diff)
downloadgsoc2013-evolution-3cb2a48944aaea3cb6e37a468a25d76c65ce544c.tar
gsoc2013-evolution-3cb2a48944aaea3cb6e37a468a25d76c65ce544c.tar.gz
gsoc2013-evolution-3cb2a48944aaea3cb6e37a468a25d76c65ce544c.tar.bz2
gsoc2013-evolution-3cb2a48944aaea3cb6e37a468a25d76c65ce544c.tar.lz
gsoc2013-evolution-3cb2a48944aaea3cb6e37a468a25d76c65ce544c.tar.xz
gsoc2013-evolution-3cb2a48944aaea3cb6e37a468a25d76c65ce544c.tar.zst
gsoc2013-evolution-3cb2a48944aaea3cb6e37a468a25d76c65ce544c.zip
New comparison function for email addresses. (subject_compare): New
2000-09-22 Jeffrey Stedfast <fejj@helixcode.com> * message-list.c (address_compare): New comparison function for email addresses. (subject_compare): New comparison function for message subjects. (message_list_init_header): Updated to use the new compare funcs. svn path=/trunk/; revision=5554
Diffstat (limited to 'mail')
-rw-r--r--mail/message-list.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/mail/message-list.c b/mail/message-list.c
index 32ad726cef..e0694cbc6b 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -231,12 +231,19 @@ address_compare (gconstpointer address1, gconstpointer address2)
ia1 = internet_address_new_from_string ((const char *) address1);
ia2 = internet_address_new_from_string ((const char *) address2);
- if (!ia1->name || !ia2->name) {
- /* if one or the other doesn't have a name we should compare addresses */
+ if (!ia1->name && !ia2->name) {
+ /* if neither has a name we should compare addresses */
retval = g_strcasecmp (ia1->address, ia2->address);
} else {
- /* FIXME: compare last names...then first names if last names are the same? */
- retval = g_strcasecmp (ia1->name, ia2->name);
+ if (!ia1->name)
+ retval = -1;
+ else if (!ia2->name)
+ retval = 1;
+ else {
+ /* FIXME: use Nat's e-western-name parser
+ * so we can compare last name then first */
+ retval = g_strcasecmp (ia1->name, ia2->name);
+ }
}
internet_address_destroy (ia1);
@@ -253,13 +260,23 @@ subject_compare (gconstpointer subject1, gconstpointer subject2)
/* trim off any "Re:"'s at the beginning of subject1 */
sub1 = (char *) subject1;
- while (!g_strncasecmp (sub1, "Re:", 3))
+ while (!g_strncasecmp (sub1, "Re:", 3)) {
sub1 += 3;
+ /* jump over any spaces */
+ for ( ; *sub1 && isspace (*sub1); sub1++);
+ }
/* trim off any "Re:"'s at the beginning of subject2 */
sub2 = (char *) subject2;
- while (!g_strncasecmp (sub2, "Re:", 3))
+ while (!g_strncasecmp (sub2, "Re:", 3)) {
sub2 += 3;
+ /* jump over any spaces */
+ for ( ; *sub2 && isspace (*sub2); sub2++);
+ }
+
+ /* jump over any spaces */
+ for ( ; *sub1 && isspace (*sub1); sub1++);
+ for ( ; *sub2 && isspace (*sub2); sub2++);
return g_strcasecmp (sub1, sub2);
}