feat(presence-status): Add more statuses.
This commit is contained in:
parent
5b4a16cf6b
commit
2b1c875b91
|
@ -587,10 +587,14 @@
|
|||
"invited": "Invited",
|
||||
"ringing": "Ringing",
|
||||
"calling": "Calling",
|
||||
"initializingCall": "Initializing Call",
|
||||
"connected": "Connected",
|
||||
"connecting": "Connecting",
|
||||
"connecting2": "Connecting*",
|
||||
"disconnected": "Disconnected",
|
||||
"busy": "Busy",
|
||||
"rejected": "Rejected",
|
||||
"ignored": "Ignored"
|
||||
"ignored": "Ignored",
|
||||
"expired": "Expired"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// User invite statuses
|
||||
|
||||
/**
|
||||
* Тhe status for a participant when it's invited to a conference.
|
||||
*
|
||||
|
@ -22,11 +24,50 @@ export const RINGING = 'Ringing';
|
|||
|
||||
/**
|
||||
* A status for a participant that indicates the call is connected.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const CONNECTED_USER = 'connected';
|
||||
|
||||
/**
|
||||
* The status for a participant when the invitation is received but the user
|
||||
* has responded with busy message.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const BUSY = 'Busy';
|
||||
|
||||
/**
|
||||
* The status for a participant when the invitation is rejected.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const REJECTED = 'Rejected';
|
||||
|
||||
/**
|
||||
* The status for a participant when the invitation is ignored.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const IGNORED = 'Ignored';
|
||||
|
||||
/**
|
||||
* The status for a participant when the invitation is expired.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const EXPIRED = 'Expired';
|
||||
|
||||
// Phone call statuses
|
||||
|
||||
/**
|
||||
* A status for a participant that indicates the call is in process of
|
||||
* initialization.
|
||||
* NOTE: Currently used for phone numbers only.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const CONNECTED = 'Connected';
|
||||
export const INITIALIZING_CALL = 'Initializing Call';
|
||||
|
||||
/**
|
||||
* A status for a participant that indicates the call is in process of
|
||||
|
@ -38,20 +79,30 @@ export const CONNECTED = 'Connected';
|
|||
export const CONNECTING = 'Connecting';
|
||||
|
||||
/**
|
||||
* The status for a participant when the invitation is received but the user
|
||||
* has responded with busy message.
|
||||
* A status for a participant that indicates the call is in process of
|
||||
* connecting.
|
||||
* NOTE: Currently used for phone numbers only.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const BUSY = 'Busy';
|
||||
export const CONNECTING2 = 'Connecting*';
|
||||
|
||||
|
||||
/**
|
||||
* The status for a participant when the invitation is rejected.
|
||||
* A status for a phone number participant that indicates the call is connected.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const REJECTED = 'Rejected';
|
||||
export const CONNECTED_PHONE_NUMBER = 'Connected';
|
||||
|
||||
|
||||
/**
|
||||
* The status for a participant when the invitation is ignored.
|
||||
* A status for a participant that indicates the call is disconnected.
|
||||
* NOTE: Currently used for phone numbers only.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
export const IGNORED = 'Ignored';
|
||||
export const DISCONNECTED = 'Disconnected';
|
||||
|
||||
/**
|
||||
* Maps the presence status values to i18n translation keys.
|
||||
|
@ -59,12 +110,17 @@ export const IGNORED = 'Ignored';
|
|||
* @type {Object<String, String>}
|
||||
*/
|
||||
export const STATUS_TO_I18N_KEY = {
|
||||
'Invited': 'presenceStatus.invited',
|
||||
'Ringing': 'presenceStatus.ringing',
|
||||
'Calling': 'presenceStatus.calling',
|
||||
'Connected': 'presenceStatus.connected',
|
||||
'Connecting': 'presenceStatus.connecting',
|
||||
'Busy': 'presenceStatus.busy',
|
||||
'Rejected': 'presenceStatus.rejected',
|
||||
'Ignored': 'presenceStatus.ignored'
|
||||
[INVITED]: 'presenceStatus.invited',
|
||||
[RINGING]: 'presenceStatus.ringing',
|
||||
[CALLING]: 'presenceStatus.calling',
|
||||
[BUSY]: 'presenceStatus.busy',
|
||||
[REJECTED]: 'presenceStatus.rejected',
|
||||
[IGNORED]: 'presenceStatus.ignored',
|
||||
[EXPIRED]: 'presenceStatus.expired',
|
||||
|
||||
[INITIALIZING_CALL]: 'presenceStatus.initializingCall',
|
||||
[CONNECTING]: 'presenceStatus.connecting',
|
||||
[CONNECTING2]: 'presenceStatus.connecting2',
|
||||
[CONNECTED_PHONE_NUMBER]: 'presenceStatus.connected',
|
||||
[DISCONNECTED]: 'presenceStatus.disconnected'
|
||||
};
|
||||
|
|
|
@ -36,10 +36,6 @@ local token_util = module:require "token/util".new(parentCtx);
|
|||
local disableTokenVerification
|
||||
= module:get_option_boolean("disable_polergeist_token_verification", false);
|
||||
|
||||
-- option to expire poltergeist with custom status text
|
||||
local poltergeistExpiredStatus
|
||||
= module:get_option_string("poltergeist_expired_status");
|
||||
|
||||
-- table to store all poltergeists we create
|
||||
local poltergeists = {};
|
||||
-- table to mark that outgoing unavailable presences
|
||||
|
@ -240,31 +236,22 @@ function create_poltergeist_occupant(room, nick, name, avatar, status, context)
|
|||
room:handle_first_presence(
|
||||
prosody.hosts[poltergeist_component], join_presence);
|
||||
|
||||
local timeout = poltergeist_timeout;
|
||||
-- the timeout before removing so participants can see the status update
|
||||
local removeTimeout = 5;
|
||||
if (poltergeistExpiredStatus) then
|
||||
timeout = timeout - removeTimeout;
|
||||
end
|
||||
local timeout = poltergeist_timeout - removeTimeout;
|
||||
|
||||
timer.add_task(timeout,
|
||||
function ()
|
||||
if (poltergeistExpiredStatus) then
|
||||
update_poltergeist_occupant_status(
|
||||
room, nick, poltergeistExpiredStatus);
|
||||
-- and remove it after some time so participant can see
|
||||
-- the update
|
||||
timer.add_task(removeTimeout,
|
||||
function ()
|
||||
if (have_poltergeist_occupant(room, nick)) then
|
||||
remove_poltergeist_occupant(room, nick, false);
|
||||
end
|
||||
end);
|
||||
else
|
||||
if (have_poltergeist_occupant(room, nick)) then
|
||||
remove_poltergeist_occupant(room, nick, false);
|
||||
end
|
||||
end
|
||||
update_poltergeist_occupant_status(
|
||||
room, nick, "Expired");
|
||||
-- and remove it after some time so participant can see
|
||||
-- the update
|
||||
timer.add_task(removeTimeout,
|
||||
function ()
|
||||
if (have_poltergeist_occupant(room, nick)) then
|
||||
remove_poltergeist_occupant(room, nick, false);
|
||||
end
|
||||
end);
|
||||
end);
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue