aboutsummaryrefslogtreecommitdiff
path: root/client/src/service/conversation_manager.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-09 15:34:32 +0100
committerfiaxh <git@mx.ax.lt>2017-03-09 15:45:03 +0100
commit5fc0435cc1227bf445d06a3931343020faaecd10 (patch)
tree329041d3b2545fc445e9f175d3d5fff755fd110b /client/src/service/conversation_manager.vala
parentb1e6e51c4f79f57f0a01b183ef185408fb22cc36 (diff)
downloaddino-5fc0435cc1227bf445d06a3931343020faaecd10.tar.gz
dino-5fc0435cc1227bf445d06a3931343020faaecd10.zip
Save unsent messages (acc offline etc) and send later; don't send pgp messages if pgp error
Diffstat (limited to 'client/src/service/conversation_manager.vala')
-rw-r--r--client/src/service/conversation_manager.vala13
1 files changed, 9 insertions, 4 deletions
diff --git a/client/src/service/conversation_manager.vala b/client/src/service/conversation_manager.vala
index 5337f007..716c9b39 100644
--- a/client/src/service/conversation_manager.vala
+++ b/client/src/service/conversation_manager.vala
@@ -27,6 +27,7 @@ public class ConversationManager : StreamInteractionModule, Object {
stream_interactor.account_added.connect(on_account_added);
MucManager.get_instance(stream_interactor).groupchat_joined.connect(on_groupchat_joined);
MessageManager.get_instance(stream_interactor).pre_message_received.connect(on_message_received);
+ MessageManager.get_instance(stream_interactor).message_sent.connect(on_message_sent);
}
public Conversation? get_conversation(Jid jid, Account account) {
@@ -37,12 +38,12 @@ public class ConversationManager : StreamInteractionModule, Object {
}
public Conversation get_add_conversation(Jid jid, Account account) {
- ensure_add_conversation(jid, account, Conversation.TYPE_CHAT);
+ ensure_add_conversation(jid, account, Conversation.Type.CHAT);
return get_conversation(jid, account);
}
public void ensure_start_conversation(Jid jid, Account account) {
- ensure_add_conversation(jid, account, Conversation.TYPE_CHAT);
+ ensure_add_conversation(jid, account, Conversation.Type.CHAT);
Conversation? conversation = get_conversation(jid, account);
if (conversation != null) {
conversation.last_active = new DateTime.now_utc();
@@ -73,12 +74,16 @@ public class ConversationManager : StreamInteractionModule, Object {
ensure_start_conversation(conversation.counterpart, conversation.account);
}
+ private void on_message_sent(Entities.Message message, Conversation conversation) {
+ conversation.last_active = message.time;
+ }
+
private void on_groupchat_joined(Account account, Jid jid, string nick) {
- ensure_add_conversation(jid, account, Conversation.TYPE_GROUPCHAT);
+ ensure_add_conversation(jid, account, Conversation.Type.GROUPCHAT);
ensure_start_conversation(jid, account);
}
- private void ensure_add_conversation(Jid jid, Account account, int type) {
+ private void ensure_add_conversation(Jid jid, Account account, Conversation.Type type) {
if (conversations.has_key(account) && !conversations[account].has_key(jid)) {
Conversation conversation = new Conversation(jid, account);
conversation.type_ = type;