Hi anlumo
Thanks for your reply.
I have tried the suggestions in XEP-0126 however i find that when i do get it working it appears that blocking presence is reciprocal. i.e user ‘‘a’’ successfully blocks his roster contacts seeing him online but user ‘‘a’’ is not informed of presence updates either.
Specifically, the aspects from XEP-0126 i am trying to implement are below in blue. for the first case, i tried the below.
java.util.List<PrivacyItem> list = new ArrayList();
PrivacyItem item = new PrivacyItem(PrivacyItem.Type.group.name(), false, 1);
item.setFilterPresence_in(true);
item.setFilterMessage(true);
item.setFilterPresence_out(false);
item.setFilterIQ(true);
list.add(item);
try {
PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(connection);
privacyManager.createPrivacyList(“invisible”, list);
privacyManager.setActiveListName(“invisible”);
} catch (XMPPException ex) {
ex.printStackTrace();
}
connection.sendPacket(presence);
this doesnt work. Would you know how to get the all the cases listed below working in smack?
Best wishes,
Steven
If a user wants to log in as invisible, a certain order of events MUST be followed. Specifically, after authenticating but before sending initial presence, the user MUST define (if necessary) and set as active a privacy list that blocks all outbound presence notifications.
Example 1. User Defines and Sets Global Invisibility Privacy Rule
… authentication / session establishment … <iq from=’‘bilbo@tolkien.lit/shire’’ type=’‘set’’ id=’‘inv1’’>
<query xmlns=’‘jabber:iq:privacy’’>
<list name=’‘invisible’’>
<item action=’‘deny’’ order=’‘1’’>
<presence-out/>
</item>
</list>
</query>
</iq> <iq from=’‘bilbo@tolkien.lit/shire’’ type=’‘set’’ id=’‘active1’’>
<query xmlns=’‘jabber:iq:privacy’’>
<active name=’‘invisible’’/>
</query>
</iq> Naturally, the user could have defined this list during a previous session and could simply set the relevant list as active when logging in, rather than defining the list on login. Both steps are shown here for completeness.
The user may now send initial presence to the server.
Example 2. User Sends Initial Presence
<presence>
<status>I’‘m not really here, you understand!</status>
</presence> Even though the user has sent initial presence, that presence information will not be broadcasted to any of the user’‘s contacts, since the active privacy list blocks all outbound presence notifications.
3.5 Become Globally Invisible
In order to become globally invisible again, the user does the following.
First, the user sends unavailable presence for broadcasting to all contacts:
Example 21. User Sends Unavailable Presence
<presence type=’‘unavailable’’/> Second, the user sets as active the global invisibility list previously defined:
Example 22. User Becomes Globally Invisible
<iq from=’‘bilbo@tolkien.lit/shire’’ type=’‘set’’ id=’‘active10’’>
<query xmlns=’‘jabber:iq:privacy’’>
<active name=’‘invisible’’/>
</query>
</iq> In order to appear globally invisible, the client MUST now re-send the user’‘s presence for broadcasting to all contacts, which the active rule will block to all contacts:
Example 23. Client Sends Available Presence
<presence>
<status>I’'m not really here, you understand!</status>
</presence>
3.5 Become Globally Invisible
In order to become globally invisible again, the user does the following.
First, the user sends unavailable presence for broadcasting to all contacts:
Example 21. User Sends Unavailable Presence
<presence type=’‘unavailable’’/> Second, the user sets as active the global invisibility list previously defined:
Example 22. User Becomes Globally Invisible
<iq from=’‘bilbo@tolkien.lit/shire’’ type=’‘set’’ id=’‘active10’’>
<query xmlns=’‘jabber:iq:privacy’’>
<active name=’‘invisible’’/>
</query>
</iq> In order to appear globally invisible, the client MUST now re-send the user’‘s presence for broadcasting to all contacts, which the active rule will block to all contacts:
Example 23. Client Sends Available Presence
<presence>
<status>I’'m not really here, you understand!</status>
</presence>