Android Open Source - dcchat Main






From Project

Back to project page dcchat.

License

The source code is released under:

Apache License

If you think the Android project dcchat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.kaleidos.dcchat;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
/*from w  w  w  . j a v  a  2 s.c  o m*/
import interfaces.NotificationListener;

public class Main {
  TestingThread th = new TestingThread();

  private class TestingThread extends Thread {
    public NotificationListener nl = new NotificationListenerImp();
    public DCChat dcchat;

    public void run() {
      
      try {
        byte[] unencodedPid = new byte[24];
        new Random().nextBytes(unencodedPid);
        
        this.dcchat = new DCChat("superalex4", "dc.p2plibre.es", 2780, true, unencodedPid, nl);
        //this.dcchat = new DCChat("betatester2", "dc.ekparty.org", 2783, false, unencodedPid, nl);
        System.out.println("INIT" +  this.dcchat);        
        // this.dcchat = new DCChat("superalex", "dc.ekparty.org", 2783, false, unencodedPid, nl);
        this.dcchat.connect();
      } catch (NoSuchAlgorithmException | IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }

    public void sendBroadcastMessage(String text, boolean isMe) throws IOException {
      this.dcchat.sendBroadcastMessage(text, isMe);
    }
    
    public void sendDirectMessage(String userSid, String text) throws IOException {
      this.dcchat.sendDirectMessage(userSid, text);
    }

  }

  public static void main(String[] args) throws Exception {
    Main m = new Main();
    m.th.start();
    Thread.sleep(3000);
    System.out.println("***************************");
    m.th.sendBroadcastMessage("an", false);
    m.th.sendBroadcastMessage("", false);
    //m.th.sendDirectMessage("XN65", "hola Al");
//    m.th.sendDirectMessage(m.th.dcchat.getSsid(), "test");    
  }
}




Java Source Code List

interfaces.NotificationListener.java
net.kaleidos.dcchat.Base32.java
net.kaleidos.dcchat.ChatActivity.java
net.kaleidos.dcchat.DCChat.java
net.kaleidos.dcchat.Data.java
net.kaleidos.dcchat.Main.java
net.kaleidos.dcchat.Message.java
net.kaleidos.dcchat.NaiveTrustManager.java
net.kaleidos.dcchat.NaiveTrustProvider.java
net.kaleidos.dcchat.NotificationListenerImp.java
net.kaleidos.dcchat.ServersActivity.java
net.kaleidos.dcchat.async.DcChatAsyncTask.java
net.kaleidos.dcchat.async.SendMessageAsyncTask.java
net.kaleidos.dcchat.listener.DccNotificationListener.java
net.kaleidos.dcchat.listener.Messageable.java