MAINT-8203 Fixing from_group processing in ReadOfflineMsgs cap

Sat, 24 Mar 2018 14:48:39 +0200

author
andreykproductengine <andreykproductengine@lindenlab.com>
date
Sat, 24 Mar 2018 14:48:39 +0200
changeset 55355
9123341e59d3
parent 55354
27143bdfa240
child 55356
16e1428630ee
child 55358
5e41325e8fcf

MAINT-8203 Fixing from_group processing in ReadOfflineMsgs cap

indra/newview/llimprocessing.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/llimprocessing.cpp	Fri Mar 23 19:14:41 2018 +0200
     1.2 +++ b/indra/newview/llimprocessing.cpp	Sat Mar 24 14:48:39 2018 +0200
     1.3 @@ -1440,7 +1440,7 @@
     1.4  
     1.5      if (!status) // success = httpResults["success"].asBoolean();
     1.6      {
     1.7 -        LL_WARNS() << "Error requesting offline messages via capability " << url << ", Status: " << status.toString() << "\nFalling back to legacy method." << LL_ENDL;
     1.8 +        LL_WARNS("Messaging") << "Error requesting offline messages via capability " << url << ", Status: " << status.toString() << "\nFalling back to legacy method." << LL_ENDL;
     1.9  
    1.10          requestOfflineMessagesLegacy();
    1.11          return;
    1.12 @@ -1450,10 +1450,11 @@
    1.13  
    1.14      if (!contents.size())
    1.15      {
    1.16 -        LL_WARNS() << "No contents received for offline messages via capability " << url << LL_ENDL;
    1.17 +        LL_WARNS("Messaging") << "No contents received for offline messages via capability " << url << LL_ENDL;
    1.18          return;
    1.19      }
    1.20  
    1.21 +    // Todo: once dirtsim-369 releases, remove one of the map/array options
    1.22      LLSD messages;
    1.23      if (contents.isArray())
    1.24      {
    1.25 @@ -1465,16 +1466,24 @@
    1.26      }
    1.27      else
    1.28      {
    1.29 -        LL_WARNS() << "Invalid offline message content received via capability " << url << LL_ENDL;
    1.30 +        LL_WARNS("Messaging") << "Invalid offline message content received via capability " << url << LL_ENDL;
    1.31          return;
    1.32      }
    1.33  
    1.34      if (!messages.isArray())
    1.35      {
    1.36 -        LL_WARNS() << "Invalid offline message content received via capability " << url << LL_ENDL;
    1.37 +        LL_WARNS("Messaging") << "Invalid offline message content received via capability " << url << LL_ENDL;
    1.38          return;
    1.39      }
    1.40  
    1.41 +    if (messages.emptyArray())
    1.42 +    {
    1.43 +        // Nothing to process
    1.44 +        return;
    1.45 +    }
    1.46 +
    1.47 +    LL_INFOS("Messaging") << "Processing offline messages." << LL_ENDL;
    1.48 +
    1.49      std::vector<U8> data;
    1.50      S32 binary_bucket_size = 0;
    1.51      LLHost sender = gAgent.getRegion()->getHost();
    1.52 @@ -1487,10 +1496,21 @@
    1.53          LLVector3 position(message_data["local_x"].asReal(), message_data["local_y"].asReal(), message_data["local_z"].asReal());
    1.54          data = message_data["binary_bucket"].asBinary();
    1.55          binary_bucket_size = data.size(); // message_data["count"] == data.size() - 1 due to ('\0')
    1.56 -        U32 parent_estate_id = message_data.has("parent_estate_id") ? message_data["ParentEstateID"].asInteger() : 1; // 1 - IMMainland
    1.57 +        U32 parent_estate_id = message_data.has("parent_estate_id") ? message_data["parent_estate_id"].asInteger() : 1; // 1 - IMMainland
    1.58 +
    1.59 +        // Todo: once dirtsim-369 releases, remove one of the int/str options
    1.60 +        BOOL from_group;
    1.61 +        if (message_data["from_group"].isInteger())
    1.62 +        {
    1.63 +            from_group = message_data["from_group"].asInteger();
    1.64 +        }
    1.65 +        else
    1.66 +        {
    1.67 +            from_group = message_data["from_group"].asString() == "Y";
    1.68 +        }
    1.69  
    1.70          LLIMProcessing::processNewMessage(message_data["from_agent_id"].asUUID(),
    1.71 -            message_data["from_group"].asInteger(), // BOOL
    1.72 +            from_group,
    1.73              message_data["to_agent_id"].asUUID(),
    1.74              IM_OFFLINE,
    1.75              (EInstantMessage)message_data["dialog"].asInteger(),
    1.76 @@ -1509,6 +1529,8 @@
    1.77  
    1.78  void LLIMProcessing::requestOfflineMessagesLegacy()
    1.79  {
    1.80 +    LL_INFOS("Messaging") << "Requesting offline messages (Legacy)." << LL_ENDL;
    1.81 +
    1.82      LLMessageSystem* msg = gMessageSystem;
    1.83      msg->newMessageFast(_PREHASH_RetrieveInstantMessages);
    1.84      msg->nextBlockFast(_PREHASH_AgentData);

mercurial