GithubHelp home page GithubHelp logo

skype4j's Introduction

Skype4J

Build Status

This is a Skype API for Java. It does not support P2P chats. You can tell whether you're in a P2P chat or not based on the output of the /help command. If it contains commands such as /kickban, you're in a P2P chat and should switch to cloud chats immediately (try using /fork).

Here is an example of using this API to log into your Skype account.

Skype skype = new SkypeBuilder(username, password).withAllResources().build();
skype.login();
skype.getEventDispatcher().registerListener(new Listener() {
  @EventHandler
  public void onMessage(MessageReceivedEvent e) {
    System.out.println("Got message: " + e.getMessage().getContent());
  }
});
skype.subscribe();
// Do stuff
skype.logout();

If you want to use a guest account, you can do that too

Skype skype = new SkypeBuilder("Skype4JGuest").withChat("19:[email protected]").withAllResources().build();
skype.login();
skype.getEventDispatcher().registerListener(new Listener() {
  @EventHandler
  public void onMessage(MessageReceivedEvent e) {
    System.out.println("Got message: " + e.getMessage().getContent());
  }
});
skype.subscribe();
// Do stuff
skype.logout();

For more examples, please consult the wiki

Maven

Maven is used for dependency management and deployment. To use this API, simply add the following to your pom.xml

<dependency>
  <groupId>com.samczsun</groupId>
  <artifactId>skype4j</artifactId>
  <version>0.1.5</version>
</dependency>

You can also download the latest build of this project from Jenkins
If you want to use Maven with the latest build and don't want to manually install, JitPack may do the trick.

JavaDocs

JavaDocs can be found here

Licensing

This project is licensed under the Apache 2.0 license

Contributing

If you want to help out, thanks a lot! However, there are a few legalities to work out first.

Any contributions you wish to make must be accompanied by a Contributer License Agreement ("CLA"). This simply gives myself, or whoever is maintaining the project, the right to redistribute your contributions.

The CLA can be found in the root directory of the project, in the file called "CLA". Please read it carefully.

You only need to submit your CLA once, so if you've already signed a CLA there's no need to do it again.

Acknowledgements

YourKit

YourKit supports open source projects with its full-featured Java Profiler.

YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.

skype4j's People

Contributors

camdenorrb avatar darkseraphim avatar ducc avatar formatq avatar pangeacake avatar samczsun avatar vemacs avatar williamburns avatar yar229 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skype4j's Issues

Skype.setVisibility errors

While updating visibility (400 Bad Request) with skype.setVisibility(Visibility.ONLINE); right after skype.login()

Error when trying to load a chat that has a join.skype.com link enabled

trying to loadChat() the identity gives this stack trace:

SEVERE: Error while handling event
java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.samczsun.skype4j.internal.RegisteredListener.handleEvent(RegisteredListener.java:37)
    at com.samczsun.skype4j.internal.SkypeEventDispatcher.callEvent(SkypeEventDispatcher.java:67)
    at com.samczsun.skype4j.internal.SkypeEventDispatcher.callEvent(SkypeEventDispatcher.java:59)
    at com.samczsun.skype4j.internal.MessageType$3.handle(MessageType.java:95)
    at com.samczsun.skype4j.internal.MessageType$2.handle(MessageType.java:78)
    at com.samczsun.skype4j.internal.EventType$1.handle(EventType.java:35)
    at com.samczsun.skype4j.internal.SkypeImpl$3$1.run(SkypeImpl.java:410)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at com.samczsun.skype4j.internal.chat.ChatGroup.load(ChatGroup.java:78)
    at com.samczsun.skype4j.internal.chat.ChatImpl.<init>(ChatImpl.java:57)
    at com.samczsun.skype4j.internal.chat.ChatGroup.<init>(ChatGroup.java:50)
    at com.samczsun.skype4j.internal.chat.ChatImpl.createChat(ChatImpl.java:130)
    at com.samczsun.skype4j.internal.SkypeImpl.loadChat(SkypeImpl.java:449)
    at io.github.pangeacake.pangeabot.PangeaBot$1.onMessage(PangeaBot.java:313)
    ... 13 more

Initialization delay when first message received from chat

When the first message is received from a chat, the API takes around 5 seconds to process it. This is not an issue with subsequent messages. Could this initialization delay be fixed? I'm assuming the API is preloading display names or something, which should be done in the subscribe() method for all chats.

