feat(presence-status): Add more statuses.
This commit is contained in:
parent
5b4a16cf6b
commit
2b1c875b91
|
@ -587,10 +587,14 @@
|
||||||
"invited": "Invited",
|
"invited": "Invited",
|
||||||
"ringing": "Ringing",
|
"ringing": "Ringing",
|
||||||
"calling": "Calling",
|
"calling": "Calling",
|
||||||
|
"initializingCall": "Initializing Call",
|
||||||
"connected": "Connected",
|
"connected": "Connected",
|
||||||
"connecting": "Connecting",
|
"connecting": "Connecting",
|
||||||
|
"connecting2": "Connecting*",
|
||||||
|
"disconnected": "Disconnected",
|
||||||
"busy": "Busy",
|
"busy": "Busy",
|
||||||
"rejected": "Rejected",
|
"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.
|
* Т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.
|
* 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.
|
* NOTE: Currently used for phone numbers only.
|
||||||
*
|
*
|
||||||
* @type {string}
|
* @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
|
* 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';
|
export const CONNECTING = 'Connecting';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The status for a participant when the invitation is received but the user
|
* A status for a participant that indicates the call is in process of
|
||||||
* has responded with busy message.
|
* 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.
|
* Maps the presence status values to i18n translation keys.
|
||||||
|
@ -59,12 +110,17 @@ export const IGNORED = 'Ignored';
|
||||||
* @type {Object<String, String>}
|
* @type {Object<String, String>}
|
||||||
*/
|
*/
|
||||||
export const STATUS_TO_I18N_KEY = {
|
export const STATUS_TO_I18N_KEY = {
|
||||||
'Invited': 'presenceStatus.invited',
|
[INVITED]: 'presenceStatus.invited',
|
||||||
'Ringing': 'presenceStatus.ringing',
|
[RINGING]: 'presenceStatus.ringing',
|
||||||
'Calling': 'presenceStatus.calling',
|
[CALLING]: 'presenceStatus.calling',
|
||||||
'Connected': 'presenceStatus.connected',
|
[BUSY]: 'presenceStatus.busy',
|
||||||
'Connecting': 'presenceStatus.connecting',
|
[REJECTED]: 'presenceStatus.rejected',
|
||||||
'Busy': 'presenceStatus.busy',
|
[IGNORED]: 'presenceStatus.ignored',
|
||||||
'Rejected': 'presenceStatus.rejected',
|
[EXPIRED]: 'presenceStatus.expired',
|
||||||
'Ignored': 'presenceStatus.ignored'
|
|
||||||
|
[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
|
local disableTokenVerification
|
||||||
= module:get_option_boolean("disable_polergeist_token_verification", false);
|
= 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
|
-- table to store all poltergeists we create
|
||||||
local poltergeists = {};
|
local poltergeists = {};
|
||||||
-- table to mark that outgoing unavailable presences
|
-- 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(
|
room:handle_first_presence(
|
||||||
prosody.hosts[poltergeist_component], join_presence);
|
prosody.hosts[poltergeist_component], join_presence);
|
||||||
|
|
||||||
local timeout = poltergeist_timeout;
|
|
||||||
-- the timeout before removing so participants can see the status update
|
-- the timeout before removing so participants can see the status update
|
||||||
local removeTimeout = 5;
|
local removeTimeout = 5;
|
||||||
if (poltergeistExpiredStatus) then
|
local timeout = poltergeist_timeout - removeTimeout;
|
||||||
timeout = timeout - removeTimeout;
|
|
||||||
end
|
|
||||||
|
|
||||||
timer.add_task(timeout,
|
timer.add_task(timeout,
|
||||||
function ()
|
function ()
|
||||||
if (poltergeistExpiredStatus) then
|
update_poltergeist_occupant_status(
|
||||||
update_poltergeist_occupant_status(
|
room, nick, "Expired");
|
||||||
room, nick, poltergeistExpiredStatus);
|
-- and remove it after some time so participant can see
|
||||||
-- and remove it after some time so participant can see
|
-- the update
|
||||||
-- the update
|
timer.add_task(removeTimeout,
|
||||||
timer.add_task(removeTimeout,
|
function ()
|
||||||
function ()
|
if (have_poltergeist_occupant(room, nick)) then
|
||||||
if (have_poltergeist_occupant(room, nick)) then
|
remove_poltergeist_occupant(room, nick, false);
|
||||||
remove_poltergeist_occupant(room, nick, false);
|
end
|
||||||
end
|
end);
|
||||||
end);
|
|
||||||
else
|
|
||||||
if (have_poltergeist_occupant(room, nick)) then
|
|
||||||
remove_poltergeist_occupant(room, nick, false);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end);
|
end);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue