Skip to content

Commit

Permalink
adapt to simplified api
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Oct 14, 2024
1 parent c9a833a commit 9c03cbb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions jni/dc_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1723,9 +1723,9 @@ JNIEXPORT jlong Java_com_b44t_messenger_DcMsg_getParentCPtr(JNIEnv *env, jobject
}


JNIEXPORT jlong Java_com_b44t_messenger_DcMsg_getOriginalMsgCPtr(JNIEnv *env, jobject obj)
JNIEXPORT jint Java_com_b44t_messenger_DcMsg_getOriginalMsgId(JNIEnv *env, jobject obj)
{
return (jlong)dc_msg_get_original_msg(get_dc_msg(env, obj));
return (jint)dc_msg_get_original_msg_id(get_dc_msg(env, obj));
}


Expand Down
6 changes: 1 addition & 5 deletions src/main/java/com/b44t/messenger/DcMsg.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,9 @@ public DcMsg getParent() {

public boolean hasOriginal () { return getOriginalChatId() != 0; }
public native int getOriginalChatId ();
public native int getOriginalMsgId ();
public native int getSavedMsgId ();

public DcMsg getOriginalMsg() {
long cPtr = getOriginalMsgCPtr();
return cPtr != 0 ? new DcMsg(cPtr) : null;
}

public File getFileAsFile() {
if(getFile()==null)
throw new AssertionError("expected a file to be present.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ protected void handleShowInChat(final DcMsg savedMsg) {
Intent intent = new Intent(getContext(), ConversationActivity.class);
intent.putExtra(ConversationActivity.CHAT_ID_EXTRA, savedMsg.getOriginalChatId());

DcMsg originalMsg = savedMsg.getOriginalMsg();
if (originalMsg != null) {
intent.putExtra(ConversationActivity.STARTING_POSITION_EXTRA, DcMsg.getMessagePosition(originalMsg, dcContext));
int originalMsgId = savedMsg.getOriginalMsgId();
if (originalMsgId != 0) {
intent.putExtra(ConversationActivity.STARTING_POSITION_EXTRA, DcMsg.getMessagePosition(dcContext.getMsg(originalMsgId), dcContext));
}

startActivity(intent);
Expand Down

0 comments on commit 9c03cbb

Please sign in to comment.