Error when using Message.fromHtml

arguments:

<font color="#55FF55">╔══════<font color="#000000"> <font color="#555555"><i>[<font color="#5555FF"></i><i>US<font color="#555555"></i><i>] <font color="#664400"></i><b>Overcast <font color="#FFAA00"></b><b>Network <font color="#000000"></b>⁚<font color="#55FF55">══════╗
<font color="#55FF55">╚════<font color="#000000">⁚ <font color="#55FFFF"><i>New players are VIP for 7 days! <font color="#000000"></i>⁚<font color="#55FF55">════╝

stacktrace:

[SEVERE] [Mon Jan 04 17:20:21 PST 2016] Could not handle class com.samczsun.skype4j.events.chat.message.MessageReceivedEvent
java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:592)
    at java.lang.Integer.parseInt(Integer.java:615)
    at com.samczsun.skype4j.formatting.RichText$2.lambda$new$8(RichText.java:111)
    at com.samczsun.skype4j.formatting.RichText$2$$Lambda$34/1415452897.test(Unknown Source)
    at com.samczsun.skype4j.formatting.RichText.hasTag(RichText.java:443)
    at com.samczsun.skype4j.formatting.RichText.parse(RichText.java:423)
    at com.samczsun.skype4j.formatting.RichText.fromHtml(RichText.java:391)
    at com.samczsun.skype4j.formatting.Message.fromHtml(Message.java:112)
    at io.github.pangeacake.pangeabot.PangeaBot$1.onMessage(PangeaBot.java:223)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.samczsun.skype4j.internal.RegisteredListener.handleEvent(RegisteredListener.java:36)
    at com.samczsun.skype4j.internal.SkypeEventDispatcher.callEvent(SkypeEventDispatcher.java:80)
    at com.samczsun.skype4j.internal.SkypeEventDispatcher.callEvent(SkypeEventDispatcher.java:61)
    at com.samczsun.skype4j.internal.MessageType$2.handle(MessageType.java:121)
    at com.samczsun.skype4j.internal.MessageType$4.handle(MessageType.java:169)
    at com.samczsun.skype4j.internal.EventType$1.handle(EventType.java:38)
    at com.samczsun.skype4j.internal.threads.PollThread.lambda$run$21(PollThread.java:147)
    at com.samczsun.skype4j.internal.threads.PollThread$$Lambda$20/1295904827.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Cannot login

I've been using the maven 0.0.8-snapshot, for the last couple of days, but, seeing as Samczsun implemented a whole load of new features and events, I decided to compile the github version of the project, however, in this new version, I can't login, since there is no skype.login(username,password) input. I'd really like to start using all the new features, especially the events, so could someone tell me how to login?

Login method

Your login method is a void that doesn't take any arguments, hence an error being thrown: The method login() in the type Skype is not applicable for the arguments (String, String)

The process is still alive after logout()

Code:

Skype skype = Skype.login(LOGIN, PASS);
skype.subscribe();
Thread.sleep(5000);
System.out.println("done");
skype.logout();
System.out.println("done1");

Console output:

done
done1

and process still alive

User is always null

Hi,i've a problem..when anyone sends a message to my bot,and my bot answer,i receive this error:

set 17, 2015 10:18:48 AM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
GRAVE: Exception while handling message
java.lang.IllegalArgumentException: User must not be null
at org.jsoup.helper.Validate.notNull(Validate.java:26)
at com.samczsun.skype4j.internal.ChatMessageImpl.createMessage(ChatMessageImpl.java:14)
at com.samczsun.skype4j.internal.MessageType$3.handle(MessageType.java:58)
at com.samczsun.skype4j.internal.SkypeImpl$1$1.run(SkypeImpl.java:114)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

set 17, 2015 10:18:48 AM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
GRAVE: {"eventMessages":[{"id":1004,"type":"EventMessage","resourceType":"NewMessage","time":"2015-09-17T08:18:38Z","resourceLink":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/8:napolissimo1926/messages/1442477918079","resource":{"clientmessageid":"1442477927523","messagetype":"RichText","originalarrivaltime":"2015-09-17T08:18:38.314Z","contenttype":"text","isactive":true,"from":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/contacts/8:siwabot","id":"1442477918079","conversationLink":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/8:napolissimo1926","type":"Message","imdisplayname":"siwabot","ackrequired":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/ALL/messages/1442477918079/ack","content":"Debug","composetime":"2015-09-17T08:18:38.314Z"}}]}

