aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-06-11 13:59:24 +0200
committerfiaxh <git@mx.ax.lt>2017-06-11 13:59:24 +0200
commite63d59eb3450471b33a22efda6df8871818209b1 (patch)
tree11660e951bf049318f6c0eae8a60fcfbff4c029e /main
parent205bd444a5ba9d119952ecddbf815f50174da8c7 (diff)
downloaddino-e63d59eb3450471b33a22efda6df8871818209b1.tar.gz
dino-e63d59eb3450471b33a22efda6df8871818209b1.zip
Muc Invite + Kick
Diffstat (limited to 'main')
-rw-r--r--main/src/ui/add_conversation/chat/dialog.vala33
-rw-r--r--main/src/ui/add_conversation/chat/roster_list.vala28
-rw-r--r--main/src/ui/add_conversation/conference/dialog.vala2
-rw-r--r--main/src/ui/add_conversation/list_row.vala4
-rw-r--r--main/src/ui/add_conversation/select_jid_fragment.vala9
-rw-r--r--main/src/ui/chat_input/occupants_tab_completer.vala4
-rw-r--r--main/src/ui/conversation_list_titlebar.vala10
-rw-r--r--main/src/ui/conversation_selector/groupchat_pm_row.vala2
-rw-r--r--main/src/ui/conversation_titlebar.vala6
-rw-r--r--main/src/ui/notifications.vala4
-rw-r--r--main/src/ui/occupant_menu/list.vala26
-rw-r--r--main/src/ui/occupant_menu/list_row.vala9
-rw-r--r--main/src/ui/occupant_menu/view.vala76
-rw-r--r--main/src/ui/unified_window.vala2
14 files changed, 138 insertions, 77 deletions
diff --git a/main/src/ui/add_conversation/chat/dialog.vala b/main/src/ui/add_conversation/chat/dialog.vala
index a36731a5..ee535f09 100644
--- a/main/src/ui/add_conversation/chat/dialog.vala
+++ b/main/src/ui/add_conversation/chat/dialog.vala
@@ -8,19 +8,21 @@ namespace Dino.Ui.AddConversation.Chat {
public class Dialog : Gtk.Dialog {
- public signal void conversation_opened(Conversation conversation);
+ public signal void selected(Account account, Jid jid);
- private Button ok_button;
+ public Button ok_button;
private RosterList roster_list;
private SelectJidFragment select_jid_fragment;
private StreamInteractor stream_interactor;
+ private Gee.List<Account> accounts;
- public Dialog(StreamInteractor stream_interactor) {
+ public Dialog(StreamInteractor stream_interactor, Gee.List<Account> accounts) {
Object(use_header_bar : 1);
- this.title = _("Start Chat");
- this.modal = true;
+ modal = true;
+
this.stream_interactor = stream_interactor;
+ this.accounts = accounts;
setup_headerbar();
setup_view();
@@ -37,19 +39,22 @@ public class Dialog : Gtk.Dialog {
ok_button = new Button();
ok_button.get_style_context().add_class("suggested-action");
- ok_button.label = _("Start");
ok_button.sensitive = false;
ok_button.visible = true;
header_bar.pack_end(ok_button);
cancel_button.clicked.connect(() => { close(); });
- ok_button.clicked.connect(on_ok_button_clicked);
+ ok_button.clicked.connect(() => {
+ ListRow? selected_row = roster_list.get_selected_row() as ListRow;
+ if (selected_row != null) selected(selected_row.account, selected_row.jid);
+ close();
+ });
}
private void setup_view() {
- roster_list = new RosterList(stream_interactor);
+ roster_list = new RosterList(stream_interactor, accounts);
roster_list.row_activated.connect(() => { ok_button.clicked(); });
- select_jid_fragment = new SelectJidFragment(stream_interactor, roster_list);
+ select_jid_fragment = new SelectJidFragment(stream_interactor, roster_list, accounts);
select_jid_fragment.add_jid.connect((row) => {
AddContactDialog add_contact_dialog = new AddContactDialog(stream_interactor);
add_contact_dialog.set_transient_for(this);
@@ -67,16 +72,6 @@ public class Dialog : Gtk.Dialog {
});
get_content_area().add(select_jid_fragment);
}
-
- protected void on_ok_button_clicked() {
- ListRow? selected_row = roster_list.get_selected_row() as ListRow;
- if (selected_row != null) {
- Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(selected_row.jid, selected_row.account, Conversation.Type.CHAT);
- stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true);
- conversation_opened(conversation);
- }
- close();
- }
}
} \ No newline at end of file
diff --git a/main/src/ui/add_conversation/chat/roster_list.vala b/main/src/ui/add_conversation/chat/roster_list.vala
index d09720d5..3c324cf6 100644
--- a/main/src/ui/add_conversation/chat/roster_list.vala
+++ b/main/src/ui/add_conversation/chat/roster_list.vala
@@ -10,27 +10,28 @@ protected class RosterList : FilterableList {
public signal void conversation_selected(Conversation? conversation);
private StreamInteractor stream_interactor;
+ private Gee.List<Account> accounts;
private HashMap<Account, HashMap<Jid, ListRow>> rows = new HashMap<Account, HashMap<Jid, ListRow>>(Account.hash_func, Account.equals_func);
- public RosterList(StreamInteractor stream_interactor) {
+ public RosterList(StreamInteractor stream_interactor, Gee.List<Account> accounts) {
this.stream_interactor = stream_interactor;
+ this.accounts = accounts;
set_filter_func(filter);
set_header_func(header);
set_sort_func(sort);
stream_interactor.get_module(RosterManager.IDENTITY).removed_roster_item.connect( (account, jid, roster_item) => {
- Idle.add(() => { on_removed_roster_item(account, jid, roster_item); return false;});});
+ if (accounts.contains(account))
+ Idle.add(() => { on_removed_roster_item(account, jid, roster_item); return false;});
+ });
stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect( (account, jid, roster_item) => {
- Idle.add(() => { on_updated_roster_item(account, jid, roster_item); return false;});});
+ if (accounts.contains(account))
+ 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);
- }
- }
+ foreach (Account a in accounts) fetch_roster_items(a);
}
private void on_removed_roster_item(Account account, Jid jid, Roster.Item roster_item) {
@@ -42,13 +43,20 @@ 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);
+ ListRow row = new ListRow.from_jid(stream_interactor, new Jid(roster_item.jid), account, accounts.size > 1);
rows[account][jid] = row;
add(row);
invalidate_sort();
invalidate_filter();
}
+ 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);
+ }
+ }
+
private void header(ListBoxRow row, ListBoxRow? before_row) {
if (row.get_header() == null && before_row != null) {
row.set_header(new Separator(Orientation.HORIZONTAL));
diff --git a/main/src/ui/add_conversation/conference/dialog.vala b/main/src/ui/add_conversation/conference/dialog.vala
index 412fb07c..9674cef2 100644
--- a/main/src/ui/add_conversation/conference/dialog.vala
+++ b/main/src/ui/add_conversation/conference/dialog.vala
@@ -88,7 +88,7 @@ public class Dialog : Gtk.Dialog {
private void setup_jid_add_view() {
conference_list = new ConferenceList(stream_interactor);
conference_list.row_activated.connect(() => { ok_button.clicked(); });
- select_fragment = new SelectJidFragment(stream_interactor, conference_list);
+ select_fragment = new SelectJidFragment(stream_interactor, conference_list, stream_interactor.get_accounts());
select_fragment.add_jid.connect((row) => {
AddGroupchatDialog dialog = new AddGroupchatDialog(stream_interactor);
dialog.set_transient_for(this);
diff --git a/main/src/ui/add_conversation/list_row.vala b/main/src/ui/add_conversation/list_row.vala
index b53432a6..c68fde7b 100644
--- a/main/src/ui/add_conversation/list_row.vala
+++ b/main/src/ui/add_conversation/list_row.vala
@@ -17,12 +17,12 @@ public class ListRow : ListBoxRow {
public ListRow() {}
- public ListRow.from_jid(StreamInteractor stream_interactor, Jid jid, Account account) {
+ public ListRow.from_jid(StreamInteractor stream_interactor, Jid jid, Account account, bool show_account) {
this.jid = jid;
this.account = account;
string display_name = Util.get_display_name(stream_interactor, jid, account);
- if (stream_interactor.get_accounts().size > 1) {
+ if (show_account && stream_interactor.get_accounts().size > 1) {
via_label.label = @"via $(account.bare_jid)";
this.has_tooltip = true;
set_tooltip_text(jid.to_string());
diff --git a/main/src/ui/add_conversation/select_jid_fragment.vala b/main/src/ui/add_conversation/select_jid_fragment.vala
index d0b214b5..71314235 100644
--- a/main/src/ui/add_conversation/select_jid_fragment.vala
+++ b/main/src/ui/add_conversation/select_jid_fragment.vala
@@ -23,13 +23,16 @@ public class SelectJidFragment : Gtk.Box {
[GtkChild] private Button edit_button;
[GtkChild] private Button remove_button;
+ private StreamInteractor stream_interactor;
private FilterableList filterable_list;
+ private Gee.List<Account> accounts;
+
private ArrayList<AddListRow> added_rows = new ArrayList<AddListRow>();
- private StreamInteractor stream_interactor;
- public SelectJidFragment(StreamInteractor stream_interactor, FilterableList filterable_list) {
+ public SelectJidFragment(StreamInteractor stream_interactor, FilterableList filterable_list, Gee.List<Account> accounts) {
this.stream_interactor = stream_interactor;
this.filterable_list = filterable_list;
+ this.accounts = accounts;
filterable_list.visible = true;
filterable_list.activate_on_single_click = false;
@@ -57,7 +60,7 @@ public class SelectJidFragment : Gtk.Box {
filterable_list.set_filter_values(values);
Jid? parsed_jid = Jid.parse(str);
if (parsed_jid != null && parsed_jid.localpart != null) {
- foreach (Account account in stream_interactor.get_accounts()) {
+ foreach (Account account in accounts) {
AddListRow row = new AddListRow(stream_interactor, str, account);
filterable_list.add(row);
added_rows.add(row);
diff --git a/main/src/ui/chat_input/occupants_tab_completer.vala b/main/src/ui/chat_input/occupants_tab_completer.vala
index 9ef73d8b..4d5d2904 100644
--- a/main/src/ui/chat_input/occupants_tab_completer.vala
+++ b/main/src/ui/chat_input/occupants_tab_completer.vala
@@ -90,8 +90,8 @@ class OccupantsTabCompletor {
Gee.List<Message> messages = stream_interactor.get_module(MessageStorage.IDENTITY).get_messages(conversation, 10);
for (int i = messages.size - 1; i > 0; i--) {
string resourcepart = messages[i].from.resourcepart;
- string own_nick = stream_interactor.get_module(MucManager.IDENTITY).get_nick(conversation.counterpart, conversation.account);
- if (resourcepart != null && resourcepart != "" && resourcepart != own_nick && !ret.contains(resourcepart)) {
+ Jid? own_nick = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
+ if (resourcepart != null && resourcepart != "" && resourcepart != own_nick.resourcepart && !ret.contains(resourcepart)) {
ret.add(resourcepart);
}
}
diff --git a/main/src/ui/conversation_list_titlebar.vala b/main/src/ui/conversation_list_titlebar.vala
index 327e1f50..e2d7fa26 100644
--- a/main/src/ui/conversation_list_titlebar.vala
+++ b/main/src/ui/conversation_list_titlebar.vala
@@ -22,9 +22,15 @@ public class ConversationListTitlebar : Gtk.HeaderBar {
private void create_add_menu(Window window) {
SimpleAction contacts_action = new SimpleAction("add_chat", null);
contacts_action.activate.connect(() => {
- AddConversation.Chat.Dialog add_chat_dialog = new AddConversation.Chat.Dialog(stream_interactor);
+ AddConversation.Chat.Dialog add_chat_dialog = new AddConversation.Chat.Dialog(stream_interactor, stream_interactor.get_accounts());
add_chat_dialog.set_transient_for(window);
- add_chat_dialog.conversation_opened.connect((conversation) => conversation_opened(conversation));
+ add_chat_dialog.title = _("Start Chat");
+ add_chat_dialog.ok_button.label = _("Start");
+ add_chat_dialog.selected.connect((account, jid) => {
+ Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.CHAT);
+ stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true);
+ conversation_opened(conversation);
+ });
add_chat_dialog.present();
});
GLib.Application.get_default().add_action(contacts_action);
diff --git a/main/src/ui/conversation_selector/groupchat_pm_row.vala b/main/src/ui/conversation_selector/groupchat_pm_row.vala
index f556b45d..c5cbcc09 100644
--- a/main/src/ui/conversation_selector/groupchat_pm_row.vala
+++ b/main/src/ui/conversation_selector/groupchat_pm_row.vala
@@ -44,7 +44,7 @@ public class GroupchatPmRow : ConversationRow {
Box inner_box = builder.get_object("inner_box") as Box;
Label jid_label = builder.get_object("jid_label") as Label;
jid_label.label = conversation.counterpart.to_string();
- if (stream_interactor.get_module(MucManager.IDENTITY).get_nick(conversation.counterpart, conversation.account) != null) {
+ if (stream_interactor.get_module(MucManager.IDENTITY).is_joined(conversation.counterpart, conversation.account)) {
inner_box.add(get_fulljid_box(conversation.counterpart));
}
return main_box;
diff --git a/main/src/ui/conversation_titlebar.vala b/main/src/ui/conversation_titlebar.vala
index 0537a1b9..be532392 100644
--- a/main/src/ui/conversation_titlebar.vala
+++ b/main/src/ui/conversation_titlebar.vala
@@ -16,10 +16,12 @@ public class ConversationTitlebar : Gtk.HeaderBar {
private Map<RadioButton, Plugins.EncryptionListEntry> encryption_radios = new HashMap<RadioButton, Plugins.EncryptionListEntry>();
private StreamInteractor stream_interactor;
+ private Window window;
private Conversation? conversation;
- public ConversationTitlebar(StreamInteractor stream_interactor) {
+ public ConversationTitlebar(StreamInteractor stream_interactor, Window window) {
this.stream_interactor = stream_interactor;
+ this.window = window;
create_conversation_menu();
create_encryption_menu();
@@ -67,7 +69,7 @@ public class ConversationTitlebar : Gtk.HeaderBar {
groupchat_button.visible = conversation.type_ == Conversation.Type.GROUPCHAT;
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
groupchat_button.set_use_popover(true);
- OccupantMenu.View menu = new OccupantMenu.View(stream_interactor, conversation);
+ OccupantMenu.View menu = new OccupantMenu.View(stream_interactor, window, conversation);
groupchat_button.set_popover(menu);
}
}
diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala
index 32e8d7ad..725a3e26 100644
--- a/main/src/ui/notifications.vala
+++ b/main/src/ui/notifications.vala
@@ -96,8 +96,8 @@ public class Notifications : Object {
private bool should_notify_message(Entities.Message message, Conversation conversation) {
Conversation.NotifySetting notify = conversation.get_notification_setting(stream_interactor);
if (notify == Conversation.NotifySetting.OFF) return false;
- string? nick = stream_interactor.get_module(MucManager.IDENTITY).get_nick(conversation.counterpart, conversation.account);
- if (notify == Conversation.NotifySetting.HIGHLIGHT && nick != null && !message.body.contains(nick)) return false;
+ Jid? nick = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
+ if (notify == Conversation.NotifySetting.HIGHLIGHT && nick != null && !message.body.contains(nick.resourcepart)) return false;
return true;
}
}
diff --git a/main/src/ui/occupant_menu/list.vala b/main/src/ui/occupant_menu/list.vala
index ff30b180..50e6b300 100644
--- a/main/src/ui/occupant_menu/list.vala
+++ b/main/src/ui/occupant_menu/list.vala
@@ -35,7 +35,7 @@ public class List : Box {
public void initialize_for_conversation(Conversation conversation) {
this.conversation = conversation;
- ArrayList<Jid>? occupants = stream_interactor.get_module(MucManager.IDENTITY).get_occupants(conversation.counterpart, conversation.account);
+ Gee.List<Jid>? occupants = stream_interactor.get_module(MucManager.IDENTITY).get_occupants(conversation.counterpart, conversation.account);
if (occupants != null) {
foreach (Jid occupant in occupants) {
add_occupant(occupant);
@@ -110,12 +110,24 @@ public class List : Box {
default:
aff_str = _("User"); break;
}
- Box box = new Box(Orientation.VERTICAL, 0) { visible=true };
- Label label = new Label("") { margin_left=10, margin_top=top?5:15, xalign=0, visible=true };
- label.set_markup(@"<b>$(Markup.escape_text(aff_str))</b>");
- box.add(label);
- box.add(new Separator(Orientation.HORIZONTAL) { visible=true });
- return box;
+
+ int count = 0;
+ foreach (ListRow row in rows.values) {
+ Xmpp.Xep.Muc.Affiliation aff = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, row.jid, conversation.account);
+ if (aff == affiliation) count++;
+ }
+
+ Label title_label = new Label("") { margin_left=10, xalign=0, visible=true };
+ title_label.set_markup(@"<b>$(Markup.escape_text(aff_str))</b>");
+
+ Label count_label = new Label(@"$count") { xalign=0, margin_right=7, expand=true, visible=true };
+ count_label.get_style_context().add_class("dim-label");
+
+ Grid grid = new Grid() { margin_top=top?5:15, column_spacing=5, hexpand=true, visible=true };
+ grid.attach(title_label, 0, 0, 1, 1);
+ grid.attach(count_label, 1, 0, 1, 1);
+ grid.attach(new Separator(Orientation.HORIZONTAL) { expand=true, visible=true }, 0, 1, 2, 1);
+ return grid;
}
private bool filter(ListBoxRow r) {
diff --git a/main/src/ui/occupant_menu/list_row.vala b/main/src/ui/occupant_menu/list_row.vala
index b8b95758..f5776b4b 100644
--- a/main/src/ui/occupant_menu/list_row.vala
+++ b/main/src/ui/occupant_menu/list_row.vala
@@ -11,8 +11,8 @@ public class ListRow : ListBoxRow {
[GtkChild] private Image image;
[GtkChild] public Label name_label;
- public Account account;
- public Jid jid;
+ public Account? account;
+ public Jid? jid;
public ListRow(StreamInteractor stream_interactor, Account account, Jid jid) {
this.account = account;
@@ -22,8 +22,9 @@ public class ListRow : ListBoxRow {
Util.image_set_from_scaled_pixbuf(image, (new AvatarGenerator(30, 30, image.scale_factor)).draw_jid(stream_interactor, jid, account));
}
- public void on_presence_received(Presence.Stanza presence) {
-
+ public ListRow.label(string c, string text) {
+ name_label.label = text;
+ image.set_from_pixbuf((new AvatarGenerator(30, 30, 1)).set_greyscale(true).draw_text(c)); // why 1
}
}
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala
index b6b25961..7918fe46 100644
--- a/main/src/ui/occupant_menu/view.vala
+++ b/main/src/ui/occupant_menu/view.vala
@@ -1,3 +1,4 @@
+using Gee;
using Gtk;
using Dino.Entities;
@@ -10,22 +11,40 @@ public class View : Popover {
private Stack stack = new Stack() { vhomogeneous=false, visible=true };
private List list;
- private Label header_label = new Label("") { xalign=0.5f, hexpand=true, visible=true };
+ private ListBox invite_list;
- public View(StreamInteractor stream_interactor, Conversation conversation) {
+ public View(StreamInteractor stream_interactor, Window window, Conversation conversation) {
this.stream_interactor = stream_interactor;
this.conversation = conversation;
+ Box list_box = new Box(Orientation.VERTICAL, 1) { visible=true };
list = new List(stream_interactor, conversation) { visible=true };
- stack.add_named(list, "list");
- setup_menu();
+ list_box.add(list);
+
+ invite_list = new ListBox() { visible=true };
+ invite_list.add(new ListRow.label("+", _("Invite")) {visible=true});
+ list_box.add(invite_list);
+ invite_list.row_activated.connect((row) => {
+ hide();
+ Gee.List<Account> acc_list = new ArrayList<Account>(Account.equals_func);
+ acc_list.add(conversation.account);
+ AddConversation.Chat.Dialog add_chat_dialog = new AddConversation.Chat.Dialog(stream_interactor, acc_list);
+ add_chat_dialog.set_transient_for(window);
+ add_chat_dialog.title = _("Invite to Conference");
+ add_chat_dialog.ok_button.label = _("Invite");
+ add_chat_dialog.selected.connect((account, jid) => {
+ stream_interactor.get_module(MucManager.IDENTITY).invite(conversation.account, conversation.counterpart, jid);
+ });
+ add_chat_dialog.present();
+ });
+
+ stack.add_named(list_box, "list");
add(stack);
stack.visible_child_name = "list";
list.list_box.row_activated.connect((row) => {
ListRow list_row = row as ListRow;
- header_label.label = list_row.name_label.label;
- show_menu();
+ show_menu(list_row.jid, list_row.name_label.label);
});
hide.connect(reset);
@@ -35,35 +54,43 @@ public class View : Popover {
stack.transition_type = StackTransitionType.NONE;
stack.visible_child_name = "list";
list.list_box.unselect_all();
+ invite_list.unselect_all();
+ }
+
+ private void show_list() {
+ list.list_box.unselect_all();
+ stack.transition_type = StackTransitionType.SLIDE_RIGHT;
+ stack.visible_child_name = "list";
}
- private void setup_menu() {
+ private void show_menu(Jid jid, string name_label) {
+ stack.transition_type = StackTransitionType.SLIDE_LEFT;
+
Box header_box = new Box(Orientation.HORIZONTAL, 5) { visible=true };
header_box.add(new Image.from_icon_name("pan-start-symbolic", IconSize.SMALL_TOOLBAR) { visible=true });
- header_box.add(header_label);
+ header_box.add(new Label(name_label) { xalign=0.5f, hexpand=true, visible=true });
Button header_button = new Button() { relief=ReliefStyle.NONE, visible=true };
header_button.add(header_box);
- ModelButton private_button = new ModelButton() { active=true, text=_("Start private conversation"), visible=true };
-
Box outer_box = new Box(Orientation.VERTICAL, 5) { margin=10, visible=true };
outer_box.add(header_button);
- outer_box.add(private_button);
- stack.add_named(outer_box, "menu");
-
header_button.clicked.connect(show_list);
+
+ ModelButton private_button = new ModelButton() { active=true, text=_("Start private conversation"), visible=true };
+ outer_box.add(private_button);
private_button.clicked.connect(private_conversation_button_clicked);
- }
- private void show_list() {
- list.list_box.unselect_all();
- stack.transition_type = StackTransitionType.SLIDE_RIGHT;
- stack.visible_child_name = "list";
- }
+ Jid? own_jid = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account);
+ Xmpp.Xep.Muc.Role? role = stream_interactor.get_module(MucManager.IDENTITY).get_role(own_jid, conversation.account);
- private void show_menu() {
- stack.transition_type = StackTransitionType.SLIDE_LEFT;
+ if (role == Xmpp.Xep.Muc.Role.MODERATOR && stream_interactor.get_module(MucManager.IDENTITY).kick_possible(conversation.account, jid)) {
+ ModelButton kick_button = new ModelButton() { active=true, text=_("Kick"), visible=true };
+ outer_box.add(kick_button);
+ kick_button.clicked.connect(kick_button_clicked);
+ }
+
+ stack.add_named(outer_box, "menu");
stack.visible_child_name = "menu";
}
@@ -74,6 +101,13 @@ public class View : Popover {
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(list_row.jid, list_row.account, Conversation.Type.GROUPCHAT_PM);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true);
}
+
+ private void kick_button_clicked() {
+ ListRow? list_row = list.list_box.get_selected_row() as ListRow;
+ if (list_row == null) return;
+
+ stream_interactor.get_module(MucManager.IDENTITY).kick(conversation.account, conversation.counterpart, list_row.jid.resourcepart);
+ }
}
} \ No newline at end of file
diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala
index 670da9b2..c0bf0487 100644
--- a/main/src/ui/unified_window.vala
+++ b/main/src/ui/unified_window.vala
@@ -83,7 +83,7 @@ public class UnifiedWindow : Window {
}
private void setup_headerbar() {
- conversation_titlebar = new ConversationTitlebar(stream_interactor) { visible=true };
+ conversation_titlebar = new ConversationTitlebar(stream_interactor, this) { visible=true };
conversation_list_titlebar = new ConversationListTitlebar(stream_interactor, this) { visible=true };
headerbar_paned.add1(conversation_list_titlebar);
headerbar_paned.add2(conversation_titlebar);