From ba57f62fbf7616ecf60045afb7b4ce13b0930eb9 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 13 Nov 2024 11:33:36 -0500 Subject: [PATCH] Note if this participant is yourself --- snikket/Chat.hx | 6 +++--- snikket/Participant.hx | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/snikket/Chat.hx b/snikket/Chat.hx index 88c7a48..8c5b579 100644 --- a/snikket/Chat.hx +++ b/snikket/Chat.hx @@ -647,7 +647,7 @@ class DirectChat extends Chat { @HaxeCBridge.noemit // on superclass as abstract public function getParticipantDetails(participantId:String): Participant { final chat = client.getDirectChat(participantId); - return new Participant(chat.getDisplayName(), chat.getPhoto(), chat.getPlaceholder()); + return new Participant(chat.getDisplayName(), chat.getPhoto(), chat.getPlaceholder(), chat.chatId == client.accountId()); } @HaxeCBridge.noemit // on superclass as abstract @@ -1066,11 +1066,11 @@ class Channel extends Chat { public function getParticipantDetails(participantId:String): Participant { if (participantId == getFullJid().asString()) { final chat = client.getDirectChat(client.accountId(), false); - return new Participant(client.displayName(), chat.getPhoto(), chat.getPlaceholder()); + return new Participant(client.displayName(), chat.getPhoto(), chat.getPlaceholder(), true); } else { final nick = JID.parse(participantId).resource; final placeholderUri = Color.defaultPhoto(participantId, nick == null ? " " : nick.charAt(0)); - return new Participant(nick, null, placeholderUri); + return new Participant(nick, null, placeholderUri, false); } } diff --git a/snikket/Participant.hx b/snikket/Participant.hx index 7ee3d5b..3e7cb86 100644 --- a/snikket/Participant.hx +++ b/snikket/Participant.hx @@ -14,11 +14,13 @@ class Participant { public final displayName: String; public final photoUri: Null; public final placeholderUri: String; + public final isSelf: Bool; @:allow(snikket) - private function new(displayName: String, photoUri: Null, placeholderUri: String) { + private function new(displayName: String, photoUri: Null, placeholderUri: String, isSelf: Bool) { this.displayName = displayName; this.photoUri = photoUri; this.placeholderUri = placeholderUri; + this.isSelf = isSelf; } }