mark bots in chat title and profile as such

This commit is contained in:
B. Petersen 2024-08-09 16:47:07 +02:00 committed by bjoern
parent 2c5bbcf75e
commit 50e66c7e66
5 changed files with 15 additions and 2 deletions

View file

@ -1857,6 +1857,11 @@ JNIEXPORT jint Java_com_b44t_messenger_DcContact_getVerifierId(JNIEnv *env, jobj
return dc_contact_get_verifier_id(get_dc_contact(env, obj));
}
JNIEXPORT jboolean Java_com_b44t_messenger_DcContact_isBot(JNIEnv *env, jobject obj)
{
return dc_contact_is_bot(get_dc_contact(env, obj)) != 0;
}
/*******************************************************************************
* DcLot

View file

@ -58,6 +58,7 @@ public class DcContact {
public native boolean isBlocked ();
public native boolean isVerified ();
public native int getVerifierId ();
public native boolean isBot ();
// working with raw c-data
private long contactCPtr; // CAVE: the name is referenced in the JNI

View file

@ -104,7 +104,9 @@ public class ConversationTitleView extends RelativeLayout {
}
else {
DcContact dcContact = dcContext.getContact(chatContacts[0]);
if (profileView || !dcChat.isProtected()) {
if (!profileView && dcContact.isBot()) {
subtitleStr = context.getString(R.string.bot);
} else if (profileView || !dcChat.isProtected()) {
subtitleStr = dcContact.getAddr();
}
isOnline = dcContact.wasSeenRecently();

View file

@ -368,7 +368,11 @@ public class ProfileActivity extends PassphraseRequiredActionBarActivity
if (chatIsDeviceTalk) {
return getString(R.string.profile);
} else if(isContactProfile()) {
return getString(R.string.tab_contact);
if (dcContext.getContact(contactId).isBot()) {
return getString(R.string.bot);
} else {
return getString(R.string.tab_contact);
}
}
else if (chatIsBroadcast) {
return getString(R.string.broadcast_list);

View file

@ -162,6 +162,7 @@
<string name="video">Video</string>
<string name="documents">Documents</string>
<string name="contact">Contact</string>
<string name="bot">Bot</string>
<string name="camera">Camera</string>
<!-- As in "start a video recording" or "take a photo"; eg. the description of the "shutter button" in cameras -->
<string name="capture">Capture</string>