powered by Jive Software

Missing Piece on Presence Documentation

android

#1

Hi,
I just noticed something that took me hours to figure out.
In Roster and Presence Docs you simply have something like

Roster roster = Roster.getInstanceFor(con);
roster.addRosterListener(new RosterListener() {
	// Ignored events public void entriesAdded(Collection<String> addresses) {}
	public void entriesDeleted(Collection<String> addresses) {}
	public void entriesUpdated(Collection<String> addresses) {}
	public void presenceChanged(Presence presence) {
		System.out.println("Presence changed: " + presence.getFrom() + " " + presence);
	}
});

Now this is enough to someone who is well versed in XMPP but not otherwise. presenceChanged brings false impression that When the other side presence changes, you will automagically get notified. However, you must subscribe to get the notification.

So I belive that need to be clarified and perhaps give some codelike this one here for each roster entry you wan to be notified

    Presence presence = new Presence(Presence.Type.subscribe);
    presence.setTo(jid);
    connection.sendPacket(presence);

I wasted a lot of time troubleshooting a problem that does not exist and I though I should help others!


#2

We are always happy about improving your documentation, and, needless to say, there is much room for improvememnt.

Although, in this case, the paragraph following the one you mentioned in “Roster and Presence” documentation reads:

Adding Entries to the Roster

Rosters and presence use a permissions-based model where users must give permission before they are added to someone else’s roster. This protects a user’s privacy by making sure that only approved users are able to view their presence information.

Patches improving the documentation are always welcome.


#3

FYI: I’ve pushed https://github.com/Flowdalic/Smack/commit/bf648cf7499e58de632a1bbd34e07fdccdee01c7

Happy to hear your toughts.


#4

That’s great. I’ll check in my laptop.
And just a word of thanks, the library is great and makes XMPP fun. I appreciate!

I saw that you have professional support. Is there any pricing? I think at some point I’ll need one, especially in calls (video and audio calls)


#5

Feel free to contact me per private mesage or e-mail for further details.

My experience shows that it is a good idea to invest some resources into research and consulting about the feasibility and possibly additional cost of the envisioned features.