Skip to content

Commit

Permalink
fixed room order in private chat
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalxl committed Mar 10, 2024
1 parent 9d60d1e commit cc048e3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
7 changes: 5 additions & 2 deletions lib/console_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ Future<void> channelMenuUI(Store node) async {
String menuInfo = """Public channel howto: To enter a channel, enter first few letters of its name or the channel identifier.
When inside a channel, the first column is the id of the given post. It can be used when you want to reply to a specific post.
To reply to a specific post, type '/reply <first few letters of id of post to reply to> <your message>.
The most latest updated channels are shown at bottom.
When in a channel, press 'x' to exit. """;
int option = showMenu([ 'Enter a channel', // 1
'Show all public channels', // 2
Expand Down Expand Up @@ -1043,6 +1044,7 @@ Future<void> encryptedChannelMenuUI(Store node) async {
String menuInfo = """Encrypted Channel howto: Enter a channel by typing the first few unique letters of its pubkey or full name.
Once in a room/channel: add new participants by typing '/add <their 64 byte hex public key>' and pressing enter,
To reply to a message, type '/reply <first few letters of id of post to reply to> <your message>,
The channels updated latest are shown at bottom.
Type '/help' to see more info. When in a channel, press 'x' and then enter to exit. """;

int option = showMenu([ 'Enter an encrypted channel', // 1
Expand Down Expand Up @@ -1216,8 +1218,9 @@ Future<void> PrivateMenuUI(Store node) async {
justShowedChannels = true;
}

String menuInfo = """Direct Message howto: To send a Direct Message to someone for the first time, enter their 64 byte hex pubkey.
To enter or continue a conversation seen in overview, enter the first few letters of the other person's name or of their pubkey""";
String menuInfo = """Direct Message howto: To send a Direct Message to someone for the first time, enter their 64 byte hex pubkey into menu option #1.
To enter or continue a conversation seen in overview, enter the first few letters of the other person's name or of their pubkey.
Latest conversations are shown at bottom.""";
int option = showMenu([
'Reply or Send a direct message',
'Show all direct rooms',
Expand Down
21 changes: 16 additions & 5 deletions lib/tree_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1797,10 +1797,8 @@ class Store {
channelsToPrint.sort(scrollableCompareTo);
int numChannelsActuallyPrinted = 0;


int startRoomIndex = 0, endRoomIndex = 0;


if( numRoomsOverview == channelsToPrint.length) {
startRoomIndex = 0;
endRoomIndex = channelsToPrint.length;
Expand All @@ -1814,7 +1812,6 @@ class Store {
}
}


print("\n\n");
printUnderlined("Channel Name id Num of Messages Latest Message ");
for(int j = startRoomIndex; j < endRoomIndex; j++) {
Expand Down Expand Up @@ -2002,7 +1999,6 @@ class Store {
return 0;
}


if( numNotificationRooms > numRoomsOverview) {
numNotificationRooms = numRoomsOverview;
}
Expand All @@ -2013,8 +2009,23 @@ class Store {

printUnderlined("From Pubkey Num of Messages Latest Message ");

int startRoomIndex = 0, endRoomIndex = 0;

if( numRoomsOverview == directRooms.length) {
startRoomIndex = 0;
endRoomIndex = directRooms.length;
} else {
if( numRoomsOverview < directRooms.length ) {
startRoomIndex = directRooms.length - numRoomsOverview;
endRoomIndex = directRooms.length;
} else {
startRoomIndex = 0;
endRoomIndex = directRooms.length;
}
}

int iNotification = 0; // notification counter
for( int j = 0; j < directRooms.length; j++) {
for( int j = startRoomIndex; j < endRoomIndex; j++) {
if( !roomSelector(directRooms[j]))
continue;

Expand Down
2 changes: 2 additions & 0 deletions scripts/send_request.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

source ./configfile.cfg


# ./send_request.sh '["REQ","name",{"ids":["b10180"]}]'
# ./send_request.sh '["REQ","nnn",{"limit":2,"ids":["d8aa6787834de19f0cb61b2aeef94886b2284f36f768bf8b5cc7533988346997"]}]'

for relay in ${nostr_relays[@]};
do
Expand Down

0 comments on commit cc048e3

Please sign in to comment.