support for receiving and displaying chat messages. Compiles but not tested.

This commit is contained in:
Eric House 2010-10-03 18:32:39 -07:00
parent d35bc7d748
commit 1e13e92deb
5 changed files with 23 additions and 0 deletions

View file

@ -15,6 +15,7 @@ local_DEFINES += \
$(local_DEBUG) \
-DXWFEATURE_RELAY \
-DXWFEATURE_TURNCHANGENOTIFY \
-DXWFEATURE_CHAT \
-DSHOW_PROGRESS \
-DKEY_SUPPORT \
-DXWFEATURE_CROSSHAIRS \

View file

@ -346,6 +346,15 @@ and_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi,
return result;
}
static void
and_util_showChat( XW_UtilCtxt* uc, const XP_UCHAR const* msg )
{
UTIL_CBK_HEADER("showChat", "(Ljava/lang/String;)V" );
jstring jmsg = (*env)->NewStringUTF( env, msg );
(*env)->CallVoidMethod( env, util->jutil, mid, jmsg );
(*env)->DeleteLocalRef( env, jmsg );
UTIL_CBK_TAIL();
}
static void
and_util_remSelected(XW_UtilCtxt* uc)
@ -445,6 +454,7 @@ makeUtil( MPFORMAL JNIEnv** envp, jobject jutil, CurGameInfo* gi,
SET_PROC(makeEmptyDict);
SET_PROC(getUserString);
SET_PROC(warnIllegalWord);
SET_PROC(showChat);
SET_PROC(remSelected);
SET_PROC(setIsServer);

View file

@ -386,4 +386,6 @@
<string name="no_name_found">No public rooms found. Try
refreshing or creating your own.</string>
<string name="chat_received">Message received</string>
</resources>

View file

@ -1152,4 +1152,12 @@ public class BoardActivity extends Activity implements UtilCtxt {
return accept;
}
public void showChat( String msg )
{
Utils.logf( "showChat(%s)", msg );
m_dlgBytes = msg;
m_dlgTitle = R.string.chat_received;
showDialog( DLG_OKONLY );
}
} // class BoardActivity

View file

@ -108,4 +108,6 @@ public interface UtilCtxt {
//void yOffsetChange( int maxOffset, int oldOffset, int newOffset );
boolean warnIllegalWord( String[] words, int turn, boolean turnLost );
void showChat( String msg );
}