-
Notifications
You must be signed in to change notification settings - Fork 64
Bot self identification. #2908
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
Bot self identification. #2908
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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; | ||
|
@@ -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) | ||
{ | ||
|
@@ -579,8 +602,16 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, | |
region_message = true; | ||
} | ||
} | ||
gIMMgr->addMessage( | ||
session_id, | ||
|
||
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); | ||
name = SYSTEM_FROM; | ||
from_id = LLUUID::null; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than bother with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your comment also flagged for me that the name |
||
|
||
gIMMgr->addMessage(session_id, | ||
from_id, | ||
name, | ||
buffer, | ||
|
@@ -592,6 +623,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id, | |
position, | ||
region_message, | ||
timestamp); | ||
|
||
} | ||
else | ||
{ | ||
|
@@ -1627,6 +1659,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) | ||
|
@@ -1654,6 +1692,7 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url) | |
local_bin_bucket.data(), | ||
S32(local_bin_bucket.size()), | ||
local_sender, | ||
metadata, | ||
message_data["asset_id"].asUUID()); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
b98fc0af5fa88601f5afa4f3c83f08188316e9a8 | ||
0d9706a9dfe23358140642a21db48980b3d016b2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment seems incorrect to assume the the sender has been flagged as a bot. For more correctness please indicate the server may or may not have flagged...
"The simulator has flagged this sender as a bot..." --> "The simulator may flag this sender as a bot in 'metadata'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The simulator may have flagged...