Change XMPPPresence to Away/Busy/Invisible
How do you change your presence to show dnd/away and etc.?
XMPPPresence *presence = [XMPPPresence presenceWithType:status]; [[[self appDelegate] xmppStream] sendElement:presence];
status is an NSString that I set to online/unavailable/away/busy/invisible.
It only works when I go online and/or unavailable.
Here's how it looks like after sending presence in my xmppStream:
<presence type="away"><x xmlns="vcard-temp:x:update"><photo/></x></presence>
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").