Naming convention: Get-by-id is the default.

This commit is contained in:
B. Petersen
2016-11-15 12:39:50 +01:00
parent 6d20fde551
commit 3b37d11337
8 changed files with 34 additions and 34 deletions
+12 -12
View File
@@ -169,9 +169,9 @@ JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxFetch(JNIEnv *env,
/* MrMailbox - handle contacts */
JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxGetContactById(JNIEnv *env, jclass c, jlong hMailbox, jint id)
JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxGetContact(JNIEnv *env, jclass c, jlong hMailbox, jint id)
{
return (jlong)mrmailbox_get_contact_by_id((mrmailbox_t*)hMailbox, id);
return (jlong)mrmailbox_get_contact((mrmailbox_t*)hMailbox, id);
}
@@ -183,15 +183,15 @@ JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxGetChatlist(JNIEn
}
JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxGetChatById(JNIEnv *env, jclass c, jlong hMailbox, jint id)
JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxGetChat(JNIEnv *env, jclass c, jlong hMailbox, jint id)
{
return (jlong)mrmailbox_get_chat_by_id((mrmailbox_t*)hMailbox, id);
return (jlong)mrmailbox_get_chat((mrmailbox_t*)hMailbox, id);
}
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxMarkseenChatById(JNIEnv *env, jclass c, jlong hMailbox, jint chat_id)
JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxMarkseenChat(JNIEnv *env, jclass c, jlong hMailbox, jint chat_id)
{
return (jlong)mrmailbox_markseen_chat_by_id((mrmailbox_t*)hMailbox, chat_id);
return (jlong)mrmailbox_markseen_chat((mrmailbox_t*)hMailbox, chat_id);
}
@@ -203,24 +203,24 @@ JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMailboxCreateChatByContac
/* MrMailbox - handle messages */
JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxGetMsgById(JNIEnv *env, jclass c, jlong hMailbox, jint id)
JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxGetMsg(JNIEnv *env, jclass c, jlong hMailbox, jint id)
{
return (jlong)mrmailbox_get_msg_by_id((mrmailbox_t*)hMailbox, id);
return (jlong)mrmailbox_get_msg((mrmailbox_t*)hMailbox, id);
}
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrMailboxGetTxtRawById(JNIEnv *env, jclass c, jlong hMailbox, jint msg_id)
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrMailboxGetMsgInfo(JNIEnv *env, jclass c, jlong hMailbox, jint msg_id)
{
char* temp = mrmailbox_get_txt_raw_by_id((mrmailbox_t*)hMailbox, msg_id);
char* temp = mrmailbox_get_msg_info((mrmailbox_t*)hMailbox, msg_id);
jstring ret = JSTRING_NEW(temp);
free(temp);
return ret;
}
JNIEXPORT void Java_org_telegram_messenger_MrMailbox_MrMailboxDeleteMsgById(JNIEnv *env, jclass c, jlong hMailbox, jint id)
JNIEXPORT void Java_org_telegram_messenger_MrMailbox_MrMailboxDeleteMsg(JNIEnv *env, jclass c, jlong hMailbox, jint id)
{
mrmailbox_delete_msg_by_id((mrmailbox_t*)hMailbox, id);
mrmailbox_delete_msg((mrmailbox_t*)hMailbox, id);
}
@@ -218,17 +218,17 @@ public class MrMailbox {
public native static void MrMailboxDisconnect (long hMailbox);
public native static int MrMailboxFetch (long hMailbox);
public native static long MrMailboxGetContactById (long hMailbox, int id);// returns hContact which must be unref'd after usage
public native static long MrMailboxGetContact (long hMailbox, int id);// returns hContact which must be unref'd after usage
public native static long MrMailboxGetChatlist (long hMailbox); // returns hChatlist which must be unref'd after usage
public native static long MrMailboxGetChatById (long hMailbox, int id); // return hChat which must be unref'd after usage
public native static int MrMailboxMarkseenChatById (long hMailbox, int id);
public native static long MrMailboxGetChat (long hMailbox, int id); // return hChat which must be unref'd after usage
public native static int MrMailboxMarkseenChat (long hMailbox, int id);
public native static int MrMailboxCreateChatByContactId(long hMailbox, int contact_id); // returns chat_id
public native static int[] MrMailboxGetChatMedia (long hMailbox, int chat_id, int msg_type, int or_msg_type);
public native static int[] MrMailboxGetChatContacts (long hMailbox, int chat_id);
public native static long MrMailboxGetMsgById (long hMailbox, int id); // return hMsg which must be unref'd after usage
public native static String MrMailboxGetTxtRawById (long hMailbox, int id);
public native static void MrMailboxDeleteMsgById (long hMailbox, int id);
public native static long MrMailboxGetMsg (long hMailbox, int id); // return hMsg which must be unref'd after usage
public native static String MrMailboxGetMsgInfo (long hMailbox, int id);
public native static void MrMailboxDeleteMsg (long hMailbox, int id);
public native static int MrMailboxSetConfig (long hMailbox, String key, String value); // value may be NULL
public native static String MrMailboxGetConfig (long hMailbox, String key, String def); // def may be NULL, returns empty string as NULL
public native static int MrMailboxGetConfigInt (long hMailbox, String key, int def); // def may be NULL, returns empty string as NULL
@@ -800,7 +800,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
// SEND MESSAGE
// -------------------------------------------------------------------------------------
long hChat = MrMailbox.MrMailboxGetChatById(MrMailbox.hMailbox, (int)peer);
long hChat = MrMailbox.MrMailboxGetChat(MrMailbox.hMailbox, (int)peer);
if (type == 0 /*|| type == 9 && message != null && encryptedChat != null*/ )
{
@@ -1120,7 +1120,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
public boolean isSendingMessage(int mid) {
//return sendingMessages.containsKey(mid);
boolean isSending = false;
long hMsg = MrMailbox.MrMailboxGetMsgById(MrMailbox.hMailbox, mid);
long hMsg = MrMailbox.MrMailboxGetMsg(MrMailbox.hMailbox, mid);
int state = MrMailbox.MrMsgGetState(hMsg);
if( state == MrMailbox.MR_OUT_PENDING || state == MrMailbox.MR_OUT_SENDING ) {
isSending = true;
@@ -86,7 +86,7 @@ public class DraftQuery {
}
public static TLRPC.DraftMessage getDraft(long did) { // returns null for "no draft"
long hChat = MrMailbox.MrMailboxGetChatById(MrMailbox.hMailbox, (int)did);
long hChat = MrMailbox.MrMailboxGetChat(MrMailbox.hMailbox, (int)did);
if( hChat == 0 ) {
return null;
}
@@ -98,7 +98,7 @@ public class DraftQuery {
}
public static TLRPC.Message getDraftMessage(long did) { // returns null for "no draft"
long hChat = MrMailbox.MrMailboxGetChatById(MrMailbox.hMailbox, (int)did);
long hChat = MrMailbox.MrMailboxGetChat(MrMailbox.hMailbox, (int)did);
if( hChat == 0 ) {
return null;
}
@@ -111,7 +111,7 @@ public class DraftQuery {
private static void saveDraft__(long did, String message, long replyToMessageId) // message may be null
{
long hChat = MrMailbox.MrMailboxGetChatById(MrMailbox.hMailbox, (int)did);
long hChat = MrMailbox.MrMailboxGetChat(MrMailbox.hMailbox, (int)did);
MrMailbox.MrChatSetDraft(hChat, message, replyToMessageId);
MrMailbox.MrChatUnref(hChat);
}
@@ -3637,7 +3637,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
String cname = "";
if(currentUser!=null && isChat) {
long hContact = MrMailbox.MrMailboxGetContactById(MrMailbox.hMailbox, currentUser.id);
long hContact = MrMailbox.MrMailboxGetContact(MrMailbox.hMailbox, currentUser.id);
cname = MrMailbox.MrContactGetDisplayName(hContact);
MrMailbox.MrContactUnref(hContact);
}
@@ -355,8 +355,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
// EDIT BY MR -- set up the values so that the activity gets usable
dialog_id = arguments.getInt("chat_id", 0);
MrMailbox.MrMailboxMarkseenChatById(MrMailbox.hMailbox, (int)dialog_id);
m_hChat = MrMailbox.MrMailboxGetChatById(MrMailbox.hMailbox, (int)dialog_id);
MrMailbox.MrMailboxMarkseenChat(MrMailbox.hMailbox, (int)dialog_id);
m_hChat = MrMailbox.MrMailboxGetChat(MrMailbox.hMailbox, (int)dialog_id);
currentChat = new TLRPC.Chat();
currentChat.id = (int)dialog_id;
// /EDIT BY MR
@@ -781,7 +781,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (id == id_info) {
if( selectedMessagesIds[0]!=null && selectedMessagesIds[0].size()==1) {
ArrayList<Integer> ids = new ArrayList<>(selectedMessagesIds[0].keySet());
String info_str = MrMailbox.MrMailboxGetTxtRawById(MrMailbox.hMailbox, ids.get(0));
String info_str = MrMailbox.MrMailboxGetMsgInfo(MrMailbox.hMailbox, ids.get(0));
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(info_str);
@@ -3514,11 +3514,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatActivityEnterView.closeKeyboard();
}
long hMsg = MrMailbox.MrMailboxGetMsgById(MrMailbox.hMailbox, messageId);
long hMsg = MrMailbox.MrMailboxGetMsg(MrMailbox.hMailbox, messageId);
if( hMsg==0 ) { return; }
final int fromId = MrMailbox.MrMsgGetFromId(hMsg);
long hContact = MrMailbox.MrMailboxGetContactById(MrMailbox.hMailbox, fromId);
long hContact = MrMailbox.MrMailboxGetContact(MrMailbox.hMailbox, fromId);
if( hContact==0 ) { MrMailbox.MrMsgUnref(hMsg); return; }
String name = MrMailbox.MrContactGetName(hContact);
@@ -4987,7 +4987,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else if (id == NotificationCenter.messagesSentOrRead) {
int back_id = MrMailbox.MrChatGetId(m_hChat);
MrMailbox.MrChatUnref(m_hChat);
MrMailbox.MrMailboxGetChatById(MrMailbox.hMailbox, back_id);
MrMailbox.MrMailboxGetChat(MrMailbox.hMailbox, back_id);
int evt_read = (int)args[0];
int evt_chat_id = (int)args[1];
@@ -6111,7 +6111,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
for (HashMap.Entry<Integer, MessageObject> entry : selectedMessagesIds[a].entrySet()) {
MessageObject msg = entry.getValue();
int id_to_del = msg.messageOwner.id;
MrMailbox.MrMailboxDeleteMsgById(MrMailbox.hMailbox, id_to_del);
MrMailbox.MrMailboxDeleteMsg(MrMailbox.hMailbox, id_to_del);
}
NotificationCenter.getInstance().postNotificationName(NotificationCenter.messagesDeleted, ids, 0);
}
@@ -6328,7 +6328,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
String str = "";
if (name) {
if (previousUid != messageObject.messageOwner.from_id) {
long hContact = MrMailbox.MrMailboxGetContactById(MrMailbox.hMailbox, messageObject.messageOwner.from_id);
long hContact = MrMailbox.MrMailboxGetContact(MrMailbox.hMailbox, messageObject.messageOwner.from_id);
str += MrMailbox.MrContactGetDisplayName(hContact) + ":\n";
MrMailbox.MrContactUnref(hContact);
}
@@ -2711,7 +2711,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if( currentMessageObject!=null && currentMessageObject.messageOwner!=null )
{
long hContact = MrMailbox.MrMailboxGetContactById(MrMailbox.hMailbox, currentMessageObject.messageOwner.from_id);
long hContact = MrMailbox.MrMailboxGetContact(MrMailbox.hMailbox, currentMessageObject.messageOwner.from_id);
nameTextView.setText(MrMailbox.MrContactGetDisplayName(hContact));
MrMailbox.MrContactUnref(hContact);
}
@@ -1415,7 +1415,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
String newString;
String newString2;
long hContact = MrMailbox.MrMailboxGetContactById(MrMailbox.hMailbox, user_id);
long hContact = MrMailbox.MrMailboxGetContact(MrMailbox.hMailbox, user_id);
newString = MrMailbox.MrContactGetDisplayName(hContact);
newString2 = MrMailbox.MrContactGetAddr(hContact);
MrMailbox.MrContactUnref(hContact);