!PtKxxSgyjbNPrkBvRG:matrix.org

Jeon project (another Matrix implementation on java)

21 Members
https://github.com/ma1uta/jeon (mirror: https://gitlab.com/ma1uta/jeon)12 Servers

Load older messages


Timestamp Message
21 Mar 2020
11:00:33@ma1uta:ru-matrix.orgma1uta

So on the Timeline you get RoomEvent's. tl;dr: get timeline and iterate into timeline events. If this event instance of RoomMessageEvent then you can get message like this "event.getContent().getBody()". Also event.getContent() return you Text class, Image and other message events.

11:03:53@ma1uta:ru-matrix.orgma1utaI recommend to read the article: https://brendan.abolivier.bzh/enter-the-matrix/ to understand the Matrix API.
13:18:55@testitest:matrix.btwarch.tktestitestThank you :) I already looked at that article but didn't understand everything back then, I'll check it out again There's one thing I still don't understand. by calling "getEvents()" on any kind of event(Timeline, Ephemeral...) you always get back a List of Events, correct? How do you then access the different methods for different Events? Sorry, object-oriented programming is still difficult to understand for me
13:20:07@testitest:matrix.btwarch.tktestitestI only have access to getContent() on these plain Events and can't cast them either
16:50:52@ma1uta:ru-matrix.orgma1uta
В ответ на@testitest:matrix.btwarch.tk
Thank you :) I already looked at that article but didn't understand everything back then, I'll check it out again There's one thing I still don't understand. by calling "getEvents()" on any kind of event(Timeline, Ephemeral...) you always get back a List of Events, correct? How do you then access the different methods for different Events? Sorry, object-oriented programming is still difficult to understand for me

Pattern matching (example for java 8):

Timeline timeline = ...
timeline.getEvents().forEach(e -> {
  if (e instanceOf RoomMessageEvent) {
    RoomMessageEvent rme = (RoomMessageEvent) e;
    RoomMessageEventContent content = rme.getContent();
    if (content instanceOf Text) {
      Text text = (Text) content
        System.out.orintln(text.getBody());
    }
  }
});
19:06:30@testitest:matrix.btwarch.tktestitestthanks again man, I hope we won't have to ask too many questions from now on, we owe you big time =)
22 Mar 2020
08:04:15@ma1uta:ru-matrix.orgma1uta
In reply to @testitest:matrix.btwarch.tk
thanks again man, I hope we won't have to ask too many questions from now on, we owe you big time =)
As I have said, no problem, you can ask questions 🙂
24 Mar 2020
20:19:55@testitest:matrix.btwarch.tktestitest

Hey ma1uta, how's it going?
We're trying to get registration to a server besides the one that we have set up of our own. For example matrix.org. And it has captcha and terms of service that the user has to accept unlike ours right now.
And also, we're still struggling to understand how to work with stages, as you have to for example with the captcha request.
Is there any easy way to handle the captcha request? We tried handling it with the MatrixException, but we keep getting Status 500 and an empty ErrorCode.

Also we came across this folder: https://github.com/ma1uta/jmsdk/tree/12a38c009ee0de3c038ed1ebb207abe2163e956b/client-impl/src/test/java/io/github/ma1uta/matrix/client, is this just you trying out stuff or is it documentation on how to use the sdk? We saw you use a "mock" server, is that just so you can host synapse locally or is this to send the json requests to the server, or another different reason?

Thanks =)

20:29:01@ma1uta:ru-matrix.orgma1utaHello. The server return one or more registration flows. Each flow contains one or more steps. If you want register user you should pass all steps from any flow. For this use uses the sessionId to identify your registration session. Unfortunately it is no way to automatically pass the captcha. For captcha user should download the captch page and then pass the captcha.
20:29:36@ma1uta:ru-matrix.orgma1utaI mock the server to avoid start synapse locally for each test.
25 Mar 2020
17:16:59@example:matrix.btwarch.tknewExampleTest

Hi Ma1uta, thanks for your answer.
Our problem is mainly that we do not know exactly how to access the stages with the SDK.
We think it has something to do with the classes AuthenticationData, AuthenticationStage and AuthenticationFlows.
We have created a RegisterToHomeserver method, this tries the normal way via username password and m.login.dummy, if there are errors it should jump into the catch block and handle the stages there.

