Add ZRTP/SRTP encryption, direct accountless calling, and alphanumeric input fix to SIP client
This commit is contained in:
1 parent
e92f7e9d96
commit
61768fa88e
15 files changed
+1468
-203
No files matched your search
@@ -437,6 +437,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
std::string callNumber;
|
||||
std::string contactName;
|
||||
int activeSimSlot = 0;
|
||||
std::string sipZrtpSas;
|
||||
DualSimInfo simInfo = queryDualSimInfo();
|
||||
std::string endReason = "CALL ENDED";
|
||||
std::string statusNotice;
|
||||
@@ -769,7 +770,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
|
||||
std::string simTag;
|
||||
if (activeSimSlot == 3 || callId.rfind("sip:", 0) == 0) {
|
||||
simTag = " [SIP]";
|
||||
simTag = sipZrtpSas.empty() ? " [SIP]" : (" [ZRTP:" + sipZrtpSas + "]");
|
||||
} else if (activeSimSlot == 4 || callId.rfind("tox:", 0) == 0) {
|
||||
simTag = " [TOX]";
|
||||
} else if (activeSimSlot == 1 || activeSimSlot == 2) {
|
||||
@@ -1676,8 +1677,15 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
render();
|
||||
return;
|
||||
}
|
||||
if (line.rfind("NOTICE ", 0) == 0) {
|
||||
statusNotice = trimStr(line.substr(7));
|
||||
statusNoticeUntilMs = nowMs() + 12000;
|
||||
render();
|
||||
return;
|
||||
}
|
||||
if (line == "ENDED" || line.rfind("ENDED ", 0) == 0) {
|
||||
std::string reason = (line.size() > 6) ? trimStr(line.substr(6)) : "CALL ENDED";
|
||||
sipZrtpSas.clear();
|
||||
if (callState != CallState::Idle) {
|
||||
transitionToEnded(reason);
|
||||
} else {
|
||||
@@ -1717,10 +1725,17 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
auto parseSimTag = [&](const std::string& cidStr, const std::string& tagStr) {
|
||||
if (tagStr == "SIP" || cidStr.rfind("sip:", 0) == 0) {
|
||||
if (tagStr == "SIP" || tagStr.rfind("SIP:", 0) == 0 ||
|
||||
cidStr.rfind("sip:", 0) == 0) {
|
||||
activeSimSlot = 3;
|
||||
if (tagStr.rfind("SIP:", 0) == 0 && tagStr.size() > 4) {
|
||||
sipZrtpSas = tagStr.substr(4);
|
||||
} else if (tagStr == "SIP") {
|
||||
sipZrtpSas.clear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
sipZrtpSas.clear();
|
||||
if (tagStr == "TOX" || cidStr.rfind("tox:", 0) == 0) {
|
||||
activeSimSlot = 4;
|
||||
return;
|
||||
|
||||
@@ -591,23 +591,42 @@ int email_run_main(int argc, char** argv) {
|
||||
|
||||
auto syncInputBuffer = [&]() {
|
||||
if (editModalOpen) {
|
||||
if (editFieldIdx == 0) neoui_input_reset(editDraft.label.c_str());
|
||||
else if (editFieldIdx == 1) neoui_input_reset(editDraft.address.c_str());
|
||||
else if (editFieldIdx == 2) neoui_input_reset(editDraft.username.c_str());
|
||||
else if (editFieldIdx == 3) neoui_input_reset(editDraft.password.c_str());
|
||||
else if (editFieldIdx == 5) neoui_input_reset(editDraft.inHost.c_str());
|
||||
else if (editFieldIdx == 6) {
|
||||
if (editFieldIdx == 0) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_TITLE);
|
||||
neoui_input_reset(editDraft.label.c_str());
|
||||
} else if (editFieldIdx == 1) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.address.c_str());
|
||||
} else if (editFieldIdx == 2) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.username.c_str());
|
||||
} else if (editFieldIdx == 3) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.password.c_str());
|
||||
} else if (editFieldIdx == 5) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.inHost.c_str());
|
||||
} else if (editFieldIdx == 6) {
|
||||
neoui_input_set_mode(NEO_INPUT_123);
|
||||
neoui_input_reset(std::to_string(editDraft.inPort).c_str());
|
||||
} else if (editFieldIdx == 8) neoui_input_reset(editDraft.smtpHost.c_str());
|
||||
else if (editFieldIdx == 9) {
|
||||
} else if (editFieldIdx == 8) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.smtpHost.c_str());
|
||||
} else if (editFieldIdx == 9) {
|
||||
neoui_input_set_mode(NEO_INPUT_123);
|
||||
neoui_input_reset(std::to_string(editDraft.smtpPort).c_str());
|
||||
}
|
||||
} else if (activeTab == 1) {
|
||||
if (composeField == 0) neoui_input_reset(composeTo.c_str());
|
||||
else if (composeField == 1) neoui_input_reset(composeSubject.c_str());
|
||||
else neoui_input_reset(composeBody.c_str());
|
||||
if (composeField == 0) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(composeTo.c_str());
|
||||
} else if (composeField == 1) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_TITLE);
|
||||
neoui_input_reset(composeSubject.c_str());
|
||||
} else {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_TITLE);
|
||||
neoui_input_reset(composeBody.c_str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -937,14 +956,30 @@ int email_run_main(int argc, char** argv) {
|
||||
else if (editDraft.smtpSecurity == "STARTTLS") editDraft.smtpSecurity = "PLAIN";
|
||||
else editDraft.smtpSecurity = "TLS";
|
||||
}
|
||||
} else if (k == NEO_KEY_STAR) {
|
||||
} else if (k == NEO_KEY_STAR || k == NEO_KEY_HASH) {
|
||||
neoui_input_cycle_mode();
|
||||
} else if (k == NEO_KEY_RIGHT && neoui_input_is_tap_active()) {
|
||||
neoui_input_commit_tap();
|
||||
applyInputBuffer();
|
||||
} else if (k == NEO_KEY_BACK) {
|
||||
neoui_input_backspace();
|
||||
applyInputBuffer();
|
||||
} else if (k >= NEO_KEY_0 && k <= NEO_KEY_9) {
|
||||
neoui_input_feed_key(k);
|
||||
applyInputBuffer();
|
||||
} else {
|
||||
int ks = neoui_event_keysym();
|
||||
if (ks >= 0x20 && ks <= 0x7e &&
|
||||
editFieldIdx != 4 && editFieldIdx != 7 && editFieldIdx != 10) {
|
||||
neoui_input_commit_tap();
|
||||
if ((editFieldIdx != 6 && editFieldIdx != 9) ||
|
||||
(ks >= '0' && ks <= '9')) {
|
||||
std::string cur = neoui_input_get_text();
|
||||
cur.push_back(static_cast<char>(ks));
|
||||
neoui_input_set_text(cur.c_str());
|
||||
applyInputBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
render();
|
||||
} else if (readingMsg) {
|
||||
|
||||
@@ -560,18 +560,32 @@ int irc_run_main(int argc, char** argv) {
|
||||
|
||||
auto syncEditInput = [&]() {
|
||||
if (!editModalOpen) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(chatInput.c_str());
|
||||
return;
|
||||
}
|
||||
if (editFieldIdx == 0) neoui_input_reset(editDraft.label.c_str());
|
||||
else if (editFieldIdx == 1) neoui_input_reset(editDraft.host.c_str());
|
||||
else if (editFieldIdx == 2) {
|
||||
if (editFieldIdx == 0) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_TITLE);
|
||||
neoui_input_reset(editDraft.label.c_str());
|
||||
} else if (editFieldIdx == 1) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.host.c_str());
|
||||
} else if (editFieldIdx == 2) {
|
||||
neoui_input_set_mode(NEO_INPUT_123);
|
||||
neoui_input_reset(std::to_string(editDraft.port).c_str());
|
||||
} else if (editFieldIdx == 4) neoui_input_reset(editDraft.nick.c_str());
|
||||
else if (editFieldIdx == 5) neoui_input_reset(editDraft.saslUser.c_str());
|
||||
else if (editFieldIdx == 6) neoui_input_reset(editDraft.saslPass.c_str());
|
||||
else if (editFieldIdx == 7) neoui_input_reset(editDraft.autoJoin.c_str());
|
||||
} else if (editFieldIdx == 4) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.nick.c_str());
|
||||
} else if (editFieldIdx == 5) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.saslUser.c_str());
|
||||
} else if (editFieldIdx == 6) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.saslPass.c_str());
|
||||
} else if (editFieldIdx == 7) {
|
||||
neoui_input_set_mode(NEO_INPUT_ABC_LOWER);
|
||||
neoui_input_reset(editDraft.autoJoin.c_str());
|
||||
}
|
||||
};
|
||||
|
||||
auto applyEditInput = [&]() {
|
||||
@@ -895,14 +909,28 @@ int irc_run_main(int argc, char** argv) {
|
||||
} else if (editFieldIdx == 8) {
|
||||
editDraft.keepInBackground = !editDraft.keepInBackground;
|
||||
}
|
||||
} else if (k == NEO_KEY_STAR) {
|
||||
} else if (k == NEO_KEY_STAR || k == NEO_KEY_HASH) {
|
||||
neoui_input_cycle_mode();
|
||||
} else if (k == NEO_KEY_RIGHT && neoui_input_is_tap_active()) {
|
||||
neoui_input_commit_tap();
|
||||
applyEditInput();
|
||||
} else if (k == NEO_KEY_BACK) {
|
||||
neoui_input_backspace();
|
||||
applyEditInput();
|
||||
} else if (k >= NEO_KEY_0 && k <= NEO_KEY_9) {
|
||||
neoui_input_feed_key(k);
|
||||
applyEditInput();
|
||||
} else {
|
||||
int ks = neoui_event_keysym();
|
||||
if (ks >= 0x20 && ks <= 0x7e && editFieldIdx != 3 && editFieldIdx != 8) {
|
||||
neoui_input_commit_tap();
|
||||
if (editFieldIdx != 2 || (ks >= '0' && ks <= '9')) {
|
||||
std::string cur = neoui_input_get_text();
|
||||
cur.push_back(static_cast<char>(ks));
|
||||
neoui_input_set_text(cur.c_str());
|
||||
applyEditInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
render();
|
||||
} else {
|
||||
|
||||
+1363
-176
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user