Coder Social home page Coder Social logo

matrix-java-sdk's People

Contributors

maxidorius avatar mrcustomizer avatar mtrnord avatar

Stargazers

 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

matrix-java-sdk's Issues

Support access token in headers

The spec allows the access token to be provided in headers or in query parameter.
We need to support both and leave the option of which to use at the client object creation time.
Headers will be the default option.

List of missing Event Types

This is a list of event Types that I currently manually need to match as they don't get parsed to a java type.

  • m.direct
  • m.tag
  • m.room.canonical_alias

Get image info from MatrixJsonRoomMessageEvent

Currently it's not possible to query the contents of an event with an image via the API. Image events have next to the body an info JSON-object which contains the necessary information like mimetype information, the mxc-URL of the image etc. It would be nice to be able to query this stuff via the API instead of having to parse the JSON-info object itself.

Add access method for formatted body to MatrixJsonRoomMessageEvent

Room message events can contain formatted text. Several clients also seem to more or less use this feature. Especially Riot makes excessive use of it. I stumbled upon it when learning about the mechanisms of how Riot handles mentions. Mention pills are html link tags, where href follows a certain formatting standard.

Several other html tags for formatting text are also supported.

Long story short: MatrixJsonRoomMessageEvent should be extended, so that clients are able to access the formatted text body sent by other clients instead of only the raw text body. I propose adding the methods getFormattedBody and getFormat to access the JSON fields formatted_body and format in the content object of the event.

New event: MatrixJsonRoomTopicEvent

I suggest adding a new event which implements MatrixJsonEvent with the name MatrixJsonRoomTopicEvent. This event should be a represantation of a timeline event of a room with the type m.room.topic.

Be able to receive core events from HS

As part of the initial implementation, be able to receive core events from the HS for a very basic usage, in the lines of a bot client which would act on messages from regular users and can navigate rooms.

List events to support:

  • Rooms
    • Invite
    • Join
    • Leave/kick/ban
  • Messages
    • Incoming basic text messages

Add missing timeouts to http requests

HttpRequests need three timeouts to be set, so that the requests automatically return on a bad connection. The default for these timeouts sadly is "infinity". The timeouts can be set like this:

int timeout = <suitableTimeout>
RequestConfig.Builder configBuilder = request.getConfig().custom();
if (request.getConfig() != null) {
    configBuilder = RequestConfig.copy(request.getConfig());
}
configBuilder.setConnectionRequestTimeout(timeout);
configBuilder.setConnectTimeout(timeout);
configBuilder.setSocketTimeout(timeout);
httpRequest.setConfig(configBuilder.build());

Invalid processing/parsing of errors when executing requests

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224)
	at com.google.gson.Gson.fromJson(Gson.java:887)
	at com.google.gson.Gson.fromJson(Gson.java:852)
	at com.google.gson.Gson.fromJson(Gson.java:801)
	at com.google.gson.Gson.fromJson(Gson.java:773)
	at io.kamax.matrix.client.AMatrixHttpClient.createErrorInfo(AMatrixHttpClient.java:312)
	at io.kamax.matrix.client.AMatrixHttpClient.execute(AMatrixHttpClient.java:202)
	at io.kamax.matrix.client.AMatrixHttpClient.execute(AMatrixHttpClient.java:186)
	at io.kamax.matrix.client.regular.MatrixHttpClient.sync(MatrixHttpClient.java:159)
	at io.kamax.matrix.bots.send_n_leave.SendNLeaveBot.lambda$start$6(SendNLeaveBot.java:94)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
	at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213)
	... 10 more

Android D8 with minify enabled sometimes complains

Androids new D8 Dex merger does complain if building the sdk sometimes :/

Error I get is:

AGPBI: {"kind":"error","text":"Default interface methods are only supported starting with Android N (--min-api 24): void io.kamax.matrix.hs._MatrixRoom.sendReadReceipt(java.lang.String)","sources":[{}],"tool":"D8"}

Generalize InvitedRoom/JoinedRoom/LeftRoom (in _SyncData)

_SyncData contains the types InvitedRoom, JoinedRoom and LeftRoom. Currently they don't have a generalized type. This leads to code duplication and in some cases triplication.

