From 41fc05106b7ce6517ca7794ff6c9ebf38052ec08 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Thu, 28 Oct 2010 18:45:55 -0700 Subject: [PATCH] add room name to callback used when device connects --- xwords4/common/comms.c | 13 ++++++++++--- xwords4/common/comms.h | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index 8c8553ad8..0a8ddf9b8 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -794,6 +794,9 @@ comms_getInitialAddr( CommsAddrRec* addr XP_MEMCPY( addr->u.ip_relay.hostName, name, XP_STRLEN(name)+1 ); XP_MEMCPY( addr->u.ip_relay.invite, room, XP_STRLEN(room)+1 ); } + addr->u.ip_relay.seeksPublicRoom = XP_FALSE; + addr->u.ip_relay.advertiseRoom = XP_FALSE; + #elif defined PLATFORM_PALM /* default values; default is still IR where there's a choice, at least on Palm... */ @@ -1203,11 +1206,13 @@ got_connect_cmd( CommsCtxt* comms, XWStreamCtxt* stream, if ( ! reconnected ) { /* This may belong as an alert to user so knows has connected. */ - (*comms->procs.rconnd)( comms->procs.closure, XP_FALSE, nSought - nHere ); + (*comms->procs.rconnd)( comms->procs.closure, + comms->addr.u.ip_relay.invite, + XP_FALSE, nSought - nHere ); } XP_LOGF( "%s: have %d of %d players", __func__, nHere, nSought ); setHeartbeatTimer( comms ); -} +} /* got_connect_cmd */ static XP_Bool relayPreProcess( CommsCtxt* comms, XWStreamCtxt* stream, XWHostID* senderID ) @@ -1261,7 +1266,9 @@ relayPreProcess( CommsCtxt* comms, XWStreamCtxt* stream, XWHostID* senderID ) comms_resendAll( comms ); /* } */ if ( XWRELAY_ALLHERE == cmd ) { /* initial connect? */ - (*comms->procs.rconnd)( comms->procs.closure, XP_TRUE, 0 ); + (*comms->procs.rconnd)( comms->procs.closure, + comms->addr.u.ip_relay.invite, + XP_TRUE, 0 ); } set_relay_state( comms, COMMS_RELAYSTATE_ALLCONNECTED ); break; diff --git a/xwords4/common/comms.h b/xwords4/common/comms.h index d6196f0ba..e664734be 100644 --- a/xwords4/common/comms.h +++ b/xwords4/common/comms.h @@ -119,8 +119,8 @@ typedef void (*TransportReset)( void* closure ); #ifdef XWFEATURE_RELAY typedef void (*RelayStatusProc)( void* closure, CommsRelayState newState ); -typedef void (*RelayConndProc)( void* closure, XP_Bool allHere, - XP_U16 nMissing ); +typedef void (*RelayConndProc)( void* closure, XP_UCHAR* const room, + XP_Bool allHere, XP_U16 nMissing ); typedef void (*RelayErrorProc)( void* closure, XWREASON relayErr ); #endif