From c692f13bd388058d0f0159bf812757d4edc0c1c1 Mon Sep 17 00:00:00 2001 From: Vishal <64505169+vishalxl@users.noreply.github.com> Date: Wed, 30 Nov 2022 11:21:11 +0530 Subject: [PATCH] increased ininital delay and improved print ui for enc groups --- bin/nostr_console.dart | 5 +---- lib/console_ui.dart | 28 ++++++++++++++++------------ pubspec.yaml | 1 + 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/bin/nostr_console.dart b/bin/nostr_console.dart index bcb4192..37ae99d 100644 --- a/bin/nostr_console.dart +++ b/bin/nostr_console.dart @@ -286,7 +286,7 @@ Future main(List arguments) async { limitSelfEvents = 5; limitMetaInfoEvents = 3; limitFollowPosts = 3; - gDefaultNumWaitSeconds = gDefaultNumWaitSeconds ~/16; + gDefaultNumWaitSeconds = gDefaultNumWaitSeconds ~/5 ; } // get event for user @@ -300,10 +300,7 @@ Future main(List arguments) async { // get group and meta info events getKindEvents([0, 3, 40, 41], gListRelayUrls1, 3 * limitPerSubscription, getSecondsDaysAgo(limitMetaInfoEvents)); // get all type 3 etc - //getKindEvents([140, 141], gListRelayUrls1, 3 * limitPerSubscription, getSecondsDaysAgo(1)); // get all type 3 etc - getKindEvents([42], gListRelayUrls1, limitPerSubscription * 3, getSecondsDaysAgo( limitFollowPosts)); // get all type 3 etc - //getKindEvents([142], gListRelayUrls1, limitPerSubscription * 3, getSecondsDaysAgo( 1)); // get all type 3 etc getKindEvents([gSecretMessageKind], gListRelayUrls1, limitPerSubscription * 3, getSecondsDaysAgo( 3)); // get all type 3 etc diff --git a/lib/console_ui.dart b/lib/console_ui.dart index 2845842..a384d65 100644 --- a/lib/console_ui.dart +++ b/lib/console_ui.dart @@ -447,6 +447,13 @@ int showMenu(List menuOptions, String menuName, [String menuInfo = ""]) } void printPubkeys(Set pubkey) { + print("${myPadRight("pubkey",64)} ${myPadRight("name", 20)} ${myPadRight("about", 40)} ${myPadRight("Nip05", 30)}"); + pubkey.forEach( (x) => print("$x ${myPadRight(getAuthorName(x), 20)} ${myPadRight(gKindONames[x]?.about??"", 40)} ${myPadRight(gKindONames[x]?.nip05Id??"No", 30)}")); + print(""); +} + +void printPubkeyResult(Set pubkey) { + if( pubkey.length == 0) { print("There is no pubkey for that given name."); return; @@ -457,9 +464,7 @@ void printPubkeys(Set pubkey) { print("There are ${pubkey.length} public keys for the given name, which are: "); } } - print("${myPadRight("pubkey",64)} ${myPadRight("name", 20)} ${myPadRight("about", 40)} ${myPadRight("Nip05", 30)}"); - pubkey.forEach( (x) => print("$x ${myPadRight(getAuthorName(x), 20)} ${myPadRight(gKindONames[x]?.about??"", 40)} ${myPadRight(gKindONames[x]?.nip05Id??"No", 30)}")); - print(""); + printPubkeys(pubkey); } Future otherOptionsMenuUi(Store node) async { @@ -972,22 +977,21 @@ Future encryptedChannelMenuUI(Store node) async { Set participantPubkeys = channel.participants; print("Sending the shared secret again to: $participantPubkeys"); await sendInvitesForEncryptedChannel(node, fullChannelId, participantPubkeys); - continue; // get to next while loop to avoid cleascreen + continue; // get to next while loop to avoid clearscreen case '/members': + clearScreen(); print("\nMembers names and pubkeys:\n"); - for( String pubkey in channel.participants) { - stdout.write("${getAuthorName(pubkey)} - $pubkey , "); - } + printPubkeys(channel.participants ); print(""); - continue; // get to next while loop to avoid cleascreen + continue; // get to next while loop to avoid clearscreen case '/help': - print("""\n /members - print names/pubkeys of all members + print("""\n /members - print names/pubkeys of all members /add ... - Space-separated pubkeys are taken as new user pubkeys, and they're added to group (admin only). /reinvite all - send secret password to all again (admin only) """); - continue; // get to next while loop to avoid cleascreen + continue; // get to next while loop to avoid clearscreen default: // send message to the given room @@ -1280,7 +1284,7 @@ Future socialMenuUi(Store node) async { if( userName != "") { Set pubkey = getPublicKeyFromName(userName); - printPubkeys(pubkey); + printPubkeyResult(pubkey); if( pubkey.length > 1) { if( pubkey.length > 1) { @@ -1353,7 +1357,7 @@ Future socialMenuUi(Store node) async { if( userName != "") { Set pubkey = getPublicKeyFromName(userName); - printPubkeys(pubkey); + printPubkeyResult(pubkey); if( pubkey.length > 1) { if( pubkey.length > 1) { diff --git a/pubspec.yaml b/pubspec.yaml index 3edaf19..ae1d3b5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,6 +11,7 @@ homepage: https://github.com/vishalxl/nostr_console # /help in enc groups # still fixing notifications # reset notifications for dm +# increased ininital delay and improved print ui for enc groups environment: