diff options
Diffstat (limited to 'libdino/src')
-rw-r--r-- | libdino/src/plugin/interfaces.vala | 15 | ||||
-rw-r--r-- | libdino/src/plugin/registry.vala | 11 | ||||
-rw-r--r-- | libdino/src/service/roster_manager.vala | 5 |
3 files changed, 31 insertions, 0 deletions
diff --git a/libdino/src/plugin/interfaces.vala b/libdino/src/plugin/interfaces.vala index 62260076..09d4d921 100644 --- a/libdino/src/plugin/interfaces.vala +++ b/libdino/src/plugin/interfaces.vala @@ -80,6 +80,12 @@ public abstract interface ConversationItemPopulator : Object { public abstract void close(Conversation conversation); } +public abstract interface NotificationPopulator : Object { + public abstract string id { get; } + public abstract void init(Conversation conversation, NotificationCollection summary, WidgetType type); + public abstract void close(Conversation conversation); +} + public abstract class MetaConversationItem : Object { public virtual Jid? jid { get; set; default=null; } public virtual string color { get; set; default=null; } @@ -98,11 +104,20 @@ public abstract class MetaConversationItem : Object { public abstract Object? get_widget(WidgetType type); } +public abstract class MetaConversationNotification : Object { + public abstract Object? get_widget(WidgetType type); +} + public interface ConversationItemCollection : Object { public signal void insert_item(MetaConversationItem item); public signal void remove_item(MetaConversationItem item); } +public interface NotificationCollection : Object { + public signal void add_meta_notification(MetaConversationNotification item); + public signal void remove_meta_notification(MetaConversationNotification item); +} + public interface MessageDisplayProvider : Object { public abstract string id { get; set; } public abstract double priority { get; set; } diff --git a/libdino/src/plugin/registry.vala b/libdino/src/plugin/registry.vala index 7b4410aa..fbdf2c5c 100644 --- a/libdino/src/plugin/registry.vala +++ b/libdino/src/plugin/registry.vala @@ -9,6 +9,7 @@ public class Registry { internal Map<string, TextCommand> text_commands = new HashMap<string, TextCommand>(); internal Gee.List<MessageDisplayProvider> message_displays = new ArrayList<MessageDisplayProvider>(); internal Gee.List<ConversationItemPopulator> conversation_item_populators = new ArrayList<ConversationItemPopulator>(); + internal Gee.List<NotificationPopulator> notification_populators = new ArrayList<NotificationPopulator>(); internal Gee.Collection<ConversationTitlebarEntry> conversation_titlebar_entries = new Gee.TreeSet<ConversationTitlebarEntry>((a, b) => { if (a.order < b.order) { return -1; @@ -89,6 +90,16 @@ public class Registry { return true; } } + + public bool register_notification_populator(NotificationPopulator populator) { + lock (notification_populators) { + foreach(NotificationPopulator p in notification_populators) { + if (p.id == populator.id) return false; + } + notification_populators.add(populator); + return true; + } + } } } diff --git a/libdino/src/service/roster_manager.vala b/libdino/src/service/roster_manager.vala index 23bc8b76..5181b90e 100644 --- a/libdino/src/service/roster_manager.vala +++ b/libdino/src/service/roster_manager.vala @@ -11,6 +11,7 @@ public class RosterManager : StreamInteractionModule, Object { public signal void removed_roster_item(Account account, Jid jid, Roster.Item roster_item); public signal void updated_roster_item(Account account, Jid jid, Roster.Item roster_item); + public signal void mutual_subscription(Account account, Jid jid); private StreamInteractor stream_interactor; private Database db; @@ -66,6 +67,10 @@ public class RosterManager : StreamInteractionModule, Object { stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).item_updated.connect_after( (stream, roster_item) => { on_roster_item_updated(account, roster_item); }); + + stream_interactor.module_manager.get_module(account, Roster.Module.IDENTITY).mutual_subscription.connect_after( (stream, jid) => { + mutual_subscription(account, jid); + }); } private void on_roster_item_updated(Account account, Roster.Item roster_item) { |