mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
pass default hostname in from platform code rather than compiling it
into jni; in java pull it from preferences and pass into jni.
This commit is contained in:
parent
a32975362a
commit
786541e9ae
6 changed files with 20 additions and 9 deletions
|
@ -14,7 +14,6 @@ local_DEBUG = -DMEM_DEBUG -DDEBUG -DENABLE_LOGGING
|
|||
local_DEFINES += \
|
||||
$(local_DEBUG) \
|
||||
-DXWFEATURE_RELAY \
|
||||
-DRELAY_NAME_DEFAULT=\"eehouse.org\" \
|
||||
-DRELAY_PORT_DEFAULT=10999 \
|
||||
-DXWFEATURE_TURNCHANGENOTIFY \
|
||||
-DKEYBOARD_NAV \
|
||||
|
|
|
@ -227,11 +227,13 @@ Java_org_eehouse_android_xw4_jni_XwJNI_gi_1from_1stream
|
|||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_eehouse_android_xw4_jni_XwJNI_comms_1getInitialAddr
|
||||
( JNIEnv* env, jclass C, jobject jaddr )
|
||||
( JNIEnv* env, jclass C, jobject jaddr, jstring jname )
|
||||
{
|
||||
LOG_FUNC();
|
||||
CommsAddrRec addr;
|
||||
comms_getInitialAddr( &addr );
|
||||
|
||||
const char* chars = (*env)->GetStringUTFChars( env, jname, NULL );
|
||||
comms_getInitialAddr( &addr, chars );
|
||||
(*env)->ReleaseStringUTFChars( env, jname, chars );
|
||||
setJAddrRec( env, jaddr, &addr );
|
||||
}
|
||||
|
||||
|
|
|
@ -343,7 +343,8 @@ public class GameConfig extends Activity implements View.OnClickListener {
|
|||
if ( XwJNI.game_hasComms( gamePtr ) ) {
|
||||
XwJNI.comms_getAddr( gamePtr, m_carOrig );
|
||||
} else {
|
||||
XwJNI.comms_getInitialAddr( m_carOrig );
|
||||
String relayName = CommonPrefs.getDefaultRelayHost();
|
||||
XwJNI.comms_getInitialAddr( m_carOrig, relayName );
|
||||
}
|
||||
XwJNI.game_dispose( gamePtr );
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ public class XwJNI {
|
|||
// Stateless methods
|
||||
public static native byte[] gi_to_stream( CurGameInfo gi );
|
||||
public static native void gi_from_stream( CurGameInfo gi, byte[] stream );
|
||||
public static native void comms_getInitialAddr( CommsAddrRec addr );
|
||||
public static native void comms_getInitialAddr( CommsAddrRec addr,
|
||||
String relayHost );
|
||||
|
||||
// Game methods
|
||||
public static native int initJNI();
|
||||
|
|
|
@ -719,14 +719,18 @@ comms_setAddr( CommsCtxt* comms, const CommsAddrRec* addr )
|
|||
} /* comms_setAddr */
|
||||
|
||||
void
|
||||
comms_getInitialAddr( CommsAddrRec* addr )
|
||||
comms_getInitialAddr( CommsAddrRec* addr
|
||||
#ifdef XWFEATURE_RELAY
|
||||
, const XP_UCHAR* relayName
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if defined XWFEATURE_RELAY
|
||||
addr->conType = COMMS_CONN_RELAY; /* for temporary ease in debugging */
|
||||
addr->u.ip_relay.ipAddr = 0L; /* force 'em to set it */
|
||||
addr->u.ip_relay.port = RELAY_PORT_DEFAULT;
|
||||
{
|
||||
char* name = RELAY_NAME_DEFAULT;
|
||||
const char* name = relayName;
|
||||
char* room = RELAY_ROOM_DEFAULT;
|
||||
XP_MEMCPY( addr->u.ip_relay.hostName, name, XP_STRLEN(name)+1 );
|
||||
XP_MEMCPY( addr->u.ip_relay.invite, room, XP_STRLEN(room)+1 );
|
||||
|
|
|
@ -149,7 +149,11 @@ void comms_destroy( CommsCtxt* comms );
|
|||
void comms_setConnID( CommsCtxt* comms, XP_U32 connID );
|
||||
|
||||
/* "static" methods work when no comms present */
|
||||
void comms_getInitialAddr( CommsAddrRec* addr );
|
||||
void comms_getInitialAddr( CommsAddrRec* addr
|
||||
#ifdef XWFEATURE_RELAY
|
||||
, const XP_UCHAR* relayName
|
||||
#endif
|
||||
);
|
||||
XP_Bool comms_checkAddr( DeviceRole role, const CommsAddrRec* addr,
|
||||
XW_UtilCtxt* util );
|
||||
|
||||
|
|
Loading…
Reference in a new issue