Then I get every minute this message:
set 17, 2015 10:46:50 AM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
GRAVE: Exception while handling message
java.lang.NullPointerException
at com.samczsun.skype4j.internal.SkypeImpl$1$1.run(SkypeImpl.java:106)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

set 17, 2015 10:46:50 AM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
GRAVE: {}

Severe Error

I received some messages and was told to open a ticket and send them.

Here are the messages:
http://hastebin.com/raw/pugukoxali

They were accompanied by:
SEVERE: CONTROL_LIVE_STATE is in need of implementation! Please open a ticket with the following JSON data
Dec 05, 2015 1:00:10 PM com.samczsun.skype4j.internal.MessageType$23 handle

Throwing a false positive

The method in ChatImpl isLoaded, is throwing a false positive, thus giving me a NotLoadedException. Fix pls

nullclient-s.gateway.messenger.live.com

        _skype = new SkypeImpl(Settings.Default.SkypeLogin, Settings.Default.SkypePassword);
        _skype.login();
        var dispatcherv = _skype.getEventDispatcher();
        dispatcherv.registerListener(new MessageListener(OnSkypeMessage));
        _skype.subscribe();

and then I got

Exception:Thrown: "nullclient-s.gateway.messenger.live.com" (java.net.UnknownHostException)
A java.net.UnknownHostException was thrown: "nullclient-s.gateway.messenger.live.com"

How to start an NPE farm

Adding users always gives this beautiful exception :3

Jul 13, 2015 11:46:22 PM com.samczsun.skype4j.internal.SkypeImpl$2$1 run
SEVERE: Exception while handling message
java.lang.NullPointerException
    at com.samczsun.skype4j.events.chat.user.UserEvent.<init>(UserEvent.java:10)
    at com.samczsun.skype4j.events.chat.user.UserAddEvent.<init>(UserAddEvent.java:9)
    at com.samczsun.skype4j.internal.MessageType$11.handle(MessageType.java:189)
    at com.samczsun.skype4j.internal.SkypeImpl$2$1.run(SkypeImpl.java:190)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Jul 13, 2015 11:46:22 PM com.samczsun.skype4j.internal.SkypeImpl$2$1 run
SEVERE: {"eventMessages":[{"id":1676,"type":"EventMessage","resourceType":"NewMessage","time":"2015-07-13T22:46:22Z","resourceLink":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/19:[email protected]/messages/1436827581841","resource":{"id":"1436827581841","ackrequired":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/ALL/messages/1436827581841/ack","originalarrivaltime":"2015-07-13T22:46:21.841Z","messagetype":"ThreadActivity/AddMember","conversationLink":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/19:[email protected]","composetime":"2015-07-13T22:46:21.841Z","contentformat":"FN=MS%20Shell%20Dlg; EF=; CO=0; CS=0; PF=0","content":"<addmember><eventtime>1436827581841</eventtime><initiator>8:joepwnsall1</initiator><target>8:spongybacon</target></addmember>","type":"Message","isactive":true,"threadtopic":"spongybacon, joepwnsall1, spongybot","from":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/contacts/19:[email protected]"}}]}
Jul 13, 2015 11:46:51 PM com.samczsun.skype4j.internal.SkypeImpl$2$1 run
SEVERE: Exception while handling message
java.lang.NullPointerException
    at com.samczsun.skype4j.events.chat.user.UserEvent.<init>(UserEvent.java:10)
    at com.samczsun.skype4j.events.chat.user.UserAddEvent.<init>(UserAddEvent.java:9)
    at com.samczsun.skype4j.events.chat.user.MultiUserAddEvent.<init>(MultiUserAddEvent.java:12)
    at com.samczsun.skype4j.internal.MessageType$11.handle(MessageType.java:191)
    at com.samczsun.skype4j.internal.SkypeImpl$2$1.run(SkypeImpl.java:190)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Jul 13, 2015 11:46:51 PM com.samczsun.skype4j.internal.SkypeImpl$2$1 run
