aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/add_conversation
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-04-23 13:50:32 +0200
committerfiaxh <git@mx.ax.lt>2017-04-23 14:03:44 +0200
commit3eb9aa0fa79ea9fcebb5f702f81c2e54aafdc8cc (patch)
tree01d04b731296a807285621ad628e79e48ef3c077 /main/src/ui/add_conversation
parent5c8275ed4efdc7a3a0bc2a9c3a3f46d0383ddcf4 (diff)
downloaddino-3eb9aa0fa79ea9fcebb5f702f81c2e54aafdc8cc.tar.gz
dino-3eb9aa0fa79ea9fcebb5f702f81c2e54aafdc8cc.zip
Sync MUC join/part behaviour with autojoin flag in bookmarks
Diffstat (limited to 'main/src/ui/add_conversation')
-rw-r--r--main/src/ui/add_conversation/chat/roster_list.vala11
-rw-r--r--main/src/ui/add_conversation/conference/conference_list.vala12
2 files changed, 13 insertions, 10 deletions
diff --git a/main/src/ui/add_conversation/chat/roster_list.vala b/main/src/ui/add_conversation/chat/roster_list.vala
index c395dc3a..d09720d5 100644
--- a/main/src/ui/add_conversation/chat/roster_list.vala
+++ b/main/src/ui/add_conversation/chat/roster_list.vala
@@ -11,7 +11,7 @@ protected class RosterList : FilterableList {
public signal void conversation_selected(Conversation? conversation);
private StreamInteractor stream_interactor;
- private HashMap<Jid, ListRow> rows = new HashMap<Jid, ListRow>(Jid.hash_func, Jid.equals_func);
+ private HashMap<Account, HashMap<Jid, ListRow>> rows = new HashMap<Account, HashMap<Jid, ListRow>>(Account.hash_func, Account.equals_func);
public RosterList(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
@@ -26,6 +26,7 @@ protected class RosterList : FilterableList {
Idle.add(() => { on_updated_roster_item(account, jid, roster_item); return false;});});
foreach (Account account in stream_interactor.get_accounts()) {
+ rows[account] = new HashMap<Jid, ListRow>(Jid.hash_func, Jid.equals_func);
foreach (Roster.Item roster_item in stream_interactor.get_module(RosterManager.IDENTITY).get_roster(account)) {
on_updated_roster_item(account, new Jid(roster_item.jid), roster_item);
}
@@ -33,16 +34,16 @@ protected class RosterList : FilterableList {
}
private void on_removed_roster_item(Account account, Jid jid, Roster.Item roster_item) {
- if (rows.has_key(jid)) {
- remove(rows[jid]);
- rows.unset(jid);
+ if (rows.has_key(account) && rows[account].has_key(jid)) {
+ remove(rows[account][jid]);
+ rows[account].unset(jid);
}
}
private void on_updated_roster_item(Account account, Jid jid, Roster.Item roster_item) {
on_removed_roster_item(account, jid, roster_item);
ListRow row = new ListRow.from_jid(stream_interactor, new Jid(roster_item.jid), account);
- rows[jid] = row;
+ rows[account][jid] = row;
add(row);
invalidate_sort();
invalidate_filter();
diff --git a/main/src/ui/add_conversation/conference/conference_list.vala b/main/src/ui/add_conversation/conference/conference_list.vala
index d11271d8..ac74fa3a 100644
--- a/main/src/ui/add_conversation/conference/conference_list.vala
+++ b/main/src/ui/add_conversation/conference/conference_list.vala
@@ -11,7 +11,7 @@ protected class ConferenceList : FilterableList {
public signal void conversation_selected(Conversation? conversation);
private StreamInteractor stream_interactor;
- private HashMap<Account, ArrayList<Xep.Bookmarks.Conference>> lists = new HashMap<Account, ArrayList<Xep.Bookmarks.Conference>>();
+ private HashMap<Account, Gee.List<Xep.Bookmarks.Conference>> lists = new HashMap<Account, Gee.List<Xep.Bookmarks.Conference>>();
public ConferenceList(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
@@ -42,7 +42,7 @@ protected class ConferenceList : FilterableList {
}
}
- private static void on_conference_bookmarks_received(Core.XmppStream stream, ArrayList<Xep.Bookmarks.Conference> conferences, Object? o) {
+ private static void on_conference_bookmarks_received(Core.XmppStream stream, Gee.List<Xep.Bookmarks.Conference> conferences, Object? o) {
Idle.add(() => {
Tuple<ConferenceList, Account> tuple = o as Tuple<ConferenceList, Account>;
ConferenceList list = tuple.a;
@@ -89,13 +89,15 @@ internal class ConferenceListRow : ListRow {
this.account = account;
this.bookmark = bookmark;
- if (bookmark.name != "" && bookmark.name != bookmark.jid) {
- name_label.label = bookmark.name;
+ name_label.label = bookmark.name ?? bookmark.jid;
+ if (stream_interactor.get_accounts().size > 1) {
+ via_label.label = "via " + account.bare_jid.to_string();
+ } else if (bookmark.name != null && bookmark.name != bookmark.jid) {
via_label.label = bookmark.jid;
} else {
- name_label.label = bookmark.jid;
via_label.visible = false;
}
+
image.set_from_pixbuf((new AvatarGenerator(35, 35)).set_stateless(true).draw_jid(stream_interactor, jid, account));
}
}