From 8eb5b7863db21355d8abb477af6170b862847c66 Mon Sep 17 00:00:00 2001 From: Armin <armin.felder@osalliance.com> Date: Sat, 17 Feb 2018 17:53:25 +0100 Subject: [PATCH] added code to leave a channel after it was blocked --- rocketchatserver.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rocketchatserver.cpp b/rocketchatserver.cpp index 237289e..d42773d 100755 --- a/rocketchatserver.cpp +++ b/rocketchatserver.cpp @@ -367,10 +367,13 @@ void RocketChatServerData::blockUser( const QString &pChannelId ) if ( userId == pChannelId ) { QString possibleRoom1 = userId + mUserId; QString possibleRoom2 = mUserId + userId; + QSharedPointer<RocketChatBlockUserRequest> blockRequest1( new RocketChatBlockUserRequest( possibleRoom1, userId ) ); QSharedPointer<RocketChatBlockUserRequest> blockRequest2( new RocketChatBlockUserRequest( possibleRoom2, userId ) ); mDdpApi->sendRequest( blockRequest1 ); mDdpApi->sendRequest( blockRequest2 ); + + } else { QSharedPointer<RocketChatBlockUserRequest> blockRequest( new RocketChatBlockUserRequest( pChannelId, userId ) ); mDdpApi->sendRequest( blockRequest ); @@ -911,13 +914,14 @@ void RocketChatServerData::handleChannelMessage( const QJsonObject &pMessage ) blocked = data[QStringLiteral( "blocker" )].toBool(); //TODO: clean this up!, there should be a user service - QString otherUserId = rid.replace( mUserId, "" ); + QString otherUserId = rid; + otherUserId = otherUserId.replace( mUserId, "" ); if ( data.contains( "name" ) ) { QString otherUserName = data["name"].toString(); mStorage->addUserToBlockList( otherUserName, otherUserId ); mMessageService->addUserToBlockList( otherUserId ); - + leaveChannel( rid ); } } -- GitLab