Skip to content

Resubmit PR#2908+2951 Bot self identification and bug fix. #3625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions indra/llmessage/message_prehash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,3 +1402,4 @@ char const* const _PREHASH_HoverHeight = LLMessageStringTable::getInstance()->ge
char const* const _PREHASH_Experience = LLMessageStringTable::getInstance()->getString("Experience");
char const* const _PREHASH_ExperienceID = LLMessageStringTable::getInstance()->getString("ExperienceID");
char const* const _PREHASH_LargeGenericMessage = LLMessageStringTable::getInstance()->getString("LargeGenericMessage");
char const* const _PREHASH_MetaData = LLMessageStringTable::getInstance()->getString("MetaData");
1 change: 1 addition & 0 deletions indra/llmessage/message_prehash.h
Original file line number Diff line number Diff line change
Expand Up @@ -1403,5 +1403,6 @@ extern char const* const _PREHASH_HoverHeight;
extern char const* const _PREHASH_Experience;
extern char const* const _PREHASH_ExperienceID;
extern char const* const _PREHASH_LargeGenericMessage;
extern char const* const _PREHASH_MetaData;

#endif
49 changes: 45 additions & 4 deletions indra/newview/llimprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
U8 *binary_bucket,
S32 binary_bucket_size,
LLHost &sender,
LLSD metadata,
LLUUID aux_id)
{
LLChat chat;
Expand Down Expand Up @@ -451,6 +452,28 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
bool is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
LLMuteList::isLinden(name);

/***
* The simulator may have flagged this sender as a bot, if the viewer would like to display
* the chat text in a different color or font, the below code is how the viewer can
* tell if the sender is a bot.
*-----------------------------------------------------
bool is_bot = false;
if (metadata.has("sender"))
{ // The server has identified this sender as a bot.
is_bot = metadata["sender"]["bot"].asBoolean();
}
*-----------------------------------------------------
*/

std::string notice_name;
LLSD notice_args;
if (metadata.has("notice"))
{ // The server has injected a notice into the IM conversation.
// These will be things like bot notifications, etc.
notice_name = metadata["notice"]["id"].asString();
notice_args = metadata["notice"]["data"];
}

chat.mMuted = is_muted;
chat.mFromID = from_id;
chat.mFromName = name;
Expand Down Expand Up @@ -544,7 +567,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
}
else
{
// standard message, not from system
// standard message, server may have injected a notice into the conversation.
std::string saved;
if (offline == IM_OFFLINE)
{
Expand Down Expand Up @@ -579,8 +602,17 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
region_message = true;
}
}
gIMMgr->addMessage(
session_id,

std::string real_name;

if (!notice_name.empty())
{ // The simulator has injected some sort of notice into the conversation.
// findString will only replace the contents of buffer if the notice_id is found.
LLTrans::findString(buffer, notice_name, notice_args);
real_name = SYSTEM_FROM;
}

gIMMgr->addMessage(session_id,
from_id,
name,
buffer,
Expand All @@ -591,7 +623,9 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
region_id,
position,
region_message,
timestamp);
timestamp,
LLUUID::null,
real_name);
}
else
{
Expand Down Expand Up @@ -1627,6 +1661,12 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
from_group = message_data["from_group"].asString() == "Y";
}

LLSD metadata;
if (message_data.has("metadata"))
{
metadata = message_data["metadata"];
}

EInstantMessage dialog = static_cast<EInstantMessage>(message_data["dialog"].asInteger());
LLUUID session_id = message_data["transaction-id"].asUUID();
if (session_id.isNull() && dialog == IM_FROM_TASK)
Expand Down Expand Up @@ -1654,6 +1694,7 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
local_bin_bucket.data(),
S32(local_bin_bucket.size()),
local_sender,
metadata,
message_data["asset_id"].asUUID());
});

Expand Down
1 change: 1 addition & 0 deletions indra/newview/llimprocessing.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class LLIMProcessing
U8 *binary_bucket,
S32 binary_bucket_size,
LLHost &sender,
LLSD metadata,
LLUUID aux_id = LLUUID::null);