Code:
try {
mxClient.account().register(reg).join();

    }catch(RuntimeException runtimeException){
        MatrixException matrixException = (MatrixException) runtimeException.getCause().getCause().getCause();
        AuthenticationFlows authFlows = new AuthenticationFlows();
        List<AuthenticationStage> authFlowList = authFlows.getFlows();
        List <String> authStagesList = authFlowList.get(0).getStages();

        System.out.println("ErrorCode: " + matrixException.getErrcode());
        System.out.println("Status: " + matrixException.getStatus());
        System.out.println("STAGESv "+ authStagesList.get(0));

We have tried to implement this here as a test and tried to get a single stage output but always get NULL back. what are we doing wrong?

At the bottom of the console in intellij we see the response from the loggingfilter like this.

{"auth":{"type":"m.login.dummy"},"username":"klejtljwl874","password":"lksflmwlf75","initial_device_display_name":"***"}
17:55:31.993 [pool-2-thread-1] ERROR io.github.ma1uta.matrix.client.filter.ErrorFilter - Error response, error code: 'null', error: 'null'
17:55:31.993 [pool-2-thread-1] ERROR io.github.ma1uta.matrix.client.filter.ErrorFilter - Response: {"session": "XmRJjOkDTBRXAsiHSwhpQrmC", "flows": [{"stages": ["m.login.recaptcha", "m.login.terms", "m.login.dummy"]}, {"stages": ["m.login.recaptcha", "m.login.terms", "m.login.email.identity"]}], "params": {"m.login.recaptcha": {"public_key": "6LcgI54UAAAAABGdGmruw6DdOocFpYVdjYBRe4zb"}, "m.login.terms": {"policies": {"privacy_policy": {"version": "1.0", "en": {"name": "Terms and Conditions", "url": "https://matrix-client.matrix.org/_matrix/consent?v=1.0"}}}}}, "completed": ["m.login.dummy"]}
17:55:31.996 [pool-2-thread-1] ERROR io.github.ma1uta.matrix.client.filter.ErrorFilter - Unable to parse response content

How can we access exactly these values and for example the response, how is it done in the Java code with your SDK that we can react to them?
Thank you for your time!

20:45:20@ma1uta:ru-matrix.orgma1utaIt's my fault, I totally forgot about this case. I will publish tomorrow fix.
26 Mar 2020
10:57:39@example:matrix.btwarch.tknewExampleTestThanks! Is this meaning that currently is not possible to working with stages in your SDK? Or do you mean receiving captcha requests when signing up or something else?
16:49:16@ma1uta:ru-matrix.orgma1uta

newExampleTest: I have release 0.11.1 version with fix of the User-interactive flows. In will be published in the maven repository in a few hours. Also I have added the registration (sync and async) example: https://github.com/ma1uta/matrix-client-example/blob/master/src/main/java/io/github/ma1uta/matrix/example/RegistrationExample.java
There are two changes:

  • non-success responses (for non 200 status) wraped in the MatrixException.
  • there are 3 exception responses: common error response, rate-limited response and response with user-interactive flow.
19:15:53@example:matrix.btwarch.tknewExampleTest hey ma1uta very cool, thank you very much for fixing this so fast and thank you for helping us again nice man! 🙂
28 Mar 2020
11:47:26@testitest:matrix.btwarch.tktestitest

Hey ma1uta, thanks for the new release. When we try to use your new release to work stages (specificially the registration again) we keep getting a MismatchedInputException:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String out of START_OBJECT token
at [Source: (byte[])"{"session": "DRSeknStGGeTlVlUUUjkpGSR", "flows": [{"stages": ["m.login.recaptcha", "m.login.terms", "m.login.dummy"]}, {"stages": ["m.login.recaptcha", "m.login.terms", "m.login.email.identity"]}], "params": {"m.login.recaptcha": {"public_key": "6LcgI54UAAAAABGdGmruw6DdOocFpYVdjYBRe4zb"}, "m.login.terms": {"policies": {"privacy_policy": {"version": "1.0", "en": {"name": "Terms and Conditions", "url": "https://matrix-client.matrix.org/_matrix/consent?v=1.0"}}}}}}"; line: 1, column: 321] (through reference chain: io.github.ma1uta.matrix.UserInteractiveResponse["params"]->java.util.LinkedHashMap["m.login.terms"]->java.util.LinkedHashMap["policies"])
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1442)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1216)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1126)
at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:63)
at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:10)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:527)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:29)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:527)
at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:364)

