Git Product home page Git Product logo

tt4j's Introduction

TT4J

Team Talk For Java.

Creating a client instance

// Server info
String hostName = "xxx.xxx.xxx.xxx";
int portNumber = 7077;

// User info
String username = "user";
String password = "passwd";
String nick = "Java Admin";

TeamTalkClient client = new TeamTalkClient(
        new TeamTalkConnection(hostName, portNumber));

Register for sample events

// Register for channel updates
client.registerForAddChannel( packet ->  System.out.println("Event: " + packet));

// Register for errors
client.registerForErrorPacket(error -> System.out.println("Error: " + error));

// Register for logged user
client.registerForAddUserPacker( packet -> System.out.println("User: " + packet));

Connecting and logging

System.out.println("Connecting: " + client.connect());
System.out.println("Logging: " + client.login(nick, username, password));

Creating a new user

// How to create new user
client.addUser(
    new UserData("New java user 3", "123", UserType.DEFAULT, 
                 "new user", "1",  UserRight.getDefaultRights()));

Sending message to a channel

This can be used to send agenda updates from channel operator

// How to send message: it can be used to update meeting agenda
client.sendMessage(1, "It's a Me: a message!");

Displaying all accounts

// How to display all accounts
System.out.println("List accounts: ");
client.getAllUsersFromServer().forEach(System.out::println);

Displaying all channels

// How to display all channels
System.out.println("List channels: ");
client.getChannels().forEach(System.out::println);

Displaying all accounts

// How to display logged account
System.out.println("List logged users: ");
client.getLoggedUsers().forEach(System.out::println);

Moving all users to another channel

// Move all users to one channel
System.out.println("Move users...");
List<AddUserPacket> list = new ArrayList(client.getLoggedUsers());
list.forEach(user -> System.out.println(client.moveUser(user.getUserid(), 2)));

// Check if users have been moved
System.out.println("List logged users: ");
client.getLoggedUsers().forEach(System.out::println);

Creating a new channel

// Hot to make new channel
client.makeChannel(
    new Channel(1, true, "api channel 5", "123", "Java docs",
	AudioCodec.SpeexVBR));

tt4j's People

Contributors

1o0ko avatar

Watchers

James Cloos avatar  avatar  avatar

tt4j's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.