|
1 | | -package net.sharksystem.cmdline.sharkmessengerUI; |
| 1 | +package net.sharksystem.messenger.cli; |
2 | 2 |
|
3 | 3 | import java.io.BufferedReader; |
4 | 4 | import java.io.IOException; |
5 | 5 | import java.io.InputStreamReader; |
6 | 6 | import java.io.PrintStream; |
7 | 7 |
|
8 | 8 | import net.sharksystem.SharkException; |
9 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.basics.*; |
10 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.encounter.UICommandShowEncounter; |
11 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.messenger.*; |
12 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.hubaccess.*; |
13 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.hubmanagement.UICommandListHub; |
14 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.hubmanagement.UICommandStartHub; |
15 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.hubmanagement.UICommandStopHub; |
16 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.persons.UICommandListPersons; |
17 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.testing.UICommandSaveLog; |
18 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.testing.UICommandShowLog; |
19 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.pki.*; |
20 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.tcp.UICommandCloseTCP; |
21 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.tcp.UICommandConnectTCP; |
22 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.tcp.UICommandOpenTCP; |
23 | | -import net.sharksystem.cmdline.sharkmessengerUI.commands.tcp.UICommandShowOpenTCPPorts; |
| 9 | +import net.sharksystem.messenger.cli.commands.basics.*; |
| 10 | +import net.sharksystem.messenger.cli.commands.encounter.UICommandShowEncounter; |
| 11 | +import net.sharksystem.messenger.cli.commands.hubmanagement.UICommandListHub; |
| 12 | +import net.sharksystem.messenger.cli.commands.hubmanagement.UICommandStartHub; |
| 13 | +import net.sharksystem.messenger.cli.commands.hubmanagement.UICommandStopHub; |
| 14 | +import net.sharksystem.messenger.cli.commands.messenger.*; |
| 15 | +import net.sharksystem.messenger.cli.commands.persons.UICommandListPersons; |
| 16 | +import net.sharksystem.messenger.cli.commands.pki.*; |
| 17 | +import net.sharksystem.messenger.cli.commands.testing.UICommandSaveLog; |
| 18 | +import net.sharksystem.messenger.cli.commands.testing.UICommandShowLog; |
| 19 | +import net.sharksystem.messenger.cli.commands.tcp.UICommandCloseTCP; |
| 20 | +import net.sharksystem.messenger.cli.commands.tcp.UICommandConnectTCP; |
| 21 | +import net.sharksystem.messenger.cli.commands.tcp.UICommandOpenTCP; |
| 22 | +import net.sharksystem.messenger.cli.commands.tcp.UICommandShowOpenTCPPorts; |
24 | 23 | import net.sharksystem.fs.ExtraData; |
25 | 24 | import net.sharksystem.fs.ExtraDataFS; |
26 | 25 | import net.sharksystem.hub.peerside.ASAPHubManager; |
| 26 | +import net.sharksystem.messenger.cli.commands.hubaccess.*; |
27 | 27 | import net.sharksystem.utils.Log; |
28 | 28 |
|
29 | 29 | /** |
30 | 30 | * This class is the entry point for the application. |
31 | 31 | * Only commands a user should be able to execute are used below. |
| 32 | + * |
| 33 | + * (I have no idea if that class serves any reason any longer. thsc, Aug'24) |
32 | 34 | */ |
33 | 35 | public class ProductionUI { |
34 | 36 | public static final String SETTINGSFILENAME = ".sharkMessengerSessionSettings"; |
@@ -64,19 +66,21 @@ public static void main(String[] args) throws SharkException, IOException { |
64 | 66 | break; |
65 | 67 | default: |
66 | 68 | System.out.println("possible arguments: "); |
67 | | - System.out.println("\n -n peerName"); |
| 69 | + System.out.println("\n peerName syncWithHubInSeconds"); |
68 | 70 | System.exit(1); |
69 | 71 | break; |
70 | 72 |
|
71 | 73 | } |
72 | 74 |
|
73 | 75 | System.out.println("Welcome to SharkMessenger version 0.1"); |
74 | 76 | if(peerName == null) { |
| 77 | + try { |
75 | 78 | byte[] storedPeerNameBytes = sessionSettings.getExtra(PEERNAME_KEY); |
76 | | - if(storedPeerNameBytes != null) { |
77 | 79 | // we have a peer name |
78 | 80 | peerName = new String(storedPeerNameBytes); |
79 | 81 | isBack = true; |
| 82 | + } catch(SharkException se) { |
| 83 | + // nothing from a previous session |
80 | 84 | } |
81 | 85 | } |
82 | 86 |
|
@@ -132,7 +136,7 @@ public static void main(String[] args) throws SharkException, IOException { |
132 | 136 | smUI.addCommand(new UICommandShowOpenTCPPorts(sharkMessengerApp, smUI, "showOpenTCPPorts", false)); |
133 | 137 |
|
134 | 138 | // encounter control |
135 | | - smUI.addCommand(new UICommandShowEncounter(sharkMessengerApp, smUI, "showEncounter", false)); |
| 139 | + smUI.addCommand(new UICommandShowEncounter(sharkMessengerApp, smUI, "lsEncounter", false)); |
136 | 140 |
|
137 | 141 | // PKI |
138 | 142 | smUI.addCommand(new UICommandListPersons(sharkMessengerApp, smUI, "lsPersons", true)); |
@@ -165,7 +169,7 @@ public static void main(String[] args) throws SharkException, IOException { |
165 | 169 | smUI.addCommand(new UICommandListHub(sharkMessengerApp, smUI, "lsHubs", true)); |
166 | 170 |
|
167 | 171 |
|
168 | | - smUI.printUsage(); |
| 172 | + System.out.println("press ? or anything else to get a command list"); |
169 | 173 | smUI.runCommandLoop(); |
170 | 174 | } |
171 | 175 | } |
0 commit comments