aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service/message_manager.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-24 22:57:05 +0100
committerfiaxh <git@mx.ax.lt>2017-03-31 01:21:35 +0200
commit7d2f995a097086be01426cc79c9c801dabaf9e3b (patch)
tree32b00adeaec82843a9f41fb3de17adc25e62fcc1 /libdino/src/service/message_manager.vala
parent3733d24a9066bdd3e038d642a62cf642abd0b0bf (diff)
downloaddino-7d2f995a097086be01426cc79c9c801dabaf9e3b.tar.gz
dino-7d2f995a097086be01426cc79c9c801dabaf9e3b.zip
Fix conversation last_active
Diffstat (limited to 'libdino/src/service/message_manager.vala')
-rw-r--r--libdino/src/service/message_manager.vala13
1 files changed, 5 insertions, 8 deletions
diff --git a/libdino/src/service/message_manager.vala b/libdino/src/service/message_manager.vala
index 1f0d528b..314a466b 100644
--- a/libdino/src/service/message_manager.vala
+++ b/libdino/src/service/message_manager.vala
@@ -103,9 +103,9 @@ public class MessageManager : StreamInteractionModule, Object {
new_message.ourpart = new_message.direction == Entities.Message.DIRECTION_SENT ? new Jid(message.from) : new Jid(message.to);
new_message.stanza = message;
Xep.DelayedDelivery.MessageFlag? deleyed_delivery_flag = Xep.DelayedDelivery.MessageFlag.get_flag(message);
- new_message.time = deleyed_delivery_flag != null ? deleyed_delivery_flag.datetime : new DateTime.now_utc();
- new_message.local_time = new DateTime.now_utc();
- Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_add_conversation(new_message.counterpart, account);
+ new_message.time = deleyed_delivery_flag != null ? deleyed_delivery_flag.datetime : new DateTime.now_local();
+ new_message.local_time = new DateTime.now_local();
+ Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(new_message.counterpart, account, Conversation.Type.CHAT);
pre_message_received(new_message, message, conversation);
bool is_uuid = new_message.stanza_id != null && Regex.match_simple("""[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}""", new_message.stanza_id);
@@ -113,9 +113,6 @@ public class MessageManager : StreamInteractionModule, Object {
(!is_uuid && !db.contains_message(new_message, conversation.account))) {
new_message.persist(db);
add_message(new_message, conversation);
- if (new_message.time.difference(conversation.last_active) > 0) {
- conversation.last_active = new_message.time;
- }
if (new_message.direction == Entities.Message.DIRECTION_SENT) {
message_sent(new_message, conversation);
} else {
@@ -137,8 +134,8 @@ public class MessageManager : StreamInteractionModule, Object {
message.stanza_id = random_uuid();
message.account = conversation.account;
message.body = text;
- message.time = new DateTime.now_utc();
- message.local_time = new DateTime.now_utc();
+ message.time = new DateTime.now_local();
+ message.local_time = new DateTime.now_local();
message.direction = Entities.Message.DIRECTION_SENT;
message.counterpart = conversation.counterpart;
message.ourpart = new Jid(conversation.account.bare_jid.to_string() + "/" + conversation.account.resourcepart);