diff options
author | trilene <trilene@runbox.com> | 2020-07-29 18:16:52 -0400 |
---|---|---|
committer | trilene <trilene@runbox.com> | 2020-07-29 18:16:52 -0400 |
commit | 97681ccf648e68d85aea39de22684ff52e9470c8 (patch) | |
tree | 858cc4385f6de87b0e021d4ee4f5bc6f654e95ba /src/CallManager.cpp | |
parent | Handle ICE failure (diff) | |
download | nheko-97681ccf648e68d85aea39de22684ff52e9470c8.tar.xz |
Remove references to video calls
Diffstat (limited to 'src/CallManager.cpp')
-rw-r--r-- | src/CallManager.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/CallManager.cpp b/src/CallManager.cpp index b57ef1bb..3ddcc227 100644 --- a/src/CallManager.cpp +++ b/src/CallManager.cpp @@ -1,3 +1,4 @@ +#include <cctype> #include <chrono> #include <QMediaPlaylist> @@ -198,12 +199,24 @@ CallManager::handleEvent_(const mtx::events::collections::TimelineEvents &event) void CallManager::handleEvent(const RoomEvent<CallInvite> &callInviteEvent) { - nhlog::ui()->debug("WebRTC: call id: {} - incoming CallInvite from {}", - callInviteEvent.content.call_id, callInviteEvent.sender); + const char video[] = "m=video"; + const std::string &sdp = callInviteEvent.content.sdp; + bool isVideo = std::search(sdp.cbegin(), sdp.cend(), std::cbegin(video), std::cend(video) - 1, + [](unsigned char c1, unsigned char c2) {return std::tolower(c1) == std::tolower(c2);}) + != sdp.cend(); + + nhlog::ui()->debug(std::string("WebRTC: call id: {} - incoming ") + (isVideo ? "video" : "voice") + + " CallInvite from {}", callInviteEvent.content.call_id, callInviteEvent.sender); if (callInviteEvent.content.call_id.empty()) return; + if (isVideo) { + emit newMessage(QString::fromStdString(callInviteEvent.room_id), + CallHangUp{callInviteEvent.content.call_id, 0, CallHangUp::Reason::InviteTimeOut}); + return; + } + auto roomInfo = cache::singleRoomInfo(callInviteEvent.room_id); if (onActiveCall() || roomInfo.member_count != 2) { emit newMessage(QString::fromStdString(callInviteEvent.room_id), |