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 text is empty, show IP address instead
if ( ChanInfo.strName.isEmpty() ) if ( ChanInfo.strName.isEmpty() )
{ {
// convert IP address to text and show it // convert IP address to text and show it (use dummy port number
const QHostAddress addrTest ( ChanInfo.iIpAddr ); // since it is not used here)
return addrTest.toString(); const CHostAddress TempAddr =
CHostAddress ( QHostAddress ( ChanInfo.iIpAddr ), 0 );
return TempAddr.GetIpAddressStringNoLastByte();
} }
else else
{ {

View File

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

View File

@ -392,6 +392,12 @@ public:
bool operator== ( const CHostAddress& CompAddr ) // compare operator bool operator== ( const CHostAddress& CompAddr ) // compare operator
{ return ( ( CompAddr.InetAddr == InetAddr ) && ( CompAddr.iPort == iPort ) ); } { 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; QHostAddress InetAddr;
quint16 iPort; quint16 iPort;
}; };