mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-12-01 16:28:33 +01:00
added search by event id, along with search by word
This commit is contained in:
@@ -161,7 +161,7 @@ Future<void> otherMenuUi(Tree node, var contactList) async {
|
||||
int option = showMenu([ 'Show user profile', // 1
|
||||
'Display contact list', // 2
|
||||
'Follow new contact', // 3
|
||||
'Search word(s)', // 4
|
||||
'Search word(s) or event id', // 4
|
||||
'Search by client name', // 5
|
||||
'Change number of days printed', // 6
|
||||
'Applicatoin stats', // 7
|
||||
|
||||
@@ -541,7 +541,7 @@ Set<Event> readEventsFromFile(String filename) {
|
||||
events.add(e);
|
||||
}
|
||||
} on Exception catch(e) {
|
||||
print("cannot open file $gEventsFilename");
|
||||
//print("cannot open file $gEventsFilename");
|
||||
if( gDebug > 0) print("Could not open file. error = $e");
|
||||
}
|
||||
|
||||
|
||||
@@ -784,14 +784,14 @@ class Tree {
|
||||
|
||||
// returns true if the given words exists in it or its children
|
||||
bool hasWords(String word) {
|
||||
//if(gDebug > 0) print("In tree selector hasWords: this id = ${e.eventData.id} word = $word");
|
||||
if( e.eventData.content.length > 1000) {
|
||||
if( e.eventData.content.length > 2000) { // ignore if content is too large, takes lot of time
|
||||
return false;
|
||||
}
|
||||
|
||||
bool childMatches = false;
|
||||
for( int i = 0; i < children.length; i++ ) {
|
||||
// ignore too large comments
|
||||
if( children[i].e.eventData.content.length > 1000) {
|
||||
if( children[i].e.eventData.content.length > 2000) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -800,7 +800,7 @@ class Tree {
|
||||
}
|
||||
}
|
||||
|
||||
if( e.eventData.content.toLowerCase().contains(word)) {
|
||||
if( e.eventData.content.toLowerCase().contains(word) || e.eventData.id == word ) {
|
||||
e.eventData.isNotification = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user