diff options
Diffstat (limited to 'main')
19 files changed, 71 insertions, 71 deletions
diff --git a/main/src/ui/add_conversation/chat/add_contact_dialog.vala b/main/src/ui/add_conversation/chat/add_contact_dialog.vala index df8fbeb9..88bfe2be 100644 --- a/main/src/ui/add_conversation/chat/add_contact_dialog.vala +++ b/main/src/ui/add_conversation/chat/add_contact_dialog.vala @@ -41,9 +41,9 @@ protected class AddContactDialog : Gtk.Dialog { account = account2; } } - RosterManager.get_instance(stream_interactor).add_jid(account, jid, alias); + stream_interactor.get_module(RosterManager.IDENTITY).add_jid(account, jid, alias); if (subscribe_checkbutton.active) { - PresenceManager.get_instance(stream_interactor).request_subscription(account, jid); + stream_interactor.get_module(PresenceManager.IDENTITY).request_subscription(account, jid); } close(); } diff --git a/main/src/ui/add_conversation/chat/dialog.vala b/main/src/ui/add_conversation/chat/dialog.vala index cad2b367..15624731 100644 --- a/main/src/ui/add_conversation/chat/dialog.vala +++ b/main/src/ui/add_conversation/chat/dialog.vala @@ -60,7 +60,7 @@ public class Dialog : Gtk.Dialog { }); select_jid_fragment.remove_jid.connect((row) => { ListRow list_row = roster_list.get_selected_row() as ListRow; - RosterManager.get_instance(stream_interactor).remove_jid(list_row.account, list_row.jid); + stream_interactor.get_module(RosterManager.IDENTITY).remove_jid(list_row.account, list_row.jid); }); select_jid_fragment.notify["done"].connect(() => { ok_button.sensitive = select_jid_fragment.done; @@ -72,8 +72,8 @@ public class Dialog : Gtk.Dialog { ListRow? selected_row = roster_list.get_selected_row() as ListRow; if (selected_row != null) { // TODO move in list to front immediately - ConversationManager.get_instance(stream_interactor).ensure_start_conversation(selected_row.jid, selected_row.account); - Conversation conversation = ConversationManager.get_instance(stream_interactor).get_conversation(selected_row.jid, selected_row.account); + stream_interactor.get_module(ConversationManager.IDENTITY).ensure_start_conversation(selected_row.jid, selected_row.account); + Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(selected_row.jid, selected_row.account); conversation_opened(conversation); } close(); diff --git a/main/src/ui/add_conversation/chat/roster_list.vala b/main/src/ui/add_conversation/chat/roster_list.vala index 92388597..c395dc3a 100644 --- a/main/src/ui/add_conversation/chat/roster_list.vala +++ b/main/src/ui/add_conversation/chat/roster_list.vala @@ -20,13 +20,13 @@ protected class RosterList : FilterableList { set_header_func(header); set_sort_func(sort); - RosterManager.get_instance(stream_interactor).removed_roster_item.connect( (account, jid, roster_item) => { + 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;});}); - RosterManager.get_instance(stream_interactor).updated_roster_item.connect( (account, jid, roster_item) => { + 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;});}); foreach (Account account in stream_interactor.get_accounts()) { - foreach (Roster.Item roster_item in RosterManager.get_instance(stream_interactor).get_roster(account)) { + 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); } } diff --git a/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala b/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala index 8cc5ac72..c097ef06 100644 --- a/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala +++ b/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala @@ -80,9 +80,9 @@ protected class AddGroupchatDialog : Gtk.Dialog { conference.name = alias_entry.text; conference.autojoin = autojoin_checkbutton.active; if (edit_confrence == null) { - MucManager.get_instance(stream_interactor).add_bookmark(account, conference); + stream_interactor.get_module(MucManager.IDENTITY).add_bookmark(account, conference); } else { - MucManager.get_instance(stream_interactor).replace_bookmark(account, edit_confrence, conference); + stream_interactor.get_module(MucManager.IDENTITY).replace_bookmark(account, edit_confrence, conference); } close(); } diff --git a/main/src/ui/add_conversation/conference/conference_list.vala b/main/src/ui/add_conversation/conference/conference_list.vala index 7743ced5..c44f989a 100644 --- a/main/src/ui/add_conversation/conference/conference_list.vala +++ b/main/src/ui/add_conversation/conference/conference_list.vala @@ -20,7 +20,7 @@ protected class ConferenceList : FilterableList { set_header_func(header); set_sort_func(sort); - MucManager.get_instance(stream_interactor).bookmarks_updated.connect((account, conferences) => { + stream_interactor.get_module(MucManager.IDENTITY).bookmarks_updated.connect((account, conferences) => { Idle.add(() => { lists[account] = conferences; refresh_conferences(); @@ -29,7 +29,7 @@ protected class ConferenceList : FilterableList { }); foreach (Account account in stream_interactor.get_accounts()) { - MucManager.get_instance(stream_interactor).get_bookmarks(account, on_conference_bookmarks_received, Tuple.create(this, account)); + stream_interactor.get_module(MucManager.IDENTITY).get_bookmarks(account, on_conference_bookmarks_received, Tuple.create(this, account)); } } diff --git a/main/src/ui/add_conversation/conference/dialog.vala b/main/src/ui/add_conversation/conference/dialog.vala index ff548699..bfb25888 100644 --- a/main/src/ui/add_conversation/conference/dialog.vala +++ b/main/src/ui/add_conversation/conference/dialog.vala @@ -102,7 +102,7 @@ public class Dialog : Gtk.Dialog { }); select_fragment.remove_jid.connect((row) => { ConferenceListRow conference_row = row as ConferenceListRow; - MucManager.get_instance(stream_interactor).remove_bookmark(conference_row.account, conference_row.bookmark); + stream_interactor.get_module(MucManager.IDENTITY).remove_bookmark(conference_row.account, conference_row.bookmark); }); stack.add_named(select_fragment, "select"); } @@ -137,7 +137,7 @@ public class Dialog : Gtk.Dialog { } private void on_ok_button_clicked() { - MucManager.get_instance(stream_interactor).join(details_fragment.account, new Jid(details_fragment.jid), details_fragment.nick, details_fragment.password); + stream_interactor.get_module(MucManager.IDENTITY).join(details_fragment.account, new Jid(details_fragment.jid), details_fragment.nick, details_fragment.password); close(); } diff --git a/main/src/ui/avatar_generator.vala b/main/src/ui/avatar_generator.vala index b668444c..eb87a3e2 100644 --- a/main/src/ui/avatar_generator.vala +++ b/main/src/ui/avatar_generator.vala @@ -31,7 +31,7 @@ public class AvatarGenerator { } public Pixbuf draw_message(StreamInteractor stream_interactor, Message message) { - Jid? real_jid = MucManager.get_instance(stream_interactor).get_message_real_jid(message); + Jid? real_jid = stream_interactor.get_module(MucManager.IDENTITY).get_message_real_jid(message); return draw_jid(stream_interactor, real_jid != null ? real_jid : message.from, message.account); } @@ -73,7 +73,7 @@ public class AvatarGenerator { } private Pixbuf draw_tile(Jid jid, Account account, int width, int height) { - if (MucManager.get_instance(stream_interactor).is_groupchat(jid, account)) { + if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat(jid, account)) { return draw_groupchat_tile(jid, account, width, height); } else { return draw_chat_tile(jid, account, width, height); @@ -81,13 +81,13 @@ public class AvatarGenerator { } private Pixbuf draw_chat_tile(Jid jid, Account account, int width, int height) { - if (MucManager.get_instance(stream_interactor).is_groupchat_occupant(jid, account)) { - Jid? real_jid = MucManager.get_instance(stream_interactor).get_real_jid(jid, account); + if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat_occupant(jid, account)) { + Jid? real_jid = stream_interactor.get_module(MucManager.IDENTITY).get_real_jid(jid, account); if (real_jid != null) { return draw_tile(real_jid, account, width, height); } } - Pixbuf? avatar = AvatarManager.get_instance(stream_interactor).get_avatar(account, jid); + Pixbuf? avatar = stream_interactor.get_module(AvatarManager.IDENTITY).get_avatar(account, jid); if (avatar != null) { double desired_ratio = (double) width / height; double avatar_ratio = (double) avatar.width / avatar.height; @@ -109,7 +109,7 @@ public class AvatarGenerator { } private Pixbuf draw_groupchat_tile(Jid jid, Account account, int width, int height) { - ArrayList<Jid>? occupants = MucManager.get_instance(stream_interactor).get_other_occupants(jid, account); + ArrayList<Jid>? occupants = stream_interactor.get_module(MucManager.IDENTITY).get_other_occupants(jid, account); if (stateless || occupants == null || occupants.size == 0) { return draw_chat_tile(jid, account, width, height); } diff --git a/main/src/ui/chat_input.vala b/main/src/ui/chat_input.vala index 92d0ccc6..1ca38786 100644 --- a/main/src/ui/chat_input.vala +++ b/main/src/ui/chat_input.vala @@ -62,20 +62,20 @@ public class ChatInput : Box { string[] token = text.split(" ", 2); switch(token[0]) { case "/kick": - MucManager.get_instance(stream_interactor).kick(conversation.account, conversation.counterpart, token[1]); + stream_interactor.get_module(MucManager.IDENTITY).kick(conversation.account, conversation.counterpart, token[1]); break; case "/me": - MessageManager.get_instance(stream_interactor).send_message(text, conversation); + stream_interactor.get_module(MessageManager.IDENTITY).send_message(text, conversation); break; case "/nick": - MucManager.get_instance(stream_interactor).change_nick(conversation.account, conversation.counterpart, token[1]); + stream_interactor.get_module(MucManager.IDENTITY).change_nick(conversation.account, conversation.counterpart, token[1]); break; case "/topic": - MucManager.get_instance(stream_interactor).change_subject(conversation.account, conversation.counterpart, token[1]); + stream_interactor.get_module(MucManager.IDENTITY).change_subject(conversation.account, conversation.counterpart, token[1]); break; } } else { - MessageManager.get_instance(stream_interactor).send_message(text, conversation); + stream_interactor.get_module(MessageManager.IDENTITY).send_message(text, conversation); } text_input.buffer.text = ""; } @@ -117,9 +117,9 @@ public class ChatInput : Box { private void on_text_input_changed() { if (text_input.buffer.text != "") { - ChatInteraction.get_instance(stream_interactor).on_message_entered(conversation); + stream_interactor.get_module(ChatInteraction.IDENTITY).on_message_entered(conversation); } else { - ChatInteraction.get_instance(stream_interactor).on_message_cleared(conversation); + stream_interactor.get_module(ChatInteraction.IDENTITY).on_message_cleared(conversation); } } } diff --git a/main/src/ui/conversation_selector/chat_row.vala b/main/src/ui/conversation_selector/chat_row.vala index 96f6921d..5e3270aa 100644 --- a/main/src/ui/conversation_selector/chat_row.vala +++ b/main/src/ui/conversation_selector/chat_row.vala @@ -40,7 +40,7 @@ public class ChatRow : ConversationRow { } public void update_avatar() { - ArrayList<Jid> full_jids = PresenceManager.get_instance(stream_interactor).get_full_jids(conversation.counterpart, conversation.account); + ArrayList<Jid> full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(conversation.counterpart, conversation.account); set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor)) .set_greyscale(full_jids == null) .draw_conversation(stream_interactor, conversation), image.scale_factor); @@ -54,12 +54,12 @@ public class ChatRow : ConversationRow { jid_label.label = conversation.counterpart.to_string(); - ArrayList<Jid>? full_jids = PresenceManager.get_instance(stream_interactor).get_full_jids(conversation.counterpart, conversation.account); + ArrayList<Jid>? full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(conversation.counterpart, conversation.account); if (full_jids != null) { for (int i = 0; i < full_jids.size; i++) { Box box = new Box(Orientation.HORIZONTAL, 5); - Show show = PresenceManager.get_instance(stream_interactor).get_last_show(full_jids[i], conversation.account); + Show show = stream_interactor.get_module(PresenceManager.IDENTITY).get_last_show(full_jids[i], conversation.account); Image image = new Image(); if (show.as == Show.AWAY) { image.set_from_icon_name("dino-status-away", IconSize.SMALL_TOOLBAR); diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala index ef3984c1..c16da287 100644 --- a/main/src/ui/conversation_selector/conversation_row.vala +++ b/main/src/ui/conversation_selector/conversation_row.vala @@ -46,7 +46,7 @@ public abstract class ConversationRow : ListBoxRow { x_button.clicked.connect(on_x_button_clicked); update_name(Util.get_conversation_display_name(stream_interactor, conversation)); - Entities.Message message = MessageManager.get_instance(stream_interactor).get_last_message(conversation); + Entities.Message message = stream_interactor.get_module(MessageManager.IDENTITY).get_last_message(conversation); if (message != null) { message_received(message); } diff --git a/main/src/ui/conversation_selector/groupchat_row.vala b/main/src/ui/conversation_selector/groupchat_row.vala index 7fe52d89..598902cc 100644 --- a/main/src/ui/conversation_selector/groupchat_row.vala +++ b/main/src/ui/conversation_selector/groupchat_row.vala @@ -23,12 +23,12 @@ public class GroupchatRow : ConversationRow { public override void network_connection(bool connected) { set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor)) .set_greyscale(!connected || - MucManager.get_instance(stream_interactor).get_nick(conversation.counterpart, conversation.account) == null) // TODO better currently joined + stream_interactor.get_module(MucManager.IDENTITY).get_nick(conversation.counterpart, conversation.account) == null) // TODO better currently joined .draw_conversation(stream_interactor, conversation), image.scale_factor); } private void on_x_button_clicked() { - MucManager.get_instance(stream_interactor).part(conversation.account, conversation.counterpart); + stream_interactor.get_module(MucManager.IDENTITY).part(conversation.account, conversation.counterpart); } } diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala index 071ac504..d95128f1 100644 --- a/main/src/ui/conversation_selector/list.vala +++ b/main/src/ui/conversation_selector/list.vala @@ -22,31 +22,31 @@ public class List : ListBox { set_header_func(header); set_sort_func(sort); - ChatInteraction.get_instance(stream_interactor).conversation_read.connect((conversation) => { + stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_read.connect((conversation) => { Idle.add(() => {if (rows.has_key(conversation)) rows[conversation].mark_read(); return false;}); }); - ChatInteraction.get_instance(stream_interactor).conversation_unread.connect((conversation) => { + stream_interactor.get_module(ChatInteraction.IDENTITY).conversation_unread.connect((conversation) => { Idle.add(() => {if (rows.has_key(conversation)) rows[conversation].mark_unread(); return false;}); }); - ConversationManager.get_instance(stream_interactor).conversation_activated.connect((conversation) => { + stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect((conversation) => { Idle.add(() => {add_conversation(conversation); return false;}); }); - MessageManager.get_instance(stream_interactor).message_received.connect((message, conversation) => { + stream_interactor.get_module(MessageManager.IDENTITY).message_received.connect((message, conversation) => { Idle.add(() => {on_message_received(message, conversation); return false;}); }); - MessageManager.get_instance(stream_interactor).message_sent.connect((message, conversation) => { + stream_interactor.get_module(MessageManager.IDENTITY).message_sent.connect((message, conversation) => { Idle.add(() => {on_message_received(message, conversation); return false;}); }); - PresenceManager.get_instance(stream_interactor).show_received.connect((show, jid, account) => { + stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect((show, jid, account) => { Idle.add(() => { - Conversation? conversation = ConversationManager.get_instance(stream_interactor).get_conversation(jid, account); + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); if (conversation != null && rows.has_key(conversation)) rows[conversation].on_show_received(show); return false; }); }); - RosterManager.get_instance(stream_interactor).updated_roster_item.connect((account, jid, roster_item) => { + stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect((account, jid, roster_item) => { Idle.add(() => { - Conversation? conversation = ConversationManager.get_instance(stream_interactor).get_conversation(jid, account); + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); if (conversation != null && rows.has_key(conversation)) { ChatRow row = rows[conversation] as ChatRow; if (row != null) row.on_updated_roster_item(roster_item); @@ -54,9 +54,9 @@ public class List : ListBox { return false; }); }); - AvatarManager.get_instance(stream_interactor).received_avatar.connect((avatar, jid, account) => { + stream_interactor.get_module(AvatarManager.IDENTITY).received_avatar.connect((avatar, jid, account) => { Idle.add(() => { - Conversation? conversation = ConversationManager.get_instance(stream_interactor).get_conversation(jid, account); + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account); if (conversation != null && rows.has_key(conversation)) { ChatRow row = rows[conversation] as ChatRow; if (row != null) row.update_avatar(); diff --git a/main/src/ui/conversation_summary/view.vala b/main/src/ui/conversation_summary/view.vala index 33b3a836..0e06a80a 100644 --- a/main/src/ui/conversation_summary/view.vala +++ b/main/src/ui/conversation_summary/view.vala @@ -32,16 +32,16 @@ public class View : Box { scrolled.vadjustment.notify["upper"].connect_after(on_upper_notify); scrolled.vadjustment.notify["value"].connect(on_value_notify); - CounterpartInteractionManager.get_instance(stream_interactor).received_state.connect((account, jid, state) => { + stream_interactor.get_module(CounterpartInteractionManager.IDENTITY).received_state.connect((account, jid, state) => { Idle.add(() => { on_received_state(account, jid, state); return false; }); }); - MessageManager.get_instance(stream_interactor).message_received.connect((message, conversation) => { + stream_interactor.get_module(MessageManager.IDENTITY).message_received.connect((message, conversation) => { Idle.add(() => { show_message(message, conversation, true); return false; }); }); - MessageManager.get_instance(stream_interactor).message_sent.connect((message, conversation) => { + stream_interactor.get_module(MessageManager.IDENTITY).message_sent.connect((message, conversation) => { Idle.add(() => { show_message(message, conversation, true); return false; }); }); - PresenceManager.get_instance(stream_interactor).show_received.connect((show, jid, account) => { + stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect((show, jid, account) => { Idle.add(() => { on_show_received(show, jid, account); return false; }); }); Timeout.add_seconds(60, () => { @@ -65,12 +65,12 @@ public class View : Box { last_conversation_item = null; ArrayList<Object> objects = new ArrayList<Object>(); - Gee.List<Entities.Message>? messages = MessageManager.get_instance(stream_interactor).get_messages(conversation); + Gee.List<Entities.Message>? messages = stream_interactor.get_module(MessageManager.IDENTITY).get_messages(conversation); if (messages != null && messages.size > 0) { earliest_message = messages[0]; objects.add_all(messages); } - HashMap<Jid, ArrayList<Show>>? shows = PresenceManager.get_instance(stream_interactor).get_shows(conversation.counterpart, conversation.account); + HashMap<Jid, ArrayList<Show>>? shows = stream_interactor.get_module(PresenceManager.IDENTITY).get_shows(conversation.counterpart, conversation.account); if (shows != null) { foreach (Jid jid in shows.keys) objects.add_all(shows[jid]); } @@ -109,7 +109,7 @@ public class View : Box { private void update_chat_state(string? state = null) { string? state_ = state; if (state_ == null) { - state_ = CounterpartInteractionManager.get_instance(stream_interactor).get_chat_state(conversation.account, conversation.counterpart); + state_ = stream_interactor.get_module(CounterpartInteractionManager.IDENTITY).get_chat_state(conversation.account, conversation.counterpart); } if (typing_status != null) { main.remove(typing_status); @@ -156,7 +156,7 @@ public class View : Box { if(reloading) return; reloading = true; } - Gee.List<Entities.Message>? messages = MessageManager.get_instance(stream_interactor).get_messages_before(conversation, earliest_message); + Gee.List<Entities.Message>? messages = stream_interactor.get_module(MessageManager.IDENTITY).get_messages_before(conversation, earliest_message); if (messages != null && messages.size > 0) { earliest_message = messages[0]; MergedMessageItem? current_item = null; diff --git a/main/src/ui/conversation_titlebar.vala b/main/src/ui/conversation_titlebar.vala index 96b154e3..45c4c9c1 100644 --- a/main/src/ui/conversation_titlebar.vala +++ b/main/src/ui/conversation_titlebar.vala @@ -20,7 +20,7 @@ public class ConversationTitlebar : Gtk.HeaderBar { public ConversationTitlebar(StreamInteractor stream_interactor) { this.stream_interactor = stream_interactor; - MucManager.get_instance(stream_interactor).groupchat_subject_set.connect((account, jid, subject) => { + stream_interactor.get_module(MucManager.IDENTITY).groupchat_subject_set.connect((account, jid, subject) => { Idle.add(() => { on_groupchat_subject_set(account, jid, subject); return false; }); }); create_conversation_menu(); @@ -77,7 +77,7 @@ public class ConversationTitlebar : Gtk.HeaderBar { if (subtitle != null) { set_subtitle(subtitle); } else if (conversation.type_ == Conversation.Type.GROUPCHAT) { - string subject = MucManager.get_instance(stream_interactor).get_groupchat_subject(conversation.counterpart, conversation.account); + string subject = stream_interactor.get_module(MucManager.IDENTITY).get_groupchat_subject(conversation.counterpart, conversation.account); set_subtitle(subject != "" ? subject : null); } else { set_subtitle(null); diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala index 3616c403..db40761d 100644 --- a/main/src/ui/manage_accounts/dialog.vala +++ b/main/src/ui/manage_accounts/dialog.vala @@ -78,7 +78,7 @@ public class Dialog : Gtk.Window { add_account(account); } - AvatarManager.get_instance(stream_interactor).received_avatar.connect((pixbuf, jid, account) => { + stream_interactor.get_module(AvatarManager.IDENTITY).received_avatar.connect((pixbuf, jid, account) => { Idle.add(() => { on_received_avatar(pixbuf, jid, account); return false; @@ -166,7 +166,7 @@ public class Dialog : Gtk.Window { if (chooser.run() == Gtk.ResponseType.ACCEPT) { string uri = chooser.get_filename(); Account account = (account_list.get_selected_row() as AccountRow).account; - AvatarManager.get_instance(stream_interactor).publish(account, uri); + stream_interactor.get_module(AvatarManager.IDENTITY).publish(account, uri); } chooser.close(); } diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index 17636995..18e33c56 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -13,14 +13,14 @@ public class Notifications : GLib.Object { } public void start() { - MessageManager.get_instance(stream_interactor).message_received.connect(on_message_received); - PresenceManager.get_instance(stream_interactor).received_subscription_request.connect(on_received_subscription_request); + stream_interactor.get_module(MessageManager.IDENTITY).message_received.connect(on_message_received); + stream_interactor.get_module(PresenceManager.IDENTITY).received_subscription_request.connect(on_received_subscription_request); } private void on_message_received(Entities.Message message, Conversation conversation) { - if (!ChatInteraction.get_instance(stream_interactor).is_active_focus()) { + if (!stream_interactor.get_module(ChatInteraction.IDENTITY).is_active_focus()) { string display_name = Util.get_conversation_display_name(stream_interactor, conversation); - if (MucManager.get_instance(stream_interactor).is_groupchat(conversation.counterpart, conversation.account)) { + if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat(conversation.counterpart, conversation.account)) { string muc_occupant = Util.get_display_name(stream_interactor, message.from, conversation.account); display_name = muc_occupant + " in " + display_name; } @@ -37,13 +37,13 @@ public class Notifications : GLib.Object { Notify.Notification notification = new Notify.Notification("Subscription request", jid.bare_jid.to_string(), null); notification.set_image_from_pixbuf((new AvatarGenerator(40, 40)).draw_jid(stream_interactor, jid, account)); notification.add_action("accept", "Accept", () => { - PresenceManager.get_instance(stream_interactor).approve_subscription(account, jid); + stream_interactor.get_module(PresenceManager.IDENTITY).approve_subscription(account, jid); try { notification.close(); } catch (Error error) { } }); notification.add_action("deny", "Deny", () => { - PresenceManager.get_instance(stream_interactor).deny_subscription(account, jid); + stream_interactor.get_module(PresenceManager.IDENTITY).deny_subscription(account, jid); try { notification.close(); } catch (Error error) { } diff --git a/main/src/ui/occupant_list.vala b/main/src/ui/occupant_list.vala index ba7c01d1..309289fc 100644 --- a/main/src/ui/occupant_list.vala +++ b/main/src/ui/occupant_list.vala @@ -25,17 +25,17 @@ public class OccupantList : Box { list_box.set_filter_func(filter); search_entry.search_changed.connect(search_changed); - PresenceManager.get_instance(stream_interactor).show_received.connect((show, jid, account) => { + stream_interactor.get_module(PresenceManager.IDENTITY).show_received.connect((show, jid, account) => { Idle.add(() => { on_show_received(show, jid, account); return false; }); }); - RosterManager.get_instance(stream_interactor).updated_roster_item.connect(on_updated_roster_item); + stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect(on_updated_roster_item); initialize_for_conversation(conversation); } public void initialize_for_conversation(Conversation conversation) { this.conversation = conversation; - ArrayList<Jid>? occupants = MucManager.get_instance(stream_interactor).get_occupants(conversation.counterpart, conversation.account); + ArrayList<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); diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala index 27240a58..8feb9a05 100644 --- a/main/src/ui/unified_window.vala +++ b/main/src/ui/unified_window.vala @@ -99,7 +99,7 @@ public class UnifiedWindow : Window { private void on_conversation_selected(Conversation conversation) { this.conversation = conversation; - ChatInteraction.get_instance(stream_interactor).on_conversation_selected(conversation); + stream_interactor.get_module(ChatInteraction.IDENTITY).on_conversation_selected(conversation); conversation.active = true; // only for conversation_selected filterable_conversation_list.conversation_list.on_conversation_selected(conversation); // only for conversation_opened @@ -109,12 +109,12 @@ public class UnifiedWindow : Window { } private bool on_focus_in_event() { - ChatInteraction.get_instance(stream_interactor).on_window_focus_in(conversation); + stream_interactor.get_module(ChatInteraction.IDENTITY).on_window_focus_in(conversation); return false; } private bool on_focus_out_event() { - ChatInteraction.get_instance(stream_interactor).on_window_focus_out(conversation); + stream_interactor.get_module(ChatInteraction.IDENTITY).on_window_focus_out(conversation); return false; } } diff --git a/main/src/ui/util.vala b/main/src/ui/util.vala index 2cf070b0..810ab13d 100644 --- a/main/src/ui/util.vala +++ b/main/src/ui/util.vala @@ -44,7 +44,7 @@ public class Util : Object { } public static string get_display_name(StreamInteractor stream_interactor, Jid jid, Account account) { - if (MucManager.get_instance(stream_interactor).is_groupchat_occupant(jid, account)) { + if (stream_interactor.get_module(MucManager.IDENTITY).is_groupchat_occupant(jid, account)) { return jid.resourcepart; } else { if (jid.bare_jid.equals(account.bare_jid.bare_jid)) { @@ -54,7 +54,7 @@ public class Util : Object { return account.alias; } } - Roster.Item roster_item = RosterManager.get_instance(stream_interactor).get_roster_item(account, jid); + Roster.Item roster_item = stream_interactor.get_module(RosterManager.IDENTITY).get_roster_item(account, jid); if (roster_item != null && roster_item.name != null) { return roster_item.name; } @@ -63,7 +63,7 @@ public class Util : Object { } public static string get_message_display_name(StreamInteractor stream_interactor, Entities.Message message, Account account) { - Jid? real_jid = MucManager.get_instance(stream_interactor).get_message_real_jid(message); + Jid? real_jid = stream_interactor.get_module(MucManager.IDENTITY).get_message_real_jid(message); if (real_jid != null) { return get_display_name(stream_interactor, real_jid, account); } else { |