aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-10-28 22:02:32 +0200
committerfiaxh <git@mx.ax.lt>2017-10-31 15:41:45 +0100
commitd9b91206c0291fa8aa58df572292784a4f8ff878 (patch)
tree09721f9fdffbb87ec8ab25fd1c44a7bc535fffab
parent7e83529afcd0ccfff5c65c99e4427bd6cf3f82ac (diff)
downloaddino-d9b91206c0291fa8aa58df572292784a4f8ff878.tar.gz
dino-d9b91206c0291fa8aa58df572292784a4f8ff878.zip
Keep MUC join dialog open until joined, show errors
-rw-r--r--libdino/src/entity/message.vala9
-rw-r--r--libdino/src/service/muc_manager.vala12
-rw-r--r--main/CMakeLists.txt16
-rw-r--r--main/data/add_conversation/add_contact_dialog.ui2
-rw-r--r--main/data/add_conversation/add_groupchat_dialog.ui20
-rw-r--r--main/data/add_conversation/conference_details_fragment.ui376
-rw-r--r--main/data/add_conversation/list_row.ui2
-rw-r--r--main/data/add_conversation/select_jid_fragment.ui2
-rw-r--r--main/src/ui/add_conversation/add_conference_dialog.vala (renamed from main/src/ui/add_conversation/conference/dialog.vala)20
-rw-r--r--main/src/ui/add_conversation/add_contact_dialog.vala (renamed from main/src/ui/add_conversation/chat/add_contact_dialog.vala)2
-rw-r--r--main/src/ui/add_conversation/add_groupchat_dialog.vala (renamed from main/src/ui/add_conversation/conference/add_groupchat_dialog.vala)5
-rw-r--r--main/src/ui/add_conversation/conference_details_fragment.vala (renamed from main/src/ui/add_conversation/conference/conference_details_fragment.vala)55
-rw-r--r--main/src/ui/add_conversation/conference_list.vala (renamed from main/src/ui/add_conversation/conference/conference_list.vala)2
-rw-r--r--main/src/ui/add_conversation/list_row.vala2
-rw-r--r--main/src/ui/add_conversation/roster_list.vala (renamed from main/src/ui/add_conversation/chat/roster_list.vala)2
-rw-r--r--main/src/ui/add_conversation/select_contact_dialog.vala (renamed from main/src/ui/add_conversation/chat/dialog.vala)22
-rw-r--r--main/src/ui/add_conversation/select_jid_fragment.vala2
-rw-r--r--main/src/ui/application.vala12
-rw-r--r--main/src/ui/conversation_list_titlebar.vala10
-rw-r--r--main/src/ui/conversation_selector/list.vala2
-rw-r--r--main/src/ui/notifications.vala2
-rw-r--r--main/src/ui/occupant_menu/view.vala2
-rw-r--r--main/src/ui/util/accounts_combo_box.vala (renamed from main/src/ui/add_conversation/accounts_combo_box.vala)0
-rw-r--r--xmpp-vala/src/module/xep/0045_muc/module.vala6
-rw-r--r--xmpp-vala/src/module/xep/0199_ping.vala4
25 files changed, 362 insertions, 227 deletions
diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala
index cd54b0a5..3c5d03d3 100644
--- a/libdino/src/entity/message.vala
+++ b/libdino/src/entity/message.vala
@@ -43,7 +43,14 @@ public class Message : Object {
/** UTC **/
public DateTime? local_time { get; set; }
public Encryption encryption { get; set; default = Encryption.NONE; }
- public Marked marked { get; set; default = Marked.NONE; }
+ private Marked marked_ = Marked.NONE;
+ public Marked marked {
+ get { return marked_; }
+ set {
+ if (marked == Marked.RECEIVED && marked == Marked.READ) return;
+ marked_ = value;
+ }
+ }
public Xmpp.Message.Stanza stanza { get; set; }
private Database? db;
diff --git a/libdino/src/service/muc_manager.vala b/libdino/src/service/muc_manager.vala
index f9a67e7a..7522f2a4 100644
--- a/libdino/src/service/muc_manager.vala
+++ b/libdino/src/service/muc_manager.vala
@@ -9,6 +9,7 @@ public class MucManager : StreamInteractionModule, Object {
public string id { get { return IDENTITY.id; } }
public signal void joined(Account account, Jid jid, string nick);
+ public signal void enter_error(Account account, Jid jid, Xep.Muc.MucEnterError error);
public signal void left(Account account, Jid jid);
public signal void subject_set(Account account, Jid jid, string? subject);
public signal void bookmarks_updated(Account account, Gee.List<Xep.Bookmarks.Conference> conferences);
@@ -29,12 +30,9 @@ public class MucManager : StreamInteractionModule, Object {
}
public void join(Account account, Jid jid, string? nick, string? password) {
- if (enter_errors.has_key(jid)) return;
-
Core.XmppStream? stream = stream_interactor.get_stream(account);
if (stream == null) return;
string nick_ = nick ?? account.bare_jid.localpart ?? account.bare_jid.domainpart;
- set_autojoin(stream, jid, nick_, password);
DateTime? history_since = null;
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(jid, account);
@@ -209,11 +207,15 @@ public class MucManager : StreamInteractionModule, Object {
private void on_account_added(Account account) {
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_entered.connect( (stream, jid_string, nick) => {
Jid jid = new Jid(jid_string);
+ enter_errors.unset(jid);
+ set_autojoin(stream, jid, nick, null); // TODO password
joined(account, jid, nick);
stream_interactor.get_module(MessageProcessor.IDENTITY).send_unsent_messages(account, jid);
});
- stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_enter_error.connect( (stream, jid, error) => {
- enter_errors[new Jid(jid)] = error;
+ stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).room_enter_error.connect( (stream, jid_str, error) => {
+ Jid jid = new Jid(jid_str);
+ enter_errors[jid] = error;
+ enter_error(account, jid, error);
});
stream_interactor.module_manager.get_module(account, Xep.Muc.Module.IDENTITY).self_removed_from_room.connect( (stream, jid, code) => {
left(account, new Jid(jid));
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 222adfb9..4fd55a47 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -72,15 +72,14 @@ SOURCES
src/main.vala
src/ui/application.vala
- src/ui/add_conversation/chat/add_contact_dialog.vala
- src/ui/add_conversation/chat/roster_list.vala
- src/ui/add_conversation/chat/dialog.vala
- src/ui/add_conversation/conference/add_groupchat_dialog.vala
- src/ui/add_conversation/conference/conference_details_fragment.vala
- src/ui/add_conversation/conference/conference_list.vala
- src/ui/add_conversation/conference/dialog.vala
- src/ui/add_conversation/accounts_combo_box.vala
+ src/ui/add_conversation/add_conference_dialog.vala
+ src/ui/add_conversation/add_contact_dialog.vala
+ src/ui/add_conversation/add_groupchat_dialog.vala
+ src/ui/add_conversation/conference_details_fragment.vala
+ src/ui/add_conversation/conference_list.vala
src/ui/add_conversation/list_row.vala
+ src/ui/add_conversation/roster_list.vala
+ src/ui/add_conversation/select_contact_dialog.vala
src/ui/add_conversation/select_jid_fragment.vala
src/ui/avatar_generator.vala
src/ui/chat_input/edit_history.vala
@@ -121,6 +120,7 @@ SOURCES
src/ui/occupant_menu/view.vala
src/ui/settings_dialog.vala
src/ui/unified_window.vala
+ src/ui/util/accounts_combo_box.vala
src/ui/util/helper.vala
src/ui/util/label_hybrid.vala
CUSTOM_VAPIS
diff --git a/main/data/add_conversation/add_contact_dialog.ui b/main/data/add_conversation/add_contact_dialog.ui
index 3e99b2cc..c2077647 100644
--- a/main/data/add_conversation/add_contact_dialog.ui
+++ b/main/data/add_conversation/add_contact_dialog.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="DinoUiAddConversationChatAddContactDialog">
+ <template class="DinoUiAddContactDialog">
<property name="default_width">300</property>
<property name="modal">True</property>
<child type="titlebar">
diff --git a/main/data/add_conversation/add_groupchat_dialog.ui b/main/data/add_conversation/add_groupchat_dialog.ui
index 1a027200..79c92947 100644
--- a/main/data/add_conversation/add_groupchat_dialog.ui
+++ b/main/data/add_conversation/add_groupchat_dialog.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="DinoUiAddConversationConferenceAddGroupchatDialog">
+ <template class="DinoUiAddGroupchatDialog">
<property name="default_width">400</property>
<property name="modal">True</property>
<child type="titlebar">
@@ -171,20 +171,6 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="autojoin_checkbutton">
- <property name="active">False</property>
- <property name="label" translatable="yes">Join on startup</property>
- <property name="xalign">0</property>
- <property name="visible">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">5</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="alias_label">
<property name="label" translatable="yes">Alias</property>
<property name="xalign">1</property>
@@ -192,7 +178,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -206,7 +192,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
diff --git a/main/data/add_conversation/conference_details_fragment.ui b/main/data/add_conversation/conference_details_fragment.ui
index 3218e27e..120fbdb6 100644
--- a/main/data/add_conversation/conference_details_fragment.ui
+++ b/main/data/add_conversation/conference_details_fragment.ui
@@ -1,224 +1,294 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="DinoUiAddConversationConferenceConferenceDetailsFragment">
+ <template class="DinoUiConferenceDetailsFragment">
<property name="visible">True</property>
<child>
- <object class="GtkGrid">
- <property name="orientation">vertical</property>
- <property name="margin">20</property>
- <property name="margin_right">40</property>
- <property name="margin_left">40</property>
- <property name="row-spacing">7</property>
- <property name="column-spacing">10</property>
+ <object class="GtkOverlay">
<property name="visible">True</property>
<child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">Account</property>
- <property name="xalign">1</property>
- <property name="visible">True</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkStack" id="accounts_stack">
+ <object class="GtkGrid">
+ <property name="orientation">vertical</property>
+ <property name="margin">20</property>
+ <property name="margin_right">40</property>
+ <property name="margin_left">40</property>
+ <property name="row-spacing">7</property>
+ <property name="column-spacing">10</property>
<property name="visible">True</property>
<child>
- <object class="GtkButton" id="accounts_button">
- <property name="relief">none</property>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Account</property>
+ <property name="xalign">1</property>
+ <property name="visible">True</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkStack" id="accounts_stack">
<property name="visible">True</property>
<child>
- <object class="GtkLabel" id="accounts_label">
- <property name="xalign">0</property>
+ <object class="GtkButton" id="accounts_button">
+ <property name="relief">none</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="accounts_label">
+ <property name="xalign">0</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="name">label</property>
+ </packing>
+ </child>
+ <child>
+ <object class="DinoUiAccountComboBox" id="account_combobox">
+ <property name="hexpand">True</property>
+ <property name="width_request">200</property>
<property name="visible">True</property>
</object>
+ <packing>
+ <property name="name">entry</property>
+ </packing>
</child>
</object>
<packing>
- <property name="name">label</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="DinoUiAccountComboBox" id="account_combobox">
- <property name="hexpand">True</property>
- <property name="width_request">200</property>
+ <object class="GtkLabel">
+ <property name="label">JID</property>
+ <property name="xalign">1</property>
<property name="visible">True</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
<packing>
- <property name="name">entry</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label">JID</property>
- <property name="xalign">1</property>
- <property name="visible">True</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkStack" id="jid_stack">
- <property name="visible">True</property>
<child>
- <object class="GtkButton" id="jid_button">
- <property name="relief">none</property>
+ <object class="GtkStack" id="jid_stack">
<property name="visible">True</property>
<child>
- <object class="GtkLabel" id="jid_label">
- <property name="xalign">0</property>
+ <object class="GtkButton" id="jid_button">
+ <property name="relief">none</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="jid_label">
+ <property name="xalign">0</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="name">label</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="jid_entry">
+ <property name="hexpand">True</property>
+ <property name="width_request">200</property>
<property name="visible">True</property>
</object>
+ <packing>
+ <property name="name">entry</property>
+ </packing>
</child>
</object>
<packing>
- <property name="name">label</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="jid_entry">
- <property name="hexpand">True</property>
- <property name="width_request">200</property>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Nick</property>
+ <property name="xalign">1</property>
<property name="visible">True</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
<packing>
- <property name="name">entry</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">Nick</property>
- <property name="xalign">1</property>
- <property name="visible">True</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkStack" id="nick_stack">
- <property name="visible">True</property>
<child>
- <object class="GtkButton" id="nick_button">
- <property name="relief">none</property>
+ <object class="GtkStack" id="nick_stack">
<property name="visible">True</property>
<child>
- <object class="GtkLabel" id="nick_label">
- <property name="xalign">0</property>
+ <object class="GtkButton" id="nick_button">
+ <property name="relief">none</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="nick_label">
+ <property name="xalign">0</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="name">label</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="nick_entry">
+ <property name="hexpand">True</property>
+ <property name="width_request">200</property>
<property name="visible">True</property>
</object>
+ <packing>
+ <property name="name">entry</property>
+ </packing>
</child>
</object>
<packing>
- <property name="name">label</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="nick_entry">
- <property name="hexpand">True</property>
- <property name="width_request">200</property>
- <property name="visible">True</property>
+ <object class="GtkLabel" id="password_text_label">
+ <property name="label" translatable="yes">Password</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
</object>
<packing>
- <property name="name">entry</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="yes">Password</property>
- <property name="xalign">1</property>
- <property name="visible">True</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkStack" id="password_stack">
- <property name="visible">True</property>
<child>
- <object class="GtkButton" id="password_button">
- <property name="relief">none</property>
- <property name="visible">True</property>
+ <object class="GtkStack" id="password_stack">
+ <child>
+ <object class="GtkButton" id="password_button">
+ <property name="relief">none</property>
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="password_label">
+ <property name="xalign">0</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="name">label</property>
+ </packing>
+ </child>
<child>
- <object class="GtkLabel" id="password_label">
- <property name="xalign">0</property>
+ <object class="GtkEntry" id="password_entry">
+ <property name="hexpand">True</property>
+ <property name="width_request">200</property>
+ <property name="visibility">False</property>
<property name="visible">True</property>
</object>
+ <packing>
+ <property name="name">entry</property>
+ </packing>
</child>
</object>
<packing>
- <property name="name">label</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
+ </object>
+ <packing>
+ <property name="index">-1</property>
+ </packing>
+ </child>
+ <child type="overlay">
+ <object class="GtkRevealer" id="notification_revealer">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">start</property>
<child>
- <object class="GtkEntry" id="password_entry">
- <property name="hexpand">True</property>
- <property name="width_request">200</property>
- <property name="visibility">False</property>
+ <object class="GtkFrame" id="frame2">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <style>
+ <class name="app-notification"/>
+ </style>
+ <child>
+ <object class="GtkBox" id="box2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
+ <child>
+ <object class="GtkLabel" id="notification_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">This is an app-notification. Click the button to dismiss</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="notification_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">window-close-symbolic</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label_item">
+ <placeholder/>
+ </child>
</object>
- <packing>
- <property name="name">entry</property>
- </packing>
</child>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
</child>
</object>
</child>
diff --git a/main/data/add_conversation/list_row.ui b/main/data/add_conversation/list_row.ui
index 9b662412..b9c3a47b 100644
--- a/main/data/add_conversation/list_row.ui
+++ b/main/data/add_conversation/list_row.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="DinoUiAddConversationListRow" parent="GtkListBoxRow">
+ <template class="DinoUiListRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<child>
<object class="GtkGrid" id="outer_grid">
diff --git a/main/data/add_conversation/select_jid_fragment.ui b/main/data/add_conversation/select_jid_fragment.ui
index 76744ad0..50bc0e36 100644
--- a/main/data/add_conversation/select_jid_fragment.ui
+++ b/main/data/add_conversation/select_jid_fragment.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="DinoUiAddConversationSelectJidFragment">
+ <template class="DinoUiSelectJidFragment">
<property name="height_request">500</property>
<property name="width_request">460</property>
<property name="visible">True</property>
diff --git a/main/src/ui/add_conversation/conference/dialog.vala b/main/src/ui/add_conversation/add_conference_dialog.vala
index 10d6e535..5e5698fb 100644
--- a/main/src/ui/add_conversation/conference/dialog.vala
+++ b/main/src/ui/add_conversation/add_conference_dialog.vala
@@ -3,9 +3,9 @@ using Gtk;
using Dino.Entities;
-namespace Dino.Ui.AddConversation.Conference {
+namespace Dino.Ui {
-public class Dialog : Gtk.Dialog {
+public class AddConferenceDialog : Gtk.Dialog {
public signal void conversation_opened(Conversation conversation);
@@ -21,7 +21,7 @@ public class Dialog : Gtk.Dialog {
private StreamInteractor stream_interactor;
- public Dialog(StreamInteractor stream_interactor) {
+ public AddConferenceDialog(StreamInteractor stream_interactor) {
Object(use_header_bar : 1);
this.title = _("Join Conference");
this.modal = true;
@@ -35,6 +35,8 @@ public class Dialog : Gtk.Dialog {
setup_jid_add_view();
setup_conference_details_view();
show_jid_add_view();
+
+ stream_interactor.get_module(MucManager.IDENTITY).joined.connect((account, jid, nick) => { Idle.add(() => { on_joined(account, jid, nick); return false; } ); });
}
private void show_jid_add_view() {
@@ -102,7 +104,7 @@ public class Dialog : Gtk.Dialog {
}
private void setup_conference_details_view() {
- details_fragment = new ConferenceDetailsFragment(stream_interactor);
+ details_fragment = new ConferenceDetailsFragment(stream_interactor, ok_button);
stack.add_named(details_fragment, "details");
}
@@ -134,7 +136,15 @@ public class Dialog : Gtk.Dialog {
private void on_ok_button_clicked() {
stream_interactor.get_module(MucManager.IDENTITY).join(details_fragment.account, new Jid(details_fragment.jid), details_fragment.nick, details_fragment.password);
- close();
+ }
+
+ private void on_joined(Account account, Jid jid, string nick) {
+ if (account.equals(details_fragment.account) && jid.equals_bare(new Jid(details_fragment.jid))) {
+ Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.GROUPCHAT);
+ stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true);
+ conversation_opened(conversation);
+ close();
+ }
}
private void on_cancel() {
diff --git a/main/src/ui/add_conversation/chat/add_contact_dialog.vala b/main/src/ui/add_conversation/add_contact_dialog.vala
index 9c14883a..102cf18a 100644
--- a/main/src/ui/add_conversation/chat/add_contact_dialog.vala
+++ b/main/src/ui/add_conversation/add_contact_dialog.vala
@@ -3,7 +3,7 @@ using Gtk;
using Dino.Entities;
-namespace Dino.Ui.AddConversation.Chat {
+namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/add_conversation/add_contact_dialog.ui")]
protected class AddContactDialog : Gtk.Dialog {
diff --git a/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala b/main/src/ui/add_conversation/add_groupchat_dialog.vala
index dc0cfd6d..274ab6f9 100644
--- a/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala
+++ b/main/src/ui/add_conversation/add_groupchat_dialog.vala
@@ -3,7 +3,7 @@ using Gtk;
using Dino.Entities;
-namespace Dino.Ui.AddConversation.Conference {
+namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/add_conversation/add_groupchat_dialog.ui")]
protected class AddGroupchatDialog : Gtk.Dialog {
@@ -16,7 +16,6 @@ protected class AddGroupchatDialog : Gtk.Dialog {
[GtkChild] private Entry jid_entry;
[GtkChild] private Entry alias_entry;
[GtkChild] private Entry nick_entry;
- [GtkChild] private CheckButton autojoin_checkbutton;
private StreamInteractor stream_interactor;
private Xmpp.Xep.Bookmarks.Conference? edit_confrence = null;
@@ -46,7 +45,6 @@ protected class AddGroupchatDialog : Gtk.Dialog {
account_combobox.selected = account;
jid_entry.text = conference.jid;
nick_entry.text = conference.nick ?? "";
- autojoin_checkbutton.active = conference.autojoin;
alias_entry.text = conference.name;
}
@@ -69,7 +67,6 @@ protected class AddGroupchatDialog : Gtk.Dialog {
Xmpp.Xep.Bookmarks.Conference conference = new Xmpp.Xep.Bookmarks.Conference(jid_entry.text);
conference.nick = nick_entry.text != "" ? nick_entry.text : null;
conference.name = alias_entry.text;
- conference.autojoin = autojoin_checkbutton.active;
if (edit_confrence == null) {
stream_interactor.get_module(MucManager.IDENTITY).add_bookmark(account_combobox.selected, conference);
} else {
diff --git a/main/src/ui/add_conversation/conference/conference_details_fragment.vala b/main/src/ui/add_conversation/conference_details_fragment.vala
index 9f9ffe9c..064d1053 100644
--- a/main/src/ui/add_conversation/conference/conference_details_fragment.vala
+++ b/main/src/ui/add_conversation/conference_details_fragment.vala
@@ -3,7 +3,7 @@ using Gtk;
using Dino.Entities;
-namespace Dino.Ui.AddConversation.Conference {
+namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/add_conversation/conference_details_fragment.ui")]
protected class ConferenceDetailsFragment : Box {
@@ -64,12 +64,20 @@ protected class ConferenceDetailsFragment : Box {
[GtkChild] private Stack password_stack;
[GtkChild] private Button password_button;
[GtkChild] private Label password_label;
+ [GtkChild] private Label password_text_label;
[GtkChild] private Entry password_entry;
+ [GtkChild] private Revealer notification_revealer;
+ [GtkChild] private Button notification_button;
+ [GtkChild] private Label notification_label;
+
private StreamInteractor stream_interactor;
+ private Button ok_button;
- public ConferenceDetailsFragment(StreamInteractor stream_interactor) {
+ public ConferenceDetailsFragment(StreamInteractor stream_interactor, Button ok_button) {
this.stream_interactor = stream_interactor;
+ this.ok_button = ok_button;
+
account_combobox.initialize(stream_interactor);
accounts_stack.set_visible_child_name("label");
@@ -90,6 +98,18 @@ protected class ConferenceDetailsFragment : Box {
jid_entry.key_release_event.connect(() => { done = true; return false; }); // just for notifying
nick_entry.key_release_event.connect(() => { done = true; return false; });
+
+ stream_interactor.get_module(MucManager.IDENTITY).enter_error.connect((account, jid, error) => {
+ Idle.add(() => {
+ on_enter_error(account, jid, error);
+ return false;
+ });
+ });
+ notification_button.clicked.connect(() => { notification_revealer.set_reveal_child(false); });
+ ok_button.clicked.connect(() => {
+ ok_button.label = _("Joining...");
+ ok_button.sensitive = false;
+ });
}
public void set_editable() {
@@ -108,9 +128,40 @@ protected class ConferenceDetailsFragment : Box {
jid = "";
nick = "";
password = "";
+ password_text_label.visible = false;
+ password_stack.visible = false;
+ notification_revealer.set_reveal_child(false);
reset_editable();
}
+ private void on_enter_error(Account account, Jid jid, Xmpp.Xep.Muc.MucEnterError error) {
+ ok_button.label = _("Join");
+ ok_button.sensitive = true;
+ string label_text = "";
+ switch (error) {
+ case Xmpp.Xep.Muc.MucEnterError.PASSWORD_REQUIRED:
+ label_text = _("Password required to enter room");
+ password_text_label.visible = true;
+ password_stack.visible = true;
+ break;
+ case Xmpp.Xep.Muc.MucEnterError.BANNED:
+ label_text = _("Banned from joining or creating conference"); break;
+ case Xmpp.Xep.Muc.MucEnterError.ROOM_DOESNT_EXIST:
+ label_text = _("Room does not exist"); break;
+ case Xmpp.Xep.Muc.MucEnterError.CREATION_RESTRICTED:
+ label_text = _("Not allowed to create room"); break;
+ case Xmpp.Xep.Muc.MucEnterError.NOT_IN_MEMBER_LIST:
+ label_text = _("Room is members only"); break;
+ case Xmpp.Xep.Muc.MucEnterError.USE_RESERVED_ROOMNICK:
+ case Xmpp.Xep.Muc.MucEnterError.NICK_CONFLICT:
+ label_text = _("Choose a different nick"); break;
+ case Xmpp.Xep.Muc.MucEnterError.OCCUPANT_LIMIT_REACHED:
+ label_text = _("Room has too many occupants"); break;
+ }
+ notification_label.label = label_text;
+ notification_revealer.set_reveal_child(true);
+ }
+
private bool on_jid_key_release_event(EventKey event) {
jid_label.label = jid_entry.text;
if (event.keyval == Key.Return) jid_stack.set_visible_child_name("label");
diff --git a/main/src/ui/add_conversation/conference/conference_list.vala b/main/src/ui/add_conversation/conference_list.vala
index 1f4abfa3..570166b1 100644
--- a/main/src/ui/add_conversation/conference/conference_list.vala
+++ b/main/src/ui/add_conversation/conference_list.vala
@@ -4,7 +4,7 @@ using Gtk;
using Xmpp;
using Dino.Entities;
-namespace Dino.Ui.AddConversation.Conference {
+namespace Dino.Ui {
protected class ConferenceList : FilterableList {
diff --git a/main/src/ui/add_conversation/list_row.vala b/main/src/ui/add_conversation/list_row.vala
index 5c33095f..fa607841 100644
--- a/main/src/ui/add_conversation/list_row.vala
+++ b/main/src/ui/add_conversation/list_row.vala
@@ -3,7 +3,7 @@ using Gtk;
using Dino.Entities;
-namespace Dino.Ui.AddConversation {
+namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/add_conversation/list_row.ui")]
public class ListRow : ListBoxRow {
diff --git a/main/src/ui/add_conversation/chat/roster_list.vala b/main/src/ui/add_conversation/roster_list.vala
index f4b42cc4..70e4bc14 100644
--- a/main/src/ui/add_conversation/chat/roster_list.vala
+++ b/main/src/ui/add_conversation/roster_list.vala
@@ -4,7 +4,7 @@ using Gtk;
using Dino.Entities;
using Xmpp;
-namespace Dino.Ui.AddConversation.Chat {
+namespace Dino.Ui {
protected class RosterList : FilterableList {
diff --git a/main/src/ui/add_conversation/chat/dialog.vala b/main/src/ui/add_conversation/select_contact_dialog.vala
index 361f70ba..b05762ec 100644
--- a/main/src/ui/add_conversation/chat/dialog.vala
+++ b/main/src/ui/add_conversation/select_contact_dialog.vala
@@ -4,9 +4,9 @@ using Gtk;
using Dino.Entities;
-namespace Dino.Ui.AddConversation.Chat {
+namespace Dino.Ui {
-public class Dialog : Gtk.Dialog {
+public class SelectContactDialog : Gtk.Dialog {
public signal void selected(Account account, Jid jid);
@@ -17,7 +17,7 @@ public class Dialog : Gtk.Dialog {
private StreamInteractor stream_interactor;
private Gee.List<Account> accounts;
- public Dialog(StreamInteractor stream_interactor, Gee.List<Account> accounts) {
+ public SelectContactDialog(StreamInteractor stream_interactor, Gee.List<Account> accounts) {
Object(use_header_bar : 1);
modal = true;
@@ -75,4 +75,20 @@ public class Dialog : Gtk.Dialog {
}
}
+public class AddChatDialog : SelectContactDialog {
+
+ public signal void added(Conversation conversation);
+
+ public AddChatDialog(StreamInteractor stream_interactor, Gee.List<Account> accounts) {
+ base(stream_interactor, accounts);
+ title = _("Start Chat");
+ ok_button.label = _("Start");
+ 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);
+ added(conversation);
+ });
+ }
+}
+
}
diff --git a/main/src/ui/add_conversation/select_jid_fragment.vala b/main/src/ui/add_conversation/select_jid_fragment.vala
index 8e975d2d..d34a22d7 100644
--- a/main/src/ui/add_conversation/select_jid_fragment.vala
+++ b/main/src/ui/add_conversation/select_jid_fragment.vala
@@ -3,7 +3,7 @@ using Gtk;
using Dino.Entities;
-namespace Dino.Ui.AddConversation {
+namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/add_conversation/select_jid_fragment.ui")]
public class SelectJidFragment : Gtk.Box {
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index ff5f44ac..625673fb 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -40,9 +40,9 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
case "join":
Dialog dialog = new Dialog.with_buttons(_("Join Conference"), window, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.USE_HEADER_BAR, _("Join"), ResponseType.OK, _("Cancel"), ResponseType.CANCEL);
dialog.modal = true;
- Widget ok_button = dialog.get_widget_for_response(ResponseType.OK);
+ Button ok_button = dialog.get_widget_for_response(ResponseType.OK) as Button;
ok_button.get_style_context().add_class("suggested-action");
- AddConversation.Conference.ConferenceDetailsFragment conference_fragment = new AddConversation.Conference.ConferenceDetailsFragment(stream_interactor);
+ ConferenceDetailsFragment conference_fragment = new ConferenceDetailsFragment(stream_interactor, ok_button);
conference_fragment.jid = jid;
conference_fragment.set_editable();
Box content_area = dialog.get_content_area();
@@ -64,14 +64,10 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true);
window.on_conversation_selected(conversation);
} else {
- AddConversation.Chat.Dialog dialog = new AddConversation.Chat.Dialog(stream_interactor, stream_interactor.get_accounts());
+ AddChatDialog dialog = new AddChatDialog(stream_interactor, stream_interactor.get_accounts());
dialog.set_filter(jid);
dialog.set_transient_for(window);
- dialog.title = _("Start Chat");
- dialog.ok_button.label = _("Start");
- 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);
+ dialog.added.connect((conversation) => {
window.on_conversation_selected(conversation);
});
dialog.present();
diff --git a/main/src/ui/conversation_list_titlebar.vala b/main/src/ui/conversation_list_titlebar.vala
index 815807f2..e499c6d5 100644
--- a/main/src/ui/conversation_list_titlebar.vala
+++ b/main/src/ui/conversation_list_titlebar.vala
@@ -26,13 +26,9 @@ 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, stream_interactor.get_accounts());
+ AddChatDialog add_chat_dialog = new AddChatDialog(stream_interactor, stream_interactor.get_accounts());
add_chat_dialog.set_transient_for(window);
- 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);
+ add_chat_dialog.added.connect((conversation) => {
conversation_opened(conversation);
});
add_chat_dialog.present();
@@ -41,7 +37,7 @@ public class ConversationListTitlebar : Gtk.HeaderBar {
SimpleAction conference_action = new SimpleAction("add_conference", null);
conference_action.activate.connect(() => {
- AddConversation.Conference.Dialog add_conference_dialog = new AddConversation.Conference.Dialog(stream_interactor);
+ AddConferenceDialog add_conference_dialog = new AddConferenceDialog(stream_interactor);
add_conference_dialog.set_transient_for(window);
add_conference_dialog.conversation_opened.connect((conversation) => conversation_opened(conversation));
add_conference_dialog.present();
diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala
index 6e9a0ec2..dbad72a8 100644
--- a/main/src/ui/conversation_selector/list.vala
+++ b/main/src/ui/conversation_selector/list.vala
@@ -144,6 +144,8 @@ public class List : ListBox {
private void header(ListBoxRow row, ListBoxRow? before_row) {
if (row.get_header() == null && before_row != null) {
row.set_header(new Separator(Orientation.HORIZONTAL));
+ } else if (row.get_header() != null && before_row == null) {
+ row.set_header(null);
}
}
diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala
index b3a373be..cfbec8dc 100644
--- a/main/src/ui/notifications.vala
+++ b/main/src/ui/notifications.vala
@@ -54,7 +54,7 @@ public class Notifications : Object {
if (conversation == null) return;
stream_interactor.get_module(PresenceManager.IDENTITY).approve_subscription(conversation.account, conversation.counterpart);
if (stream_interactor.get_module(RosterManager.IDENTITY).get_roster_item(conversation.account, conversation.counterpart) == null) {
- AddConversation.Chat.AddContactDialog dialog = new AddConversation.Chat.AddContactDialog(stream_interactor);
+ AddContactDialog dialog = new AddContactDialog(stream_interactor);
dialog.jid = conversation.counterpart.bare_jid.to_string();
dialog.account = conversation.account;
dialog.present();
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala
index b93e38e6..fb63a06a 100644
--- a/main/src/ui/occupant_menu/view.vala
+++ b/main/src/ui/occupant_menu/view.vala
@@ -29,7 +29,7 @@ public class View : Popover {
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);
+ SelectContactDialog add_chat_dialog = new SelectContactDialog(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");
diff --git a/main/src/ui/add_conversation/accounts_combo_box.vala b/main/src/ui/util/accounts_combo_box.vala
index 5fdd18e6..5fdd18e6 100644
--- a/main/src/ui/add_conversation/accounts_combo_box.vala
+++ b/main/src/ui/util/accounts_combo_box.vala
diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala
index 0b92119c..08747343 100644
--- a/xmpp-vala/src/module/xep/0045_muc/module.vala
+++ b/xmpp-vala/src/module/xep/0045_muc/module.vala
@@ -163,7 +163,7 @@ public class Module : XmppStreamModule {
public override void attach(XmppStream stream) {
stream.add_flag(new Muc.Flag());
stream.get_module(Message.Module.IDENTITY).received_message.connect(on_received_message);
- stream.get_module(Presence.Module.IDENTITY).received_presence.connect(on_received_presence);
+ stream.get_module(Presence.Module.IDENTITY).received_presence.connect(check_for_enter_error);
stream.get_module(Presence.Module.IDENTITY).received_available.connect(on_received_available);
stream.get_module(Presence.Module.IDENTITY).received_unavailable.connect(on_received_unavailable);
if (stream.get_module(ServiceDiscovery.Module.IDENTITY) != null) {
@@ -179,7 +179,7 @@ public class Module : XmppStreamModule {
public override void detach(XmppStream stream) {
stream.get_module(Message.Module.IDENTITY).received_message.disconnect(on_received_message);
- stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(on_received_presence);
+ stream.get_module(Presence.Module.IDENTITY).received_presence.disconnect(check_for_enter_error);
stream.get_module(Presence.Module.IDENTITY).received_available.disconnect(on_received_available);
stream.get_module(Presence.Module.IDENTITY).received_unavailable.disconnect(on_received_unavailable);
}
@@ -206,7 +206,7 @@ public class Module : XmppStreamModule {
}
}
- private void on_received_presence(XmppStream stream, Presence.Stanza presence) {
+ private void check_for_enter_error(XmppStream stream, Presence.Stanza presence) {
Flag flag = stream.get_flag(Flag.IDENTITY);
if (presence.is_error() && flag.is_muc_enter_outstanding() && flag.is_occupant(presence.from)) {
string bare_jid = get_bare_jid(presence.from);
diff --git a/xmpp-vala/src/module/xep/0199_ping.vala b/xmpp-vala/src/module/xep/0199_ping.vala
index 74802be1..4902b0c7 100644
--- a/xmpp-vala/src/module/xep/0199_ping.vala
+++ b/xmpp-vala/src/module/xep/0199_ping.vala
@@ -12,7 +12,9 @@ namespace Xmpp.Xep.Ping {
public void send_ping(XmppStream stream, string jid, owned OnResult? listener) {
Iq.Stanza iq = new Iq.Stanza.get(new StanzaNode.build("ping", NS_URI).add_self_xmlns());
iq.to = jid;
- stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, (stream) => { listener(stream); });
+ stream.get_module(Iq.Module.IDENTITY).send_iq(stream, iq, (stream) => {
+ if (listener != null) listener(stream);
+ });
}
public override void attach(XmppStream stream) {