Add Webarchy WPE/WebKit browser, SIP ZRTP/SRTP & codecs, xirc buffer fixes, and Noto web fonts
This commit is contained in:
1 parent
61768fa88e
commit
d7335b5ebe
81 files changed
+3822
-248
No files matched your search
@@ -498,6 +498,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
alsa.setInteger("ADC3 Volume", mute ? 0 : 8);
|
||||
alsa.setInteger("TX1 Digital Volume", mute ? 0 : 88);
|
||||
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", !mute);
|
||||
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !mute);
|
||||
runAsyncCmd(mute ? "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 1 >/dev/null 2>&1"
|
||||
: "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0 >/dev/null 2>&1");
|
||||
statusNotice = mute ? "Microphone muted" : "Microphone unmuted";
|
||||
@@ -516,6 +517,9 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
if (!voip) {
|
||||
alsa.setBoolean("PRI_MI2S_RX Voice Mixer VoiceMMode1", true);
|
||||
alsa.setBoolean("VoiceMMode1 Capture Mixer TERT_MI2S_TX", !micMuted);
|
||||
} else {
|
||||
alsa.setBoolean("PRI_MI2S_RX Audio Mixer MultiMedia1", true);
|
||||
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !micMuted);
|
||||
}
|
||||
alsa.setEnum("CIC1 MUX", 0);
|
||||
if (!micMuted) {
|
||||
@@ -523,6 +527,10 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
alsa.setInteger("ADC1 Volume", 8);
|
||||
alsa.setInteger("TX1 Digital Volume", 88);
|
||||
}
|
||||
auto setOutDevFile = [](const char* devName) {
|
||||
std::ofstream out("/tmp/sxmo_audio_out_device", std::ios::trunc);
|
||||
if (out.is_open()) out << devName << "\n";
|
||||
};
|
||||
if (toSpeaker) {
|
||||
alsa.setEnum("EAR_S", 0);
|
||||
alsa.setEnum("HPHL", 0);
|
||||
@@ -532,7 +540,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
alsa.setBoolean("SPK DAC Switch", true);
|
||||
alsa.setEnum("RX3 MIX1 INP1", 3);
|
||||
alsa.setInteger("RX3 Digital Volume", hwVol);
|
||||
runAsyncCmd("sxmo_audio.sh device set Speaker >/dev/null 2>&1");
|
||||
setOutDevFile("Speaker");
|
||||
statusNotice = "Audio routed to Speaker";
|
||||
} else if (jackPlugged) {
|
||||
alsa.setBoolean("SPK DAC Switch", false);
|
||||
@@ -547,7 +555,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
alsa.setBoolean("RX1 Mute Switch", false);
|
||||
alsa.setInteger("RX1 Digital Volume", hwVol);
|
||||
alsa.setInteger("RX2 Digital Volume", hwVol);
|
||||
runAsyncCmd("sxmo_audio.sh device set Headphones >/dev/null 2>&1");
|
||||
setOutDevFile("Headphones");
|
||||
statusNotice = "Audio routed to Headphones";
|
||||
} else {
|
||||
alsa.setBoolean("SPK DAC Switch", false);
|
||||
@@ -561,9 +569,11 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
alsa.setEnum("EAR_S", 1);
|
||||
alsa.setBoolean("RX1 Mute Switch", false);
|
||||
alsa.setInteger("RX1 Digital Volume", hwVol);
|
||||
runAsyncCmd("sxmo_audio.sh device set Earpiece >/dev/null 2>&1");
|
||||
setOutDevFile("Earpiece");
|
||||
statusNotice = "Audio routed to Earpiece";
|
||||
}
|
||||
runAsyncCmd("PATH=\"$HOME/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:$PATH\" "
|
||||
"sxmo_hook_statusbar.sh volume >/dev/null 2>&1");
|
||||
statusNoticeUntilMs = nowMs() + 2000;
|
||||
};
|
||||
|
||||
@@ -588,7 +598,7 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
};
|
||||
|
||||
auto finishRecordingFile = [&]() {
|
||||
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", false);
|
||||
alsa.setBoolean("MultiMedia2 Mixer TERT_MI2S_TX", !micMuted);
|
||||
finalizeWavHeader(recordFilePath);
|
||||
struct stat st {};
|
||||
if (!recordFilePath.empty() && ::stat(recordFilePath.c_str(), &st) == 0 &&
|
||||
@@ -1726,11 +1736,12 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
|
||||
auto parseSimTag = [&](const std::string& cidStr, const std::string& tagStr) {
|
||||
if (tagStr == "SIP" || tagStr.rfind("SIP:", 0) == 0 ||
|
||||
cidStr.rfind("sip:", 0) == 0) {
|
||||
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") {
|
||||
size_t colonPos = tagStr.find(':');
|
||||
if (colonPos != std::string::npos && colonPos + 1 < tagStr.size()) {
|
||||
sipZrtpSas = tagStr.substr(colonPos + 1);
|
||||
} else if (tagStr == "SIP" || tagStr.rfind("SIP/", 0) == 0) {
|
||||
sipZrtpSas.clear();
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -316,6 +316,9 @@ static const char *resolve_plugin_name_from_argv0(const char *argv0) {
|
||||
strcasecmp(base, "xsmallweb") == 0 || strcasecmp(base, "smallweb") == 0) {
|
||||
return "smallweb";
|
||||
}
|
||||
if (strcasecmp(base, "xwebarchy") == 0 || strcasecmp(base, "webarchy") == 0) {
|
||||
return "webarchy";
|
||||
}
|
||||
if (strcasecmp(base, "xgps") == 0 || strcasecmp(base, "xmaps") == 0 ||
|
||||
strcasecmp(base, "xnav") == 0 || strcasecmp(base, "gps") == 0) {
|
||||
return "gps";
|
||||
|
||||
+230
-35
@@ -247,6 +247,7 @@ int irc_run_main(int argc, char** argv) {
|
||||
if (s.realname.empty()) s.realname = s.nick;
|
||||
sendIrcRaw(srvIdx, "NICK " + s.nick);
|
||||
sendIrcRaw(srvIdx, "USER " + s.username + " 0 * :" + s.realname);
|
||||
activeBufIdx = stBuf;
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -399,6 +400,9 @@ int irc_run_main(int argc, char** argv) {
|
||||
if (cmd == "001") {
|
||||
srv.registered = true;
|
||||
srv.state = srv.useTls ? "ONLINE(TLS)" : "ONLINE";
|
||||
if (!params.empty() && !params[0].empty() && params[0] != "*") {
|
||||
srv.nick = params[0];
|
||||
}
|
||||
buffers[stBuf].append("*", trailing, false, true, serverTimeHHMM);
|
||||
if (!srv.autoJoin.empty()) {
|
||||
std::stringstream ss(srv.autoJoin);
|
||||
@@ -413,13 +417,54 @@ int irc_run_main(int argc, char** argv) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd == "433") {
|
||||
// ERR_NICKNAMEINUSE: automatically pick an alternate nickname if registering
|
||||
buffers[stBuf].append("!", trailing.empty() ? "Nickname in use" : trailing,
|
||||
false, true, serverTimeHHMM);
|
||||
if (!srv.registered) {
|
||||
srv.nick += "_";
|
||||
sendIrcRaw(srvIdx, "NICK " + srv.nick);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd == "nick") {
|
||||
std::string newNick = !trailing.empty() ? trailing : (params.empty() ? "" : params[0]);
|
||||
if (!newNick.empty()) {
|
||||
if (toLowerStr(senderNick) == toLowerStr(srv.nick)) {
|
||||
srv.nick = newNick;
|
||||
}
|
||||
buffers[stBuf].append("*", senderNick + " is now known as " + newNick,
|
||||
false, true, serverTimeHHMM);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd == "470" && params.size() >= 3) {
|
||||
// Channel forward (e.g. #bananarchy -> ##bananarchy)
|
||||
std::string oldCh = toLowerStr(params[1]);
|
||||
std::string newCh = params[2];
|
||||
for (auto& b : buffers) {
|
||||
if (b.serverIdx == srvIdx && toLowerStr(b.name) == oldCh) {
|
||||
b.name = newCh;
|
||||
break;
|
||||
}
|
||||
}
|
||||
buffers[stBuf].append("*", params[1] + " forwarded to " + newCh,
|
||||
false, true, serverTimeHHMM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd == "join") {
|
||||
std::string chan = !trailing.empty() ? trailing : (params.empty() ? "" : params[0]);
|
||||
if (!chan.empty()) {
|
||||
int bIdx = findOrCreateBuffer(srvIdx, chan);
|
||||
buffers[bIdx].append("*", senderNick + " joined " + chan, false, true, serverTimeHHMM);
|
||||
if (toLowerStr(senderNick) == toLowerStr(srv.nick)) {
|
||||
if (toLowerStr(senderNick) == toLowerStr(srv.nick) || !srv.registered) {
|
||||
activeBufIdx = bIdx;
|
||||
if (activeTab == 1) {
|
||||
selectedRow = bIdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -470,11 +515,73 @@ int irc_run_main(int argc, char** argv) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd == "353" && params.size() >= 3) {
|
||||
int bIdx = findOrCreateBuffer(srvIdx, params[2]);
|
||||
buffers[bIdx].append("*", "Users: " + trailing, false, true, serverTimeHHMM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd == "366") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!trailing.empty()) {
|
||||
buffers[stBuf].append(senderNick, trailing, false, true, serverTimeHHMM);
|
||||
}
|
||||
};
|
||||
|
||||
auto closeBufferAt = [&](int targetIdx, const std::string& partReason = "") {
|
||||
if (buffers.empty()) return;
|
||||
targetIdx = std::clamp(targetIdx, 0, static_cast<int>(buffers.size()) - 1);
|
||||
int srvIdx = buffers[targetIdx].serverIdx;
|
||||
std::string bName = buffers[targetIdx].name;
|
||||
|
||||
if (bName == "*status*") {
|
||||
// Never erase a server's *status* buffer; clear its scrollback instead
|
||||
buffers[targetIdx].lines.clear();
|
||||
buffers[targetIdx].unreadCount = 0;
|
||||
buffers[targetIdx].hasHighlight = false;
|
||||
buffers[targetIdx].append("*", "Status buffer cleared", false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bName.empty() && (bName[0] == '#' || bName[0] == '&')) {
|
||||
sendIrcRaw(srvIdx, "PART " + bName + (partReason.empty() ? "" : (" :" + partReason)));
|
||||
}
|
||||
|
||||
if (buffers.size() <= 1) {
|
||||
buffers[targetIdx].name = "*status*";
|
||||
buffers[targetIdx].lines.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
buffers.erase(buffers.begin() + targetIdx);
|
||||
|
||||
if (activeBufIdx == targetIdx) {
|
||||
int fallback = -1;
|
||||
for (int i = std::min(targetIdx, static_cast<int>(buffers.size()) - 1); i >= 0; --i) {
|
||||
if (buffers[i].serverIdx == srvIdx) {
|
||||
fallback = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fallback < 0) {
|
||||
for (size_t i = 0; i < buffers.size(); ++i) {
|
||||
if (buffers[i].serverIdx == srvIdx) {
|
||||
fallback = static_cast<int>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
activeBufIdx = (fallback >= 0)
|
||||
? fallback
|
||||
: std::clamp(targetIdx - 1, 0, static_cast<int>(buffers.size()) - 1);
|
||||
} else if (activeBufIdx > targetIdx) {
|
||||
--activeBufIdx;
|
||||
}
|
||||
selectedRow = std::clamp(selectedRow, 0, static_cast<int>(buffers.size()) - 1);
|
||||
};
|
||||
|
||||
auto submitChatLine = [&]() {
|
||||
chatInput = neoui_input_get_text();
|
||||
std::string line = trimStr(chatInput);
|
||||
@@ -484,6 +591,15 @@ int irc_run_main(int argc, char** argv) {
|
||||
|
||||
activeBufIdx = std::clamp(activeBufIdx, 0, static_cast<int>(buffers.size()) - 1);
|
||||
int srvIdx = buffers[activeBufIdx].serverIdx;
|
||||
if ((!servers[srvIdx].net || !servers[srvIdx].net->isConnected()) &&
|
||||
buffers[activeBufIdx].name == "*status*") {
|
||||
for (size_t i = 0; i < servers.size(); ++i) {
|
||||
if (servers[i].net && servers[i].net->isConnected()) {
|
||||
srvIdx = static_cast<int>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
auto& srv = servers[srvIdx];
|
||||
|
||||
if (line[0] == '/') {
|
||||
@@ -497,15 +613,28 @@ int irc_run_main(int argc, char** argv) {
|
||||
|
||||
if (low == "join" || low == "j") {
|
||||
if (!rest.empty()) {
|
||||
if (rest[0] != '#' && rest[0] != '&') rest = "#" + rest;
|
||||
sendIrcRaw(srvIdx, "JOIN " + rest);
|
||||
activeBufIdx = findOrCreateBuffer(srvIdx, rest);
|
||||
}
|
||||
} else if (low == "part" || low == "leave") {
|
||||
std::string ch = buffers[activeBufIdx].name;
|
||||
if (!ch.empty() && ch[0] == '#') {
|
||||
sendIrcRaw(srvIdx, "PART " + ch + (rest.empty() ? "" : (" :" + rest)));
|
||||
std::istringstream css(rest);
|
||||
std::string chTok;
|
||||
int lastJoined = -1;
|
||||
while (std::getline(css, chTok, ',')) {
|
||||
chTok = trimStr(chTok);
|
||||
if (chTok.empty()) continue;
|
||||
size_t sp = chTok.find(' ');
|
||||
std::string chName = (sp == std::string::npos) ? chTok : chTok.substr(0, sp);
|
||||
if (chName[0] != '#' && chName[0] != '&') chName = "#" + chName;
|
||||
lastJoined = findOrCreateBuffer(srvIdx, chName);
|
||||
if (!sendIrcRaw(srvIdx, "JOIN " + chTok)) {
|
||||
buffers[lastJoined].append("!", "Not connected (Servers -> Connect)", false, true);
|
||||
}
|
||||
}
|
||||
if (lastJoined >= 0) {
|
||||
activeBufIdx = lastJoined;
|
||||
chatScrollBack = 0;
|
||||
}
|
||||
}
|
||||
} else if (low == "part" || low == "leave" || low == "close") {
|
||||
closeBufferAt(activeBufIdx, rest);
|
||||
chatScrollBack = 0;
|
||||
} else if (low == "msg" || low == "query") {
|
||||
std::istringstream mss(rest);
|
||||
std::string target, text;
|
||||
@@ -547,11 +676,14 @@ int irc_run_main(int argc, char** argv) {
|
||||
|
||||
std::string target = buffers[activeBufIdx].name;
|
||||
if (target == "*status*") {
|
||||
sendIrcRaw(srvIdx, line);
|
||||
buffers[activeBufIdx].append(srv.nick, line, false, true);
|
||||
if (!sendIrcRaw(srvIdx, line)) {
|
||||
buffers[activeBufIdx].append("!", "Not connected (Servers -> Connect)", false, true);
|
||||
} else {
|
||||
buffers[activeBufIdx].append(srv.nick, line, false, true);
|
||||
}
|
||||
} else {
|
||||
if (!sendIrcRaw(srvIdx, "PRIVMSG " + target + " :" + line)) {
|
||||
buffers[activeBufIdx].append("!", "Not connected (Server -> Connect)", false, true);
|
||||
buffers[activeBufIdx].append("!", "Not connected (Servers -> Connect)", false, true);
|
||||
} else {
|
||||
buffers[activeBufIdx].append(srv.nick, line);
|
||||
}
|
||||
@@ -660,14 +792,19 @@ int irc_run_main(int argc, char** argv) {
|
||||
for (int i = 0; i < maxVis && (scrollOffset + i) < static_cast<int>(buffers.size()); ++i) {
|
||||
int idx = scrollOffset + i;
|
||||
const auto& b = buffers[idx];
|
||||
std::string srvLbl = servers[b.serverIdx].label;
|
||||
std::string badge = b.unreadCount > 0 ? ("+" + std::to_string(b.unreadCount)) : "";
|
||||
int bSrv = std::clamp(b.serverIdx, 0, static_cast<int>(servers.size()) - 1);
|
||||
std::string srvLbl = servers[bSrv].label + " (" + servers[bSrv].nick + ") [" +
|
||||
servers[bSrv].state + "]";
|
||||
std::string badge = b.unreadCount > 0 ? ("+" + std::to_string(b.unreadCount))
|
||||
: (idx == activeBufIdx ? "ACTIVE" : "");
|
||||
int col = b.hasHighlight ? NEO_TEXT_YELLOW
|
||||
: (idx == activeBufIdx ? NEO_TEXT_GREEN : NEO_TEXT_LIGHT);
|
||||
neoui_draw_list_row(idx, kBodyY + i * rowH, rowH, idx == selectedRow ? 1 : 0,
|
||||
kIconList, col, b.name.c_str(), srvLbl.c_str(),
|
||||
badge.c_str());
|
||||
}
|
||||
neoui_draw_scrollbar(236, kBodyY, kBodyH, static_cast<int>(buffers.size()),
|
||||
maxVis, scrollOffset);
|
||||
neoui_draw_softkeys("Menu", "OPEN", "Back");
|
||||
} else {
|
||||
int rowH = 42;
|
||||
@@ -684,6 +821,8 @@ int irc_run_main(int argc, char** argv) {
|
||||
kIconGlobe, col, s.label.c_str(), sub.c_str(),
|
||||
s.state.c_str());
|
||||
}
|
||||
neoui_draw_scrollbar(236, kBodyY, kBodyH, static_cast<int>(servers.size()),
|
||||
maxVis, scrollOffset);
|
||||
neoui_draw_softkeys("Menu", "CONN/DISC", "Back");
|
||||
}
|
||||
|
||||
@@ -850,7 +989,13 @@ int irc_run_main(int argc, char** argv) {
|
||||
else if (k == NEO_KEY_DOWN) menuSel = (menuSel + 1) % 5;
|
||||
else if (k == NEO_KEY_OK) {
|
||||
menuOpen = false;
|
||||
int srvIdx = buffers[activeBufIdx].serverIdx;
|
||||
int targetBufIdx = (activeTab == 1)
|
||||
? std::clamp(selectedRow, 0, static_cast<int>(buffers.size()) - 1)
|
||||
: std::clamp(activeBufIdx, 0, static_cast<int>(buffers.size()) - 1);
|
||||
int srvIdx = (activeTab == 2)
|
||||
? std::clamp(selectedRow, 0, static_cast<int>(servers.size()) - 1)
|
||||
: buffers[targetBufIdx].serverIdx;
|
||||
srvIdx = std::clamp(srvIdx, 0, static_cast<int>(servers.size()) - 1);
|
||||
if (menuSel == 0) {
|
||||
if (servers[srvIdx].net && servers[srvIdx].net->isConnected()) {
|
||||
disconnectServer(srvIdx);
|
||||
@@ -864,8 +1009,7 @@ int irc_run_main(int argc, char** argv) {
|
||||
editModalOpen = true;
|
||||
syncEditInput();
|
||||
} else if (menuSel == 2) {
|
||||
int idx = (activeTab == 2) ? selectedRow : srvIdx;
|
||||
idx = std::clamp(idx, 0, static_cast<int>(servers.size()) - 1);
|
||||
int idx = srvIdx;
|
||||
editSrvIdx = idx;
|
||||
editDraft.label = servers[idx].label;
|
||||
editDraft.host = servers[idx].host;
|
||||
@@ -881,13 +1025,23 @@ int irc_run_main(int argc, char** argv) {
|
||||
editModalOpen = true;
|
||||
syncEditInput();
|
||||
} else if (menuSel == 3) {
|
||||
if (!servers[srvIdx].net || !servers[srvIdx].net->isConnected()) {
|
||||
for (size_t i = 0; i < servers.size(); ++i) {
|
||||
if (servers[i].net && servers[i].net->isConnected()) {
|
||||
srvIdx = static_cast<int>(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
sendIrcRaw(srvIdx, "JOIN #bananarchy");
|
||||
activeBufIdx = findOrCreateBuffer(srvIdx, "#bananarchy");
|
||||
selectedRow = activeBufIdx;
|
||||
activeTab = 0;
|
||||
} else if (menuSel == 4 && buffers[activeBufIdx].name != "*status*" &&
|
||||
buffers.size() > 1) {
|
||||
buffers.erase(buffers.begin() + activeBufIdx);
|
||||
activeBufIdx = 0;
|
||||
chatScrollBack = 0;
|
||||
syncEditInput();
|
||||
} else if (menuSel == 4) {
|
||||
closeBufferAt(targetBufIdx);
|
||||
chatScrollBack = 0;
|
||||
}
|
||||
} else if (k == NEO_KEY_BACK || k == NEO_KEY_END) {
|
||||
menuOpen = false;
|
||||
@@ -934,16 +1088,33 @@ int irc_run_main(int argc, char** argv) {
|
||||
}
|
||||
render();
|
||||
} else {
|
||||
if (k == NEO_KEY_LEFT) {
|
||||
if (activeTab == 0 && k == NEO_KEY_RIGHT && neoui_input_is_tap_active()) {
|
||||
neoui_input_commit_tap();
|
||||
applyEditInput();
|
||||
} else if (k == NEO_KEY_LEFT) {
|
||||
applyEditInput();
|
||||
activeTab = (activeTab + 2) % 3;
|
||||
selectedRow = 0;
|
||||
if (activeTab == 1) {
|
||||
selectedRow = std::clamp(activeBufIdx, 0, static_cast<int>(buffers.size()) - 1);
|
||||
} else if (activeTab == 2) {
|
||||
int sIdx = buffers[std::clamp(activeBufIdx, 0, static_cast<int>(buffers.size()) - 1)].serverIdx;
|
||||
selectedRow = std::clamp(sIdx, 0, static_cast<int>(servers.size()) - 1);
|
||||
} else {
|
||||
selectedRow = 0;
|
||||
}
|
||||
scrollOffset = 0;
|
||||
syncEditInput();
|
||||
} else if (k == NEO_KEY_RIGHT) {
|
||||
applyEditInput();
|
||||
activeTab = (activeTab + 1) % 3;
|
||||
selectedRow = 0;
|
||||
if (activeTab == 1) {
|
||||
selectedRow = std::clamp(activeBufIdx, 0, static_cast<int>(buffers.size()) - 1);
|
||||
} else if (activeTab == 2) {
|
||||
int sIdx = buffers[std::clamp(activeBufIdx, 0, static_cast<int>(buffers.size()) - 1)].serverIdx;
|
||||
selectedRow = std::clamp(sIdx, 0, static_cast<int>(servers.size()) - 1);
|
||||
} else {
|
||||
selectedRow = 0;
|
||||
}
|
||||
scrollOffset = 0;
|
||||
syncEditInput();
|
||||
} else if (activeTab == 0) {
|
||||
@@ -952,7 +1123,7 @@ int irc_run_main(int argc, char** argv) {
|
||||
else if (k == NEO_KEY_OK || k == NEO_KEY_CALL) {
|
||||
submitChatLine();
|
||||
chatScrollBack = 0;
|
||||
} 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_BACK) {
|
||||
if (!std::string(neoui_input_get_text()).empty()) {
|
||||
@@ -968,28 +1139,52 @@ int irc_run_main(int argc, char** argv) {
|
||||
} else if (k == NEO_KEY_END) {
|
||||
closeWindow();
|
||||
break;
|
||||
} else {
|
||||
int ks = neoui_event_keysym();
|
||||
if (ks >= 0x20 && ks <= 0x7e) {
|
||||
neoui_input_commit_tap();
|
||||
std::string cur = neoui_input_get_text();
|
||||
cur.push_back(static_cast<char>(ks));
|
||||
neoui_input_set_text(cur.c_str());
|
||||
applyEditInput();
|
||||
}
|
||||
}
|
||||
} else if (activeTab == 1) {
|
||||
if (k == NEO_KEY_UP && selectedRow > 0) --selectedRow;
|
||||
else if (k == NEO_KEY_DOWN) ++selectedRow;
|
||||
else if (k == NEO_KEY_OK) {
|
||||
activeBufIdx = std::clamp(selectedRow, 0,
|
||||
static_cast<int>(buffers.size()) - 1);
|
||||
int nBuf = static_cast<int>(buffers.size());
|
||||
if ((k == NEO_KEY_UP || k == NEO_KEY_2) && nBuf > 0) {
|
||||
selectedRow = (selectedRow + nBuf - 1) % nBuf;
|
||||
activeBufIdx = selectedRow;
|
||||
} else if ((k == NEO_KEY_DOWN || k == NEO_KEY_8) && nBuf > 0) {
|
||||
selectedRow = (selectedRow + 1) % nBuf;
|
||||
activeBufIdx = selectedRow;
|
||||
} else if (k == NEO_KEY_OK || k == NEO_KEY_5 || k == NEO_KEY_CALL) {
|
||||
activeBufIdx = std::clamp(selectedRow, 0, nBuf - 1);
|
||||
activeTab = 0;
|
||||
chatScrollBack = 0;
|
||||
syncEditInput();
|
||||
} else if (k == NEO_KEY_BACK) {
|
||||
closeBufferAt(selectedRow);
|
||||
chatScrollBack = 0;
|
||||
} else if (k == NEO_KEY_END) {
|
||||
closeWindow();
|
||||
break;
|
||||
}
|
||||
} else if (activeTab == 2) {
|
||||
if (k == NEO_KEY_UP && selectedRow > 0) --selectedRow;
|
||||
else if (k == NEO_KEY_DOWN) ++selectedRow;
|
||||
else if (k == NEO_KEY_OK) {
|
||||
int idx = std::clamp(selectedRow, 0,
|
||||
static_cast<int>(servers.size()) - 1);
|
||||
int nSrv = static_cast<int>(servers.size());
|
||||
if ((k == NEO_KEY_UP || k == NEO_KEY_2) && nSrv > 0) {
|
||||
selectedRow = (selectedRow + nSrv - 1) % nSrv;
|
||||
} else if ((k == NEO_KEY_DOWN || k == NEO_KEY_8) && nSrv > 0) {
|
||||
selectedRow = (selectedRow + 1) % nSrv;
|
||||
} else if (k == NEO_KEY_OK || k == NEO_KEY_5 || k == NEO_KEY_CALL) {
|
||||
int idx = std::clamp(selectedRow, 0, nSrv - 1);
|
||||
if (servers[idx].net && servers[idx].net->isConnected()) {
|
||||
disconnectServer(idx);
|
||||
} else {
|
||||
connectServer(idx);
|
||||
}
|
||||
} else if (k == NEO_KEY_END) {
|
||||
closeWindow();
|
||||
break;
|
||||
}
|
||||
}
|
||||
render();
|
||||
|
||||
@@ -97,6 +97,8 @@ constexpr const char* kIconBell = "\xef\x83\xb3"; // U+F0F3 bell / ringto
|
||||
constexpr const char* kIconBan = "\xef\x81\x9e"; // U+F05E ban / block
|
||||
constexpr const char* kIconShield = "\xef\x84\xb2"; // U+F132 shield / anti-spam
|
||||
constexpr const char* kIconGamepad = "\xef\x84\x9b"; // U+F11B gamepad / emulator
|
||||
constexpr const char* kIconStar = "\xef\x80\x85"; // U+F005 star / bookmark
|
||||
constexpr const char* kIconCircle = "\xef\x84\x8c"; // U+F10C empty circle slot
|
||||
|
||||
inline int64_t nowMs() {
|
||||
struct timespec ts {};
|
||||
@@ -1871,6 +1873,7 @@ inline void closeOtherPlugins(const char* selfPluginName) {
|
||||
{"xirc.pid", "irc"},
|
||||
{"xtox.pid", "tox"},
|
||||
{"xsmallweb.pid", "smallweb"},
|
||||
{"xwebarchy.pid", "webarchy"},
|
||||
{"xgps.pid", "gps"},
|
||||
{"xpasscode.pid", "passcode"},
|
||||
{"xengmenu.pid", "engmenu"},
|
||||
@@ -1915,6 +1918,7 @@ inline bool isAnotherPluginActive(const char* selfPluginName) {
|
||||
{"xirc.pid", "irc"},
|
||||
{"xtox.pid", "tox"},
|
||||
{"xsmallweb.pid", "smallweb"},
|
||||
{"xwebarchy.pid", "webarchy"},
|
||||
{"xgps.pid", "gps"},
|
||||
{"xpasscode.pid", "passcode"},
|
||||
{"xengmenu.pid", "engmenu"},
|
||||
@@ -1968,6 +1972,7 @@ inline void broadcastThemeReload(const char* selfPluginName = nullptr) {
|
||||
"irc",
|
||||
"tox",
|
||||
"smallweb",
|
||||
"webarchy",
|
||||
"gps",
|
||||
"passcode",
|
||||
"engmenu",
|
||||
|
||||
+1389
-134
File diff suppressed because it is too large.
Load diff
@@ -176,11 +176,17 @@ std::string getFriendPubKeyHex(Tox* tox, uint32_t friendNum) {
|
||||
|
||||
void startToxAvAudioPipes(ToxRuntimeContext* ctx) {
|
||||
std::lock_guard<std::mutex> lk(ctx->audioMtx);
|
||||
::system("amixer -c 0 cset \"name='PRI_MI2S_RX Audio Mixer MultiMedia1'\" 1 >/dev/null 2>&1; "
|
||||
"amixer -c 0 cset \"name='MultiMedia2 Mixer TERT_MI2S_TX'\" 1 >/dev/null 2>&1");
|
||||
if (!ctx->playPipe) {
|
||||
ctx->playPipe = ::popen("aplay -q -f S16_LE -r 48000 -c 1 -t raw 2>/dev/null", "w");
|
||||
ctx->playPipe = ::popen(
|
||||
"aplay -q --buffer-time=80000 --period-time=20000 -f S16_LE -r 48000 -c 1 -t raw 2>/dev/null",
|
||||
"w");
|
||||
}
|
||||
if (!ctx->capPipe) {
|
||||
ctx->capPipe = ::popen("arecord -q -f S16_LE -r 48000 -c 1 -t raw 2>/dev/null", "r");
|
||||
ctx->capPipe = ::popen(
|
||||
"arecord -q -D plughw:0,1 --buffer-time=80000 --period-time=20000 -f S16_LE -r 48000 -c 1 -t raw 2>/dev/null",
|
||||
"r");
|
||||
if (ctx->capPipe) {
|
||||
ctx->capFd = ::fileno(ctx->capPipe);
|
||||
int fl = ::fcntl(ctx->capFd, F_GETFL, 0);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user