I’‘m (still) writing a plugin that notifies people of offline messages over another, non-XMPP medium. I’‘m trying to send notifications on each first offline message that is received. After that, notifications won’'t be send again until the user clears its offline message store.
To do this, I’‘m using the OfflineMessageStore.getSize(username) method. In pseudo, I’'m trying to somthing like this (where ‘‘oms’’ is an OfflineMessageStore instance):
int spaceUsed = oms.getSize(receipientUserName);
if ( spaceUsed == 0 )
// user has no messages in store yet
// user has had a previous notification,
// don’'t send one again.
Log.info("Sorry, couldn’'t send notification. "
"The receipient already has "
spaceUsed + " bytes of "
“messages waiting for him/her.”);
Sadly, this doesn’‘t seem to work. After a user reads his offline messages, OfflineMessageStore.getSize(username) seems to return data for offline messages that do not exist anymore. I checked the ‘‘jiveOffline’’ table: it’'s empty, but still getSize() returns non-zero values. Is this some intended caching/buffering or a bug? Can someone think of a workaround?