mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
transmit sms phone in nli (and hard-code port=1)
This fixes on gtk version being able to invite to an SMS game using relayID. I don't know why not transmitting port is ok; maybe android doesn't use the port or gets it some other way, e.g. it's hard-coded for each variant.
This commit is contained in:
parent
cdbf574c0e
commit
9406297c03
2 changed files with 19 additions and 7 deletions
|
@ -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);
|
||||
|
|
|
@ -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 ) );
|
||||
|
||||
|
|
Loading…
Reference in a new issue