do not show last digits of IP address in case no fader tag is available for chat window and audio mixer fader

This commit is contained in:
Volker Fischer 2009-03-10 22:08:12 +00:00
parent f7d483fa12
commit 205daead99
3 changed files with 18 additions and 11 deletions

View file

@ -191,9 +191,12 @@ QString CAudioMixerBoard::GenFaderText ( CChannelShortInfo& ChanInfo )
// if text is empty, show IP address instead
if ( ChanInfo.strName.isEmpty() )
{
// convert IP address to text and show it
const QHostAddress addrTest ( ChanInfo.iIpAddr );
return addrTest.toString();
// convert IP address to text and show it (use dummy port number
// since it is not used here)
const CHostAddress TempAddr =
CHostAddress ( QHostAddress ( ChanInfo.iIpAddr ), 0 );
return TempAddr.GetIpAddressStringNoLastByte();
}
else
{

View file

@ -205,8 +205,8 @@ void CChannelSet::CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
if ( ChanName.isEmpty() )
{
// convert IP address to text and show it
const QHostAddress addrTest ( vecChannels[iCurChanID].GetAddress().InetAddr );
ChanName = addrTest.toString();
ChanName =
vecChannels[iCurChanID].GetAddress().GetIpAddressStringNoLastByte();
}
// add name of the client at the beginning of the message text and use
@ -637,12 +637,10 @@ void CChannelSet::WriteHTMLChannelList()
// if text is empty, show IP address instead
if ( strCurChanName.isEmpty() )
{
// convert IP address to text and show it
const QHostAddress addrTest ( vecChannels[i].GetAddress().InetAddr );
strCurChanName = addrTest.toString();
// remove last digits
strCurChanName = strCurChanName.section ( ".", 0, 2 ) + ".x";
// convert IP address to text and show it, remove last
// digits
strCurChanName =
vecChannels[i].GetAddress().GetIpAddressStringNoLastByte();
}
streamFileOut << " <li>" << strCurChanName << "</li>" << endl;

View file

@ -392,6 +392,12 @@ public:
bool operator== ( const CHostAddress& CompAddr ) // compare operator
{ return ( ( CompAddr.InetAddr == InetAddr ) && ( CompAddr.iPort == iPort ) ); }
QString GetIpAddressStringNoLastByte() const
{
// remove the last byte of the IP address
return InetAddr.toString().section ( ".", 0, 2 ) + ".x";
}
QHostAddress InetAddr;
quint16 iPort;
};