SEVERE: {"eventMessages":[{"id":1681,"type":"EventMessage","resourceType":"NewMessage","time":"2015-07-13T22:46:51Z","resourceLink":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/19:[email protected]/messages/1436827610731","resource":{"id":"1436827610731","ackrequired":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/ALL/messages/1436827610731/ack","originalarrivaltime":"2015-07-13T22:46:50.731Z","messagetype":"ThreadActivity/AddMember","conversationLink":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/19:[email protected]","composetime":"2015-07-13T22:46:50.731Z","contentformat":"FN=MS%20Shell%20Dlg; EF=; CO=0; CS=0; PF=0","content":"<addmember><eventtime>1436827610731</eventtime><initiator>8:joepwnsall1</initiator><target>8:spongybacon</target><target>8:codebeasts</target></addmember>","type":"Message","isactive":true,"threadtopic":"codebeasts, spongybacon, joepwnsall1, spongybot","from":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/contacts/19:[email protected]"}}]}

enjoi bb

Chat is null when message received

ш■ы 22, 2015 1:39:15 PM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
SEVERE: Exception while handling message
java.lang.NullPointerException
at com.samczsun.skype4j.internal.MessageType.getUser(MessageType.java:33
4)
at com.samczsun.skype4j.internal.MessageType.access$200(MessageType.java
:32)
at com.samczsun.skype4j.internal.MessageType$3.handle(MessageType.java:5
5)
at com.samczsun.skype4j.internal.SkypeImpl$1$1.run(SkypeImpl.java:142)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:603)
at java.lang.Thread.run(Thread.java:935)

