librelist archives

« back to archive

Display unread message count inside roster

Display unread message count inside roster

From:
J M
Date:
2015-09-09 @ 12:35
Hello,

I'm trying to show a custom unread message counter which includes the count
of messages received offline, next to each contact name in the roster
(RosterContactView).

I've already written out the server side code required to return the
offline message count, and some code for conversejs that will post to the
server to mark messages as read whenever the chat window is opened.  I've
also gotten the css changed to accommodate the display of this unread
message count nicely.

Now, I'm stuck on how to access message or listen to message received
events inside RosterContactView so that I can increment the unread message
counter.  I've looked at the MinimizedChats view code but it had the
chatboxes passed in directly inside the View's constructor so it clearly
has access to the messages.  Any pointers?

Thank you

Re: [conversejs] Display unread message count inside roster

From:
Lamtei W
Date:
2015-09-10 @ 07:33
Hi,

    I think you have to call the incrementMsgCounter function in some
appropriate method inside the RosterContactView, the same way it is being
called inside the ChatBoxView onMessageAdded function. Just take a look you
might figure out something. Hope it helps.

Regards,
Lamtei

On Wed, Sep 9, 2015 at 6:05 PM, J M <blugbee@gmail.com> wrote:

> Hello,
>
> I'm trying to show a custom unread message counter which includes the
> count of messages received offline, next to each contact name in the roster
> (RosterContactView).
>
> I've already written out the server side code required to return the
> offline message count, and some code for conversejs that will post to the
> server to mark messages as read whenever the chat window is opened.  I've
> also gotten the css changed to accommodate the display of this unread
> message count nicely.
>
> Now, I'm stuck on how to access message or listen to message received
> events inside RosterContactView so that I can increment the unread message
> counter.  I've looked at the MinimizedChats view code but it had the
> chatboxes passed in directly inside the View's constructor so it clearly
> has access to the messages.  Any pointers?
>
> Thank you
>