git » sdk » commit ba57f62

Note if this participant is yourself

author Stephen Paul Weber
2024-11-13 16:33:36 UTC
committer Stephen Paul Weber
2024-11-13 16:33:36 UTC
parent 18967ab778112fa6b16fec94ea42c0fc998f9258

Note if this participant is yourself

snikket/Chat.hx +3 -3
snikket/Participant.hx +3 -1

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<String>;
 	public final placeholderUri: String;
+	public final isSelf: Bool;
 
 	@:allow(snikket)
-	private function new(displayName: String, photoUri: Null<String>, placeholderUri: String) {
+	private function new(displayName: String, photoUri: Null<String>, placeholderUri: String, isSelf: Bool) {
 		this.displayName = displayName;
 		this.photoUri = photoUri;
 		this.placeholderUri = placeholderUri;
+		this.isSelf = isSelf;
 	}
 }