mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00

Automated using the following commands: $ mv src/{dring,jami} $ git grep -l src/dring | xargs sed -i 's,src/dring,src/jami,g' $ git grep -l '#include "dring/' | \ xargs sed -i 's,#include "dring/,#include "jami/,g' $ git grep -l 'dring.h' | xargs sed -i 's,dring.h,jami.h,g' And finally, $ git grep -l 'dring' | xargs sed -i 's,dring,jami,g' $ files=$(find -name '*dring*' | sort) $ for f in $files; do mkdir -p "$(dirname "$f")"; \ mv "$f" "$(echo $f | sed 's/dring/jami/g')"; done To resolve a bad renaming favorably: $ git grep -l -i AlsaCarjami | \ xargs sed -i -E 's/([Aa])lsaCarjami/\1lsaCardRingtone/g' The above renaming command is not perfect, so some hand-tuning was required to complete it. * src/manager.cpp (Manager::ManagerPimpl::retrieveConfigPath): Preserve the dring.yml configuration file name, until we add something to migrate (rename) it to jami.yml. * man/dring.pod: Delete. * bin/dbus/jamid.pod: Move to ... * man/jamid.pod: here. * bin/dbus/meson.build (jamid_targets): Normalize man section to the pre-existing 1 and adjust accordingly. * src/jami/def.h (dring_EXPORTS): Rename to ... (jami_EXPORTS): ... this. change-Id: I9828be6da9c711ab2f22c4d1b9539fea89d7b6fb
128 lines
4.7 KiB
JavaScript
Executable File
128 lines
4.7 KiB
JavaScript
Executable File
/*
|
|
* Copyright (C) 2004-2021 Savoir-faire Linux Inc.
|
|
*
|
|
* Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
|
|
* Author: Asad Salman <me@asad.co>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
|
|
"use strict";
|
|
class JamiDaemon {
|
|
constructor(callbackMap) {
|
|
if (callbackMap){
|
|
this.jami = require("./build/Release/jami.node");
|
|
this.jami.init(callbackMap);
|
|
}
|
|
}
|
|
|
|
boolToStr(bool) {
|
|
return bool ? JamiDaemon.BOOL_TRUE : JamiDaemon.BOOL_FALSE;
|
|
}
|
|
|
|
addAccount(account) {
|
|
const params = new this.jami.StringMap();
|
|
params.set("Account.type", "RING");
|
|
if (account.managerUri)
|
|
params.set("Account.managerUri", account.managerUri);
|
|
if (account.managerUsername)
|
|
params.set("Account.managerUsername", account.managerUsername);
|
|
if (account.archivePassword) {
|
|
params.set("Account.archivePassword", account.archivePassword);
|
|
} else {
|
|
console.log("archivePassword required");
|
|
return;
|
|
}
|
|
if (account.alias)
|
|
params.set("Account.alias", account.alias);
|
|
if (account.displayName)
|
|
params.set("Account.displayName", account.displayName);
|
|
if (account.enable)
|
|
params.set("Account.enable", this.boolToStr(account.enable));
|
|
if (account.autoAnswer)
|
|
params.set("Account.autoAnswer", this.boolToStr(account.autoAnswer));
|
|
if (account.ringtonePath)
|
|
params.set("Account.ringtonePath", account.ringtonePath);
|
|
if (account.ringtoneEnabled)
|
|
params.set("Account.ringtoneEnabled", this.boolToStr(account.ringtoneEnabled));
|
|
if (account.videoEnabled)
|
|
params.set("Account.videoEnabled", this.boolToStr(account.videoEnabled));
|
|
if (account.useragent) {
|
|
params.set("Account.useragent", account.useragent);
|
|
params.set("Account.hasCustomUserAgent", JamiDaemon.BOOL_TRUE);
|
|
} else {
|
|
params.set("Account.hasCustomUserAgent", JamiDaemon.BOOL_FALSE);
|
|
}
|
|
if (account.audioPortMin)
|
|
params.set("Account.audioPortMin", account.audioPortMin);
|
|
if (account.audioPortMax)
|
|
params.set("Account.audioPortMax", account.audioPortMax);
|
|
if (account.videoPortMin)
|
|
params.set("Account.videoPortMin", account.videoPortMin);
|
|
if (account.videoPortMax)
|
|
params.set("Account.videoPortMax", account.videoPortMax);
|
|
if (account.localInterface)
|
|
params.set("Account.localInterface", account.localInterface);
|
|
if (account.publishedSameAsLocal)
|
|
params.set("Account.publishedSameAsLocal", this.boolToStr(account.publishedSameAsLocal));
|
|
if (account.localPort)
|
|
params.set("Account.localPort", account.localPort);
|
|
if (account.publishedPort)
|
|
params.set("Account.publishedPort", account.publishedPort);
|
|
if (account.publishedAddress)
|
|
params.set("Account.publishedAddress", account.publishedAddress);
|
|
if (account.upnpEnabled)
|
|
params.set("Account.upnpEnabled", this.boolToStr(account.upnpEnabled));
|
|
|
|
this.jami.addAccount(params);
|
|
}
|
|
stringVectToArr(stringvect) {
|
|
const outputArr = [];
|
|
for (let i = 0; i < stringvect.size(); i++)
|
|
outputArr.push(stringvect.get(i));
|
|
return outputArr;
|
|
}
|
|
mapToJs(m) {
|
|
const outputObj = {};
|
|
this.stringVectToArr(m.keys())
|
|
.forEach(k => outputObj[k] = m.get(k));
|
|
return outputObj;
|
|
}
|
|
getAccountList() {
|
|
return this.stringVectToArr(this.jami.getAccountList());
|
|
}
|
|
getAccountDetails(accountId) {
|
|
return this.mapToJs(this.jami.getAccountDetails(accountId));
|
|
}
|
|
getAudioOutputDeviceList() {
|
|
return this.stringVectToArr(this.jami.getAudioOutputDeviceList());
|
|
}
|
|
getVolume(deviceName) {
|
|
return this.jami.getVolume(deviceName);
|
|
}
|
|
|
|
setVolume(deviceName, volume) {
|
|
return this.jami.setVolume(deviceName, volume);
|
|
}
|
|
|
|
stop() {
|
|
this.jami.fini();
|
|
}
|
|
}
|
|
|
|
JamiDaemon.BOOL_TRUE = "true"
|
|
JamiDaemon.BOOL_FALSE = "false"
|
|
|
|
module.exports = JamiDaemon; |