aboutsummaryrefslogtreecommitdiff
path: root/libdino
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-08-31 18:40:58 +0200
committerfiaxh <git@mx.ax.lt>2017-08-31 18:54:38 +0200
commitd2a5287effcf60a44084568a37c9c9091d336178 (patch)
tree392d24930cf5c635f114c3e4f30bfce930edf76f /libdino
parenta257b163376174e4f5efcbc82c9fdd56463c3191 (diff)
downloaddino-d2a5287effcf60a44084568a37c9c9091d336178.tar.gz
dino-d2a5287effcf60a44084568a37c9c9091d336178.zip
Use utc time everywhere
Diffstat (limited to 'libdino')
-rw-r--r--libdino/src/entity/conversation.vala2
-rw-r--r--libdino/src/entity/file_transfer.vala4
-rw-r--r--libdino/src/entity/message.vala4
-rw-r--r--libdino/src/service/chat_interaction.vala8
-rw-r--r--libdino/src/service/connection_manager.vala2
-rw-r--r--libdino/src/service/conversation_manager.vala2
-rw-r--r--libdino/src/service/message_processor.vala6
-rw-r--r--libdino/src/service/presence_manager.vala8
8 files changed, 18 insertions, 18 deletions
diff --git a/libdino/src/entity/conversation.vala b/libdino/src/entity/conversation.vala
index a978cf10..83c5ac22 100644
--- a/libdino/src/entity/conversation.vala
+++ b/libdino/src/entity/conversation.vala
@@ -54,7 +54,7 @@ public class Conversation : Object {
counterpart = resource != null ? new Jid.with_resource(jid, resource) : new Jid(jid);
active = row[db.conversation.active];
int64? last_active = row[db.conversation.last_active];
- if (last_active != null) this.last_active = new DateTime.from_unix_local(last_active);
+ if (last_active != null) this.last_active = new DateTime.from_unix_utc(last_active);
type_ = (Conversation.Type) row[db.conversation.type_];
encryption = (Encryption) row[db.conversation.encryption];
int? read_up_to = row[db.conversation.read_up_to];
diff --git a/libdino/src/entity/file_transfer.vala b/libdino/src/entity/file_transfer.vala
index 7a752518..10fe99f5 100644
--- a/libdino/src/entity/file_transfer.vala
+++ b/libdino/src/entity/file_transfer.vala
@@ -52,8 +52,8 @@ public class FileTransfer : Object {
ourpart = account.bare_jid;
}
direction = row[db.file_transfer.direction];
- time = new DateTime.from_unix_local(row[db.file_transfer.time]);
- local_time = new DateTime.from_unix_local(row[db.file_transfer.time]);
+ time = new DateTime.from_unix_utc(row[db.file_transfer.time]);
+ local_time = new DateTime.from_unix_utc(row[db.file_transfer.time]);
encryption = (Encryption) row[db.file_transfer.encryption];
file_name = row[db.file_transfer.file_name];
path = row[db.file_transfer.path];
diff --git a/libdino/src/entity/message.vala b/libdino/src/entity/message.vala
index e5871f49..cd54b0a5 100644
--- a/libdino/src/entity/message.vala
+++ b/libdino/src/entity/message.vala
@@ -73,8 +73,8 @@ public class Message : Object {
ourpart = account.bare_jid;
}
direction = row[db.message.direction];
- time = new DateTime.from_unix_local(row[db.message.time]);
- local_time = new DateTime.from_unix_local(row[db.message.time]);
+ time = new DateTime.from_unix_utc(row[db.message.time]);
+ local_time = new DateTime.from_unix_utc(row[db.message.time]);
body = row[db.message.body];
marked = (Message.Marked) row[db.message.marked];
encryption = (Encryption) row[db.message.encryption];
diff --git a/libdino/src/service/chat_interaction.vala b/libdino/src/service/chat_interaction.vala
index 3e8f4b24..0aefc418 100644
--- a/libdino/src/service/chat_interaction.vala
+++ b/libdino/src/service/chat_interaction.vala
@@ -51,8 +51,8 @@ public class ChatInteraction : StreamInteractionModule, Object {
if (!last_input_interaction.has_key(conversation)) {
send_chat_state_notification(conversation, Xep.ChatStateNotifications.STATE_COMPOSING);
}
- last_input_interaction[conversation] = new DateTime.now_local();
- last_interface_interaction[conversation] = new DateTime.now_local();
+ last_input_interaction[conversation] = new DateTime.now_utc();
+ last_interface_interaction[conversation] = new DateTime.now_utc();
}
public void on_message_cleared(Conversation? conversation) {
@@ -106,7 +106,7 @@ public class ChatInteraction : StreamInteractionModule, Object {
if (!iter.valid && iter.has_next()) iter.next();
Conversation conversation = iter.get_key();
if (last_input_interaction.has_key(conversation) &&
- (new DateTime.now_local()).difference(last_input_interaction[conversation]) >= 15 * TimeSpan.SECOND) {
+ (new DateTime.now_utc()).difference(last_input_interaction[conversation]) >= 15 * TimeSpan.SECOND) {
iter.unset();
send_chat_state_notification(conversation, Xep.ChatStateNotifications.STATE_PAUSED);
}
@@ -115,7 +115,7 @@ public class ChatInteraction : StreamInteractionModule, Object {
if (!iter.valid && iter.has_next()) iter.next();
Conversation conversation = iter.get_key();
if (last_interface_interaction.has_key(conversation) &&
- (new DateTime.now_local()).difference(last_interface_interaction[conversation]) >= 1.5 * TimeSpan.MINUTE) {
+ (new DateTime.now_utc()).difference(last_interface_interaction[conversation]) >= 1.5 * TimeSpan.MINUTE) {
iter.unset();
send_chat_state_notification(conversation, Xep.ChatStateNotifications.STATE_GONE);
}
diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala
index f7333bbd..2be16a21 100644
--- a/libdino/src/service/connection_manager.vala
+++ b/libdino/src/service/connection_manager.vala
@@ -155,7 +155,7 @@ public class ConnectionManager {
}
stream.log = new Core.XmppLog(account.bare_jid.to_string(), log_options);
- Connection connection = new Connection(stream, new DateTime.now_local());
+ Connection connection = new Connection(stream, new DateTime.now_utc());
connections[account] = connection;
change_connection_state(account, ConnectionState.CONNECTING);
stream.attached_modules.connect((stream) => {
diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala
index 81d846e0..0f827e26 100644
--- a/libdino/src/service/conversation_manager.vala
+++ b/libdino/src/service/conversation_manager.vala
@@ -86,7 +86,7 @@ public class ConversationManager : StreamInteractionModule, Object {
public void start_conversation(Conversation conversation, bool push_front = false) {
if (push_front) {
- conversation.last_active = new DateTime.now_local();
+ conversation.last_active = new DateTime.now_utc();
if (conversation.active) conversation_activated(conversation);
}
if (!conversation.active) {
diff --git a/libdino/src/service/message_processor.vala b/libdino/src/service/message_processor.vala
index 4bb30ce6..25e8f91a 100644
--- a/libdino/src/service/message_processor.vala
+++ b/libdino/src/service/message_processor.vala
@@ -85,7 +85,7 @@ public class MessageProcessor : StreamInteractionModule, Object {
Xep.MessageArchiveManagement.MessageFlag? mam_message_flag = Xep.MessageArchiveManagement.MessageFlag.get_flag(message);
if (mam_message_flag != null) new_message.local_time = mam_message_flag.server_time;
- if (new_message.local_time == null || new_message.local_time.compare(new DateTime.now_local()) > 0) new_message.local_time = new DateTime.now_local();
+ if (new_message.local_time == null || new_message.local_time.compare(new DateTime.now_utc()) > 0) new_message.local_time = new DateTime.now_utc();
Xep.DelayedDelivery.MessageFlag? delayed_message_flag = Xep.DelayedDelivery.MessageFlag.get_flag(message);
if (delayed_message_flag != null) new_message.time = delayed_message_flag.datetime;
@@ -163,8 +163,8 @@ public class MessageProcessor : StreamInteractionModule, Object {
message.stanza_id = random_uuid();
message.account = conversation.account;
message.body = text;
- message.time = new DateTime.now_local();
- message.local_time = new DateTime.now_local();
+ message.time = new DateTime.now_utc();
+ message.local_time = new DateTime.now_utc();
message.direction = Entities.Message.DIRECTION_SENT;
message.counterpart = conversation.counterpart;
if (conversation.type_ in new Conversation.Type[]{Conversation.Type.GROUPCHAT, Conversation.Type.GROUPCHAT_PM}) {
diff --git a/libdino/src/service/presence_manager.vala b/libdino/src/service/presence_manager.vala
index ad2db89f..298fa234 100644
--- a/libdino/src/service/presence_manager.vala
+++ b/libdino/src/service/presence_manager.vala
@@ -30,10 +30,10 @@ public class PresenceManager : StreamInteractionModule, Object {
if (stream != null) {
Xmpp.Presence.Stanza? presence = stream.get_flag(Presence.Flag.IDENTITY).get_presence(jid.to_string());
if (presence != null) {
- return new Show(jid, presence.show, new DateTime.now_local());
+ return new Show(jid, presence.show, new DateTime.now_utc());
}
}
- return new Show(jid, Show.OFFLINE, new DateTime.now_local());
+ return new Show(jid, Show.OFFLINE, new DateTime.now_utc());
}
public HashMap<Jid, ArrayList<Show>>? get_shows(Jid jid, Account account) {
@@ -116,7 +116,7 @@ public class PresenceManager : StreamInteractionModule, Object {
}
private void add_show(Account account, Jid jid, string s) {
- Show show = new Show(jid, s, new DateTime.now_local());
+ Show show = new Show(jid, s, new DateTime.now_utc());
lock (shows) {
if (!shows.has_key(jid)) {
shows[jid] = new HashMap<Jid, ArrayList<Show>>();
@@ -148,4 +148,4 @@ public class Show : Object {
this.datetime = datetime;
}
}
-} \ No newline at end of file
+}