// Either receives list of offline messages from 'ReadOfflineMsgs' capability
Expand Down
13 changes: 10 additions & 3 deletions indra/newview/llimview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3142,9 +3142,16 @@ void LLIMMgr::addMessage(
const LLUUID& region_id,
const LLVector3& position,
bool is_region_msg,
U32 timestamp) // May be zero
U32 timestamp, // May be zero
LLUUID display_id,
std::string_view display_name)
{
LLUUID other_participant_id = target_id;
std::string message_display_name = (display_name.empty()) ? from : std::string(display_name);
if (display_id.isNull() && (display_name.empty()))
{
display_id = other_participant_id;
}

LLUUID new_session_id = session_id;
if (new_session_id.isNull())
Expand Down Expand Up @@ -3240,7 +3247,7 @@ void LLIMMgr::addMessage(
}

//Play sound for new conversations
if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation")))
if (!skip_message && !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation")))
{
make_ui_sound("UISndNewIncomingIMSession");
}
Expand All @@ -3254,7 +3261,7 @@ void LLIMMgr::addMessage(

if (!LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !skip_message)
{
LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, true, is_region_msg, timestamp);
LLIMModel::instance().addMessage(new_session_id, message_display_name, display_id, msg, true, is_region_msg, timestamp);
}

// Open conversation floater if offline messages are present
Expand Down
4 changes: 3 additions & 1 deletion indra/newview/llimview.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ class LLIMMgr : public LLSingleton<LLIMMgr>
const LLUUID& region_id = LLUUID::null,
const LLVector3& position = LLVector3::zero,
bool is_region_msg = false,
U32 timestamp = 0);
U32 timestamp = 0,
LLUUID display_id = LLUUID::null,
std::string_view display_name = "");

void addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args);

Expand Down
18 changes: 17 additions & 1 deletion indra/newview/llviewermessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2137,6 +2137,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
EInstantMessage dialog = (EInstantMessage)d;
LLHost sender = msg->getSender();

LLSD metadata;
if (msg->getNumberOfBlocksFast(_PREHASH_MetaData) > 0)
{
S32 metadata_size = msg->getSizeFast(_PREHASH_MetaData, 0, _PREHASH_Data);
std::string metadata_buffer;
metadata_buffer.resize(metadata_size, 0);

msg->getBinaryDataFast(_PREHASH_MetaData, _PREHASH_Data, &metadata_buffer[0], metadata_size, 0, metadata_size );
std::stringstream metadata_stream(metadata_buffer);
if (LLSDSerialize::fromBinary(metadata, metadata_stream, metadata_size) == LLSDParser::PARSE_FAILURE)
{
metadata.clear();
}
}

LLIMProcessing::processNewMessage(from_id,
from_group,
to_id,
Expand All @@ -2151,7 +2166,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
position,
binary_bucket,
binary_bucket_size,
sender);
sender,
metadata);
}

