How to check online state of the special user in the special channel

Thanks for your swift response.
I mean:
For example: Imagine that the user “A” is viewing a vid or putting a message in the channel “test_chan”
I have to get the state of the user “A”.
In other words, I have to get the online/offline state of user “A” in the channel “test_chan”. And the count of his messages as well…
Thanks