mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-15 08:47:56 +01:00
get rid of getMQTTIDsFor
This commit is contained in:
parent
968934277f
commit
1ea0c97115
7 changed files with 12 additions and 82 deletions
|
@ -35,7 +35,6 @@ interface UtilCtxt {
|
|||
fun clearTimer(why: Int) {}
|
||||
fun requestTime() {}
|
||||
fun remSelected() {}
|
||||
fun getMQTTIDsFor(relayID: Array<String?>?) {}
|
||||
fun timerSelected(inDuplicateMode: Boolean, canPause: Boolean) {}
|
||||
fun informWordsBlocked(nWords: Int, words: String?, dict: String?) {}
|
||||
fun getInviteeName(index: Int): String? = null
|
||||
|
|
|
@ -32,38 +32,5 @@ private val TAG = UtilCtxtImpl::class.java.getSimpleName()
|
|||
// private val TAG = BTInviteDelegate::class.java.getSimpleName()
|
||||
|
||||
open class UtilCtxtImpl(val m_context: Context) : UtilCtxt {
|
||||
override fun getMQTTIDsFor(relayIDs: Array<String?>?) {
|
||||
val rowid = getRowID()
|
||||
if (0L == rowid) {
|
||||
Log.d(TAG, "getMQTTIDsFor() no rowid available so dropping")
|
||||
} else {
|
||||
Thread(Runnable {
|
||||
val params = JSONObject()
|
||||
val array = JSONArray()
|
||||
try {
|
||||
JNIThread.getRetained(rowid).use { thread ->
|
||||
params.put("rids", array)
|
||||
for (rid: String? in relayIDs!!) {
|
||||
array.put(rid)
|
||||
}
|
||||
val conn: HttpURLConnection = NetUtils
|
||||
.makeHttpMQTTConn(m_context, "mids4rids")
|
||||
val resStr: String = NetUtils.runConn(conn, params, true)
|
||||
Log.d(TAG, "mids4rids => %s", resStr)
|
||||
val obj: JSONObject = JSONObject(resStr)
|
||||
val keys: Iterator<String> = obj.keys()
|
||||
while (keys.hasNext()) {
|
||||
val key: String = keys.next()
|
||||
val hid: Int = key.toInt()
|
||||
thread.handle(JNICmd.CMD_SETMQTTID, hid, obj.getString(key))
|
||||
}
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
Log.ex(TAG, ex)
|
||||
}
|
||||
}).start()
|
||||
}
|
||||
}
|
||||
|
||||
open fun getRowID(): Long = 0L // meant to be overridden!
|
||||
}
|
||||
|
|
|
@ -599,18 +599,6 @@ and_util_remSelected( XW_UtilCtxt* uc, XWEnv xwe )
|
|||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
||||
static void
|
||||
and_util_getMQTTIDsFor( XW_UtilCtxt* uc, XWEnv xwe, XP_U16 nRelayIDs,
|
||||
const XP_UCHAR* relayIDs[] )
|
||||
{
|
||||
UTIL_CBK_HEADER("getMQTTIDsFor", "([Ljava/lang/String;)V" );
|
||||
|
||||
jobjectArray jrids = makeStringArray( env, nRelayIDs, relayIDs );
|
||||
(*env)->CallVoidMethod( env, util->jutil, mid, jrids );
|
||||
deleteLocalRef( env, jrids );
|
||||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
||||
static void
|
||||
and_util_timerSelected( XW_UtilCtxt* uc, XWEnv xwe, XP_Bool inDuplicateMode, XP_Bool canPause )
|
||||
{
|
||||
|
@ -1052,7 +1040,6 @@ makeUtil( MPFORMAL JNIEnv* env,
|
|||
SET_PROC(showChat);
|
||||
#endif
|
||||
SET_PROC(remSelected);
|
||||
SET_PROC(getMQTTIDsFor);
|
||||
SET_PROC(timerSelected);
|
||||
SET_PROC(formatPauseHistory);
|
||||
|
||||
|
|
|
@ -733,6 +733,17 @@ addrFromStream( CommsAddrRec* addrP, XWStreamCtxt* stream )
|
|||
// ASSERT_ADDR_OK( addrP );
|
||||
}
|
||||
|
||||
static void
|
||||
getMQTTIDsFor( CommsCtxt* comms, XWEnv xwe, XP_U16 nRelayIDs,
|
||||
const XP_UCHAR* relayIDs[] )
|
||||
{
|
||||
XP_USE(comms);
|
||||
XP_USE(xwe);
|
||||
XP_USE(nRelayIDs);
|
||||
XP_USE(relayIDs);
|
||||
XP_ASSERT(0);
|
||||
}
|
||||
|
||||
/* Return TRUE if there are no addresses left that include relay */
|
||||
static XP_Bool
|
||||
removeRelayIf( CommsCtxt* comms, XWEnv xwe )
|
||||
|
@ -758,7 +769,7 @@ removeRelayIf( CommsCtxt* comms, XWEnv xwe )
|
|||
}
|
||||
}
|
||||
if ( 0 < nIds ) {
|
||||
util_getMQTTIDsFor( comms->util, xwe, nIds, ptrs );
|
||||
getMQTTIDsFor( comms, xwe, nIds, ptrs );
|
||||
}
|
||||
LOG_RETURNF( "%s", boolToStr(allRemoved) );
|
||||
return allRemoved;
|
||||
|
|
|
@ -146,13 +146,6 @@ typedef struct UtilVtable {
|
|||
|
||||
void (*m_util_remSelected)(XW_UtilCtxt* uc, XWEnv xwe);
|
||||
|
||||
/* Solving a time-limited problem of games that know how to connect via
|
||||
relay but not MQTT. Once this method succeeds and the platform
|
||||
implementation calls comms_addMQTTDevID() we never need it again for
|
||||
that game. */
|
||||
void (*m_util_getMQTTIDsFor)( XW_UtilCtxt* uc, XWEnv xwe, XP_U16 nRelayIDs,
|
||||
const XP_UCHAR* relayIDs[] );
|
||||
|
||||
void (*m_util_timerSelected)(XW_UtilCtxt* uc, XWEnv xwe, XP_Bool inDuplicateMode,
|
||||
XP_Bool canPause);
|
||||
|
||||
|
@ -287,9 +280,6 @@ struct XW_UtilCtxt {
|
|||
#define util_remSelected( uc,e ) \
|
||||
(uc)->vtable->m_util_remSelected((uc), (e))
|
||||
|
||||
#define util_getMQTTIDsFor( uc, e, cnt, rids ) \
|
||||
(uc)->vtable->m_util_getMQTTIDsFor((uc), (e), (cnt), (rids))
|
||||
|
||||
#define util_timerSelected( uc,e, dm, cp ) \
|
||||
(uc)->vtable->m_util_timerSelected((uc), (e), (dm), (cp))
|
||||
|
||||
|
|
|
@ -1145,17 +1145,6 @@ curses_util_remSelected( XW_UtilCtxt* uc, XWEnv XP_UNUSED(xwe) )
|
|||
free( text );
|
||||
}
|
||||
|
||||
static void
|
||||
curses_util_getMQTTIDsFor( XW_UtilCtxt* uc, XWEnv xwe, XP_U16 nRelayIDs,
|
||||
const XP_UCHAR* relayIDs[] )
|
||||
{
|
||||
XP_ASSERT(0); /* implement me */
|
||||
XP_USE( uc );
|
||||
XP_USE( xwe );
|
||||
XP_USE( nRelayIDs );
|
||||
XP_USE( relayIDs );
|
||||
}
|
||||
|
||||
static void
|
||||
curses_util_timerSelected( XW_UtilCtxt* XP_UNUSED(uc), XWEnv XP_UNUSED(xwe),
|
||||
XP_Bool XP_UNUSED_DBG(inDuplicateMode),
|
||||
|
@ -1249,7 +1238,6 @@ setupCursesUtilCallbacks( CursesBoardGlobals* bGlobals, XW_UtilCtxt* util )
|
|||
SET_PROC(altKeyDown); /* ?? */
|
||||
SET_PROC(notifyIllegalWords);
|
||||
SET_PROC(remSelected);
|
||||
SET_PROC(getMQTTIDsFor);
|
||||
SET_PROC(timerSelected);
|
||||
#ifndef XWFEATURE_MINIWIN
|
||||
SET_PROC(bonusSquareHeld);
|
||||
|
|
|
@ -1963,17 +1963,6 @@ gtk_util_timerSelected( XW_UtilCtxt* uc, XWEnv XP_UNUSED(xwe), XP_Bool inDuplica
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_util_getMQTTIDsFor( XW_UtilCtxt* uc, XWEnv xwe, XP_U16 nRelayIDs,
|
||||
const XP_UCHAR* relayIDs[] )
|
||||
{
|
||||
XP_ASSERT(0); /* implement me */
|
||||
XP_USE( uc );
|
||||
XP_USE( xwe );
|
||||
XP_USE( nRelayIDs );
|
||||
XP_USE( relayIDs );
|
||||
}
|
||||
|
||||
#ifdef XWFEATURE_CHAT
|
||||
static void
|
||||
gtk_util_showChat( XW_UtilCtxt* uc, XWEnv XP_UNUSED(xwe),
|
||||
|
@ -2277,7 +2266,6 @@ setupGtkUtilCallbacks( GtkGameGlobals* globals, XW_UtilCtxt* util )
|
|||
SET_PROC(engineProgressCallback);
|
||||
SET_PROC(notifyIllegalWords);
|
||||
SET_PROC(remSelected);
|
||||
SET_PROC(getMQTTIDsFor);
|
||||
SET_PROC(timerSelected);
|
||||
#ifdef XWFEATURE_CHAT
|
||||
SET_PROC(showChat);
|
||||
|
|
Loading…
Add table
Reference in a new issue