Skip to content
PunKeel edited this page Apr 6, 2016 · 13 revisions

Basic Usage

Logging into a regular account

Skype skype = new SkypeBuilder(username, password).withAllResources().withExceptionHandler((errorSource, throwable, willShutdown) -> {
  System.out.println("Error: " + errorSource + " " + throwable + " " + willShutdown);
}).build();
skype.login();
skype.subscribe();
// Do things
skype.logout();

Logging into a guest account

Skype skype = new SkypeBuilder(username).withAllResources().withChat("19:chatid@thread.skype").withExceptionHandler((errorSource, throwable, willShutdown) -> {
  System.out.println("Error: " + errorSource + " " + throwable + " " + willShutdown);
});.build();
skype.login();
skype.subscribe();
// Do things
skype.logout();

Setting visibility

Skype skype = ...;
skype.setVisibility(Visibility.ONLINE);

Loading a Chat

Chats are not loaded until they are needed (eg a message was sent in the chat). If you want to use a chat then you may need to load it first.

Skype skype = ...;
Chat chat = skype.loadChat("19:chatid@thread.skype");

If you are lazy, you can always use Skype#getOrLoadChat

Skype skype = ...;
Chat chat = skype.getOrLoadChat("19:chatid@thread.skype");

Sending a message

Messages can contain 'plain' text if the text has no formatting, or 'rich' text if it does. If you want to specify your own HTML you can use Text.raw(String)

Chat chat = ...;
chat.sendMessage(Message.create().with(Text.plain("Hello. This will be ")).with(Text.rich("bold").withBold()));

Events

The event queue will begin once you have subscribed to Skype. You may listen to events by registering a Listener.

Skype skype = ...;
skype.getEventDispatcher().registerListener(new Listener() {

});

Advanced Usage

For more advanced features, feel free to explore around. You'll find lots of cool things you can do with Chats, Contacts, and more.

You may find the JavaDocs helpful