Skip to content

Commit

Permalink
feat: parse emoticons in last message
Browse files Browse the repository at this point in the history
  • Loading branch information
sualko committed Jan 24, 2019
1 parent 04bf5d5 commit 7066d8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Message.interface.ts
Expand Up @@ -73,6 +73,8 @@ export interface IMessage {

getEncryptedPlaintextMessage(): string

getPlaintextEmoticonMessage(): string

getSender(): { name: string, jid?: JID }

received();
Expand Down
9 changes: 9 additions & 0 deletions src/Message.ts
Expand Up @@ -252,6 +252,15 @@ export default class Message implements Identifiable, IMessage {
return `<p>${body}</p>`;
}

public getPlaintextEmoticonMessage(): string {
let body = this.getPlaintextMessage();

body = Utils.escapeHTML(body);
body = Emoticons.toImage(body);

return body;
}

public setErrorMessage(error: string) {
return this.data.set('errorMessage', error);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/RosterItem.ts
Expand Up @@ -103,12 +103,12 @@ export default class RosterItem {

let message = this.contact.getTranscript().getMessage(firstMessageId);

this.element.find('.jsxc-bar__caption__secondary').text(message.getPlaintextMessage());
this.element.find('.jsxc-bar__caption__secondary').html(message.getPlaintextEmoticonMessage());
});

let message = this.contact.getTranscript().getFirstMessage();
if (message) {
this.element.find('.jsxc-bar__caption__secondary').text(message.getPlaintextMessage());
this.element.find('.jsxc-bar__caption__secondary').html(message.getPlaintextEmoticonMessage());
}

let updateUnreadMessage = () => {
Expand Down

0 comments on commit 7066d8f

Please sign in to comment.