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
|
@ -255,7 +255,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
|||
TimerStatus.start ( STATUSBAR_UPDATE_TIME );
|
||||
}
|
||||
|
||||
void CLlconClientDlg::closeEvent ( QCloseEvent * Event )
|
||||
void CLlconClientDlg::closeEvent ( QCloseEvent* Event )
|
||||
{
|
||||
// if settings dialog or chat dialog is open, close it
|
||||
ClientSettingsDlg.close();
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
// create channel list
|
||||
|
@ -573,13 +550,13 @@ void CServer::CreateAndSendChatTextForAllConChannels ( const int iCurChanID,
|
|||
vecChannels[iCurChanID].GetAddress().GetIpAddressStringNoLastByte();
|
||||
}
|
||||
|
||||
// add name of the client at the beginning of the message text and use
|
||||
// different colors, to get correct HTML, the "<" and ">" signs must be
|
||||
// replaced by "<" and ">"
|
||||
// add time and name of the client at the beginning of the message text and
|
||||
// use different colors
|
||||
QString sCurColor = vstrChatColors[iCurChanID % vstrChatColors.Size()];
|
||||
const QString strActualMessageText =
|
||||
"<font color=""" + sCurColor + """><b><" + ChanName +
|
||||
"></b></font> " + strChatText;
|
||||
"<font color=""" + sCurColor + """>(" +
|
||||
QTime::currentTime().toString ( "hh:mm:ss AP" ) + ") <b>" + ChanName +
|
||||
"</b></font> " + strChatText;
|
||||
|
||||
|
||||
// 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
|
||||
// channel first so that this channel is marked as connected)
|
||||
//
|
||||
// connected clients list is only send for new connected clients after
|
||||
// request, only the already connected clients get the list
|
||||
// automatically, because they don't know when new clients connect
|
||||
CreateAndSendChanListForAllExceptThisChan ( iCurChanID );
|
||||
// Usually it is not required to send the channel list to the
|
||||
// client currently connecting since it automatically requests
|
||||
// the channel list on a new connection (as a result, he will
|
||||
// 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();
|
||||
|
|
|
@ -109,7 +109,6 @@ protected:
|
|||
int GetFreeChan();
|
||||
CVector<CChannelShortInfo> CreateChannelList();
|
||||
void CreateAndSendChanListForAllConChannels();
|
||||
void CreateAndSendChanListForAllExceptThisChan ( const int iCurChanID );
|
||||
void CreateAndSendChanListForThisChan ( const int iCurChanID );
|
||||
void CreateAndSendChatTextForAllConChannels ( const int iCurChanID, const QString& strChatText );
|
||||
void WriteHTMLChannelList();
|
||||
|
|
Loading…
Reference in a new issue