diff options
author | fiaxh <git@mx.ax.lt> | 2017-08-16 11:44:42 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-08-17 01:26:03 +0200 |
commit | fb36ea055301b6db513a31acde30f315e2c0fd68 (patch) | |
tree | e9bfeecc12a3824e3b9a86abbed44856ef6dd1e0 /main | |
parent | 30818b3965aef36f161147881967006d6e9376a6 (diff) | |
download | dino-fb36ea055301b6db513a31acde30f315e2c0fd68.tar.gz dino-fb36ea055301b6db513a31acde30f315e2c0fd68.zip |
Message Archive Management
Diffstat (limited to 'main')
-rw-r--r-- | main/src/ui/contact_details/muc_config_form_provider.vala | 78 | ||||
-rw-r--r-- | main/src/ui/notifications.vala | 5 | ||||
-rw-r--r-- | main/src/ui/occupant_menu/list.vala | 8 |
3 files changed, 49 insertions, 42 deletions
diff --git a/main/src/ui/contact_details/muc_config_form_provider.vala b/main/src/ui/contact_details/muc_config_form_provider.vala index 41df4465..438f41c4 100644 --- a/main/src/ui/contact_details/muc_config_form_provider.vala +++ b/main/src/ui/contact_details/muc_config_form_provider.vala @@ -34,43 +34,46 @@ public class MucConfigFormProvider : Plugins.ContactDetailsProvider { public static void add_field(DataForms.DataForm.Field field, Plugins.ContactDetails contact_details) { string label = field.label ?? ""; string? desc = null; - switch (field.var) { - case "muc#roomconfig_roomname": - label = _("Name of the room"); - break; - case "muc#roomconfig_roomdesc": - label = _("Description of the room"); - break; - case "muc#roomconfig_persistentroom": - label = _("Persistent"); - desc = _("The room will persist after the last occupant exits"); - break; - case "muc#roomconfig_publicroom": - label = _("Publicly searchable"); - break; - case "muc#roomconfig_changesubject": - label = _("Occupants may change subject"); - break; - case "muc#roomconfig_whois": - label = _("Discover real JIDs"); - desc = _("Who may discover real JIDs?"); - break; - case "muc#roomconfig_roomsecret": - label = _("Password"); - desc = _("Password required to enter the room. Leave empty for none"); - break; - case "muc#roomconfig_moderatedroom": - label = _("Moderated"); - desc = _("Only occupants with voice may send messages"); - break; - case "muc#roomconfig_membersonly": - label = _("Members only"); - desc = _("Only members may enter the room"); - break; - case "muc#roomconfig_historylength": - label = _("Message history"); - desc = _("Maximum number of history messages returned by the room"); - break; + + if (field.var != null) { + switch (field.var) { + case "muc#roomconfig_roomname": + label = _("Name of the room"); + break; + case "muc#roomconfig_roomdesc": + label = _("Description of the room"); + break; + case "muc#roomconfig_persistentroom": + label = _("Persistent"); + desc = _("The room will persist after the last occupant exits"); + break; + case "muc#roomconfig_publicroom": + label = _("Publicly searchable"); + break; + case "muc#roomconfig_changesubject": + label = _("Occupants may change subject"); + break; + case "muc#roomconfig_whois": + label = _("Discover real JIDs"); + desc = _("Who may discover real JIDs?"); + break; + case "muc#roomconfig_roomsecret": + label = _("Password"); + desc = _("Password required to enter the room. Leave empty for none"); + break; + case "muc#roomconfig_moderatedroom": + label = _("Moderated"); + desc = _("Only occupants with voice may send messages"); + break; + case "muc#roomconfig_membersonly": + label = _("Members only"); + desc = _("Only members may enter the room"); + break; + case "muc#roomconfig_historylength": + label = _("Message history"); + desc = _("Maximum number of history messages returned by the room"); + break; + } } Widget? widget = get_widget(field); @@ -78,6 +81,7 @@ public class MucConfigFormProvider : Plugins.ContactDetailsProvider { } private static Widget? get_widget(DataForms.DataForm.Field field) { + if (field.type_ == null) return null; switch (field.type_) { case DataForms.DataForm.Type.BOOLEAN: DataForms.DataForm.BooleanField boolean_field = field as DataForms.DataForm.BooleanField; diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala index 725a3e26..02f0b1de 100644 --- a/main/src/ui/notifications.vala +++ b/main/src/ui/notifications.vala @@ -35,7 +35,7 @@ public class Notifications : Object { if (!notifications.has_key(conversation)) { notifications[conversation] = new Notify.Notification("", null, null); - notifications[conversation].set_hint("transient", true); + notifications[conversation].set_hint("persistent", true); notifications[conversation].add_action("default", "Open", () => { conversation_selected(conversation); #if GDK3_WITH_X11 @@ -69,6 +69,7 @@ public class Notifications : Object { private void on_received_subscription_request(Jid jid, Account account) { 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.set_hint("persistent", true); notification.add_action("accept", _("Accept"), () => { stream_interactor.get_module(PresenceManager.IDENTITY).approve_subscription(account, jid); @@ -102,4 +103,4 @@ public class Notifications : Object { } } -}
\ No newline at end of file +} diff --git a/main/src/ui/occupant_menu/list.vala b/main/src/ui/occupant_menu/list.vala index 42ff3da6..aeea7c26 100644 --- a/main/src/ui/occupant_menu/list.vala +++ b/main/src/ui/occupant_menu/list.vala @@ -84,10 +84,12 @@ public class List : Box { private void header(ListBoxRow row, ListBoxRow? before_row) { ListRow c1 = row as ListRow; - Xmpp.Xep.Muc.Affiliation a1 = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c1.jid, c1.account); + Xmpp.Xep.Muc.Affiliation? a1 = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c1.jid, c1.account); + if (a1 == null) return; + if (before_row != null) { - ListRow c2 = before_row as ListRow; - Xmpp.Xep.Muc.Affiliation a2 = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c2.jid, c2.account); + ListRow c2 = (ListRow) before_row; + Xmpp.Xep.Muc.Affiliation? a2 = stream_interactor.get_module(MucManager.IDENTITY).get_affiliation(conversation.counterpart, c2.jid, c2.account); if (a1 != a2) { row.set_header(generate_header_widget(a1, false)); } else if (row.get_header() != null){ |