aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/add_conversation/list_row.vala
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/add_conversation/list_row.vala')
-rw-r--r--main/src/ui/add_conversation/list_row.vala17
1 files changed, 17 insertions, 0 deletions
diff --git a/main/src/ui/add_conversation/list_row.vala b/main/src/ui/add_conversation/list_row.vala
index c5e344d0..8ba9c4cd 100644
--- a/main/src/ui/add_conversation/list_row.vala
+++ b/main/src/ui/add_conversation/list_row.vala
@@ -11,6 +11,7 @@ public class ListRow : Widget {
public Grid outer_grid;
public AvatarPicture picture;
public Label name_label;
+ public Label status_label;
public Label via_label;
public Jid? jid;
@@ -21,6 +22,7 @@ public class ListRow : Widget {
outer_grid = (Grid) builder.get_object("outer_grid");
picture = (AvatarPicture) builder.get_object("picture");
name_label = (Label) builder.get_object("name_label");
+ status_label = (Label) builder.get_object("status_label");
via_label = (Label) builder.get_object("via_label");
this.layout_manager = new BinLayout();
@@ -46,6 +48,21 @@ public class ListRow : Widget {
}
name_label.label = display_name;
picture.model = new ViewModel.CompatAvatarPictureModel(stream_interactor).set_conversation(conv);
+ Gee.List<Jid>? full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(jid, account);
+ if (full_jids != null){
+ for (int i = 0; i < full_jids.size; i++) {
+ Jid full_jid = full_jids[i];
+ string? presence_str = stream_interactor.get_module(PresenceManager.IDENTITY).get_last_show(full_jid, account);
+ switch(presence_str){
+ case "online": status_label.label = "<span color='green'>" + _("Online") + "</span>"; break;
+ case "xa": status_label.label = "<span color='orange'>" + _("Extended Away") + "</span>"; break;
+ case "away": status_label.label = "<span color='orange'>" + _("Away") + "</span>"; break;
+ case "chat": status_label.label = "<span color='cyan'>" + _("Chatting") +"</span>"; break;
+ case "dnd": status_label.label = "<span color='red'>" + _("Do not disturb") + "</span>"; break;
+ }
+ }
+ }
+ else status_label.label = "<span color='grey'>Offline</span>";
}
public override void dispose() {