ш■ы 22, 2015 1:39:15 PM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
SEVERE: {"eventMessages":[{"id":1008,"type":"EventMessage","resourceType":"NewMe
ssage","time":"2015-07-22T09:38:47Z","resourceLink":"https://bay-client-s.gatewa
y.messenger.live.com/v1/users/ME/conversations/19:c6a914c896a54ac1b0cb3040ea9124
[email protected]/messages/1437557927265","resource":{"clientmessageid":"107547954
58636289908","threadtopic":"SkypeWebText","messagetype":"RichText","originalarri
valtime":"2015-07-22T09:38:46.648Z","isactive":false,"from":"https://bay-client-
s.gateway.messenger.live.com/v1/users/ME/contacts/8:yarwork","id":"1437557927265
","conversationLink":"https://bay-client-s.gateway.messenger.live.com/v1/users/M
E/conversations/19:[email protected]","type":"Messag
e","imdisplayname":"YaR Rou","ackrequired":"https://bay-client-s.gateway.messeng
er.live.com/v1/users/ME/conversations/ALL/messages/1437557927265/ack","content":
"7","composetime":"2015-07-22T09:38:46.648Z"}}]}
ш■ы 22, 2015 1:39:15 PM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
SEVERE: {"eventMessages":[{"id":1010,"type":"EventMessage","resourceType":"NewMe
ssage","time":"2015-07-22T09:39:05Z","resourceLink":"https://bay-client-s.gatewa
y.messenger.live.com/v1/users/ME/conversations/19:c6a914c896a54ac1b0cb3040ea9124
[email protected]/messages/1437557945220","resource":{"clientmessageid":"161333209
8838435701","threadtopic":"SkypeWebText","messagetype":"RichText","originalarriv
altime":"2015-07-22T09:39:04.947Z","isactive":false,"from":"https://bay-client-s
.gateway.messenger.live.com/v1/users/ME/contacts/8:yarwork","id":"1437557945220"
,"conversationLink":"https://bay-client-s.gateway.messenger.live.com/v1/users/ME
/conversations/19:[email protected]","type":"Message
","imdisplayname":"YaR Rou","ackrequired":"https://bay-client-s.gateway.messenge
r.live.com/v1/users/ME/conversations/ALL/messages/1437557945220/ack","content":"
message text","composetime":"2015-07-22T09:39:04.947Z"}}]}

Private Chat vs Group Chat

Message Received Event is not fired when my account receives a message in a private chat but works in group chats. Please add support for private messaging if you can.

P.S. I would also like if on the Topic Update Event it would be possible to get the old topic. If that is not possible, sorry to ask. But if it is, thanks in advance.

Message text parsing exception

...and there is no Message.fromPlainText...

Message.fromHtml("zzz <ss😠R)</ss> zzz (don't ask me what the hell this text is)");

java.util.EmptyStackException

at java.util.Stack.peek()
at com.samczsun.skype4j.formatting.Message$1.head(Node , Int32 )
at org.jsoup.select.NodeTraversor.traverse(Node root)
at org.jsoup.nodes.Node.traverse(NodeVisitor nodeVisitor)
at com.samczsun.skype4j.formatting.Message.fromHtml(String text)

Username must be all lowercase when logging in

I set up some basic code to try out Skype4J:

        String username = "Username";
        String password = "password";
        SkypeBuilder skypeBuild = new SkypeBuilder(username, password);
        skypeBuild.withAllResources();
        Skype skype = skypeBuild.build();
        try {
            skype.login();
        } catch (ConnectionException | ParseException | InvalidCredentialsException e) {
            e.printStackTrace();
        }

        skype.getEventDispatcher().registerListener(new Listener() {
              @EventHandler
              public void onMessage(MessageReceivedEvent e) {
                System.out.println("Got message:" + e.getMessage().getContent());   
              }
            });
            try {
                skype.subscribe();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
       }

However, each time I got a message from a group chat, an exception occurs:

Jul 27, 2015 8:51:29 PM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
SEVERE: Exception while handling message
com.samczsun.skype4j.exceptions.NotParticipatingException
    at com.samczsun.skype4j.internal.ChatGroup.load(ChatGroup.java:66)
    at com.samczsun.skype4j.internal.ChatImpl.<init>(ChatImpl.java:61)
    at com.samczsun.skype4j.internal.ChatGroup.<init>(ChatGroup.java:24)
    at com.samczsun.skype4j.internal.ChatImpl.createChat(ChatImpl.java:37)
    at com.samczsun.skype4j.internal.SkypeImpl.loadChat(SkypeImpl.java:193)
    at com.samczsun.skype4j.internal.MessageType.getChat(MessageType.java:420)
    at com.samczsun.skype4j.internal.MessageType.access$3(MessageType.java:415)
    at com.samczsun.skype4j.internal.MessageType$3.handle(MessageType.java:76)
    at com.samczsun.skype4j.internal.SkypeImpl$1$1.run(SkypeImpl.java:148)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Looking at the list of members from the ChatGroup, I saw that my username was indeed in there, but it was in all lowercase, hence failing the comparison here. Putting my username in all lowercase when logging in solved the issue.

I don't know if that's an intended behavior, but since I haven't seen it mentioned anywhere, I figure it's worth reporting.

maven central

Please consider add this to Maven Central repository.
And fix jar file name to SNAPSHOT instead of datetime. maven-jar-plugin fails to create correct classpath

Can't logout

Windows 7, jdk1.8_45, skype version: 7.16.0.102

Skype skype = new SkypeBuilder(username, password).withAllResources().build();
skype.login();
skype.getEventDispatcher().registerListener(new Listener() {
  @EventHandler
  public void onMessage(MessageReceivedEvent e) {
    System.out.println("Got message: " + e.getMessage().getContent());
  }
});
skype.subscribe();
// Do stuff
skype.logout();

com.samczsun.skype4j.exceptions.ConnectionException: While logging out (302 Found)
at com.samczsun.skype4j.internal.ExceptionHandler.generateException(ExceptionHandler.java:50)
at com.samczsun.skype4j.internal.Endpoints$EndpointConnection.connect(Endpoints.java:367)
at com.samczsun.skype4j.internal.Endpoints$EndpointConnection.get(Endpoints.java:262)
at com.samczsun.skype4j.internal.client.FullClient.logout(FullClient.java:74)
at com.mykhaylenko.main.SkypeTest.test(SkypeTest.java:26)
at com.mykhaylenko.main.SkypeTest.main(SkypeTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Can't login

Hello,
When I try to run next code I get error:

Windows 7, jdk1.8_45, skype version: 7.16.0.102

Skype skype = new SkypeBuilder(username, password).withAllResources().build();
skype.login();
skype.getEventDispatcher().registerListener(new Listener() {
  @EventHandler
  public void onMessage(MessageReceivedEvent e) {
    System.out.println("Got message: " + e.getMessage().getContent());
  }
});
skype.subscribe();
// Do stuff
skype.logout();

com.samczsun.skype4j.exceptions.ConnectionException: While fetching the asmtoken
at com.samczsun.skype4j.internal.SkypeImpl.getAsmToken(SkypeImpl.java:364)
at com.samczsun.skype4j.internal.client.FullClient.login(FullClient.java:251)
at com.samczsun.skype4j.internal.client.FullClient.login(FullClient.java:234)
at com.mykhaylenko.dellaparser.DellaPageTest.testSkype(DellaPageTest.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.jsoup.HttpStatusException: HTTP error fetching URL. Status=204, URL=https://api.asm.skype.com/v1/skypetokenauth
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:435)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:410)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:164)
at com.samczsun.skype4j.internal.SkypeImpl.getAsmToken(SkypeImpl.java:362)
... 29 more

Send an invite to friends and message

Hello :) How i cant:

  • send invite in friends list if i know only login skype?
  • send message if i know only login skype?

i try. But didn't work

bot.getSkype().loadChat("8:firkys").sendMessage(Message.fromHtml("test"));

Message encoding

Message.getContent().asPlainText()
Message.getContent().asHtml()

returns message text in Windows-1251 encoding.
Is it right? Maybe UTF will be better?

Events not triggered...

After 5-6 hours online (maybe after internet failure on a second) Skype4j does not receive messages, and I see no exceptions, events, everything is clear...
Any suggestions?
Thanks.

Can't connect

After about two weeks of using this lib exception thrown every time I try to login

com.samczsun.skype4j.exceptions.InvalidCredentialsException: Signing in failed. Please double-check your Skype Name and re-enter your password.

web.skype.com in browser on this machine is working ok...

Exception after 2 days online - java.io.IOException: Server returned HTTP response code: 429

Version 0.0.8-SNAPSHOT

java.io.IOException: Server returned HTTP response code: 429 for URL: https://client-s.gateway.messenger.live.com/v1/users/ME/endpoints
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1838)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at com.samczsun.skype4j.internal.SkypeImpl.login(SkypeImpl.java:274)
    at com.samczsun.skype4j.internal.SkypeImpl.access$700(SkypeImpl.java:36)
    at com.samczsun.skype4j.internal.SkypeImpl$1.run(SkypeImpl.java:143)
java.io.IOException: Server returned HTTP response code: 429 for URL: https://client-s.gateway.messenger.live.com/v1/users/ME/endpoints
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1838)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at com.samczsun.skype4j.internal.SkypeImpl.login(SkypeImpl.java:274)
    at com.samczsun.skype4j.internal.SkypeImpl.access$700(SkypeImpl.java:36)
    at com.samczsun.skype4j.internal.SkypeImpl$1.run(SkypeImpl.java:143)

Add support for pre tag

Hi,

The <pre> tag is usable on skype (Using {code}message{code}) and that seems to break some pieces :o

CONTROL_CLEAR_TYPING {"id":"xxx","ackrequired":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/ALL/messages/xxx/ack","originalarrivaltime":"2015-07-26T21:12:12.559Z","imdisplayname":"xxx","messagetype":"Control/ClearTyping","conversationLink":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/conversations/8:format930","composetime":"2015-07-26T21:12:12.559Z","isactive":false,"type":"Message","from":"https://db3-client-s.gateway.messenger.live.com/v1/users/ME/contacts/8:format930"}
Jul 26, 2015 11:40:02 PM com.samczsun.skype4j.internal.SkypeImpl$1$1 run
SEVERE: Exception while handling message
java.util.EmptyStackException
    at java.util.Stack.peek(Stack.java:102)
    at com.samczsun.skype4j.formatting.Message$1.head(Message.java:109)
    at org.jsoup.select.NodeTraversor.traverse(NodeTraversor.java:31)
    at org.jsoup.nodes.Node.traverse(Node.java:544)
    at com.samczsun.skype4j.formatting.Message.fromHtml(Message.java:62)
    at com.samczsun.skype4j.internal.MessageType$3.handle(MessageType.java:68)
    at com.samczsun.skype4j.internal.SkypeImpl$1$1.run(SkypeImpl.java:148)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

sealed attribute

com.samczsun.skype4j.events.EventHandlerAttribute
I want to decorate it, but can't do it simply cause of it marked as sealed.

Is there any chance to make it non-sealed?

send messages

Would you be so kind to show some examples about sending messages to user and to group chat?

mvn package failed

