deltachat-bot / echo

An echo bot in multiple languages to get you started
The Unlicense
15 stars 4 forks source link

Java? #9

Open EchedelleLR opened 4 years ago

EchedelleLR commented 4 years ago

Whats about implement the same bot in Java?

Simon-Laux commented 4 years ago

good idea, but unfortunately the java bindings are not standalone, they are part of the android client. so this could be a bit tricky.

r10s commented 4 years ago

the java bindings are pretty separated, though. they are in the folder https://github.com/deltachat/deltachat-android/tree/master/src/com/b44t/messenger

@EchedeyLR so, if you want to push this forward, you can copy this folder (together with the jni part) and use it. or just use the whole deltachat-android as a subproject. of course, i expect some things to be adapted. also a "high-level" api missing.

if there are actual bots in java, at some point, we can think over to separate this, however, this comes at costs, so the advantages and disadvantages should be weighted carefully.

EchedelleLR commented 4 years ago

Thank you. I will check. As I never tried to mount a bot before I expected an example in the language I can use and try to extend from it.

Simon-Laux commented 3 years ago

The following imports depend on android / the android ui code:

DcEventCenter.java:
import org.thoughtcrime.securesms.util.Util;

DcChatlist.java:
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

DcContact.java:
import android.graphics.Color;
import android.util.Log;

DcContext.java:
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

DcMsg.java:
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.thoughtcrime.securesms.connect.ApplicationDcContext;
r10s commented 3 years ago

@Simon-Laux thanks for the list, i made a pr removing these dependencies, https://github.com/deltachat/deltachat-android/pull/1825

Simon-Laux commented 2 years ago

https://github.com/angelo-fuchs/dc-jni-playground is the attempt to make the java bindings standalone as a maven package

link2xt commented 4 months ago

With https://github.com/deltachat/deltachat-android/pull/2976 merged we still have Android-related hack https://github.com/deltachat/deltachat-android/blob/430c15861abf9fa64fe5708843eaa5a3570f4bdf/jni/dc_wrapper.c#L10-L58

It provides fallback implementations for getauxval and recvmmsg functions which don't exist in NDK version used to build Android currently.

Also need to move https://github.com/deltachat/deltachat-android/tree/430c15861abf9fa64fe5708843eaa5a3570f4bdf/src/com/b44t/messenger into a separate module. util/concurrent/SettableFuture.java and probably ListenableFuture.java comes from Signal code, that would need proper annotation and the whole package would be GPLv3+ not MPL like the core then.