add native function for getting chat-ids from chatlist

This commit is contained in:
B. Petersen
2018-09-08 01:58:03 +02:00
parent 82e50142b3
commit 57716f48d1
2 changed files with 11 additions and 4 deletions
+7 -1
View File
@@ -727,12 +727,18 @@ JNIEXPORT void Java_com_b44t_messenger_DcChatlist_DcChatlistUnref(JNIEnv *env, j
}
JNIEXPORT jint Java_com_b44t_messenger_DcChatlist_getCnt(JNIEnv *env, jobject obj, jlong hChatlist)
JNIEXPORT jint Java_com_b44t_messenger_DcChatlist_getCnt(JNIEnv *env, jobject obj)
{
return dc_chatlist_get_cnt(get_dc_chatlist(env, obj));
}
JNIEXPORT jint Java_com_b44t_messenger_DcChatlist_getChatId(JNIEnv *env, jobject obj, jint index)
{
return dc_chatlist_get_chat_id(get_dc_chatlist(env, obj), index);
}
JNIEXPORT jlong Java_com_b44t_messenger_DcChatlist_DcChatlistGetChatByIndex(JNIEnv *env, jclass c, jlong hChatlist, jint index)
{
dc_chatlist_t* chatlist = (dc_chatlist_t*)hChatlist;
+4 -3
View File
@@ -36,9 +36,10 @@ public class DcChatlist {
}
public native int getCnt();
public DcChat getChatByIndex(int index) { return new DcChat(DcChatlistGetChatByIndex(m_hChatlist, index)); }
public DcMsg getMsgByIndex(int index) { return new DcMsg(DcChatlistGetMsgByIndex(m_hChatlist, index)); }
public DcLot getSummaryByIndex(int index, DcChat chat) { return new DcLot(DcChatlistGetSummaryByIndex(m_hChatlist, index, chat==null? null : chat.getCPtr())); }
public native int getChatId(int index);
public DcChat getChat(int index) { return new DcChat(DcChatlistGetChatByIndex(m_hChatlist, index)); }
public DcMsg getMsg(int index) { return new DcMsg(DcChatlistGetMsgByIndex(m_hChatlist, index)); }
public DcLot getSummary(int index, DcChat chat) { return new DcLot(DcChatlistGetSummaryByIndex(m_hChatlist, index, chat==null? null : chat.getCPtr())); }
// working with raw c-data
private long m_hChatlist; // must not be renamed as referenced by JNI