diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java index e5d3e2326..16341b077 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BoardDelegate.java @@ -3154,9 +3154,7 @@ public class BoardDelegate extends DelegateBase private boolean tryOtherInvites( CommsAddrRec addr ) { Log.d( TAG, "tryOtherInvites(%s)", addr ); - NetLaunchInfo nli = nliForMe(); - XwJNI.comms_invite( m_jniGamePtr, nli, addr ); - boolean result = true; + XwJNI.comms_invite( m_jniGamePtr, nliForMe(), addr ); // Not sure what to do about this recordInviteSent stuff CommsConnTypeSet conTypes = addr.conTypes; @@ -3164,7 +3162,7 @@ public class BoardDelegate extends DelegateBase switch ( typ ) { case COMMS_CONN_MQTT: // MQTTUtils.inviteRemote( m_jniGamePtr, addr.mqtt_devID, nli ); - // recordInviteSent( InviteMeans.MQTT, addr.mqtt_devID ); + recordInviteSent( InviteMeans.MQTT, addr.mqtt_devID ); break; case COMMS_CONN_BT: // BTUtils.inviteRemote( m_activity, addr.bt_btAddr, nli ); @@ -3183,7 +3181,7 @@ public class BoardDelegate extends DelegateBase Log.d( TAG, "not inviting using addr type %s", typ ); } } - return result; + return true; } private void sendNBSInviteIf( String phone, NetLaunchInfo nli, diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java index d5845f106..e0fdbd710 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/MQTTUtils.java @@ -542,6 +542,7 @@ public class MQTTUtils extends Thread addToSendQueue( context, topic[0], packet ); } + // This goes away? comms_invite() is already getting called. PENDING public static void addInvite( GamePtr game, String devID, NetLaunchInfo nli ) { CommsAddrRec destAddr = new CommsAddrRec(CommsConnType.COMMS_CONN_MQTT) diff --git a/xwords4/android/jni/xwjni.c b/xwords4/android/jni/xwjni.c index 5065b73a2..5c21a1b1e 100644 --- a/xwords4/android/jni/xwjni.c +++ b/xwords4/android/jni/xwjni.c @@ -2628,6 +2628,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1invite { XWJNI_START_GLOBALS(); CommsCtxt* comms = state->game.comms; + XP_ASSERT( NULL != comms ); if ( NULL != comms ) { CommsAddrRec destAddr; getJAddrRec( env, &destAddr, jaddr ); diff --git a/xwords4/common/comms.c b/xwords4/common/comms.c index a4c82a13a..fd82c8065 100644 --- a/xwords4/common/comms.c +++ b/xwords4/common/comms.c @@ -689,7 +689,6 @@ addrFromStreamOne( CommsAddrRec* addrP, XWStreamCtxt* stream, CommsConnType typ break; case COMMS_CONN_RELAY: { IpRelay ip_relay = {{0}}; - stringFromStreamHere( stream, ip_relay.invite, sizeof(ip_relay.invite) ); stringFromStreamHere( stream, ip_relay.hostName, @@ -2881,13 +2880,14 @@ comms_checkIncomingStream( CommsCtxt* comms, XWEnv xwe, XWStreamCtxt* stream, messageValid = parseSmallHeader( comms, xwe, stream, &stuff ); } } + if ( messageValid ) { state->msgID = stuff.msgID; CNO_FMT( cbuf, stuff.channelNo ); XP_LOGFF( TAGFMT() "rcd on %s: msgID=%d, lastMsgRcd=%d ", TAGPRMS, cbuf, stuff.msgID, stuff.lastMsgRcd ); } else { - XP_LOGFF( TAGFMT() "got message to self?", TAGPRMS ); + XP_LOGFF( TAGFMT() "got message to self?", TAGPRMS ); /* firing */ } AddressRecord* rec = NULL; diff --git a/xwords4/linux/gtkboard.c b/xwords4/linux/gtkboard.c index 9c76345d4..aa80f3535 100644 --- a/xwords4/linux/gtkboard.c +++ b/xwords4/linux/gtkboard.c @@ -837,7 +837,6 @@ new_game_impl( GtkGameGlobals* globals, XP_Bool fireConnDlg ) XP_Bool success = XP_FALSE; CommonGlobals* cGlobals = &globals->cGlobals; - CurGameInfo* gi = cGlobals->gi; success = gtkNewGameDialog( globals, gi, &cGlobals->selfAddr, XP_TRUE, fireConnDlg ); @@ -2694,16 +2693,4 @@ loadGameNoDraw( GtkGameGlobals* globals, LaunchParams* params, stream_destroy( stream, NULL_XWE ); return loaded; } - -XP_Bool -makeNewGame( GtkGameGlobals* globals ) -{ - CommonGlobals* cGlobals = &globals->cGlobals; - XP_Bool success = gtkNewGameDialog( globals, cGlobals->gi, - &cGlobals->selfAddr, - XP_TRUE, XP_FALSE ); - LOG_RETURNF( "%s", boolToStr(success) ); - return success; -} - #endif /* PLATFORM_GTK */ diff --git a/xwords4/linux/gtkboard.h b/xwords4/linux/gtkboard.h index 1dcd67b1d..03765f2ad 100644 --- a/xwords4/linux/gtkboard.h +++ b/xwords4/linux/gtkboard.h @@ -175,7 +175,6 @@ typedef struct GtkGameGlobals { void initBoardGlobalsGtk( GtkGameGlobals* globals, LaunchParams* params, const CurGameInfo* gi ); void freeGlobals( GtkGameGlobals* globals ); -XP_Bool makeNewGame( GtkGameGlobals* globals ); XP_Bool loadGameNoDraw( GtkGameGlobals* globals, LaunchParams* params, sqlite3_int64 rowid ); void destroy_board_window( GtkWidget* widget, GtkGameGlobals* globals ); diff --git a/xwords4/linux/gtkmain.c b/xwords4/linux/gtkmain.c index d1b899cd5..6be7656c8 100644 --- a/xwords4/linux/gtkmain.c +++ b/xwords4/linux/gtkmain.c @@ -34,6 +34,7 @@ #include "gtkask.h" #include "device.h" #include "gtkkpdlg.h" +#include "gtknewgame.h" static void onNewData( GtkAppGlobals* apg, sqlite3_int64 rowid, XP_Bool isNew ); @@ -311,13 +312,16 @@ handle_newgame_button( GtkWidget* XP_UNUSED(widget), void* closure ) GtkGameGlobals* globals = calloc( 1, sizeof(*globals) ); apg->cag.params->needsNewGame = XP_FALSE; initBoardGlobalsGtk( globals, apg->cag.params, NULL ); - if ( !makeNewGame( globals ) ) { - freeGlobals( globals ); - } else { + + if ( gtkNewGameDialog( globals, globals->cGlobals.gi, + &globals->cGlobals.selfAddr, + XP_TRUE, XP_FALSE ) ) { GtkWidget* gameWindow = globals->window; globals->cGlobals.rowid = -1; recordOpened( apg, globals ); gtk_widget_show( gameWindow ); + } else { + freeGlobals( globals ); } }