cleanup: remove some relay stuff

This commit is contained in:
Eric House 2022-08-25 11:19:50 -07:00
parent 3c9626c5ba
commit 4ba1b2418c
3 changed files with 9 additions and 14 deletions

View file

@ -86,7 +86,6 @@ static void handle_invite_button( GtkWidget* widget, GtkGameGlobals* globals );
static void gtkShowFinalScores( const GtkGameGlobals* globals,
XP_Bool ignoreTimeout );
static void send_invites( CommonGlobals* cGlobals, XP_U16 nPlayers,
XP_U32 relayDevID, const XP_UCHAR* relayID,
const CommsAddrRec* addrs );
#define GTK_TRAY_HT_ROWS 3
@ -729,7 +728,7 @@ on_board_window_shown( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
CommsAddrRec addr = {0};
addrFromStream( &addr, stream );
send_invites( cGlobals, 1, 0, relayID, &addr );
send_invites( cGlobals, 1, &addr );
}
}
stream_destroy( stream, NULL_XWE );
@ -1460,19 +1459,16 @@ handle_invite_button( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
CommsAddrRec inviteAddr = {0};
gint nPlayers = nMissing;
XP_U32 relayDevID = 0;
XP_Bool confirmed = gtkInviteDlg( globals, &inviteAddr, &nPlayers,
&relayDevID );
XP_Bool confirmed = gtkInviteDlg( globals, &inviteAddr, &nPlayers );
XP_LOGFF( "gtkInviteDlg() => %s", boolToStr(confirmed) );
if ( confirmed ) {
send_invites( cGlobals, nPlayers, relayDevID, NULL, &inviteAddr );
send_invites( cGlobals, nPlayers, &inviteAddr );
}
} /* handle_invite_button */
static void
send_invites( CommonGlobals* cGlobals, XP_U16 nPlayers,
XP_U32 relayDevID, const XP_UCHAR* relayID,
const CommsAddrRec* destAddr )
{
CommsAddrRec myAddr = {0};
@ -1515,11 +1511,12 @@ send_invites( CommonGlobals* cGlobals, XP_U16 nPlayers,
linux_sms_invite( cGlobals->params, &nli,
destAddr->u.sms.phone, destAddr->u.sms.port );
}
#ifdef XWFEATURE_RELAY
if ( 0 != relayDevID || !!relayID ) {
XP_ASSERT( 0 != relayDevID || (!!relayID && !!relayID[0]) );
relaycon_invite( cGlobals->params, relayDevID, relayID, &nli );
}
#endif
if ( addr_hasType( destAddr, COMMS_CONN_MQTT ) ) {
mqttc_invite( cGlobals->params, &nli, &destAddr->u.mqtt.devID );

View file

@ -44,12 +44,12 @@ typedef struct _GtkInviteState {
XW_DUtilCtxt* dutil; /* hang onto as optimization */
CommsAddrRec* addr;
gint* nPlayersP;
XP_U32* relayDevIDp;
gint maxPlayers;
GtkWidget* nPlayersCombo;
/* relay */
#ifdef XWFEATURE_RELAY
GtkWidget* devID;
#endif
/* BT */
GtkWidget* bthost;
/* SMS */
@ -349,14 +349,12 @@ onPageChanged( GtkNotebook* XP_UNUSED(notebook), gpointer XP_UNUSED(arg1),
}
XP_Bool
gtkInviteDlg( GtkGameGlobals* globals, CommsAddrRec* addr,
gint* nPlayersP, XP_U32* relayDevIDp )
gtkInviteDlg( GtkGameGlobals* globals, CommsAddrRec* addr, gint* nPlayersP )
{
GtkInviteState state = {
.globals = globals,
.addr = addr,
.nPlayersP = nPlayersP,
.relayDevIDp = relayDevIDp,
.maxPlayers = *nPlayersP,
.dutil = globals->cGlobals.params->dutil,
};

View file

@ -24,7 +24,7 @@
/* return true if not cancelled */
XP_Bool gtkInviteDlg( GtkGameGlobals* globals, CommsAddrRec* addr,
/*inout*/ gint* nPlayers, /* out */ XP_U32* relayDevID );
/*inout*/ gint* nPlayers );
#endif