mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Show user names in group chats.
This commit is contained in:
@@ -169,7 +169,7 @@ 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, long hMailbox, jint id)
|
||||
JNIEXPORT jlong Java_org_telegram_messenger_MrMailbox_MrMailboxGetContactById(JNIEnv *env, jclass c, jlong hMailbox, jint id)
|
||||
{
|
||||
return (jlong)mrmailbox_get_contact_by_id((mrmailbox_t*)hMailbox, id);
|
||||
}
|
||||
@@ -451,6 +451,29 @@ JNIEXPORT jint Java_org_telegram_messenger_MrMailbox_MrMsgGetToId(JNIEnv *env, j
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MrContact
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
JNIEXPORT void Java_org_telegram_messenger_MrMailbox_MrContactUnref(JNIEnv *env, jclass c, jlong hContact)
|
||||
{
|
||||
mrcontact_unref((mrcontact_t*)hContact);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_org_telegram_messenger_MrMailbox_MrContactGetDisplayName(JNIEnv *env, jclass c, jlong hContact)
|
||||
{
|
||||
mrcontact_t* ths = (mrcontact_t*)hContact; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
if( ths->m_name && ths->m_name[0] ) {
|
||||
return JSTRING_NEW(ths->m_name);
|
||||
}
|
||||
else {
|
||||
return JSTRING_NEW(ths->m_addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MrPoortext
|
||||
******************************************************************************/
|
||||
|
||||
@@ -130,7 +130,7 @@ public class MrMailbox {
|
||||
public native static void MrMailboxDisconnect (long hMailbox);
|
||||
public native static int MrMailboxFetch (long hMailbox);
|
||||
|
||||
public native static long MrMailboxGetContactById (long hMailbox);// returns hContact which must be unref'd after usage
|
||||
public native static long MrMailboxGetContactById (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
|
||||
@@ -178,6 +178,10 @@ public class MrMailbox {
|
||||
public native static int MrMsgGetFromId (long hMsg);
|
||||
public native static int MrMsgGetToId (long hMsg);
|
||||
|
||||
// MrContact objects
|
||||
public native static void MrContactUnref (long hContact);
|
||||
public native static String MrContactGetDisplayName (long hContact);
|
||||
|
||||
// MrPoortext objects
|
||||
public native static void MrPoortextUnref (long hPoortext);
|
||||
public native static String MrPoortextGetTitle (long hPoortext);
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.telegram.messenger.FileLoader;
|
||||
import org.telegram.messenger.FileLog;
|
||||
import org.telegram.messenger.MessageObject;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.MrMailbox;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.SendMessagesHelper;
|
||||
import org.telegram.messenger.UserObject;
|
||||
@@ -3981,6 +3982,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
String viaUsername = null;
|
||||
CharSequence viaString = null;
|
||||
/*EDIT BY MR
|
||||
if (messageObject.messageOwner.via_bot_id != 0) {
|
||||
TLRPC.User botUser = MessagesController.getInstance().getUser(messageObject.messageOwner.via_bot_id);
|
||||
if (botUser != null && botUser.username != null && botUser.username.length() > 0) {
|
||||
@@ -3994,6 +3996,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
viaString = replaceTags(String.format(" via <b>%s</b>", viaUsername));
|
||||
viaWidth = (int) Math.ceil(replyNamePaint.measureText(viaString, 0, viaString.length()));
|
||||
}
|
||||
*/
|
||||
|
||||
boolean authorName = drawName && isChat && !currentMessageObject.isOutOwner();
|
||||
boolean viaBot = (messageObject.messageOwner.fwd_from == null || messageObject.type == 14) && viaUsername != null;
|
||||
@@ -4006,7 +4009,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
if (authorName) {
|
||||
if (currentUser != null) {
|
||||
currentNameString = UserObject.getUserName(currentUser);
|
||||
// EDIT BY MR
|
||||
long hContact= MrMailbox.MrMailboxGetContactById(MrMailbox.hMailbox, currentUser.id);
|
||||
currentNameString = MrMailbox.MrContactGetDisplayName(hContact);
|
||||
MrMailbox.MrContactUnref(hContact);
|
||||
// /EDIT BY MR
|
||||
} else if (currentChat != null) {
|
||||
currentNameString = currentChat.title;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user