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>

Answers


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").


Need Your Help

PHP 5.5 to SQL Server via PDO, how to pass row contents back to JavaScript jQuery Ajax call

javascript php jquery sql sql-server

I am working on a project that uses jQuery Ajax on the Front-End and PHP 5.5.15 and SQL Server 2014 on the back-end. I have installed drivers for PHP 5.5 to talk to SQL Server from

JQuery add click event to unknown div id

javascript jquery events html

I'm loading a php page that shows multiple elements, depending of the users (so i can't know how many items will be show). Those elements looks like :

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.