Hi at all,
I’m Pasquale, an italian objective c programmer.
I encountered problem with OF Server and xmppFramework library ( iOS ).
The problem is that my client send offline presence to server in this form:
0
but the server for unknow reason, the server interpreting this presence and always return it in this form:
with conseguence that the first time this presence is stored into db and i can correctly retrieve lastActivity of user, but the next time DB is not updated because the presence is always the same and i can’t retrieve the new value of lastActivity.
Inside PresenceManagerImpl.java i set a debug log before compiling, and i get the following value:
public void userUnavailable(Presence presence) {
// Only save the last presence status and keep track of the time when the user went
// offline if this is an unavailable presence sent to THE SERVER and the presence belongs
// to a local user.
-------> I RECEIVE THE INTERPRETED PRESENCE
if (presence.getTo() == null && server.isLocal(presence.getFrom())) {
String username = presence.getFrom().getNode();
if (username == null || !userManager.isRegisteredUser(username)) {
// Ignore anonymous users
return;
}
// If the user has any remaining sessions, don’t record the offline info.
if (sessionManager.getActiveSessionCount(username) > 0) {
return;
}
String offlinePresence = null;
// Save the last unavailable presence of this user if the presence contains any
// child element such as .
if (!presence.getElement().elements().isEmpty()) {
offlinePresence = presence.toXML();
}
---->>>> OFFLINEPRESENCE IS ALWAYS NULL
// Keep track of the time when the user went offline
java.util.Date offlinePresenceDate = new java.util.Date();
boolean addedToCache;
if (offlinePresence == null) {
addedToCache = !NULL_STRING.equals(offlinePresenceCache.put(username, NULL_STRING));
}
else {
addedToCache = !offlinePresence.equals(offlinePresenceCache.put(username, offlinePresence));
}
if (!addedToCache) {
---->>> THE SECOND TIME ( WHEN I ALREADY SAVED A OFFLINE PRESENCE ) HERE RETURN;
return;
}
--------->>> FIRST TIME I STORE MY OFFLINE PRESENCE WITH SUCCESS
lastActivityCache.put(username, offlinePresenceDate.getTime());
writeToDatabase(username, offlinePresence, offlinePresenceDate);
}
What can i do to solve this problem?
Thanks in advance.
Pasquale.