summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Doležel <lubos@dolezel.info>2020-02-23 09:40:17 +0100
committerGitHub <noreply@github.com>2020-02-23 09:40:17 +0100
commit0d2fb40624e6d35a043409cb0fd3dedf7a7e10a7 (patch)
treed05f2f23dd6c21df81ad49177648af8a5f44215b
parent54182649a76f729de853187f455878a40b49d4df (diff)
parent53d22e59ad08799c54fb8021954fd267deddfc5d (diff)
downloadtwinkle-0d2fb40624e6d35a043409cb0fd3dedf7a7e10a7.tar
twinkle-0d2fb40624e6d35a043409cb0fd3dedf7a7e10a7.tar.gz
twinkle-0d2fb40624e6d35a043409cb0fd3dedf7a7e10a7.tar.lz
twinkle-0d2fb40624e6d35a043409cb0fd3dedf7a7e10a7.tar.xz
twinkle-0d2fb40624e6d35a043409cb0fd3dedf7a7e10a7.zip
Merge pull request #158 from 4-FLOSS-Free-Libre-Open-Source-Software/patch-1
Add twinkle-console option --sip-port --rtp-port
-rw-r--r--src/main.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 20ee366..d8d363f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -241,14 +241,33 @@ int main(int argc, char *argv[]) {
// Take default user profile if there are is no default is sys settings
if (config_files.empty()) config_files.push_back(USER_CONFIG_FILE);
- // Read user configurations.
if (argc >= 2) {
config_files.clear();
- for (int i = 1; i < argc; i++) {
+ for (int i = 1; i < argc && i < 2; i++) {
config_files.push_back(argv[i]);
}
}
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "--sip-port") == 0) {
+ if (i < argc - 1) {
+ i++;
+ sys_config->set_override_sip_port(atoi(argv[i]));
+ } else {
+ cout << argv[0] << ": ";
+ cout << "Port missing for option '--sip-port'\n";
+ }
+ } else if (strcmp(argv[i], "--rtp-port") == 0) {
+ if (i < argc - 1) {
+ i++;
+ sys_config->set_override_rtp_port(atoi(argv[i]));
+ } else {
+ cout << argv[0] << ": ";
+ cout << "Port missing for option '--rtp-port'\n";
+ }
+ }
+ }
+
// Activate users
for (list<string>::iterator i = config_files.begin();
i != config_files.end(); i++)