added time to chat message, bug fix: if client is connected and server is restarted, the channel list has to resent to this client
This commit is contained in:
parent
6d83d6180c
commit
7b633f88a1
3 changed files with 15 additions and 34 deletions
|
@ -528,29 +528,6 @@ void CServer::CreateAndSendChanListForAllConChannels()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServer::CreateAndSendChanListForAllExceptThisChan ( const int iCurChanID )
|
|
||||||
{
|
|
||||||
// create channel list
|
|
||||||
CVector<CChannelShortInfo> vecChanInfo ( CreateChannelList() );
|
|
||||||
|
|
||||||
// now send connected channels list to all connected clients except for
|
|
||||||
// the channel with the ID "iCurChanID"
|
|
||||||
for ( int i = 0; i < USED_NUM_CHANNELS; i++ )
|
|
||||||
{
|
|
||||||
if ( ( vecChannels[i].IsConnected() ) && ( i != iCurChanID ) )
|
|
||||||
{
|
|
||||||
// send message
|
|
||||||
vecChannels[i].CreateConClientListMes ( vecChanInfo );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// create status HTML file if enabled
|
|
||||||
if ( bWriteStatusHTMLFile )
|
|
||||||
{
|
|
||||||
WriteHTMLChannelList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CServer::CreateAndSendChanListForThisChan ( const int iCurChanID )
|
void CServer::CreateAndSendChanListForThisChan ( const int iCurChanID )
|
||||||
{
|
{
|
||||||
// create channel list
|
// create channel list
|
||||||
|
@ -573,13 +550,13 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
||||||
vecChannels[iCurChanID].GetAddress().GetIpAddressStringNoLastByte();
|
vecChannels[iCurChanID].GetAddress().GetIpAddressStringNoLastByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
// add name of the client at the beginning of the message text and use
|
// add time and name of the client at the beginning of the message text and
|
||||||
// different colors, to get correct HTML, the "<" and ">" signs must be
|
// use different colors
|
||||||
// replaced by "<" and ">"
|
|
||||||
QString sCurColor = vstrChatColors[iCurChanID % vstrChatColors.Size()];
|
QString sCurColor = vstrChatColors[iCurChanID % vstrChatColors.Size()];
|
||||||
const QString strActualMessageText =
|
const QString strActualMessageText =
|
||||||
"<font color=""" + sCurColor + """><b><" + ChanName +
|
"<font color=""" + sCurColor + """>(" +
|
||||||
"></b></font> " + strChatText;
|
QTime::currentTime().toString ( "hh:mm:ss AP" ) + ") <b>" + ChanName +
|
||||||
|
"</b></font> " + strChatText;
|
||||||
|
|
||||||
|
|
||||||
// send chat text to all connected clients ---------------------------------
|
// send chat text to all connected clients ---------------------------------
|
||||||
|
@ -723,10 +700,15 @@ bAudioOK = true;
|
||||||
// be created after the received data has to be put to the
|
// be created after the received data has to be put to the
|
||||||
// channel first so that this channel is marked as connected)
|
// channel first so that this channel is marked as connected)
|
||||||
//
|
//
|
||||||
// connected clients list is only send for new connected clients after
|
// Usually it is not required to send the channel list to the
|
||||||
// request, only the already connected clients get the list
|
// client currently connecting since it automatically requests
|
||||||
// automatically, because they don't know when new clients connect
|
// the channel list on a new connection (as a result, he will
|
||||||
CreateAndSendChanListForAllExceptThisChan ( iCurChanID );
|
// usually get the list twice which has no impact on functionality
|
||||||
|
// but will only increase the network load a tiny little bit). But
|
||||||
|
// in case the client thinks he is still connected but the server
|
||||||
|
// was restartet, it is important that we send the channel list
|
||||||
|
// at this place.
|
||||||
|
CreateAndSendChanListForAllConChannels();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mutex.unlock();
|
Mutex.unlock();
|
||||||
|
|
|
@ -109,7 +109,6 @@ protected:
|
||||||
int GetFreeChan();
|
int GetFreeChan();
|
||||||
CVector<CChannelShortInfo> CreateChannelList();
|
CVector<CChannelShortInfo> CreateChannelList();
|
||||||
void CreateAndSendChanListForAllConChannels();
|
void CreateAndSendChanListForAllConChannels();
|
||||||
void CreateAndSendChanListForAllExceptThisChan ( const int iCurChanID );
|
|
||||||
void CreateAndSendChanListForThisChan ( const int iCurChanID );
|
void CreateAndSendChanListForThisChan ( const int iCurChanID );
|
||||||
void CreateAndSendChatTextForAllConChannels ( const int iCurChanID, const QString& strChatText );
|
void CreateAndSendChatTextForAllConChannels ( const int iCurChanID, const QString& strChatText );
|
||||||
void WriteHTMLChannelList();
|
void WriteHTMLChannelList();
|
||||||
|
|
Loading…
Reference in a new issue