You can change your status immediately after you're logged in via goOnline
method as it is called after xmppStreamDidAuthenticate
.
- (void)goOnline
{
// Initialize XMPPPresence variable
XMPPPresence *presence = [XMPPPresence presence];
// Initialize XML element <show/> for specifying your status
NSXMLElement *show = [NSXMLElement elementWithName:@"show"];
// Initialize XML element <status/> for describing your status
NSXMLElement *status = [NSXMLElement elementWithName:@"status"];
// If you want your user status to be shown as "Available"
[show setStringValue:@"chat"];
[status setStringValue:@"Available"];
// If you want your user status to be shown as "Busy"
[show setStringValue:@"dnd"];
[status setStringValue:@"Busy"];
// If you want your user status to be shown as "Away"
[show setStringValue:@"away"];
[status setStringValue:@"Away"];
// If you want your user status to be shown as "Off-day"
[show setStringValue:@"xa"];
[status setStringValue:@"Off-day"];
// Add the XML elements to XMPPPresence
[presence addChild:show];
[presence addChild:status];
// Update new presence to server
[xmppStream sendElement:presence];
}
For more information and an explanation to my code above, visit Change XMPPPresence to Away/Busy/Invisible.