mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-14 08:01:38 +01:00
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:
parent
3d18e5832e
commit
9fca3792cf
3 changed files with 7 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -81,6 +81,7 @@ struct CursesAppGlobals {
|
|||
|
||||
short statusLine;
|
||||
XWGameState state;
|
||||
CommsRelayState commsRelayState;
|
||||
|
||||
struct sockaddr_in listenerSockAddr;
|
||||
#ifdef USE_GLIBLOOP
|
||||
|
|
|
@ -48,8 +48,6 @@
|
|||
# include <bluetooth/hci_lib.h>
|
||||
#endif
|
||||
|
||||
/* #include <pthread.h> */
|
||||
|
||||
#include "linuxmain.h"
|
||||
#include "linuxutl.h"
|
||||
#include "linuxbt.h"
|
||||
|
|
Loading…
Reference in a new issue