messenger-android

Android graphical user interfaces for GNUnet Messenger
Log | Files | Refs | README | LICENSE

commit 3f8d6cb9fd12032ec90e7bfe2bf3c6735dd2e947
parent af0e36f779f97a0466e7a856475571d55bac9ea9
Author: t3sserakt <t3ss@posteo.de>
Date:   Mon, 30 Mar 2026 11:10:53 +0200

account creating for Lobby, and link creation for lobby

Diffstat:
MGNUnetMessenger/app/src/androidTest/java/org/gnunet/gnunetmessenger/ipc/GnunetChatLobbyTest.kt | 140+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MGNUnetMessenger/app/src/main/aidl/org/gnunet/gnunetmessenger/ipc/IGnunetChat.aidl | 3++-
2 files changed, 142 insertions(+), 1 deletion(-)

diff --git a/GNUnetMessenger/app/src/androidTest/java/org/gnunet/gnunetmessenger/ipc/GnunetChatLobbyTest.kt b/GNUnetMessenger/app/src/androidTest/java/org/gnunet/gnunetmessenger/ipc/GnunetChatLobbyTest.kt @@ -81,15 +81,155 @@ class GnunetChatLobbyTest { println("STEP 1: Create Account 1 (Lobby Creator)") + val account1Name = "LobbyCreatorAccount" + println("Creating account with name: $account1Name") + + try { + val createAccount1Result = gnunetChat.createAccount(handle, account1Name) + if (createAccount1Result == GnunetReturnValue.OK) { + println(" Account 1 created successfully") + } else { + println(" Account 1 creation failed with code: $createAccount1Result") + } + } catch (e: Exception) { + println(" Exception creating Account 1: ${e.message}") + println(" This may indicate the remote service is not responding") + } println("STEP 2: Create Lobby with Account 1") + var lobbyUri = "" + var lobbyCreateSuccess = false + var lobbyCreateError: String? = null + + try { + println("Calling lobbyOpen...") + gnunetChat.lobbyOpen(handle) { uri -> + lobbyUri = uri + lobbyCreateSuccess = true + println(" Lobby creation callback received") + println(" Lobby URI: $uri") + } + + // Wait for lobby URI to be received + var lobbyWaitAttempts = 0 + val maxLobbyWaitAttempts = 50 // 5 seconds with 100ms delay + + withContext(Dispatchers.Default.limitedParallelism(1)) { + while (lobbyUri.isEmpty() && lobbyWaitAttempts < maxLobbyWaitAttempts) { + delay(100) + lobbyWaitAttempts++ + } + } + + if (lobbyUri.isNotEmpty()) { + println(" Lobby URI received: ${lobbyUri.take(60)}...") + println(" Full URI length: ${lobbyUri.length} characters") + } else { + println(" Timeout waiting for lobby URI") + lobbyCreateError = "Timeout after ${maxLobbyWaitAttempts * 100}ms" + } + + } catch (e: Exception) { + lobbyCreateError = e.message + println(" Exception during lobby creation: ${e.message}") + } + + println("STEP 3: Create Account 2 (Lobby Joiner)") + val account2Name = "LobbyJoinerAccount" + println("Creating account with name: $account2Name") + + try { + val createAccount2Result = gnunetChat.createAccount(handle, account2Name) + if (createAccount2Result == GnunetReturnValue.OK) { + println(" Account 2 created successfully") + } else { + println(" Account 2 creation failed with code: $createAccount2Result") + } + } catch (e: Exception) { + println(" Exception creating Account 2: ${e.message}") + } + + + println("STEP 4: Attempt to Join Lobby with Account 2") + println("IMPORTANT: Lobby joining is currently NOT functional") + println("This step will document what happens when we attempt to join") + + var lobbyJoinAttempted = false + var lobbyJoinError: String? = null + var lobbyJoinCompleted = false + + if (lobbyUri.isNotEmpty()) { + try { + println("Calling lobbyJoin with URI...") + gnunetChat.lobbyJoin(handle, lobbyUri) + lobbyJoinAttempted = true + println(" lobbyJoin method called without immediate crash") + + // Wait + println("Waiting 2 seconds for lobby join to process...") + delay(2000) + + println(" Lobby join call completed") + println(" Result: No visible effect observed") + println(" Expected - lobby joining functionality is not yet implemented") + + lobbyJoinCompleted = true + + } catch (e: Exception) { + lobbyJoinError = e.message + println(" Exception during lobby join: ${e.message}") + println(" This might be expected if the feature isn't implemented") + } + } else { + println(" Skipping lobby join attempt - no lobby URI available") + println(" (Lobby creation did not succeed)") + } + + + + + + // TEST SUMMARY + + + println("TEST SUMMARY: Two-Account Lobby Creation and Join") + println("\nAccount 1 ($account1Name):") + println(" - Creation: ${if (account1Name.isNotEmpty()) "Attempted" else "Skipped"}") + + println("\nLobby Creation:") + println(" - Attempted: YES") + println(" - Success: ${if (lobbyCreateSuccess) "YES" else "NO"}") + println(" - Error: ${lobbyCreateError ?: "None"}") + println(" - URI received: ${if (lobbyUri.isNotEmpty()) "YES" else "NO"}") + if (lobbyUri.isNotEmpty()) { + println(" - URI: ${lobbyUri.take(50)}...") + } + + println("\nAccount 2 ($account2Name):") + println(" - Creation: ${if (account2Name.isNotEmpty()) "Attempted" else "Skipped"}") + + println("\nLobby Join Attempt:") + println(" - Attempted: ${if (lobbyJoinAttempted) "YES" else "NO"}") + println(" - Completed: ${if (lobbyJoinCompleted) "YES" else "NO"}") + println(" - Error: ${lobbyJoinError ?: "None"}") + + + println("CONCLUSION:") + println("\nThis test documents the current state of lobby functionality:") + println("1. Account creation can be attempted") + println("2. Lobby creation can be attempted and may generate a URI") + println("3. Lobby joining can be called without crashing") + println("4. However, the lobby join does NOT establish a connection") + println(" between the accounts (not implemented yet)") + println("\nThe test demonstrates that while the API calls can be made,") + println("the actual lobby joining functionality requires implementation.") } diff --git a/GNUnetMessenger/app/src/main/aidl/org/gnunet/gnunetmessenger/ipc/IGnunetChat.aidl b/GNUnetMessenger/app/src/main/aidl/org/gnunet/gnunetmessenger/ipc/IGnunetChat.aidl @@ -25,7 +25,8 @@ interface IGnunetChat { void disconnect(long handle); void stopChat(long handle); String getProfileName(long handle); - + void setProfileName(long handle, String name); + // Contact operations String getProfileKey(long handle); boolean isContactBlocked(in ChatContactDto contact);