powered by Jive Software

Should Presence.getMode() return Mode.available when mode is null?

This came up within the aSmack community (aSmack issue 27). RFC6121 states that “If no element is provided, the entity is assumed to be online and available.” The show element has only 4 modes defined, namely “away”, “chat”, “dnd” and “xa”. The “available” mode, not to be confused with status type “available”, is an implicit one.

I am considering changing Prescence.getMode() to return Mode.available if mode is not set. This seems to be the better aproach compared to explicity setting mode to Mode.available in the Prescence(Type) constructor. Any comments or objections?

1 Like

I’m just want to note that since there is available value for Mode, returning null is error-prone for library users (mainly because null usually means value is absent for some reason).