summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2018-04-02 20:16:09 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2018-04-02 20:16:09 +0300
commit1dd695822098608fd47c5a816fea6c62fcd565aa (patch)
tree87acfe1c6720c81f5c65591a0d21d667f7822a23 /indra
parentf271522d918b125ec8f83758e95bc26b4f1fe5f9 (diff)
parent47f5a2f7f9482eced5451e4bf9a61114c56575ee (diff)
Merged in lindenlab/viewer-lynx
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llimprocessing.cpp179
-rw-r--r--indra/newview/llimprocessing.h3
2 files changed, 131 insertions, 51 deletions
diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp
index b6943bbfae..da0c218f9f 100644
--- a/indra/newview/llimprocessing.cpp
+++ b/indra/newview/llimprocessing.cpp
@@ -42,6 +42,7 @@
#include "llnotificationmanager.h"
#include "llpanelgroup.h"
#include "llregionhandle.h"
+#include "llsdserialize.h"
#include "llslurl.h"
#include "llstring.h"
#include "lltoastnotifypanel.h"
@@ -420,7 +421,8 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
LLVector3 position,
U8 *binary_bucket,
S32 binary_bucket_size,
- LLHost &sender)
+ LLHost &sender,
+ LLUUID aux_id)
{
LLChat chat;
std::string buffer;
@@ -591,14 +593,44 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
case IM_TYPING_START:
{
- LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
+ std::vector<U8> bucket(binary_bucket[0], binary_bucket_size);
+ LLSD data;
+ data["binary_bucket"] = bucket;
+ LLPointer<LLIMInfo> im_info = new LLIMInfo(from_id,
+ from_group,
+ to_id,
+ dialog,
+ agentName,
+ message,
+ session_id,
+ parent_estate_id,
+ region_id,
+ position,
+ data,
+ offline,
+ timestamp);
gIMMgr->processIMTypingStart(im_info);
}
break;
case IM_TYPING_STOP:
{
- LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
+ std::vector<U8> bucket(binary_bucket[0], binary_bucket_size);
+ LLSD data;
+ data["binary_bucket"] = bucket;
+ LLPointer<LLIMInfo> im_info = new LLIMInfo(from_id,
+ from_group,
+ to_id,
+ dialog,
+ agentName,
+ message,
+ session_id,
+ parent_estate_id,
+ region_id,
+ position,
+ data,
+ offline,
+ timestamp);
gIMMgr->processIMTypingStop(im_info);
}
break;
@@ -614,54 +646,77 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
case IM_GROUP_NOTICE_REQUESTED:
{
LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL;
- // Read the binary bucket for more information.
- struct notice_bucket_header_t
- {
- U8 has_inventory;
- U8 asset_type;
- LLUUID group_id;
- };
- struct notice_bucket_full_t
- {
- struct notice_bucket_header_t header;
- U8 item_name[DB_INV_ITEM_NAME_BUF_SIZE];
- }*notice_bin_bucket;
-
- // Make sure the binary bucket is big enough to hold the header
- // and a null terminated item name.
- if ((binary_bucket_size < (S32)((sizeof(notice_bucket_header_t) + sizeof(U8))))
- || (binary_bucket[binary_bucket_size - 1] != '\0'))
- {
- LL_WARNS("Messaging") << "Malformed group notice binary bucket" << LL_ENDL;
- break;
- }
- // The group notice packet does not have an AgentID. Obtain one from the name cache.
- // If last name is "Resident" strip it out so the cache name lookup works.
- S32 index = original_name.find(" Resident");
- if (index != std::string::npos)
+ LLUUID agent_id = from_id;
+ U8 has_inventory;
+ U8 asset_type = 0;
+ LLUUID group_id;
+ std::string item_name;
+
+ if (aux_id.notNull())
{
- original_name = original_name.substr(0, index);
- }
+ // aux_id contains group id, binary bucket contains name and asset type
+ group_id = aux_id;
+ has_inventory = binary_bucket_size > 1 ? TRUE : FALSE;
+ from_group = TRUE; // inaccurate value correction
+ if (has_inventory)
+ {
+ std::string str_bucket = ll_safe_string((char*)binary_bucket, binary_bucket_size);
- std::string legacy_name = gCacheName->buildLegacyName(original_name);
- LLUUID agent_id = LLAvatarNameCache::findIdByName(legacy_name);
+ typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+ boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
+ tokenizer tokens(str_bucket, sep);
+ tokenizer::iterator iter = tokens.begin();
- if (agent_id.isNull())
+ asset_type = (LLAssetType::EType)(atoi((*(iter++)).c_str()));
+ iter++; // wearable type if applicable, otherwise asset type
+ item_name = std::string((*(iter++)).c_str());
+ // Note There is more elements in 'tokens' ...
+
+
+ for (int i = 0; i < 6; i++)
+ {
+ LL_WARNS() << *(iter++) << LL_ENDL;
+ iter++;
+ }
+ }
+ }
+ else
{
- LL_WARNS("Messaging") << "buildLegacyName returned null while processing " << original_name << LL_ENDL;
+ // All info is in binary bucket, read it for more information.
+ struct notice_bucket_header_t
+ {
+ U8 has_inventory;
+ U8 asset_type;
+ LLUUID group_id;
+ };
+ struct notice_bucket_full_t
+ {
+ struct notice_bucket_header_t header;
+ U8 item_name[DB_INV_ITEM_NAME_BUF_SIZE];
+ }*notice_bin_bucket;
+
+ // Make sure the binary bucket is big enough to hold the header
+ // and a null terminated item name.
+ if ((binary_bucket_size < (S32)((sizeof(notice_bucket_header_t) + sizeof(U8))))
+ || (binary_bucket[binary_bucket_size - 1] != '\0'))
+ {
+ LL_WARNS("Messaging") << "Malformed group notice binary bucket" << LL_ENDL;
+ break;
+ }
+
+ notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0];
+ has_inventory = notice_bin_bucket->header.has_inventory;
+ asset_type = notice_bin_bucket->header.asset_type;
+ group_id = notice_bin_bucket->header.group_id;
+ item_name = ll_safe_string((const char*)notice_bin_bucket->item_name);
}
- else if (LLMuteList::getInstance()->isMuted(agent_id))
+
+ if (agent_id.notNull() && LLMuteList::getInstance()->isMuted(agent_id))
{
break;
}
- notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0];
- U8 has_inventory = notice_bin_bucket->header.has_inventory;
- U8 asset_type = notice_bin_bucket->header.asset_type;
- LLUUID group_id = notice_bin_bucket->header.group_id;
- std::string item_name = ll_safe_string((const char*)notice_bin_bucket->item_name);
-
// If there is inventory, give the user the inventory offer.
LLOfferInfo* info = NULL;
@@ -1440,7 +1495,7 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
if (!status) // success = httpResults["success"].asBoolean();
{
- LL_WARNS() << "Error requesting offline messages via capability " << url << ", Status: " << status.toString() << "\nFalling back to legacy method." << LL_ENDL;
+ LL_WARNS("Messaging") << "Error requesting offline messages via capability " << url << ", Status: " << status.toString() << "\nFalling back to legacy method." << LL_ENDL;
requestOfflineMessagesLegacy();
return;
@@ -1450,10 +1505,11 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
if (!contents.size())
{
- LL_WARNS() << "No contents received for offline messages via capability " << url << LL_ENDL;
+ LL_WARNS("Messaging") << "No contents received for offline messages via capability " << url << LL_ENDL;
return;
}
+ // Todo: once dirtsim-369 releases, remove one of the map/array options
LLSD messages;
if (contents.isArray())
{
@@ -1465,16 +1521,24 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
}
else
{
- LL_WARNS() << "Invalid offline message content received via capability " << url << LL_ENDL;
+ LL_WARNS("Messaging") << "Invalid offline message content received via capability " << url << LL_ENDL;
return;
}
if (!messages.isArray())
{
- LL_WARNS() << "Invalid offline message content received via capability " << url << LL_ENDL;
+ LL_WARNS("Messaging") << "Invalid offline message content received via capability " << url << LL_ENDL;
return;
}
+ if (messages.emptyArray())
+ {
+ // Nothing to process
+ return;
+ }
+
+ LL_INFOS("Messaging") << "Processing offline messages." << LL_ENDL;
+
std::vector<U8> data;
S32 binary_bucket_size = 0;
LLHost sender = gAgent.getRegion()->getHost();
@@ -1484,17 +1548,29 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
for (; i != iEnd; ++i)
{
const LLSD &message_data(*i);
+
LLVector3 position(message_data["local_x"].asReal(), message_data["local_y"].asReal(), message_data["local_z"].asReal());
data = message_data["binary_bucket"].asBinary();
- binary_bucket_size = data.size(); // message_data["count"] == data.size() - 1 due to ('\0')
- U32 parent_estate_id = message_data.has("parent_estate_id") ? message_data["ParentEstateID"].asInteger() : 1; // 1 - IMMainland
+ binary_bucket_size = data.size(); // message_data["count"] always 0
+ U32 parent_estate_id = message_data.has("parent_estate_id") ? message_data["parent_estate_id"].asInteger() : 1; // 1 - IMMainland
+
+ // Todo: once dirtsim-369 releases, remove one of the int/str options
+ BOOL from_group;
+ if (message_data["from_group"].isInteger())
+ {
+ from_group = message_data["from_group"].asInteger();
+ }
+ else
+ {
+ from_group = message_data["from_group"].asString() == "Y";
+ }
LLIMProcessing::processNewMessage(message_data["from_agent_id"].asUUID(),
- message_data["from_group"].asInteger(), // BOOL
+ from_group,
message_data["to_agent_id"].asUUID(),
IM_OFFLINE,
(EInstantMessage)message_data["dialog"].asInteger(),
- message_data["session_id"].asUUID(),
+ LLUUID::null, // session id, fix this for friendship offers to work
message_data["timestamp"].asInteger(),
message_data["from_agent_name"].asString(),
message_data["message"].asString(),
@@ -1503,12 +1579,15 @@ void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
position,
&data[0],
binary_bucket_size,
- sender);
+ sender,
+ message_data["asset_id"].asUUID()); // not necessarily an asset
}
}
void LLIMProcessing::requestOfflineMessagesLegacy()
{
+ LL_INFOS("Messaging") << "Requesting offline messages (Legacy)." << LL_ENDL;
+
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_RetrieveInstantMessages);
msg->nextBlockFast(_PREHASH_AgentData);
diff --git a/indra/newview/llimprocessing.h b/indra/newview/llimprocessing.h
index eadf34ded7..4d20b963a4 100644
--- a/indra/newview/llimprocessing.h
+++ b/indra/newview/llimprocessing.h
@@ -47,7 +47,8 @@ public:
LLVector3 position,
U8 *binary_bucket,
S32 binary_bucket_size,
- LLHost &sender);
+ LLHost &sender,
+ LLUUID aux_id = LLUUID::null);
// Either receives list of offline messages from 'ReadOfflineMsgs' capability
// or uses legacy method