Is this due to an issue inside of your sdk or because we did something wrong?

16:46:28@ma1uta:ru-matrix.orgma1utaStrange. It seems a bug in the sdk.
16:49:50@ma1uta:ru-matrix.orgma1utaYeah, I found it. I will publish today a fix.
17:55:13@testitest:matrix.btwarch.tktestitestThanks, that's great. Sounds like it was expecting a differently formatted json than the one it was getting?
18:35:04@ma1uta:ru-matrix.orgma1utaYes, I expected that params can be object only with string params, without nested objects.
19:10:32@ma1uta:ru-matrix.orgma1utaJust released 0.11.2 with user-interactive fix. Will available in a few hours.
29 Mar 2020
09:15:20@testitest:matrix.btwarch.tktestitestthanks for the quick fix again =), we hope we're helping by testing out things and finding bugs
10:12:20@ma1uta:ru-matrix.orgma1uta
В ответ на@testitest:matrix.btwarch.tk
thanks for the quick fix again =), we hope we're helping by testing out things and finding bugs
Yes, you are very helping to test. Thanks.
10:22:52@testitest:matrix.btwarch.tktestitestI was thinking, do you maybe prefer if we opened issues on github with bugs instead of writing here? so everyone can see. Or is this okay
10:27:46@ma1uta:ru-matrix.orgma1uta
В ответ на@testitest:matrix.btwarch.tk
I was thinking, do you maybe prefer if we opened issues on github with bugs instead of writing here? so everyone can see. Or is this okay
Open issues prefer, of course.
3 Apr 2020
19:20:58@testitest:matrix.btwarch.tktestitest

Hey ma1uta, hows it going?
I have an issue where I always seem to get null as the ID of the room when handling events, not sure if I'm being stupid or not.
Example code:

// list of timeline events
list.forEach(e -> {
    if(e instanceof RoomEvent){
        RoomEvent roomEvent = (RoomEvent) e;
        System.out.println("roomId: " +  roomEvent.getRoomId());
    }
});

Always returns roomId: null. But at the same time I'm able to get content of messages ... from the Events.

19:24:25@testitest:matrix.btwarch.tktestitest *

Hey ma1uta, hows it going?
I have an issue where I always seem to get null as the ID of the room when handling events, not sure if I'm being stupid or not.
Example code:
...java
// list of timeline events
list.forEach(e -> {
if(e instanceof RoomEvent){
RoomEvent roomEvent = (RoomEvent) e;
System.out.println("roomId: " + roomEvent.getRoomId());
}
});
...

Always returns roomId: null. But at the same time I'm able to get content of messages ... from the Events.

19:24:32@testitest:matrix.btwarch.tktestitest *

Hey ma1uta, hows it going?
I have an issue where I always seem to get null as the ID of the room when handling events, not sure if I'm being stupid or not.
Example code:

// list of timeline events
list.forEach(e -> {
if(e instanceof RoomEvent){
RoomEvent roomEvent = (RoomEvent) e;
System.out.println("roomId: " + roomEvent.getRoomId());
}
});

Always returns roomId: null. But at the same time I'm able to get content of messages ... from the Events.

19:24:52@testitest:matrix.btwarch.tktestitest *

Hey ma1uta, hows it going?
I have an issue where I always seem to get null as the ID of the room when handling events, not sure if I'm being stupid or not.
Example code:

// list of timeline events
list.forEach(e -> {
if(e instanceof RoomEvent){
RoomEvent roomEvent = (RoomEvent) e;
System.out.println("roomId: " +  roomEvent.getRoomId());
}
});

Always returns roomId: null. But at the same time I'm able to get content of messages ... from the Events.

19:25:16@testitest:matrix.btwarch.tktestitest *

Hey ma1uta, hows it going?
I have an issue where I always seem to get null as the ID of the room when handling events, not sure if I'm being stupid or not.
Example code:

// list of timeline events
list.forEach(e -> {
    if(e instanceof RoomEvent){
        RoomEvent roomEvent = (RoomEvent) e;
        System.out.println("roomId: " +  roomEvent.getRoomId());
    }
});

Always returns roomId: null. But at the same time I'm able to get content of messages ... from the Events.


There are no newer messages yet.


Back to Room List