don't pile on chat messages when relay isn't even connected: it's an

unfair test that doesn't duplicate what users will likely do.
This commit is contained in:
Eric House 2013-07-01 07:51:38 -07:00 committed by Eric House
parent 3d18e5832e
commit 9fca3792cf
3 changed files with 7 additions and 9 deletions

View file

@ -1661,9 +1661,10 @@ relay_sendNoConn_curses( const XP_U8* msg, XP_U16 len,
} /* relay_sendNoConn_curses */
static void
relay_status_curses( void* XP_UNUSED(closure),
CommsRelayState XP_UNUSED_DBG(state) )
relay_status_curses( void* closure, CommsRelayState state )
{
CursesAppGlobals* globals = (CursesAppGlobals*)closure;
globals->commsRelayState = state;
XP_LOGF( "%s got status: %s", __func__, CommsRelayState2Str(state) );
}
@ -1720,22 +1721,20 @@ chatsTimerFired( gpointer data )
{
CursesAppGlobals* globals = (CursesAppGlobals*)data;
GameStateInfo gsi;
game_getState( &globals->cGlobals.game, &gsi );
if ( gsi.gameIsConnected ) {
if ( COMMS_RELAYSTATE_ALLCONNECTED == globals->commsRelayState ) {
XP_UCHAR msg[128];
struct tm* timp;
struct timeval tv;
struct timezone tz;
XP_LOGF( "%s: sending \"%s\"", __func__, msg );
gettimeofday( &tv, &tz );
timp = localtime( &tv.tv_sec );
snprintf( msg, sizeof(msg), "Saying hi via chat at %.2d:%.2d:%.2d",
timp->tm_hour, timp->tm_min, timp->tm_sec );
server_sendChat( globals->cGlobals.game.server, msg );
XP_LOGF( "%s: sent \"%s\"", __func__, msg );
}
return TRUE;

View file

@ -81,6 +81,7 @@ struct CursesAppGlobals {
short statusLine;
XWGameState state;
CommsRelayState commsRelayState;
struct sockaddr_in listenerSockAddr;
#ifdef USE_GLIBLOOP

View file

@ -48,8 +48,6 @@
# include <bluetooth/hci_lib.h>
#endif
/* #include <pthread.h> */
#include "linuxmain.h"
#include "linuxutl.h"
#include "linuxbt.h"