diff --git a/xwords4/android/XWords4/jni/utilwrapper.c b/xwords4/android/XWords4/jni/utilwrapper.c index d9f6cd1c3..be8a093cb 100644 --- a/xwords4/android/XWords4/jni/utilwrapper.c +++ b/xwords4/android/XWords4/jni/utilwrapper.c @@ -501,12 +501,19 @@ and_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi, #ifdef XWFEATURE_CHAT static void -and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg ) +and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg, XP_S16 from ) { - UTIL_CBK_HEADER("showChat", "(Ljava/lang/String;)V" ); + UTIL_CBK_HEADER( "showChat", "(Ljava/lang/String;Ljava/lang/String;)V" ); + jstring jname = NULL; + if ( 0 <= from ) { + LocalPlayer* lp = &uc->gameInfo->players[from]; + XP_ASSERT( !lp->isLocal ); + jname = (*env)->NewStringUTF( env, lp->name ); + } + jstring jmsg = (*env)->NewStringUTF( env, msg ); - (*env)->CallVoidMethod( env, util->jutil, mid, jmsg ); - deleteLocalRef( env, jmsg ); + (*env)->CallVoidMethod( env, util->jutil, mid, jmsg, jname ); + deleteLocalRefs( env, jmsg, jname, DELETE_NO_REF ); UTIL_CBK_TAIL(); } #endif diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index 86ed0ee6f..a5e40d8c0 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -1872,13 +1872,13 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1endGame #ifdef XWFEATURE_CHAT JNIEXPORT void JNICALL -Java_org_eehouse_android_xw4_jni_XwJNI_server_1sendChat +Java_org_eehouse_android_xw4_jni_XwJNI_board_1sendChat ( JNIEnv* env, jclass C, jint gamePtr, jstring jmsg ) { XWJNI_START(); XP_ASSERT( !!state->game.server ); const char* msg = (*env)->GetStringUTFChars( env, jmsg, NULL ); - server_sendChat( state->game.server, msg ); + board_sendChat( state->game.board, msg ); (*env)->ReleaseStringUTFChars( env, jmsg, msg ); XWJNI_END(); } diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 1d2b77e27..ada5c43f7 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -1464,7 +1464,7 @@ down. --> Move in game %1$s Chat message in game %1$s - + %1$s: %2$s Evom ni emag %1$s Tahc egassem ni emag %1$s + %1$s: %2$s MOVE IN GAME %1$s CHAT MESSAGE IN GAME %1$s + %1$s: %2$s