diff --git a/xwords4/common/nli.c b/xwords4/common/nli.c index a49802443..c65d708b9 100644 --- a/xwords4/common/nli.c +++ b/xwords4/common/nli.c @@ -42,9 +42,21 @@ nli_init( NetLaunchInfo* nli, const CurGameInfo* gi, const CommsAddrRec* addr, nli->nPlayersH = nPlayers; nli->forceChannel = forceChannel; - if ( addr_hasType( addr, COMMS_CONN_RELAY ) ) { - types_addType( &nli->_conTypes, COMMS_CONN_RELAY ); - XP_STRCAT( nli->room, addr->u.ip_relay.invite ); + CommsConnType typ; + for ( XP_U32 st = 0; addr_iter( addr, &typ, &st ); ) { + types_addType( &nli->_conTypes, typ ); + switch ( typ ) { + case COMMS_CONN_RELAY: + XP_STRCAT( nli->room, addr->u.ip_relay.invite ); + break; + case COMMS_CONN_SMS: + XP_STRCAT( nli->phone, addr->u.sms.phone ); + // nli->port = addr->u.sms.port; <-- I wish + break; + default: + XP_ASSERT(0); + break; + } } } @@ -159,9 +171,8 @@ nli_makeFromStream( NetLaunchInfo* nli, XWStreamCtxt* stream ) void nli_makeAddrRec( const NetLaunchInfo* nli, CommsAddrRec* addr ) { - XP_U32 state = 0; CommsConnType type; - while ( types_iter( nli->_conTypes, &type, &state ) ) { + for ( XP_U32 state = 0; types_iter( nli->_conTypes, &type, &state ); ) { addr_addType( addr, type ); switch( type ) { case COMMS_CONN_RELAY: @@ -176,6 +187,7 @@ nli_makeAddrRec( const NetLaunchInfo* nli, CommsAddrRec* addr ) break; case COMMS_CONN_SMS: XP_STRCAT( addr->u.sms.phone, nli->phone ); + addr->u.sms.port = 1; /* BAD, but 0 is worse */ break; default: XP_ASSERT(0); diff --git a/xwords4/linux/gtkboard.c b/xwords4/linux/gtkboard.c index f40ffed47..0393bf9f5 100644 --- a/xwords4/linux/gtkboard.c +++ b/xwords4/linux/gtkboard.c @@ -1580,10 +1580,10 @@ send_invites( CommonGlobals* cGlobals, XP_U16 nPlayers, NetLaunchInfo nli = {0}; nli_init( &nli, cGlobals->gi, &addr, nPlayers, forceChannel ); - if ( 0 != relayDevID || !!relayID ) { + if ( addr_hasType( &addr, COMMS_CONN_RELAY ) ) { XP_UCHAR buf[32]; snprintf( buf, sizeof(buf), "%X", makeRandomInt() ); - nli_setInviteID( &nli, buf ); + nli_setInviteID( &nli, buf ); /* should not be relay only!!! */ } // nli_setDevID( &nli, linux_getDevIDRelay( cGlobals->params ) );