MCPcopy Create free account
hub / github.com/TrsstProject/trsst / doPost

Method doPost

src/main/java/com/trsst/Command.java:711–1031  ·  view source on GitHub ↗
(Client client, CommandLine commands,
            LinkedList<String> arguments, PrintStream out, InputStream in)

Source from the content-addressed store, hash-verified

709 }
710
711 public int doPost(Client client, CommandLine commands,
712 LinkedList<String> arguments, PrintStream out, InputStream in) {
713
714 String id = null;
715
716 if (arguments.size() == 0 && commands.getArgList().size() == 0) {
717 printPostUsage();
718 return 127; // "command not found"
719 }
720
721 if (arguments.size() > 0) {
722 id = arguments.removeFirst();
723 System.err.println("Obtaining keys for feed id: " + id);
724 } else {
725 System.err.println("Generating new feed id... ");
726 }
727
728 // read input text
729 String subject = commands.getOptionValue("s");
730 String verb = commands.getOptionValue("v");
731 String base = commands.getOptionValue("b");
732 String body = commands.getOptionValue("c");
733 String name = commands.getOptionValue("n");
734 String email = commands.getOptionValue("m");
735 String uri = commands.getOptionValue("uri");
736 String title = commands.getOptionValue("t");
737 String subtitle = commands.getOptionValue("subtitle");
738 String icon = commands.getOptionValue("i");
739 if (icon == null && commands.hasOption("i")) {
740 icon = "-";
741 }
742 String logo = commands.getOptionValue("l");
743 if (logo == null && commands.hasOption("l")) {
744 logo = "-";
745 }
746 String attach = commands.getOptionValue("a");
747 if (attach == null && commands.hasOption("a")) {
748 attach = "-";
749 }
750 String[] recipients = commands.getOptionValues("e");
751 String[] mentions = commands.getOptionValues("r");
752 String[] tags = commands.getOptionValues("g");
753 String url = commands.getOptionValue("u");
754 String vanity = commands.getOptionValue("vanity");
755
756 // obtain password
757 char[] password = null;
758 String pass = commands.getOptionValue("p");
759 if (pass != null) {
760 password = pass.toCharArray();
761 } else {
762 try {
763 Console console = System.console();
764 if (console != null) {
765 password = console.readPassword("Password: ");
766 } else {
767 log.info("No console detected for password input.");
768 }

Callers 1

doBeginMethod · 0.95

Calls 15

printPostUsageMethod · 0.95
toFeedIdMethod · 0.95
getClientRootMethod · 0.95
writeSigningKeyPairMethod · 0.95
readSigningKeyPairMethod · 0.95
readEncryptionKeyPairMethod · 0.95
isFeedIdMethod · 0.95
readFullyMethod · 0.95
setStatusMethod · 0.95

Tested by

no test coverage detected