From 6ec7efc36f44dfddff4c9d843cd4c70cffb95837 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 17 Aug 2010 00:22:21 +0200 Subject: Many improvements to roster view --- src/gui/Contact.vala | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/gui/Contact.vala') diff --git a/src/gui/Contact.vala b/src/gui/Contact.vala index 4ced825..512c33f 100644 --- a/src/gui/Contact.vala +++ b/src/gui/Contact.vala @@ -20,6 +20,8 @@ public class Contact : Object { public Contact(string jid0, string? name0) { Object(jid: jid0, name: name0); + subscription = Subscription.NONE; + update_display_string(); } @@ -40,7 +42,7 @@ public class Contact : Object { if (name != null) display_string = name; else - display_string = jid; + display_string = jid.split("@", 2)[0]; } public Gee.Map.Entry? get_resource_with_highest_priority() { @@ -68,7 +70,15 @@ public class Contact : Object { } public enum Subscription { - BOTH + NONE, PENDING_OUT, PENDING_IN, PENDING_BOTH, TO, TO_PENDING_IN, FROM, FROM_PENDING_OUT, BOTH; + + public bool is_to() { + return (this == TO || this == TO_PENDING_IN || this == BOTH); + } + + public bool is_from() { + return (this == FROM || this == FROM_PENDING_OUT || this == BOTH); + } } public class Resource : Object { -- cgit v1.2.3