aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-04-26 00:20:27 +0200
committerfiaxh <git@lightrise.org>2020-04-26 00:20:27 +0200
commitaf52c24df7749923df897a2dd53c367a9f8ef31f (patch)
treede9bbeef864cc90b84bd9498c28240fc308ee319 /main/src
parentee9795d8f466706e06b2fdbc9beca2f8ecbf5d08 (diff)
downloaddino-af52c24df7749923df897a2dd53c367a9f8ef31f.tar.gz
dino-af52c24df7749923df897a2dd53c367a9f8ef31f.zip
Fix nick change in MUC, update bookmark accordingly; remove unused code
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/avatar_image.vala2
-rw-r--r--main/src/ui/chat_input/chat_input_controller.vala2
-rw-r--r--main/src/ui/conversation_selector/conversation_selector_row.vala17
-rw-r--r--main/src/ui/occupant_menu/list.vala17
4 files changed, 20 insertions, 18 deletions
diff --git a/main/src/ui/avatar_image.vala b/main/src/ui/avatar_image.vala
index ab64f5b9..b9366751 100644
--- a/main/src/ui/avatar_image.vala
+++ b/main/src/ui/avatar_image.vala
@@ -88,7 +88,7 @@ public class AvatarImage : Misc {
}
}
- private void on_show_received(Show show, Jid jid, Account account) {
+ private void on_show_received(Jid jid, Account account) {
if (!account.equals(this.account)) return;
update_avatar_if_jid(jid);
}
diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala
index 704cec94..aca47470 100644
--- a/main/src/ui/chat_input/chat_input_controller.vala
+++ b/main/src/ui/chat_input/chat_input_controller.vala
@@ -127,7 +127,7 @@ public class ChatInputController : Object {
}
return;
case "/nick":
- stream_interactor.get_module(MucManager.IDENTITY).change_nick(conversation.account, conversation.counterpart, token[1]);
+ stream_interactor.get_module(MucManager.IDENTITY).change_nick(conversation, token[1]);
return;
case "/ping":
Xmpp.XmppStream? stream = stream_interactor.get_stream(conversation.account);
diff --git a/main/src/ui/conversation_selector/conversation_selector_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala
index 467bed70..09de3c80 100644
--- a/main/src/ui/conversation_selector/conversation_selector_row.vala
+++ b/main/src/ui/conversation_selector/conversation_selector_row.vala
@@ -250,7 +250,8 @@ public class ConversationSelectorRow : ListBoxRow {
for (int i = 0; i < full_jids.size; i++) {
Jid full_jid = full_jids[i];
- Show show = stream_interactor.get_module(PresenceManager.IDENTITY).get_last_show(full_jid, conversation.account);
+ string? show = stream_interactor.get_module(PresenceManager.IDENTITY).get_last_show(full_jid, conversation.account);
+ if (show == null) continue;
Xep.ServiceDiscovery.Identity? identity = stream_interactor.get_module(EntityInfo.IDENTITY).get_identity(conversation.account, full_jid);
Image image = new Image() { hexpand=false, valign=Align.START, visible=true };
@@ -260,20 +261,20 @@ public class ConversationSelectorRow : ListBoxRow {
image.set_from_icon_name("dino-device-desktop-symbolic", IconSize.SMALL_TOOLBAR);
}
- if (show.as == Show.AWAY) {
+ if (show == Presence.Stanza.SHOW_AWAY) {
Util.force_color(image, "#FF9800");
- } else if (show.as == Show.XA || show.as == Show.DND) {
+ } else if (show == Presence.Stanza.SHOW_XA || show == Presence.Stanza.SHOW_DND) {
Util.force_color(image, "#FF5722");
} else {
Util.force_color(image, "#4CAF50");
}
string? status = null;
- if (show.as == Show.AWAY) {
+ if (show == Presence.Stanza.SHOW_AWAY) {
status = "away";
- } else if (show.as == Show.XA) {
+ } else if (show == Presence.Stanza.SHOW_XA) {
status = "not available";
- } else if (show.as == Show.DND) {
+ } else if (show == Presence.Stanza.SHOW_DND) {
status = "do not disturb";
}
@@ -288,9 +289,7 @@ public class ConversationSelectorRow : ListBoxRow {
continue;
}
if (status != null) {
- sb.append(" <i>(");
- sb.append(status);
- sb.append(")</i>");
+ sb.append(" <i>(").append(status).append(")</i>");
}
Label resource = new Label(sb.str) { use_markup=true, hexpand=true, xalign=0, visible=true };
diff --git a/main/src/ui/occupant_menu/list.vala b/main/src/ui/occupant_menu/list.vala
index ffa98f31..960b716b 100644
--- a/main/src/ui/occupant_menu/list.vala
+++ b/main/src/ui/occupant_menu/list.vala
@@ -27,7 +27,7 @@ public class List : Box {
search_entry.search_changed.connect(refilter);
stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect(on_show_received);
- stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect(on_updated_roster_item);
+ stream_interactor.get_module(PresenceManager.IDENTITY).received_offline_presence.connect(on_received_offline_presence);
initialize_for_conversation(conversation);
}
@@ -62,15 +62,18 @@ public class List : Box {
rows.unset(jid);
}
- private void on_updated_roster_item(Account account, Jid jid, Xmpp.Roster.Item roster_item) {
-
+ private void on_received_offline_presence(Jid jid, Account account) {
+ if (conversation != null && conversation.counterpart.equals_bare(jid) && jid.is_full()) {
+ if (rows.has_key(jid)) {
+ remove_occupant(jid);
+ }
+ list_box.invalidate_filter();
+ }
}
- private void on_show_received(Show show, Jid jid, Account account) {
+ private void on_show_received(Jid jid, Account account) {
if (conversation != null && conversation.counterpart.equals_bare(jid) && jid.is_full()) {
- if (show.as == Show.OFFLINE && rows.has_key(jid)) {
- remove_occupant(jid);
- } else if (show.as != Show.OFFLINE && !rows.has_key(jid)) {
+ if (!rows.has_key(jid)) {
add_occupant(jid);
}
list_box.invalidate_filter();