aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/util
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-05-11 12:57:02 +0200
committerfiaxh <git@lightrise.org>2021-05-11 12:57:02 +0200
commitd71604913dd5b3372a823320db83c37c845fac5c (patch)
tree2ffbff97a02c81d48d8aef4a4b7ee870507236e9 /main/src/ui/util
parente92ed27317ae398c867c946cf7206b1f0b32f3b4 (diff)
parent90f9ecf62b2ebfef14de2874e7942552409632bf (diff)
downloaddino-d71604913dd5b3372a823320db83c37c845fac5c.tar.gz
dino-d71604913dd5b3372a823320db83c37c845fac5c.zip
Merge remote-tracking branch 'origin/feature/calls'
Diffstat (limited to 'main/src/ui/util')
-rw-r--r--main/src/ui/util/helper.vala15
1 files changed, 12 insertions, 3 deletions
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala
index b6c9cb5a..17dfd334 100644
--- a/main/src/ui/util/helper.vala
+++ b/main/src/ui/util/helper.vala
@@ -122,15 +122,15 @@ public static string get_participant_display_name(StreamInteractor stream_intera
return Dino.get_participant_display_name(stream_interactor, conversation, participant, me_is_me ? _("Me") : null);
}
-private static string? get_real_display_name(StreamInteractor stream_interactor, Account account, Jid jid, bool me_is_me = false) {
+public static string? get_real_display_name(StreamInteractor stream_interactor, Account account, Jid jid, bool me_is_me = false) {
return Dino.get_real_display_name(stream_interactor, account, jid, me_is_me ? _("Me") : null);
}
-private static string get_groupchat_display_name(StreamInteractor stream_interactor, Account account, Jid jid) {
+public static string get_groupchat_display_name(StreamInteractor stream_interactor, Account account, Jid jid) {
return Dino.get_groupchat_display_name(stream_interactor, account, jid);
}
-private static string get_occupant_display_name(StreamInteractor stream_interactor, Conversation conversation, Jid jid, bool me_is_me = false, bool muc_real_name = false) {
+public static string get_occupant_display_name(StreamInteractor stream_interactor, Conversation conversation, Jid jid, bool me_is_me = false, bool muc_real_name = false) {
return Dino.get_occupant_display_name(stream_interactor, conversation, jid, me_is_me ? _("Me") : null);
}
@@ -194,6 +194,15 @@ public static bool is_24h_format() {
return is24h == 1;
}
+public static string format_time(DateTime datetime, string format_24h, string format_12h) {
+ string format = Util.is_24h_format() ? format_24h : format_12h;
+ if (!get_charset(null)) {
+ // No UTF-8 support, use simple colon for time instead
+ format = format.replace("∶", ":");
+ }
+ return datetime.format(format);
+}
+
public static Regex get_url_regex() {
if (URL_REGEX == null) {
URL_REGEX = /\b(((http|ftp)s?:\/\/|(ircs?|xmpp|mailto|sms|smsto|mms|tel|geo|openpgp4fpr|im|news|nntp|sip|ssh|bitcoin|sftp|magnet|vnc|urn):)\S+)/;