Skip to content

Commit

Permalink
Note if this participant is yourself
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Nov 13, 2024
1 parent 18967ab commit ba57f62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions snikket/Chat.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 3 additions & 1 deletion snikket/Participant.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit ba57f62

Please sign in to comment.