void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id)
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3723,6 +3723,10 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
<string name="conference-title-incoming">
Konference med [AGENT_NAME]
</string>
<string name="bot_warning">
Du chatter med en bot, [NAME]. Del ikke personlige oplysninger.
Læs mere på https://second.life/scripted-agents.
</string>
<string name="no_session_message">
(IM session eksisterer ikke)
</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,10 @@ Falls diese Meldung weiterhin angezeigt wird, wenden Sie sich bitte an [SUPPORT_
<string name="conference-title-incoming">Konferenz mit [AGENT_NAME]</string>
<string name="inventory_item_offered-im">Inventarobjekt „[ITEM_NAME]“ angeboten</string>
<string name="inventory_folder_offered-im">Inventarordner „[ITEM_NAME]“ angeboten</string>
<string name="bot_warning">
Sie chatten mit einem Bot, [NAME]. Geben Sie keine persönlichen Informationen weiter.
Erfahren Sie mehr unter https://second.life/scripted-agents.
</string>
<string name="share_alert">Objekte aus dem Inventar hier her ziehen</string>
<string name="facebook_post_success">Sie haben auf Facebook gepostet.</string>
<string name="flickr_post_success">Sie haben auf Flickr gepostet.</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3717,6 +3717,10 @@ Please reinstall viewer from https://secondlife.com/support/downloads/ and cont
<string name="inventory_folder_offered-im">
Inventory folder '[ITEM_NAME]' offered
</string>
<string name="bot_warning">
You are chatting with a bot, [NAME]. Do not share any personal information.
Learn more at https://second.life/scripted-agents.
</string>
<string name="share_alert">
Drag items from inventory here
</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,10 @@ Si sigues recibiendo este mensaje, contacta con [SUPPORT_SITE].</string>
<string name="conference-title-incoming">Conferencia con [AGENT_NAME]</string>
<string name="inventory_item_offered-im">Ítem del inventario '[ITEM_NAME]' ofrecido</string>
<string name="inventory_folder_offered-im">Carpeta del inventario '[ITEM_NAME]' ofrecida</string>
<string name="bot_warning">
Estás conversando con un bot, [NAME]. No compartas información personal.
Más información en https://second.life/scripted-agents.
</string>
<string name="share_alert">Arrastra los ítems desde el invenbtario hasta aquí</string>
<string name="facebook_post_success">Has publicado en Facebook.</string>
<string name="flickr_post_success">Has publicado en Flickr.</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,10 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].</string>
<string name="conference-title-incoming">Conférence avec [AGENT_NAME]</string>
<string name="inventory_item_offered-im">Objet de l’inventaire [ITEM_NAME] offert</string>
<string name="inventory_folder_offered-im">Dossier de l’inventaire [ITEM_NAME] offert</string>
<string name="bot_warning">
Vous discutez avec un bot, [NAME]. Ne partagez pas d’informations personnelles.
En savoir plus sur https://second.life/scripted-agents.
</string>
<string name="share_alert">Faire glisser les objets de l'inventaire ici</string>
<string name="facebook_post_success">Vous avez publié sur Facebook.</string>
<string name="flickr_post_success">Vous avez publié sur Flickr.</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,10 @@ Se il messaggio persiste, contatta [SUPPORT_SITE].</string>
<string name="conference-title-incoming">Chiamata in conferenza con [AGENT_NAME]</string>
<string name="inventory_item_offered-im">Offerto oggetto di inventario &quot;[ITEM_NAME]&quot;</string>
<string name="inventory_folder_offered-im">Offerta cartella di inventario &quot;[ITEM_NAME]&quot;</string>
<string name="bot_warning">
Stai parlando con un bot, [NAME]. Non condividere informazioni personali.
Scopri di più su https://second.life/scripted-agents.
</string>
<string name="facebook_post_success">Hai pubblicato su Facebook.</string>
<string name="flickr_post_success">Hai pubblicato su Flickr.</string>
<string name="twitter_post_success">Hai pubblicato su Twitter.</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6150,6 +6150,10 @@ www.secondlife.com から最新バージョンをダウンロードしてくだ
<string name="inventory_folder_offered-im">
フォルダ「[ITEM_NAME]」がインベントリに送られてきました。
</string>
<string name="bot_warning">
[NAME]とチャットしています。個人情報を共有しないでください。
詳細は https://second.life/scripted-agents をご覧ください。
</string>
<string name="share_alert">
インベントリからここにアイテムをドラッグします。
</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4413,6 +4413,10 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
<string name="inventory_folder_offered-im">
Zaoferowano folder: '[ITEM_NAME]'
</string>
<string name="bot_warning">
Rozmawiasz z botem [NAME]. Nie udostępniaj żadnych danych osobowych.
Dowiedz się więcej na https://second.life/scripted-agents.
</string>
<string name="share_alert">
Przeciągaj tutaj rzeczy z Szafy
</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1550,6 +1550,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE].</string>
<string name="conference-title-incoming">Conversa com [AGENT_NAME]</string>
<string name="inventory_item_offered-im">Item do inventário '[ITEM_NAME]' oferecido</string>
<string name="inventory_folder_offered-im">Pasta do inventário '[ITEM_NAME]' oferecida</string>
<string name="bot_warning">
Você está conversando com um bot, [NAME]. Não compartilhe informações pessoais.
Saiba mais em https://second.life/scripted-agents.
</string>
<string name="facebook_post_success">Você publicou no Facebook.</string>
<string name="flickr_post_success">Você publicou no Flickr.</string>
<string name="twitter_post_success">Você publicou no Twitter.</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4577,6 +4577,10 @@ support@secondlife.com.
<string name="inventory_folder_offered-im">
Предложена папка инвентаря «[ITEM_NAME]»
</string>
<string name="bot_warning">
Вы общаетесь с ботом [NAME]. Не передавайте личные данные.
Подробнее на https://second.life/scripted-agents.
</string>
<string name="share_alert">
Перетаскивайте вещи из инвентаря сюда
</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4580,6 +4580,10 @@ Bu iletiyi almaya devam ederseniz, lütfen [SUPPORT_SITE] bölümüne başvurun.
<string name="inventory_folder_offered-im">
&quot;[ITEM_NAME]&quot; envanter klasörü sunuldu
</string>
<string name="bot_warning">
Bir bot ile sohbet ediyorsunuz, [NAME]. Kişisel bilgilerinizi paylaşmayın.
Daha fazla bilgi için: https://second.life/scripted-agents.
</string>
<string name="share_alert">
Envanterinizden buraya öğeler sürükleyin
</string>
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4573,6 +4573,10 @@ http://secondlife.com/support 求助解決問題。
<string name="inventory_folder_offered-im">
收納區資料夾&apos;[ITEM_NAME]&apos;已向人提供
</string>
<string name="bot_warning">
您正在与人工智能机器人 [NAME] 聊天。请勿分享任何个人信息。
了解更多:https://second.life/scripted-agents。
</string>
<string name="share_alert">
將收納區物品拖曳到這裡
</string>
Expand Down