Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. // Read DISCORD chat from the database
  2. if( m_GHost->m_optWWTReadDiscordChatFromDB && GetTime( ) - m_DiscordChatLastReadTime >= m_GHost->m_optWWTDiscordChatReadWaitTime && !m_GameLoaded && !m_GameLoading)
  3. {
  4. m_ChatLogEventReadC = m_GHost->m_DB->ThreadedChatLogEventRead( m_LastChatID, m_WWTGameUpdateID, m_GHost->m_reportFinishedGamesInChat, m_GHost->m_optWWTDiscordChatReadWaitTime );
  5. //(m_GameUpdateID, GetMapName(), GetGameName(), GetOwnerName(), GetCreatorName(), GetNumHumanPlayers(), GetPlayerList( ), GetNumHumanPlayers() + GetSlotsOpen(), m_GameLoaded ? 1 : 0, 0, true, m_GameLoaded ? m_GameTicks : m_CreationTime );
  6. m_DiscordChatLastReadTime = GetTime( );
  7. //CONSOLE_Print( "Reading chat from database" );
  8. }
  9.  
  10. if( m_ChatLogEventReadC && m_ChatLogEventReadC->GetReady()) {
  11. //CONSOLE_Print( "Reading chat record in DB" );
  12. m_LastGameUpdateTime = GetTime();
  13. CDBChatLogEventRead *ChatLogEvent = m_ChatLogEventReadC->GetResult( );
  14.  
  15. if( ChatLogEvent )
  16. {
  17. uint32_t ID = ChatLogEvent->GetLastId( );
  18. //vector<uint32_t> MessagesIDsArray m_ChatLogEventReadC->GetMessageId( );
  19. vector<string> MessageArray = ChatLogEvent->GetMessage( );
  20.  
  21. for( vector<string> :: iterator p = MessageArray.begin( ); p != MessageArray.end( ); ++p )
  22. {
  23. if((*p).substr( 0, 6 ) == "STSGM:")
  24. SendAllChat( (*p).substr( 6, ((*p).size() - 1) ) );
  25. else
  26. SendAllChat( "<Discord> " + *p );
  27. }
  28.  
  29. /*for( uint32_t a = 0; a < MessageArray.size(); ++a )
  30. SendAllChat( "<Discord> " + MessageArray[a] );*/
  31.  
  32. if( ID != 0 )
  33. m_LastChatID = ID;
  34. }
  35. m_GHost->m_DB->RecoverCallable( m_ChatLogEventReadC );
  36. delete m_ChatLogEventReadC;
  37. m_ChatLogEventReadC = NULL;
  38.  
  39. //CONSOLE_Print( "Recieved response (possible chat message)" );
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement