TheHolyWaffle / League-of-Legends-XMPP-Chat-Library

A Java 7 XMPP API to chat and interact with the League of Legends ChatServers.
MIT License
58 stars 23 forks source link

Taiwan and Singapore connections aren't working #4

Closed MaxiBoether closed 10 years ago

MaxiBoether commented 10 years ago

Hello,

I can successfully connect to Taiwan and Singapore, but after some seconds (~30), I get disconnected with the following error:

Sep 23, 2014 9:07:19 PM org.jivesoftware.smack.tcp.PacketWriter writePackets
WARNUNG: Exception writing closing stream element
java.net.SocketException: Connection closed by remote host
    at sun.security.ssl.SSLSocketImpl.checkWrite(Unknown Source)
    at sun.security.ssl.AppOutputStream.write(Unknown Source)
    at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
    at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
    at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
    at sun.nio.cs.StreamEncoder.flush(Unknown Source)
    at java.io.OutputStreamWriter.flush(Unknown Source)
    at java.io.BufferedWriter.flush(Unknown Source)
    at org.jivesoftware.smack.tcp.PacketWriter.writePackets(PacketWriter.java:190)
    at org.jivesoftware.smack.tcp.PacketWriter.access$000(PacketWriter.java:40)
    at org.jivesoftware.smack.tcp.PacketWriter$1.run(PacketWriter.java:77)

Sep 23, 2014 9:07:19 PM org.jivesoftware.smack.XMPPConnection callConnectionClosedOnErrorListener
WARNUNG: Connection closed with error
java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen ...<not-authorized/></failure>... @1:486
    at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
    at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:279)
    at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:47)
    at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:81)

Sometimes the error is different:

Sep 23, 2014 9:20:38 PM org.jivesoftware.smack.tcp.PacketWriter writePackets
WARNUNG: Exception writing closing stream element
java.net.SocketException: Connection closed by remote host
    at sun.security.ssl.SSLSocketImpl.checkWrite(Unknown Source)
    at sun.security.ssl.AppOutputStream.write(Unknown Source)
    at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
    at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
    at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
    at sun.nio.cs.StreamEncoder.flush(Unknown Source)
    at java.io.OutputStreamWriter.flush(Unknown Source)
    at java.io.BufferedWriter.flush(Unknown Source)
    at org.jivesoftware.smack.tcp.PacketWriter.writePackets(PacketWriter.java:190)
    at org.jivesoftware.smack.tcp.PacketWriter.access$000(PacketWriter.java:40)
    at org.jivesoftware.smack.tcp.PacketWriter$1.run(PacketWriter.java:77)

Sep 23, 2014 9:20:38 PM org.jivesoftware.smack.XMPPConnection callConnectionClosedOnErrorListener
WARNUNG: Connection closed with error
java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen ...e xmlns=\'jabber:iq:riotgames:muc:autopresence\'/></stream:features>... @1:409
    at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
    at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:279)
    at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:47)
    at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:81)

Is guess it happens because the Garena chat behaves different from the Riot regions? Is there any way to fix this?

Edit: After debugging, it seems like even the login doesn't work. If you activate the xmpp debug you'll see what I mean.

TheHolyWaffle commented 10 years ago

Hmm, are you sure that you're using the correct credentials? It might be that the login process of garena is different than from the rest.

MaxiBoether commented 10 years ago

Yes, I am for sure using the right credentials. Tested multiple times I can log in to Garena with them.

Edit: If can help you in any way fixing this, please let me now. For example send me your twitter (Mine is @MayestersGaming) and we can exchange Skype names over direct message if you want. I really need to use Garena regions and I will do anything what I can do to use them.

TheHolyWaffle commented 10 years ago

Could you show me your code? In particular the code where you use LolChat#login. This method shouldn't return unless authentication is for sure succesful. So I have absolutely no idea what is going wrong if your code keeps running after login.

MaxiBoether commented 10 years ago

Code:

    LolChat sgChat = new LolChat(ChatServer.SEA,
                FriendRequestPolicy.MANUAL);
        sgChat.login("leaguealerter", "password");

http://puu.sh/bMcFY/f744e04099.png <- the SMACK Debug output. The method returns.

TheHolyWaffle commented 10 years ago

Any exception being thrown from login?

MaxiBoether commented 10 years ago

Nope nothing, code just goes on.

TheHolyWaffle commented 10 years ago

In the Riot supported regions the login process uses your password and prepends "AIR_" to it. I think this is where Garena login is different, altough I have no idea how their actual login process works. Could you perhaps use a network sniffer and search for connections to chat.lol.garenanow.com?

TheHolyWaffle commented 10 years ago

I may have found something. In the login method use the following arguments:

username: garena user id (found when clicking on avatar apparently, should only contain numbers) password: "pass" + garena user id with the 5 last characters removed

Derived from

string pass = "AIR_pass" + this.txbLogin.Text.Substring(this.txbLogin.Text.Length - 5);

I got this from ftp://ftp.heanet.ie/mirrors/sourceforge/a/ap/appearoffline/frmMain.cs

MaxiBoether commented 10 years ago

Still doesn't work :/ ChatServer.SEA, "_300589", "pass_3" Being used, same error as before (same XMPP output)

TheHolyWaffle commented 10 years ago

What if you don't remove the last 5 chars?

MaxiBoether commented 10 years ago

Same error

TheHolyWaffle commented 10 years ago

I'm out of options, If you want support for garena you'll have to find it out yourself.

2014-09-27 21:57 GMT+02:00 Mayesters notifications@github.com:

Same error

— Reply to this email directly or view it on GitHub https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/issues/4#issuecomment-57063867 .

MaxiBoether commented 10 years ago

I found it! It has to be the last 5 chars, not the first 5! So remove the first4 chars and it works! YAAAY! At least for Singapore. For Vietnam it doesn't, for Taiwan I can't check (chat servers are down)

TheHolyWaffle commented 10 years ago

Could you give me an fake example so I can implement garena properly? Also, why wouldn't it work for Vietnam?

MaxiBoether commented 10 years ago

You said remove the last 5 chars, but you have to keep the last 5 and remove the first four. I am currently on my mobile but anyways: Example: Garena id is 123456789 LolChat Username must be 123456789 Password must be pass1234

If you want a coded example, I can send you an example tomorrow.

Vietnam was my bad, I did something wrong. It should work.

Sincerely, Mayesters

Am 28.09.2014 um 19:42 schrieb Bert De Geyter notifications@github.com:

Isn't that what I said, the last 5 chars?

— Reply to this email directly or view it on GitHub.

TheHolyWaffle commented 10 years ago

There must be some kind of miscommunication.

You said you have to remove the first four chars, but in your example you keep the first four chars?

MaxiBoether commented 10 years ago

I am really sorry, I was laying in bad and replying via eMail and couldn't look at my code <.< I suck at developing xD

Working example: ID: 123456789 Password: pass56789

That is it. Remove the first 4 chars just like I wrote: http://puu.sh/bSBkl/b7738746d0.png here. I am sorry for the miscommunication :/

TheHolyWaffle commented 10 years ago

Alright, thank you.

Do you think this method will also work for people who have an ID that is shorter/longer than yours?

MaxiBoether commented 10 years ago

I have absolutley no idea, but I think it should always be the last 5 chars for the password and full ID for the username. At least it makes sense and in the .NET C# Source you linked all ID Lengths are handled the same way, so I think yes, it should. Always last 5 chars

TheHolyWaffle commented 10 years ago

Fixed in 274b2eeb11c03213e5cf3fa043e4ef7744ebd0f5. Maven: 1.2.7