Reference HTML file for welcome message #361

This commit is contained in:
Volker Fischer 2020-06-13 18:15:52 +02:00
parent 1e80a8659b
commit 2285148cb8
2 changed files with 18 additions and 1 deletions

View file

@ -250,7 +250,6 @@ CServer::CServer ( const int iNewMaxNumChan,
bNCentServPingServerInList, bNCentServPingServerInList,
&ConnLessProtocol ), &ConnLessProtocol ),
bAutoRunMinimized ( false ), bAutoRunMinimized ( false ),
strWelcomeMessage ( strNewWelcomeMessage ),
eLicenceType ( eNLicenceType ), eLicenceType ( eNLicenceType ),
bDisconnectAllClientsOnQuit ( bNDisconnectAllClientsOnQuit ), bDisconnectAllClientsOnQuit ( bNDisconnectAllClientsOnQuit ),
pSignalHandler ( CSignalHandler::getSingletonP() ) pSignalHandler ( CSignalHandler::getSingletonP() )
@ -402,6 +401,23 @@ CServer::CServer ( const int iNewMaxNumChan,
QString().number( static_cast<int> ( iPortNumber ) ) ); QString().number( static_cast<int> ( iPortNumber ) ) );
} }
// manage welcome message: if the welcome message is a valid link to a local
// file, the content of that file is used as the welcome message (#361)
strWelcomeMessage = strNewWelcomeMessage; // first copy text, may be overwritten
if ( QFileInfo ( strNewWelcomeMessage ).exists() )
{
QFile file ( strNewWelcomeMessage );
if ( file.open ( QIODevice::ReadOnly | QIODevice::Text ) )
{
// use entrie file content for the welcome message
strWelcomeMessage = file.readAll();
}
}
// restrict welcome message to maximum allowed length
strWelcomeMessage = strWelcomeMessage.left ( MAX_LEN_CHAT_TEXT );
// enable jam recording (if requested) - kicks off the thread // enable jam recording (if requested) - kicks off the thread
if ( !strRecordingDirName.isEmpty() ) if ( !strRecordingDirName.isEmpty() )
{ {

View file

@ -28,6 +28,7 @@
#include <QTimer> #include <QTimer>
#include <QDateTime> #include <QDateTime>
#include <QHostAddress> #include <QHostAddress>
#include <QFileInfo>
#include <algorithm> #include <algorithm>
#ifdef USE_OPUS_SHARED_LIB #ifdef USE_OPUS_SHARED_LIB
# include "opus/opus_custom.h" # include "opus/opus_custom.h"