From 97681ccf648e68d85aea39de22684ff52e9470c8 Mon Sep 17 00:00:00 2001 From: trilene Date: Wed, 29 Jul 2020 18:16:52 -0400 Subject: Remove references to video calls --- src/CallManager.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/CallManager.cpp') 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 #include #include @@ -198,12 +199,24 @@ CallManager::handleEvent_(const mtx::events::collections::TimelineEvents &event) void CallManager::handleEvent(const RoomEvent &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), -- cgit 1.4.1