$ mvn package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building skype4j 0.0.9-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ skype4j ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/victor/projects/Skype4J/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ skype4j ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 74 source files to /home/victor/projects/Skype4J/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/victor/projects/Skype4J/src/main/java/com/samczsun/skype4j/internal/SkypeImpl.java:[24,27] error: cannot find symbol
[ERROR]  package com.samczsun.skype4j
/home/victor/projects/Skype4J/src/main/java/com/samczsun/skype4j/internal/SkypeImpl.java:[28,39] error: cannot find symbol
[ERROR]  package com.samczsun.skype4j.events.chat
/home/victor/projects/Skype4J/src/main/java/com/samczsun/skype4j/internal/MessageType.java:[22,27] error: cannot find symbol
[ERROR]  package com.samczsun.skype4j
/home/victor/projects/Skype4J/src/main/java/com/samczsun/skype4j/internal/SkypeImpl.java:[722,58] error: cannot find symbol
[INFO] 4 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.137s
[INFO] Finished at: Thu Nov 12 17:22:53 EET 2015
[INFO] Final Memory: 15M/177M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project skype4j: Compilation failure: Compilation failure:
[ERROR] /home/victor/projects/Skype4J/src/main/java/com/samczsun/skype4j/internal/SkypeImpl.java:[24,27] error: cannot find symbol
[ERROR] package com.samczsun.skype4j
[ERROR] /home/victor/projects/Skype4J/src/main/java/com/samczsun/skype4j/internal/SkypeImpl.java:[28,39] error: cannot find symbol
[ERROR] package com.samczsun.skype4j.events.chat
[ERROR] /home/victor/projects/Skype4J/src/main/java/com/samczsun/skype4j/internal/MessageType.java:[22,27] error: cannot find symbol
[ERROR] package com.samczsun.skype4j
[ERROR] /home/victor/projects/Skype4J/src/main/java/com/samczsun/skype4j/internal/SkypeImpl.java:[722,58] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Events not being triggered

Not sure if there is something I am doing wrong, I can't seem to get any of the events to fire.

Skype skype = new SkypeBuilder(Login.USER, Login.PASS).withAllResources().build();
skype.login();
skype.getEventDispatcher().registerListener(new Listener(){
    @EventHandler
    public void onMessage(MessageEditedByOtherEvent e){
        System.out.println("MESSAGE");
        System.out.println(e.getClass());
    }
});
System.out.println("Registered listener");
skype.subscribe();
System.out.println("Doing stuff...");
skype.logout();
System.out.println("Logged out");

As a side note, I'm not really sure how to go about obtaining the ID of a group chat (in general).

Thanks!

  • Os

User Joining without being added

There is a minor error being called (PARSING_MESSAGE) whenever a user joins via clicking a link or when a guest joins (Joining without being added).

Relies on file.encoding

Using com.samczsun:skype4j:0.0.9-SNAPSHOT version of Skype4J, Windows, Russian locale, file encoding is windows-1251 (Russian Windows default).

When running with default settings, it considers UTF-8 strings as CP-1251 ones somewhere. It leads, for example, to appearannce of скайп in place of скайп.

When running with -Dfile.encoding=UTF-8, everything is ok.

skype.login()

Win 8.1 VS 2013 skype4j-0.1.5 C#

java.lang.RuntimeException не обработано
HResult=-2146233088
Message=java.lang.UnsupportedOperationException: Not a string: 78790
Source=Skype4j
StackTrace:
в com.samczsun.skype4j.internal.client.FullClient.login(String[] )
в com.samczsun.skype4j.internal.client.FullClient.login()
в Skype.Program.Main(String[] args) в c:\Users\El'bor\Documents\Visual Studio 2013\Projects\Skypebeta\Skypebeta\Program.cs:строка 51
в System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
в System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
в Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
в System.Threading.ThreadHelper.ThreadStart_Context(Object state)
в System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
в System.Threading.ThreadHelper.ThreadStart()
InnerException: java.lang.UnsupportedOperationException
HResult=-2146233088
Message=Not a string: 78790
Source=Skype4j
StackTrace:
в com.eclipsesource.json.JsonValue.asString()
в com.samczsun.skype4j.internal.client.FullClient.registerWebSocket()
в com.samczsun.skype4j.internal.client.FullClient.login(String[] )
InnerException:

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.