All three types contain synchronisation data for a specific room. Common properties are the room ID #getId() and the state events #getState().

A generalized type RoomData (or some other name) could be

interface RoomData {
   String getId(); // room ID
   State getState(); // state events
}

For better distinction between the RoomData subtypes add a RoomDataKind enum

enum RoomDataKind {
  JOINED,
  INVITED,
  LEFT
  ;
}
interface RoomData {
  …
  RoomDataKind getKind();
}

Implement auto-discovery of the Client APIs (Home, Identity) endpoints

There is currently no official way in the spec to discover the client endpoint for a given Matrix domain, which would be the equivalent of the SRV record for the S2S API.

Following several conversations and exchanges [1] [2], we'll use a .well-known URL [RFC 5785].

For the domain example.org, the discovery URL will be: https://example.org/.well-known/matrix
It will return a status code 200 and body as JSON object like so:

{
  "m.hs": {
    "base_urls": [
      "https://a.mxhsd.example.org",
      "https://b.mxhsd.example.org",
      "https://c.mxhsd.example.org/with/prefix/path",
      "https://d.mxhsd.example.org:12345"
    ]
  },
  "m.is": {
    "base_urls": [
      "https://a.mxisd.example.org",
      "https://b.mxisd.example.org",
      "https://c.mxisd.example.org/with/prefix/path",
      "https://d.mxisd.example.org:12345"
    ]
  },
  "im.vector.riot.integrations": {
    "ui_url": "https://dimension.example.org/riot",
    "rest_url": "https://dimension.example.org/api/v1/scalar",
    "widgets_urls": [
      "https://dimension.example.org/widgets"
    ]
  }
}

For base_urls in m.hs and m.is:

  • Will not include the /_matrix/... path.
  • Will be tried in order, going to the next in case of error.
  • A Base URL is valid if:
    • For m.hs, /_matrix/client/versions is reachable and contains valid data
    • For m.is, /_matrix/identity/versions is reachable and contains valid data

Every other entry will be DNS namespace, like other parts of the Matrix protocol, so custom features in clients can also receive dedicated configuration, or rely on other other clients supported configuration.
In this case, im.vector.riot.integrations would reference to the Riot Integration Manager and any other client that supports it.

/_matrix/identity/versions will be defined at https://kamax.io/matrix/api/identity_service/unstable.html

This implementation will be documented at https://kamax.io/matrix/api/client_server/unstable.html

Add optional fileName parameter to MatrixHttpClient.putMedia(File data, String type).

There is a currently a method defined for uploading files and specifying the content-type:
MatrixHttpClient.putMedia(File data, String type).

There should be an additional method which accepts a filename parameter:
MatrixHttpClient.putMedia(File data, String type, String filename)

The specification defines the URL query parameter filename.
See https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-media-r0-upload

The m.room.message with message type m.image specifies only the name that is displayed. However when downloading a file, the matrix client gets a random filename such as AgTxPeyqwuCUpoyPjAgBcVxH.png

NPE when fetching name for user

java.lang.NullPointerException
	at io.kamax.matrix.client.AMatrixHttpClient.extractAsStringFromBody(AMatrixHttpClient.java:317)
	at io.kamax.matrix.client.MatrixHttpUser.getName(MatrixHttpUser.java:62)
	at de.localtoast.palaver.sys.RoomRepository.fetchRoomName(RoomRepository.kt:87)
	at de.localtoast.palaver.sys.RoomRepository.prefetch(RoomRepository.kt:95)
	at de.localtoast.palaver.sys.events.MatrixEventProcessor.prefetch(MatrixEventProcessor.kt:99)
	at de.localtoast.palaver.sys.events.MatrixEventProcessor.access$prefetch(MatrixEventProcessor.kt:35)
	at de.localtoast.palaver.sys.events.MatrixEventProcessor$processNewEventsForRoom$1.invoke(MatrixEventProcessor.kt:84)
	at de.localtoast.palaver.sys.events.MatrixEventProcessor$processNewEventsForRoom$1.invoke(MatrixEventProcessor.kt:35)
	at tornadofx.FXTask.call(Async.kt:416)
	at javafx.concurrent.Task$TaskCallable.call(Task.java:1423)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

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.