blob: 480ccd484d4df8666a05e56b1d3aecdd2cadfc21 (
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
|
using Dino.Entities;
namespace Dino.Ui.ConversationSummary {
public enum MessageKind {
TEXT,
ME_COMMAND
}
public MessageKind get_message_kind(Message message) {
if (message.body.has_prefix("/me ")) {
return MessageKind.ME_COMMAND;
} else {
return MessageKind.TEXT;
}
}
public interface ConversationItem : Gtk.Widget {
public abstract bool merge(Entities.Message message);
public static ConversationItem create_for_message(StreamInteractor stream_interactor, Conversation conversation, Message message) {
switch (get_message_kind(message)) {
case MessageKind.TEXT:
return new MergedMessageItem(stream_interactor, conversation, message);
break;
case MessageKind.ME_COMMAND:
return new SlashMeItem(stream_interactor, conversation, message);
break;
}
return null;
}
}
}
|