Add help texts and update README

This commit is contained in:
vanitasvitae 2017-08-15 17:53:50 +02:00
parent fcd0a7ce8c
commit 49c25c97d5
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 24 additions and 2 deletions

8
README.md Normal file
View file

@ -0,0 +1,8 @@
# GSoC 2017 - Jingle File Transfer Demo App
File synchronisation via XMPP.
xmpp_sync has two modes: Master and Slave mode. A client started in master mode will send files
out, while clients in slave mode will receive files.
In order to use the program, you need at least two XMPP accounts (which might be on different
servers). I recommend using a server, which supports Socks5 proxies.

View file

@ -11,12 +11,10 @@ import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException; import java.security.NoSuchProviderException;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import javax.crypto.BadPaddingException; import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException; import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException; import javax.crypto.NoSuchPaddingException;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;

View file

@ -46,11 +46,13 @@ public class Main {
Option debug = Option.builder("d").longOpt("debug").desc("Start in debug mode").build(); Option debug = Option.builder("d").longOpt("debug").desc("Start in debug mode").build();
Option directory = Option.builder("D").longOpt("directory").hasArg().required().desc("Directory to sync").build(); Option directory = Option.builder("D").longOpt("directory").hasArg().required().desc("Directory to sync").build();
Option master = Option.builder("m").longOpt("master").desc("Start in master mode").build(); Option master = Option.builder("m").longOpt("master").desc("Start in master mode").build();
Option help = Option.builder("h").longOpt("help").desc("Display this help text").build();
options.addOption(username); options.addOption(username);
options.addOption(password); options.addOption(password);
options.addOption(debug); options.addOption(debug);
options.addOption(directory); options.addOption(directory);
options.addOption(master); options.addOption(master);
options.addOption(help);
return options; return options;
} }
@ -82,6 +84,11 @@ public class Main {
return; return;
} }
if (cmd.hasOption('h')) {
formatter.printHelp("client", options, true);
return;
}
String username = cmd.getOptionValue('u'); String username = cmd.getOptionValue('u');
String password = cmd.getOptionValue('p'); String password = cmd.getOptionValue('p');
String dir = cmd.getOptionValue('D'); String dir = cmd.getOptionValue('D');
@ -212,6 +219,15 @@ public class Main {
} }
break; break;
case "/help":
System.out.println("Available commands: \n" +
"/add <user@server.tld>: Add user to roster, or display current roster.\n" +
"/sync <user@server.tld>: Add a users device to synced devices or display currently synced devices.\n" +
"/trust user@sever.tld: Trust a users OMEMO identities.\n" +
"/help: Show this help text.\n" +
"/quit: Quit the application.");
break;
case "/quit": case "/quit":
((AbstractXMPPConnection) client.connection).disconnect(new Presence(Presence.Type.unavailable, "Shutdown", 100, Presence.Mode.away)); ((AbstractXMPPConnection) client.connection).disconnect(new Presence(Presence.Type.unavailable, "Shutdown", 100, Presence.Mode.away));
break outerloop; break outerloop;