Skip to content

Commit

Permalink
- changed kill singal for "incomingCallCommand" from SIGKILL to SIGTE… (
Browse files Browse the repository at this point in the history
#1044)

* - changed kill singal for "incomingCallCommand" from SIGKILL to SIGTERM to get access to the trap functionality in scripts
- added a new argument "incomingCallCommandArgs" to increase argument compatibility and get rid of the regex. "incomingCallCommand" does only contain the executeable from now on.
- if the incomingCallCommand is executed the callers name is now  given as the last argument

* Update app/mainAppWindow/index.js

Co-authored-by: IsmaelMartinez <[email protected]>

* The function incomingCallCommandTerminate will now be executed on the incomingCallCreated event if an incomingCallCommand is given

* bump version

---------

Co-authored-by: IsmaelMartinez <[email protected]>
  • Loading branch information
93Sprinter and IsmaelMartinez authored Dec 21, 2023
1 parent 4ed1c3c commit fd890cb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/browser/notifications/activityManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ function updateActivityCountHandler(self) {
* @param {ActivityManager} self
*/
function incomingCallCreatedHandler(self) {
return async () => {
self.ipcRenderer.invoke('incoming-call-created');
return async (data) => {
self.ipcRenderer.invoke('incoming-call-created', data);
};
}

Expand Down
6 changes: 3 additions & 3 deletions app/browser/tools/activityHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function assignIncomingCallCreatedHandler(controller) {
controller.constants.events.calling.callCreated,
(e, data) => {
if (data.signalingSession.isIncomingCall) {
onIncomingCallCreated();
onIncomingCallCreated({ caller: data.signalingSession.remoteCaller.displayName });
}
});
}
Expand Down Expand Up @@ -286,10 +286,10 @@ async function onActivitiesCountUpdated(controller) {
}
}

async function onIncomingCallCreated() {
async function onIncomingCallCreated(data) {
const handlers = getEventHandlers('incoming-call-created');
for (const handler of handlers) {
handler.handler({});
handler.handler(data);
}
}

Expand Down
4 changes: 4 additions & 0 deletions app/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ function argv(configPath) {
incomingCallCommand: {
default: null,
describe: 'Command to execute on an incoming call.'
},
incomingCallCommandArgs: {
default: [],
describe: 'Arguments for the incomming call command.'
}
})
.parse(process.argv.slice(1));
Expand Down
15 changes: 7 additions & 8 deletions app/mainAppWindow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const TrayIconChooser = require('../browser/tools/trayIconChooser');
const { AppConfiguration } = require('../appConfiguration');
const connMgr = require('../connectionManager');

const commandSplitRegex = /"(\\"|[^"])*?"|(\\ |[^\s])*/gm;

/**
* @type {TrayIconChooser}
*/
Expand Down Expand Up @@ -511,16 +509,17 @@ function assignSelectSourceHandler() {
};
}

async function handleOnIncomingCallCreated() {
if (!incomingCallCommandProcess && config.incomingCallCommand) {
let commandParts = config.incomingCallCommand.match(commandSplitRegex);
incomingCallCommandProcess = spawn(commandParts.shift(), commandParts);
async function handleOnIncomingCallCreated(e, data) {
if (config.incomingCallCommand) {
incomingCallCommandTerminate();
const commandArgs = [...config.incomingCallCommandArgs, data.caller];
incomingCallCommandProcess = spawn(config.incomingCallCommand, commandArgs);
}
}

async function incomingCallCommandKill() {
async function incomingCallCommandTerminate() {
if (incomingCallCommandProcess) {
incomingCallCommandProcess.kill('SIGKILL');
incomingCallCommandProcess.kill('SIGTERM');
incomingCallCommandProcess = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "teams-for-linux",
"version": "1.3.26",
"version": "1.3.27",
"main": "app/index.js",
"description": "Unofficial client for Microsoft Teams for Linux",
"homepage": "https://github.com/IsmaelMartinez/teams-for-linux",
Expand Down

0 comments on commit fd890cb

Please sign in to comment.