No inaccessibility of user A when user B is also inaccessible

I am working on a chat application. I am adding functionality to get inaccessible user status. Following a situation where I don't get an inaccessible user presence

There are 2 users, User A and User B, and both are available.

The first user A is unavailable, and user b becomes inaccessible to user A, therefore, his functionality ceases. Then user B becomes inaccessible, and then user A becomes available here, problems arise when user A does not get offline. Unavailable for user B.

But when user A is unavailable, and then user B becomes available, and then becomes available to user A, then in this case, USER A receives offline presence of user B so that it works normally.

So, the problem here is only if the presence of other users is not available offline. but unavailable offline availability

below is the code that I use for access and inaccessibility

 - (void)goOnline {
     XMPPPresence *presence = [XMPPPresence presence]; // type="available" is implicit
 [[self xmppStream] sendElement:presence];
}

- (void)goOffline {
XMPPPresence *presence = [XMPPPresence presenceWithType:@"unavailable"];
[[self xmppStream] sendElement:presence];

}

Thanks for any help with this :-)

+2
source share

Source: https://habr.com/ru/post/1546286/


All Articles