Determine and send user presence state

This commit is contained in:
Emmanuel ROHEE 2014-08-26 16:25:27 +02:00
parent b07bc9bdbd
commit c21fcb3373
4 changed files with 140 additions and 5 deletions

View file

@ -358,6 +358,23 @@ angular.module('matrixService', [])
return false;
}
},
// Enum of presence state
presence: {
offline: "offline",
unavailable: "unavailable",
online: "online",
free_for_chat: "free_for_chat"
},
// Set the logged in user presence state
setUserPresence: function(presence) {
var path = "/presence/$user_id/status";
path = path.replace("$user_id", config.user_id);
return doRequest("PUT", path, undefined, {
state: presence
});
},
/****** Permanent storage of user information ******/