diff options
author | Marvin W <git@larma.de> | 2018-01-12 21:03:09 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2018-01-28 00:38:47 +0100 |
commit | 782ae4c049e2b6fab13d7453cbb0e74610e7d200 (patch) | |
tree | 1b4cd0a1689cee0c2e2cac2ae9a5fb8ebbe63621 /main/src/ui/add_conversation | |
parent | d46d071e57e599e8cfb1780597cbecb36881c4d8 (diff) | |
download | dino-782ae4c049e2b6fab13d7453cbb0e74610e7d200.tar.gz dino-782ae4c049e2b6fab13d7453cbb0e74610e7d200.zip |
Move Jid class to xmpp-vala, partially refactor namespace
Diffstat (limited to 'main/src/ui/add_conversation')
9 files changed, 22 insertions, 11 deletions
diff --git a/main/src/ui/add_conversation/add_conference_dialog.vala b/main/src/ui/add_conversation/add_conference_dialog.vala index d840ff2a..f6597505 100644 --- a/main/src/ui/add_conversation/add_conference_dialog.vala +++ b/main/src/ui/add_conversation/add_conference_dialog.vala @@ -2,6 +2,7 @@ using Gee; using Gtk; using Dino.Entities; +using Xmpp; namespace Dino.Ui { @@ -122,7 +123,7 @@ public class AddConferenceDialog : Gtk.Dialog { ConferenceListRow? conference_row = conference_list.get_selected_row() as ConferenceListRow; if (conference_row != null) { details_fragment.account = conference_row.account; - details_fragment.jid = conference_row.bookmark.jid; + details_fragment.jid = conference_row.bookmark.jid.to_string(); details_fragment.nick = conference_row.bookmark.nick; if (conference_row.bookmark.password != null) details_fragment.password = conference_row.bookmark.password; ok_button.grab_focus(); diff --git a/main/src/ui/add_conversation/add_contact_dialog.vala b/main/src/ui/add_conversation/add_contact_dialog.vala index decc588d..33f6fa72 100644 --- a/main/src/ui/add_conversation/add_contact_dialog.vala +++ b/main/src/ui/add_conversation/add_contact_dialog.vala @@ -2,6 +2,7 @@ using Gee; using Gtk; using Dino.Entities; +using Xmpp; namespace Dino.Ui { diff --git a/main/src/ui/add_conversation/add_groupchat_dialog.vala b/main/src/ui/add_conversation/add_groupchat_dialog.vala index 2ecc9e19..53359813 100644 --- a/main/src/ui/add_conversation/add_groupchat_dialog.vala +++ b/main/src/ui/add_conversation/add_groupchat_dialog.vala @@ -2,6 +2,7 @@ using Gee; using Gtk; using Dino.Entities; +using Xmpp; namespace Dino.Ui { @@ -43,7 +44,7 @@ protected class AddGroupchatDialog : Gtk.Dialog { accounts_stack.set_visible_child_name("label"); account_label.label = account.bare_jid.to_string(); account_combobox.selected = account; - jid_entry.text = conference.jid; + jid_entry.text = conference.jid.to_string(); nick_entry.text = conference.nick ?? ""; alias_entry.text = conference.name; } @@ -64,7 +65,7 @@ protected class AddGroupchatDialog : Gtk.Dialog { } private void on_ok_button_clicked() { - Xmpp.Xep.Bookmarks.Conference conference = new Xmpp.Xep.Bookmarks.Conference(jid_entry.text); + Xmpp.Xep.Bookmarks.Conference conference = new Xmpp.Xep.Bookmarks.Conference(Jid.parse(jid_entry.text)); conference.nick = nick_entry.text != "" ? nick_entry.text : null; conference.name = alias_entry.text; if (edit_conference == null) { diff --git a/main/src/ui/add_conversation/conference_details_fragment.vala b/main/src/ui/add_conversation/conference_details_fragment.vala index 5efcb593..964bb059 100644 --- a/main/src/ui/add_conversation/conference_details_fragment.vala +++ b/main/src/ui/add_conversation/conference_details_fragment.vala @@ -2,6 +2,7 @@ using Gdk; using Gtk; using Dino.Entities; +using Xmpp; namespace Dino.Ui { diff --git a/main/src/ui/add_conversation/conference_list.vala b/main/src/ui/add_conversation/conference_list.vala index 8338558c..dfe80a66 100644 --- a/main/src/ui/add_conversation/conference_list.vala +++ b/main/src/ui/add_conversation/conference_list.vala @@ -39,8 +39,12 @@ protected class ConferenceList : FilterableList { } } - private void on_conference_bookmarks_received(Core.XmppStream stream, Account account, Gee.List<Xep.Bookmarks.Conference> conferences) { - lists[account] = conferences; + private void on_conference_bookmarks_received(XmppStream stream, Account account, Gee.List<Xep.Bookmarks.Conference>? conferences) { + if (conferences == null) { + lists.unset(account); + } else { + lists[account] = conferences; + } refresh_conferences(); } @@ -77,15 +81,15 @@ internal class ConferenceListRow : ListRow { public Xep.Bookmarks.Conference bookmark; public ConferenceListRow(StreamInteractor stream_interactor, Xep.Bookmarks.Conference bookmark, Account account) { - this.jid = new Jid(bookmark.jid); + this.jid = bookmark.jid; this.account = account; this.bookmark = bookmark; - name_label.label = bookmark.name ?? bookmark.jid; + name_label.label = bookmark.name ?? bookmark.jid.to_string(); 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 if (bookmark.name != null && bookmark.name != bookmark.jid.to_string()) { + via_label.label = bookmark.jid.to_string(); } else { via_label.visible = false; } diff --git a/main/src/ui/add_conversation/list_row.vala b/main/src/ui/add_conversation/list_row.vala index 958445b7..ffc1802b 100644 --- a/main/src/ui/add_conversation/list_row.vala +++ b/main/src/ui/add_conversation/list_row.vala @@ -2,6 +2,7 @@ using Gee; using Gtk; using Dino.Entities; +using Xmpp; namespace Dino.Ui { diff --git a/main/src/ui/add_conversation/roster_list.vala b/main/src/ui/add_conversation/roster_list.vala index 3107dc47..fd4d4ade 100644 --- a/main/src/ui/add_conversation/roster_list.vala +++ b/main/src/ui/add_conversation/roster_list.vala @@ -49,7 +49,7 @@ protected class RosterList : FilterableList { 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, accounts.size > 1); + ListRow row = new ListRow.from_jid(stream_interactor, roster_item.jid, account, accounts.size > 1); rows[account][jid] = row; add(row); invalidate_sort(); @@ -59,7 +59,7 @@ protected class RosterList : FilterableList { private void fetch_roster_items(Account account) { 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); + on_updated_roster_item(account, roster_item.jid, roster_item); } } diff --git a/main/src/ui/add_conversation/select_contact_dialog.vala b/main/src/ui/add_conversation/select_contact_dialog.vala index b05762ec..80b7f09b 100644 --- a/main/src/ui/add_conversation/select_contact_dialog.vala +++ b/main/src/ui/add_conversation/select_contact_dialog.vala @@ -3,6 +3,7 @@ using Gdk; using Gtk; using Dino.Entities; +using Xmpp; namespace Dino.Ui { diff --git a/main/src/ui/add_conversation/select_jid_fragment.vala b/main/src/ui/add_conversation/select_jid_fragment.vala index e6f45ba1..aca0a937 100644 --- a/main/src/ui/add_conversation/select_jid_fragment.vala +++ b/main/src/ui/add_conversation/select_jid_fragment.vala @@ -2,6 +2,7 @@ using Gee; using Gtk; using Dino.Entities; +using Xmpp; namespace Dino.Ui { |