Permalink
Browse files

Actually solve SV-2103

Tons of duplicate code cleanup, yaaaay~
  • Loading branch information...
Lirusaito committed Jul 8, 2016
1 parent 873b399 commit 727a91b6891984ee6ade62a9a162582b666fe3fc
Showing with 14 additions and 41 deletions.
  1. +3 −34 indra/newview/llfloateravatarlist.cpp
  2. +11 −7 indra/newview/llviewermenu.cpp
@@ -1355,38 +1355,7 @@ void send_eject(const LLUUID& avatar_id, bool ban)
}
}
static void send_estate_message(
const char* request,
const LLUUID& target)
{
LLMessageSystem* msg = gMessageSystem;
LLUUID invoice;
// This seems to provide an ID so that the sim can say which request it's
// replying to. I think this can be ignored for now.
invoice.generate();
LL_INFOS() << "Sending estate request '" << request << "'" << LL_ENDL;
msg->newMessage("EstateOwnerMessage");
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgentID);
msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID);
msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
msg->nextBlock("MethodData");
msg->addString("Method", request);
msg->addUUID("Invoice", invoice);
// Agent id
msg->nextBlock("ParamList");
msg->addString("Parameter", gAgentID.asString().c_str());
// Target
msg->nextBlock("ParamList");
msg->addString("Parameter", target.asString().c_str());
msg->sendReliable(gAgent.getRegion()->getHost());
}
static void send_estate_message(const std::string request, const std::vector<std::string>& strings);
static void cmd_append_names(const LLAvatarListEntry* entry, std::string &str, std::string &sep)
{ if(!str.empty())str.append(sep);str.append(entry->getName()); }
@@ -1398,8 +1367,8 @@ static void cmd_freeze(const LLAvatarListEntry* entry) { send_freeze(entry->get
static void cmd_unfreeze(const LLAvatarListEntry* entry) { send_freeze(entry->getID(), false); }
static void cmd_eject(const LLAvatarListEntry* entry) { send_eject(entry->getID(), false); }
static void cmd_ban(const LLAvatarListEntry* entry) { send_eject(entry->getID(), true); }
static void cmd_estate_eject(const LLAvatarListEntry* entry){ send_estate_message("kickestate", entry->getID()); }
static void cmd_estate_tp_home(const LLAvatarListEntry* entry){ send_estate_message("teleporthomeuser", entry->getID()); }
static void cmd_estate_eject(const LLAvatarListEntry* entry){ send_estate_message("kickestate", {entry->getID().asString()}); }
static void cmd_estate_tp_home(const LLAvatarListEntry* entry){ send_estate_message("teleporthomeuser", {gAgentID.asString(), entry->getID().asString()}); }
static void cmd_estate_ban(const LLAvatarListEntry* entry) { LLPanelEstateInfo::sendEstateAccessDelta(ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | ESTATE_ACCESS_NO_REPLY, entry->getID()); }
void LLFloaterAvatarList::doCommand(avlist_command_t func, bool single/*=false*/) const
@@ -9182,18 +9182,22 @@ class ListFreeze : public view_listener_t
}
};
static void send_estate_message(const std::string request, const std::vector<std::string>& strings)
{
LLRegionInfoModel::sendEstateOwnerMessage(gMessageSystem, request, LLFloaterRegionInfo::getLastInvoice(), strings);
}
void estate_bulk_eject(const uuid_vec_t& ids, bool ban, S32 option)
{
if (ids.empty() || option == (ban ? 1 : 2)) return;
std::vector<std::string> strings(2, gAgentID.asString()); // [0] = our agent id
const std::string request(option == 1 ? "teleporthomeuser" : "kickestate");
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
const bool tphome(option == 1);
const std::string request(tphome ? "teleporthomeuser" : "kickestate");
const std::string agent(tphome ? gAgentID.asString() : LLStringUtil::null);
for (const LLUUID& id : ids)
{
LLUUID id(*it);
if (id.isNull()) continue;
strings[1] = id.asString(); // [1] = target agent id
LLRegionInfoModel::sendEstateOwnerMessage(gMessageSystem, request, LLFloaterRegionInfo::getLastInvoice(), strings);
const string idstr(id.asString());
send_estate_message(request, tphome ? {agent, idstr} : {idstr});
if (ban)
LLPanelEstateInfo::sendEstateAccessDelta(ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE | ESTATE_ACCESS_NO_REPLY, id);
}

0 comments on commit 727a91b

Please sign in to comment.