Package tahrir.io.net.broadcasts.broadcastMessages

Examples of tahrir.io.net.broadcasts.broadcastMessages.SignedBroadcastMessage


                }
                else{
                    String message = newPostPane.getText();
                    //TODO: get the language from config or settings page.
                    ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext(message, "en", node.mbClasses.identityStore, System.currentTimeMillis());
                    SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, node.getConfig().currentUserIdentity);
                    final BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
                    node.mbClasses.incomingMbHandler.handleInsertion(broadcastMessage);
                    newPostPane.setText("");
                }
            }
View Full Code Here


     */
    public static BroadcastMessage getBroadcastMessage(TrNode node1) {
            UserIdentity randomUser = new UserIdentity("Random User", TrCrypto.createRsaKeyPair().a, Optional.of(TrCrypto.createRsaKeyPair().b));
            node1.mbClasses.identityStore.addIdentity(randomUser);
      ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Hi @User3, How are you?", "en", node1.mbClasses.identityStore, System.currentTimeMillis());
            SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, randomUser);
            BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
          return broadcastMessage;
    }
View Full Code Here

    /**
     * Get a microblog from a user that mentions another user twice.
     */
    public static BroadcastMessage getBroadcastMessage(UserIdentity from, UserIdentity mention, TrNode node) {
            ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Hi @"+mention.getNick()+", this is a sample with mention", "en", node.mbClasses.identityStore, System.currentTimeMillis());
            SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, from);
            BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
            return broadcastMessage;
    }
View Full Code Here

    /**
     * Get broadcastMessage from a user which is just text, no mentions.
     */
    public static BroadcastMessage getBroadcastMessageFrom(TrNode node) {
            ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Some post from a user.", "en", node.mbClasses.identityStore, System.currentTimeMillis());
            SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, node.getConfig().currentUserIdentity);
            BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
            return broadcastMessage;

    }
View Full Code Here

    }

        public static BroadcastMessage getBroadcastMessageFrom(TrNode node, UserIdentity identity) {
            ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("From a given node, given user.", "en", node.mbClasses.identityStore, System.currentTimeMillis());
            SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, identity);
            BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
            return broadcastMessage;

        }
View Full Code Here

            pi.capabilities.receivesMessageBroadcasts = true;
        }
        sendingNode.getConfig().currentUserIdentity = new UserIdentity("user1", TrCrypto.createRsaKeyPair().a, Optional.of(TrCrypto.createRsaKeyPair().b));
        String langCode = "en";
        final ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("Hello world", langCode, sendingNode.mbClasses.identityStore, System.currentTimeMillis());
        final SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, sendingNode.getConfig().currentUserIdentity);
        final BroadcastMessage broadcastMessage = new BroadcastMessage(signedBroadcastMessage);
        sendingNode.mbClasses.mbsForBroadcast.insert(broadcastMessage);

        // stop the receiver from broadcasting
        receivingNode.mbClasses.mbScheduler.disable();
View Full Code Here

            pi.capabilities.receivesMessageBroadcasts = true;
        }

        sendingNode.getConfig().currentUserIdentity = new UserIdentity("user1", TrCrypto.createRsaKeyPair().a, Optional.of(TrCrypto.createRsaKeyPair().b));
        final ParsedBroadcastMessage parsedBroadcastMessage = ParsedBroadcastMessage.createFromPlaintext("You SHOULD have this microblog!", "en", sendingNode.mbClasses.identityStore, System.currentTimeMillis());
        final SignedBroadcastMessage signedBroadcastMessage = new SignedBroadcastMessage(parsedBroadcastMessage, sendingNode.getConfig().currentUserIdentity);
        final BroadcastMessage broadcastMessage1 = new BroadcastMessage(signedBroadcastMessage);

        final ParsedBroadcastMessage parsedBroadcastMessage1 = ParsedBroadcastMessage.createFromPlaintext("You should NOT have this microblog!", "en", sendingNode.mbClasses.identityStore, System.currentTimeMillis());
        final SignedBroadcastMessage signedBroadcastMessage1 = new SignedBroadcastMessage(parsedBroadcastMessage1, sendingNode.getConfig().currentUserIdentity);
        final BroadcastMessage broadcastMessage2 = new BroadcastMessage(signedBroadcastMessage1);

        sendingNode.mbClasses.mbsForBroadcast.insert(broadcastMessage1);
        sendingNode.mbClasses.mbsForBroadcast.insert(broadcastMessage2);
View Full Code Here

TOP

Related Classes of tahrir.io.net.broadcasts.broadcastMessages.SignedBroadcastMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.