Change XMPPPresence to Away/Busy/Invisible

后端 未结 2 984
甜味超标
甜味超标 2021-02-04 22:02

How do you change your presence to show dnd/away and etc.?

XMPPPresence *presence = [XMPPPresence presenceWithType:status];
[[[self appDelegate] xmppStream] send         


        
2条回答
  •  孤街浪徒
    2021-02-04 22:39

    To change the status of your client you will need to use this simple code:

    XMPPPresence *presence = [XMPPPresence presence];
    NSXMLElement *status = [NSXMLElement elementWithName:@"status"];
    [status setStringValue:@"online/unavailable/away/busy/invisible"];
    [presence addChild:status];
    [[self xmppStream] sendElement:presence];
    

    This simply means that the key to change the status of your client is by adding a status element to your presence. Please note that the openfire server will only show the "available/Offline" status when you hover on the user icon in the admin panel. This should not confuse you though. You can simply check the presence message sent by your client and received by the others which will show on of the status you have set ("online/unavailable/away/busy/invisible").

提交回复
热议问题