Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Read DISCORD chat from the database
- if( m_GHost->m_optWWTReadDiscordChatFromDB && GetTime( ) - m_DiscordChatLastReadTime >= m_GHost->m_optWWTDiscordChatReadWaitTime && !m_GameLoaded && !m_GameLoading)
- {
- m_ChatLogEventReadC = m_GHost->m_DB->ThreadedChatLogEventRead( m_LastChatID, m_WWTGameUpdateID, m_GHost->m_reportFinishedGamesInChat, m_GHost->m_optWWTDiscordChatReadWaitTime );
- //(m_GameUpdateID, GetMapName(), GetGameName(), GetOwnerName(), GetCreatorName(), GetNumHumanPlayers(), GetPlayerList( ), GetNumHumanPlayers() + GetSlotsOpen(), m_GameLoaded ? 1 : 0, 0, true, m_GameLoaded ? m_GameTicks : m_CreationTime );
- m_DiscordChatLastReadTime = GetTime( );
- //CONSOLE_Print( "Reading chat from database" );
- }
- if( m_ChatLogEventReadC && m_ChatLogEventReadC->GetReady()) {
- //CONSOLE_Print( "Reading chat record in DB" );
- m_LastGameUpdateTime = GetTime();
- CDBChatLogEventRead *ChatLogEvent = m_ChatLogEventReadC->GetResult( );
- if( ChatLogEvent )
- {
- uint32_t ID = ChatLogEvent->GetLastId( );
- //vector<uint32_t> MessagesIDsArray m_ChatLogEventReadC->GetMessageId( );
- vector<string> MessageArray = ChatLogEvent->GetMessage( );
- for( vector<string> :: iterator p = MessageArray.begin( ); p != MessageArray.end( ); ++p )
- {
- if((*p).substr( 0, 6 ) == "STSGM:")
- SendAllChat( (*p).substr( 6, ((*p).size() - 1) ) );
- else
- SendAllChat( "<Discord> " + *p );
- }
- /*for( uint32_t a = 0; a < MessageArray.size(); ++a )
- SendAllChat( "<Discord> " + MessageArray[a] );*/
- if( ID != 0 )
- m_LastChatID = ID;
- }
- m_GHost->m_DB->RecoverCallable( m_ChatLogEventReadC );
- delete m_ChatLogEventReadC;
- m_ChatLogEventReadC = NULL;
- //CONSOLE_Print( "Recieved response (possible chat message)" );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement