diff --git a/src/server.cpp b/src/server.cpp
index 67274965bc..c32f737a75 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1297,17 +1297,31 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID, con
const QString strActualMessageText = "(" + QTime::currentTime().toString ( "hh:mm:ss AP" ) + ") " +
ChanName.toHtmlEscaped() + " " + strChatText.toHtmlEscaped();
+ // Send chat text to all connected clients ---------------------------------
+ SendChatTextToAllConChannels ( strActualMessageText );
+}
+
+void CServer::SendChatTextToAllConChannels ( const QString& strChatText )
+{
// Send chat text to all connected clients ---------------------------------
for ( int i = 0; i < iMaxNumChannels; i++ )
{
if ( vecChannels[i].IsConnected() )
{
- // send message
- vecChannels[i].CreateChatTextMes ( strActualMessageText );
+ vecChannels[i].CreateChatTextMes ( strChatText );
}
}
}
+void CServer::SendChatTextToConChannel ( const int iCurChanID, const QString& strChatText )
+{
+ if ( MathUtils::InRange ( iCurChanID, 0, iMaxNumChannels - 1 ) && vecChannels[iCurChanID].IsConnected() )
+ {
+ // send message
+ vecChannels[iCurChanID].CreateChatTextMes ( strChatText );
+ }
+}
+
void CServer::CreateAndSendRecorderStateForAllConChannels()
{
// get recorder state
diff --git a/src/server.h b/src/server.h
index 2e6b13e835..4f1c4a3805 100644
--- a/src/server.h
+++ b/src/server.h
@@ -191,6 +191,9 @@ class CServer : public QObject, public CServerSlots
void SetEnableDelayPanning ( bool bDelayPanningOn ) { bDelayPan = bDelayPanningOn; }
bool IsDelayPanningEnabled() { return bDelayPan; }
+ void SendChatTextToAllConChannels ( const QString& strChatText );
+ void SendChatTextToConChannel ( const int iCurChanID, const QString& strChatText );
+
protected:
// access functions for actual channels
bool IsConnected ( const int iChanNum ) { return vecChannels[iChanNum].IsConnected(); }
diff --git a/src/util.h b/src/util.h
index 563fbb58ef..0b9169f265 100644
--- a/src/util.h
+++ b/src/util.h
@@ -1223,6 +1223,13 @@ class MathUtils
return powf ( 10.0f, ( fInValueRange0_1 - 1.0f ) * AUD_MIX_FADER_RANGE_DB / 20.0f );
}
}
+
+ // return true if a value is within the lower and upper bounds (inclusively), otherwise false
+ template
+ static inline bool InRange ( T value, T lower, T upper )
+ {
+ return !( value < lower || value > upper );
+ }
};
/******************************************************************************\