aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/plugin/interfaces.vala
blob: dd25c5f5895219dfb8315f72a78f89fbbbc7ed6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
using Dino.Entities;
using Xmpp;

namespace Dino.Plugins {

public enum Priority {
    LOWEST,
    LOWER,
    DEFAULT,
    HIGHER,
    HIGHEST
}

public enum WidgetType {
    GTK3,
    GTK4
}

public interface RootInterface : Object {
    public abstract void registered(Dino.Application app);

    public abstract void shutdown();
}

public interface EncryptionListEntry : Object {
    public abstract Entities.Encryption encryption { get; }
    public abstract string name { get; }

    public abstract void encryption_activated(Entities.Conversation conversation, Plugins.SetInputFieldStatus callback);
    public abstract Object? get_encryption_icon(Entities.Conversation conversation, ContentItem content_item);
    public abstract string? get_encryption_icon_name(Entities.Conversation conversation, ContentItem content_item);

}

public interface CallEncryptionEntry : Object {
    public abstract CallEncryptionWidget? get_widget(Account account, Xmpp.Xep.Jingle.ContentEncryption encryption);
}

public interface CallEncryptionWidget : Object {
    public abstract string? get_title();
    public abstract bool show_keys();
    public abstract string? get_icon_name();
}

public abstract class AccountSettingsEntry : Object {
    public abstract string id { get; }
    public virtual Priority priority { get { return Priority.DEFAULT; } }
    public abstract string name { get; }
    public virtual int16 label_top_padding { get { return -1; } }

    public abstract signal void activated();
    public abstract void deactivate();

    public abstract void set_account(Account account);
    public abstract Object? get_widget(WidgetType type);
}

public abstract class EncryptionPreferencesEntry : Object {
    public abstract string id { get; }
    public virtual Priority priority { get { return Priority.DEFAULT; } }

    public abstract Object? get_widget(Account account, WidgetType type);
}

public interface ContactDetailsProvider : Object {
    public abstract string id { get; }

    public abstract void populate(Conversation conversation, ContactDetails contact_details, WidgetType type);
}

public class ContactDetails : Object {
    public signal void save();
    public signal void add(string category, string label, string? desc, Object widget);
}

public interface TextCommand : Object {
    public abstract string cmd { get; }

    public abstract string? handle_command(string? text, Entities.Conversation? conversation);
}

public interface ConversationTitlebarEntry : Object {
    public abstract string id { get; }
    public abstract double order { get; }
    public abstract Object? get_widget(WidgetType type);

    public abstract void set_conversation(Conversation conversation);
    public abstract void unset_conversation();
}

public abstract interface ConversationItemPopulator : Object {
    public abstract string id { get; }
    public abstract void init(Conversation conversation, ConversationItemCollection summary, WidgetType type);
    public abstract void close(Conversation conversation);
}

public abstract interface ConversationAdditionPopulator : ConversationItemPopulator {
    public virtual void populate_timespan(Conversation conversation, DateTime from, DateTime to) { }
}

public abstract interface VideoCallPlugin : Object {

    public abstract bool supports(string? media);
    // Video widget
    public abstract VideoCallWidget? create_widget(WidgetType type);

    // Devices
    public signal void devices_changed(string media, bool incoming);
    public abstract Gee.List<MediaDevice> get_devices(string media, bool incoming);
    public abstract MediaDevice? get_preferred_device(string media, bool incoming);
    public abstract MediaDevice? get_device(Xmpp.Xep.JingleRtp.Stream? stream, bool incoming);
    public abstract void set_pause(Xmpp.Xep.JingleRtp.Stream? stream, bool pause);
    public abstract void set_device(Xmpp.Xep.JingleRtp.Stream? stream, MediaDevice? device);

    public abstract void dump_dot();
}

public abstract interface VideoCallWidget : Object {
    public signal void resolution_changed(uint width, uint height);
    public abstract void display_stream(Xmpp.Xep.JingleRtp.Stream? stream, Jid jid);
    public abstract void display_device(MediaDevice device);
    public abstract void detach();
}

public abstract interface MediaDevice : Object {
    public abstract string id { owned get; }
    public abstract string display_name { owned get; }
    public abstract string? detail_name { owned get; }

    public abstract string? media { owned get; }
    public abstract bool incoming { get; }
}

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 string populator_id { get; set; }
    public virtual Jid? jid { get; set; default=null; }
    public virtual DateTime time { get; set; default = new DateTime.now_utc(); }
    public virtual int secondary_sort_indicator { get; set; }
    public virtual Encryption encryption { get; set; default = Encryption.NONE; }
    public virtual Entities.Message.Marked mark { get; set; default = Entities.Message.Marked.NONE; }

    public bool can_merge { get; set; default=false; }
    public bool requires_avatar { get; set; default=false; }
    public bool requires_header { get; set; default=false; }
    public bool in_edit_mode { get; set; default=false; }

    public abstract Object? get_widget(ConversationItemWidgetInterface outer, WidgetType type);
    public abstract Gee.List<MessageAction>? get_item_actions(WidgetType type);
}

public interface ConversationItemWidgetInterface: Object {
    public abstract void set_widget(Object object, WidgetType type, int priority);
}

public delegate void MessageActionEvoked(Variant? variant);
public class MessageAction : Object {
    public string name;
    public bool sensitive = true;
    public string icon_name;
    public string? tooltip;
    public Object? popover;
    public MessageActionEvoked? callback;
}

public abstract class MetaConversationNotification : Object {
    public abstract Object? get_widget(WidgetType type);
}

public interface ConversationItemCollection : Object {
    public signal void inserted_item(MetaConversationItem item);
    public signal void removed_item(MetaConversationItem item);

    public abstract void insert_item(MetaConversationItem item);
    public abstract 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 delegate void SetInputFieldStatus(InputFieldStatus field_status);
public class InputFieldStatus : Object {
    public enum MessageType {
        NONE,
        INFO,
        WARNING,
        ERROR
    }
    public enum InputState {
        NORMAL,
        DISABLED,
        NO_SEND
    }

    public string? message;
    public MessageType message_type;
    public InputState input_state;
    public bool contains_markup;

    public InputFieldStatus(string? message, MessageType message_type, InputState input_state, bool contains_markup = false) {
        this.message = message;
        this.message_type = message_type;
        this.input_state = input_state;
        this.contains_markup = contains_markup;
    }
}

}