diff options
Diffstat (limited to 'linden/indra/newview/llfloatermap.cpp')
-rw-r--r-- | linden/indra/newview/llfloatermap.cpp | 533 |
1 files changed, 428 insertions, 105 deletions
diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 9ade3bf..29a95c2 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp | |||
@@ -47,11 +47,16 @@ | |||
47 | #include "llfloaterfriends.h" | 47 | #include "llfloaterfriends.h" |
48 | #include "llfloatergroupinvite.h" | 48 | #include "llfloatergroupinvite.h" |
49 | #include "llfloatergroups.h" | 49 | #include "llfloatergroups.h" |
50 | #include "llfloaterreporter.h" | ||
50 | #include "llimview.h" | 51 | #include "llimview.h" |
52 | #include "llmutelist.h" | ||
51 | #include "roles_constants.h" | 53 | #include "roles_constants.h" |
52 | #include "llscrolllistctrl.h" | 54 | #include "llscrolllistctrl.h" |
53 | #include "lltracker.h" | 55 | #include "lltracker.h" |
56 | #include "llviewerobjectlist.h" | ||
54 | #include "llviewermessage.h" | 57 | #include "llviewermessage.h" |
58 | #include "llviewerregion.h" | ||
59 | #include "llviewerwindow.h" | ||
55 | #include "llworld.h" | 60 | #include "llworld.h" |
56 | 61 | ||
57 | LLFloaterMap* LLFloaterMap::sInstance = NULL; | 62 | LLFloaterMap* LLFloaterMap::sInstance = NULL; |
@@ -59,11 +64,16 @@ LLFloaterMap* LLFloaterMap::sInstance = NULL; | |||
59 | LLFloaterMap::LLFloaterMap(const LLSD& key) | 64 | LLFloaterMap::LLFloaterMap(const LLSD& key) |
60 | : | 65 | : |
61 | LLFloater(std::string("minimap")), | 66 | LLFloater(std::string("minimap")), |
62 | mPanelMap(NULL) | 67 | mPanelMap(NULL), |
68 | mUpdate(TRUE) | ||
63 | { | 69 | { |
64 | LLCallbackMap::map_t factory_map; | 70 | LLCallbackMap::map_t factory_map; |
65 | factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this); | 71 | factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this); |
66 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); | 72 | LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); |
73 | |||
74 | mSelectedAvatar.setNull(); | ||
75 | mAvatars.clear(); | ||
76 | |||
67 | sInstance = this; | 77 | sInstance = this; |
68 | } | 78 | } |
69 | 79 | ||
@@ -73,7 +83,6 @@ void* LLFloaterMap::createPanelMiniMap(void* data) | |||
73 | { | 83 | { |
74 | LLFloaterMap* self = (LLFloaterMap*)data; | 84 | LLFloaterMap* self = (LLFloaterMap*)data; |
75 | self->mPanelMap = new LLNetMap("Mapview"); | 85 | self->mPanelMap = new LLNetMap("Mapview"); |
76 | self->mSelectedAvatar.setNull(); | ||
77 | return self->mPanelMap; | 86 | return self->mPanelMap; |
78 | } | 87 | } |
79 | 88 | ||
@@ -88,12 +97,20 @@ BOOL LLFloaterMap::postBuild() | |||
88 | childSetCommitCallback("RadarList", onList, this); | 97 | childSetCommitCallback("RadarList", onList, this); |
89 | mRadarList->setDoubleClickCallback(onClickIM); | 98 | mRadarList->setDoubleClickCallback(onClickIM); |
90 | 99 | ||
100 | childSetFocusChangedCallback("near_me_range", onRangeChange, this); | ||
101 | |||
91 | childSetAction("im_btn", onClickIM, this); | 102 | childSetAction("im_btn", onClickIM, this); |
92 | childSetAction("profile_btn", onClickProfile, this); | 103 | childSetAction("profile_btn", onClickProfile, this); |
93 | childSetAction("offer_teleport_btn", onClickOfferTeleport, this); | 104 | childSetAction("offer_teleport_btn", onClickOfferTeleport, this); |
94 | childSetAction("track_btn", onClickTrack, this); | 105 | childSetAction("track_btn", onClickTrack, this); |
95 | childSetAction("invite_btn", onClickInvite, this); | 106 | childSetAction("invite_btn", onClickInvite, this); |
96 | childSetAction("add_btn", onClickAddFriend, this); | 107 | childSetAction("add_btn", onClickAddFriend, this); |
108 | childSetAction("freeze_btn", onClickFreeze, this); | ||
109 | childSetAction("eject_btn", onClickEject, this); | ||
110 | childSetAction("mute_btn", onClickMute, this); | ||
111 | childSetAction("unmute_btn", onClickUnmute, this); | ||
112 | childSetAction("ar_btn", onClickAR, this); | ||
113 | childSetAction("estate_eject_btn", onClickEjectFromEstate, this); | ||
97 | 114 | ||
98 | setDefaultBtn("im_btn"); | 115 | setDefaultBtn("im_btn"); |
99 | 116 | ||
@@ -155,11 +172,25 @@ void LLFloaterMap::draw() | |||
155 | } | 172 | } |
156 | } | 173 | } |
157 | 174 | ||
175 | // [RLVa:KB] - Version: 1.22.11 | Checked: 2009-07-05 (RLVa-1.0.0c) | ||
176 | void LLFloaterMap::open() | ||
177 | { | ||
178 | if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP)) | ||
179 | { | ||
180 | LLFloater::open(); | ||
181 | } | ||
182 | } | ||
183 | // [/RLVa:KB] | ||
184 | |||
158 | // TODO: make this detachable | 185 | // TODO: make this detachable |
186 | // TODO: make this expand/collapse | ||
159 | 187 | ||
160 | // | 188 | /* |
161 | // Radar | 189 | * Imprudence Radar |
162 | // | 190 | * @brief inworld radar integrated with the minimap |
191 | * by McCabe Maxsted | ||
192 | * Estate tab portion by Dale Glass | ||
193 | */ | ||
163 | 194 | ||
164 | //static | 195 | //static |
165 | void LLFloaterMap::updateRadar() | 196 | void LLFloaterMap::updateRadar() |
@@ -170,113 +201,128 @@ void LLFloaterMap::updateRadar() | |||
170 | 201 | ||
171 | void LLFloaterMap::populateRadar() | 202 | void LLFloaterMap::populateRadar() |
172 | { | 203 | { |
173 | std::stringstream avatar_count_string; | 204 | if (!mUpdate) |
205 | { | ||
206 | return; | ||
207 | } | ||
208 | |||
209 | if (visibleItemsSelected()) | ||
210 | { | ||
211 | mSelectedAvatar = mRadarList->getSelectedValue().asUUID(); | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | mSelectedAvatar.setNull(); | ||
216 | } | ||
217 | |||
218 | S32 scroll_pos = mRadarList->getScrollPos(); | ||
219 | |||
174 | LLVector3d current_pos = gAgent.getPositionGlobal(); | 220 | LLVector3d current_pos = gAgent.getPositionGlobal(); |
175 | 221 | ||
176 | // find what avatars you can see | 222 | // find what avatars you can see |
177 | std::vector<LLUUID> avatar_ids_new; | 223 | std::vector<LLUUID> avatar_ids; |
178 | std::vector<LLVector3d> positions_new; | 224 | std::vector<LLVector3d> positions; |
179 | LLWorld::getInstance()->getAvatars(&avatar_ids_new, &positions_new, current_pos, gSavedSettings.getF32("NearMeRange")); | 225 | LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, current_pos, gSavedSettings.getF32("NearMeRange")); |
180 | 226 | ||
181 | // add an avatar to the list if it doesn't exist | 227 | // Add avatars to the list. If they're already there, update positions |
182 | std::vector<LLUUID>::iterator result; | 228 | std::pair<std::map<LLUUID, LLVector3d>::iterator, bool> ret; |
183 | for (U32 i=0; i<avatar_ids_new.size(); i++) | 229 | for (U32 i=0; i<avatar_ids.size(); i++) |
184 | { | 230 | { |
185 | result = find(mAvatarIDs.begin(), mAvatarIDs.end(), avatar_ids_new[i]); | 231 | if (avatar_ids[i] == gAgent.getID() || |
186 | if (result == mAvatarIDs.end()) | 232 | avatar_ids[i].isNull()) |
187 | { | 233 | { |
188 | mAvatarIDs.push_back(avatar_ids_new[i]); | 234 | continue; |
189 | mPositions.push_back(positions_new[i]); | ||
190 | addToList(avatar_ids_new[i], positions_new[i], current_pos); | ||
191 | } | 235 | } |
192 | else // avatar exists, check for updated position | 236 | |
237 | ret = mAvatars.insert(std::pair<LLUUID, LLVector3d>(avatar_ids[i], positions[i])); | ||
238 | if (ret.second == false) | ||
193 | { | 239 | { |
194 | if (mPositions[i] != positions_new[i]) | 240 | mAvatars[avatar_ids[i]] = positions[i]; |
195 | { | ||
196 | removeFromList(mAvatarIDs[i]); | ||
197 | mPositions[i] = positions_new[i]; | ||
198 | addToList(mAvatarIDs[i], mPositions[i], current_pos); | ||
199 | } | ||
200 | } | 241 | } |
201 | } | 242 | } |
202 | 243 | ||
203 | // pull out dead entries | 244 | LLSD element; |
204 | for (U32 i=0; i<mAvatarIDs.size(); i++) | 245 | |
246 | mRadarList->deleteAllItems(); | ||
247 | |||
248 | // if an avatar's not in range anymore, kill it. Otherwise, populate radar | ||
249 | std::map<LLUUID, LLVector3d>::iterator mIt; | ||
250 | std::vector<LLUUID>::iterator result; | ||
251 | for (mIt = mAvatars.begin(); mIt != mAvatars.end(); ) | ||
205 | { | 252 | { |
206 | result = find(avatar_ids_new.begin(), avatar_ids_new.end(), mAvatarIDs[i]); | 253 | result = find(avatar_ids.begin(), avatar_ids.end(), mIt->first); |
207 | if (result == avatar_ids_new.end()) | 254 | if (result == avatar_ids.end()) |
208 | { | 255 | { |
209 | removeFromList(mAvatarIDs[i]); | 256 | mAvatars.erase(mIt++); |
210 | 257 | } | |
211 | // pop_back is faster | 258 | else |
212 | std::swap(mAvatarIDs[i], mAvatarIDs.back()); | 259 | { |
213 | mAvatarIDs.pop_back(); | 260 | // Add to list only if we get their name |
214 | std::swap(mPositions[i], mPositions.back()); | 261 | std::string fullname = getSelectedName(mIt->first); |
215 | mPositions.pop_back(); | 262 | if (!fullname.empty() && fullname != " ") |
263 | { | ||
264 | std::string mute_text = LLMuteList::getInstance()->isMuted(mIt->first) ? getString("muted") : ""; | ||
265 | element["id"] = mIt->first; | ||
266 | element["columns"][0]["column"] = "avatar_name"; | ||
267 | element["columns"][0]["type"] = "text"; | ||
268 | element["columns"][0]["value"] = fullname + " " + mute_text; | ||
269 | element["columns"][1]["column"] = "avatar_distance"; | ||
270 | element["columns"][1]["type"] = "text"; | ||
271 | |||
272 | F64 distance = dist_vec(current_pos, mIt->second); | ||
273 | std::stringstream dist_formatted; | ||
274 | dist_formatted.str(""); | ||
275 | dist_formatted << (double)((int)((distance + 0.05)*10.0))/10.0 << "m"; | ||
276 | element["columns"][1]["value"] = dist_formatted.str(); | ||
277 | |||
278 | mRadarList->addElement(element, ADD_BOTTOM); | ||
279 | } | ||
280 | ++mIt; | ||
216 | } | 281 | } |
217 | } | 282 | } |
218 | 283 | ||
219 | avatar_count_string.str(""); | 284 | mRadarList->sortItems(); |
220 | if (mAvatarIDs.empty()) | 285 | mRadarList->setScrollPos(scroll_pos); |
221 | { | 286 | |
222 | childSetEnabled("RadarList", false);childSetEnabled("im_btn", false); | 287 | if (mSelectedAvatar.notNull()) |
223 | mRadarList->addCommentText(getString("no_one_near")); | ||
224 | avatar_count_string << "0"; | ||
225 | } | ||
226 | else | ||
227 | { | 288 | { |
228 | childSetEnabled("RadarList", true); | 289 | mRadarList->selectByID(mSelectedAvatar); |
229 | avatar_count_string << (int)mAvatarIDs.size(); | ||
230 | } | 290 | } |
231 | LLTextBox* lblAvatarCount = getChild<LLTextBox>("lblAvatarCount"); | ||
232 | lblAvatarCount->setText(avatar_count_string.str()); | ||
233 | onList(mRadarList, this); | ||
234 | } | ||
235 | |||
236 | void LLFloaterMap::addToList(const LLUUID& agent_id, const LLVector3d& agent_pos, const LLVector3d& current_pos) | ||
237 | { | ||
238 | if (agent_id == gAgent.getID()) | ||
239 | return; | ||
240 | |||
241 | F64 distance = dist_vec(current_pos, agent_pos); | ||
242 | std::stringstream dist_formatted; | ||
243 | dist_formatted << (double)((int)((distance + 0.05)*10.0))/10.0 << "m"; | ||
244 | |||
245 | LLSD element; | ||
246 | element["id"] = agent_id; // value | ||
247 | element["columns"][0]["column"] = "avatar_name"; | ||
248 | element["columns"][0]["type"] = "text"; | ||
249 | 291 | ||
250 | std::string fullname; | 292 | // set count |
251 | if(!gCacheName->getFullName(agent_id, fullname)) | 293 | std::stringstream avatar_count; |
294 | avatar_count.str(""); | ||
295 | if (mAvatars.empty()) | ||
252 | { | 296 | { |
253 | element["columns"][0]["value"] = LLCacheName::getDefaultName(); | 297 | mRadarList->addCommentText(getString("no_one_near"), ADD_TOP); |
254 | } | 298 | avatar_count << "0"; |
299 | } | ||
255 | else | 300 | else |
256 | { | 301 | { |
257 | element["columns"][0]["value"] = fullname; | 302 | avatar_count << (int)mAvatars.size(); |
258 | } | 303 | } |
304 | childSetText("lblAvatarCount", avatar_count.str()); | ||
259 | 305 | ||
260 | element["columns"][1]["column"] = "avatar_distance"; | 306 | toggleButtons(); |
261 | element["columns"][1]["type"] = "text"; | 307 | } |
262 | element["columns"][1]["value"] = dist_formatted.str(); | ||
263 | |||
264 | mRadarList->addElement(element); | ||
265 | mRadarList->selectByID(mSelectedAvatar); | ||
266 | |||
267 | onList(mRadarList, this); | ||
268 | } | ||
269 | 308 | ||
270 | void LLFloaterMap::removeFromList(const LLUUID& agent_id) | 309 | void LLFloaterMap::toggleButtons() |
271 | { | 310 | { |
272 | S32 index = mRadarList->getItemIndex(agent_id); | 311 | BOOL enabled = mRadarList->hasFocus() ? visibleItemsSelected() : FALSE; |
273 | if (index >= 0) | 312 | BOOL unmute_enabled = mRadarList->hasFocus() ? LLMuteList::getInstance()->isMuted(mSelectedAvatar) : FALSE; |
274 | { | 313 | |
275 | mRadarList->deleteSingleItem(index); | 314 | childSetEnabled("im_btn", enabled); |
276 | mRadarList->selectByID(mSelectedAvatar); | 315 | childSetEnabled("profile_btn", enabled); |
277 | 316 | childSetEnabled("offer_teleport_btn", enabled); | |
278 | onList(mRadarList, this); | 317 | childSetEnabled("track_btn", enabled); |
279 | } | 318 | childSetEnabled("invite_btn", enabled); |
319 | childSetEnabled("add_btn", enabled); | ||
320 | childSetEnabled("freeze_btn", enabled); | ||
321 | childSetEnabled("eject_btn", enabled); | ||
322 | childSetEnabled("mute_btn", enabled); | ||
323 | childSetEnabled("unmute_btn", unmute_enabled); | ||
324 | childSetEnabled("ar_btn", enabled); | ||
325 | childSetEnabled("estate_eject_btn", enabled); | ||
280 | } | 326 | } |
281 | 327 | ||
282 | // static | 328 | // static |
@@ -285,26 +331,10 @@ void LLFloaterMap::onList(LLUICtrl* ctrl, void* user_data) | |||
285 | LLFloaterMap* self = (LLFloaterMap*)user_data; | 331 | LLFloaterMap* self = (LLFloaterMap*)user_data; |
286 | if (self) | 332 | if (self) |
287 | { | 333 | { |
288 | self->childSetEnabled("im_btn", self->visibleItemsSelected()); | 334 | self->toggleButtons(); |
289 | self->childSetEnabled("profile_btn", self->visibleItemsSelected()); | ||
290 | self->childSetEnabled("offer_teleport_btn", self->visibleItemsSelected()); | ||
291 | self->childSetEnabled("track_btn", self->visibleItemsSelected()); | ||
292 | self->childSetEnabled("invite_btn", self->visibleItemsSelected()); | ||
293 | self->childSetEnabled("add_btn", self->visibleItemsSelected()); | ||
294 | |||
295 | if (self->visibleItemsSelected()) | ||
296 | { | ||
297 | if (self->mSelectedAvatar != self->mRadarList->getFirstSelected()->getUUID()) | ||
298 | { | ||
299 | self->mSelectedAvatar = self->mRadarList->getFirstSelected()->getUUID(); | ||
300 | } | ||
301 | } | ||
302 | else | ||
303 | { | ||
304 | self->mSelectedAvatar.setNull(); | ||
305 | } | ||
306 | } | 335 | } |
307 | } | 336 | } |
337 | |||
308 | 338 | ||
309 | BOOL LLFloaterMap::visibleItemsSelected() const | 339 | BOOL LLFloaterMap::visibleItemsSelected() const |
310 | { | 340 | { |
@@ -316,6 +346,16 @@ BOOL LLFloaterMap::visibleItemsSelected() const | |||
316 | } | 346 | } |
317 | 347 | ||
318 | // static | 348 | // static |
349 | void LLFloaterMap::onRangeChange(LLFocusableElement* focus, void* user_data) | ||
350 | { | ||
351 | LLFloaterMap* self = (LLFloaterMap*)user_data; | ||
352 | if (self) | ||
353 | { | ||
354 | self->mUpdate = !(self->childHasFocus("near_me_range")); | ||
355 | } | ||
356 | } | ||
357 | |||
358 | // static | ||
319 | BOOL LLFloaterMap::isSelected(LLUUID agent) | 359 | BOOL LLFloaterMap::isSelected(LLUUID agent) |
320 | { | 360 | { |
321 | if (sInstance->mSelectedAvatar == agent) | 361 | if (sInstance->mSelectedAvatar == agent) |
@@ -325,6 +365,10 @@ BOOL LLFloaterMap::isSelected(LLUUID agent) | |||
325 | return FALSE; | 365 | return FALSE; |
326 | } | 366 | } |
327 | 367 | ||
368 | // | ||
369 | // Avatar tab | ||
370 | // | ||
371 | |||
328 | // static | 372 | // static |
329 | void LLFloaterMap::onClickIM(void* user_data) | 373 | void LLFloaterMap::onClickIM(void* user_data) |
330 | { | 374 | { |
@@ -429,3 +473,282 @@ void LLFloaterMap::onClickAddFriend(void* user_data) | |||
429 | LLPanelFriends::requestFriendshipDialog(agent_id, fullname); | 473 | LLPanelFriends::requestFriendshipDialog(agent_id, fullname); |
430 | } | 474 | } |
431 | } | 475 | } |
476 | |||
477 | // | ||
478 | // Estate tab | ||
479 | // | ||
480 | |||
481 | //static | ||
482 | std::string LLFloaterMap::getSelectedName(LLUUID agent_id) | ||
483 | { | ||
484 | std::string agent_name; | ||
485 | if(agent_id.notNull() && gCacheName->getFullName(agent_id, agent_name)) | ||
486 | { | ||
487 | return agent_name; | ||
488 | } | ||
489 | return LLStringUtil::null; | ||
490 | } | ||
491 | |||
492 | //static | ||
493 | void LLFloaterMap::callbackFreeze(S32 option, void *user_data) | ||
494 | { | ||
495 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
496 | |||
497 | if ( option == 0 ) | ||
498 | { | ||
499 | sendFreeze(self->mSelectedAvatar, true); | ||
500 | } | ||
501 | else if ( option == 1 ) | ||
502 | { | ||
503 | sendFreeze(self->mSelectedAvatar, false); | ||
504 | } | ||
505 | } | ||
506 | |||
507 | //static | ||
508 | void LLFloaterMap::callbackEject(S32 option, void *user_data) | ||
509 | { | ||
510 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
511 | |||
512 | if ( option == 0 ) | ||
513 | { | ||
514 | sendEject(self->mSelectedAvatar, false); | ||
515 | } | ||
516 | else if ( option == 1 ) | ||
517 | { | ||
518 | sendEject(self->mSelectedAvatar, true); | ||
519 | } | ||
520 | } | ||
521 | |||
522 | //static | ||
523 | void LLFloaterMap::callbackEjectFromEstate(S32 option, void *user_data) | ||
524 | { | ||
525 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
526 | |||
527 | if ( option == 0 ) | ||
528 | { | ||
529 | cmdEstateEject(self->mSelectedAvatar); | ||
530 | } | ||
531 | else if ( option == 1 ) | ||
532 | { | ||
533 | cmdEstateBan(self->mSelectedAvatar); | ||
534 | } | ||
535 | } | ||
536 | |||
537 | void LLFloaterMap::onClickFreeze(void *user_data) | ||
538 | { | ||
539 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
540 | LLStringUtil::format_map_t args; | ||
541 | LLSD payload; | ||
542 | args["[AVATAR_NAME]"] = self->getSelectedName(self->mSelectedAvatar); | ||
543 | gViewerWindow->alertXml("FreezeAvatarFullname", args, callbackFreeze, user_data); | ||
544 | } | ||
545 | |||
546 | //static | ||
547 | void LLFloaterMap::onClickEject(void *user_data) | ||
548 | { | ||
549 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
550 | LLStringUtil::format_map_t args; | ||
551 | LLSD payload; | ||
552 | args["AVATAR_NAME"] = self->getSelectedName(self->mSelectedAvatar); | ||
553 | gViewerWindow->alertXml("EjectAvatarFullName", args, callbackEject, user_data); | ||
554 | } | ||
555 | |||
556 | //static | ||
557 | void LLFloaterMap::onClickMute(void *user_data) | ||
558 | { | ||
559 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
560 | |||
561 | LLUUID agent_id = self->mSelectedAvatar; | ||
562 | std::string agent_name = self->getSelectedName(agent_id); | ||
563 | if(!agent_name.empty()) | ||
564 | { | ||
565 | if (LLMuteList::getInstance()->isMuted(agent_id)) | ||
566 | { | ||
567 | //LLMute mute(agent_id, agent_name, LLMute::AGENT); | ||
568 | //LLMuteList::getInstance()->remove(mute); | ||
569 | //LLFloaterMute::getInstance()->selectMute(agent_id); | ||
570 | } | ||
571 | else | ||
572 | { | ||
573 | LLMute mute(agent_id, agent_name, LLMute::AGENT); | ||
574 | LLMuteList::getInstance()->add(mute); | ||
575 | } | ||
576 | } | ||
577 | } | ||
578 | |||
579 | //static | ||
580 | void LLFloaterMap::onClickUnmute(void *user_data) | ||
581 | { | ||
582 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
583 | |||
584 | LLUUID agent_id = self->mSelectedAvatar; | ||
585 | std::string agent_name = self->getSelectedName(agent_id); | ||
586 | if(!agent_name.empty()) | ||
587 | { | ||
588 | if (LLMuteList::getInstance()->isMuted(agent_id)) | ||
589 | { | ||
590 | LLMute mute(agent_id, agent_name, LLMute::AGENT); | ||
591 | LLMuteList::getInstance()->remove(mute); | ||
592 | //LLFloaterMute::getInstance()->selectMute(agent_id); | ||
593 | } | ||
594 | else | ||
595 | { | ||
596 | //LLMute mute(agent_id, agent_name, LLMute::AGENT); | ||
597 | //LLMuteList::getInstance()->add(mute); | ||
598 | } | ||
599 | } | ||
600 | } | ||
601 | |||
602 | //static | ||
603 | void LLFloaterMap::onClickEjectFromEstate(void *user_data) | ||
604 | { | ||
605 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
606 | LLStringUtil::format_map_t args; | ||
607 | LLSD payload; | ||
608 | args["EVIL_USER"] = self->getSelectedName(self->mSelectedAvatar); | ||
609 | gViewerWindow->alertXml("EstateKickUser", args, callbackEjectFromEstate, user_data); | ||
610 | } | ||
611 | |||
612 | //static | ||
613 | void LLFloaterMap::onClickAR(void *user_data) | ||
614 | { | ||
615 | LLFloaterMap *self = (LLFloaterMap*)user_data; | ||
616 | LLUUID agent_id = self->mSelectedAvatar; | ||
617 | |||
618 | if (agent_id.notNull()) | ||
619 | { | ||
620 | LLFloaterReporter::showFromObject(agent_id); | ||
621 | } | ||
622 | } | ||
623 | |||
624 | // static | ||
625 | void LLFloaterMap::cmdEstateEject(const LLUUID &avatar) | ||
626 | { | ||
627 | sendEstateMessage("teleporthomeuser", avatar); | ||
628 | } | ||
629 | |||
630 | // static | ||
631 | void LLFloaterMap::cmdEstateBan(const LLUUID &avatar) | ||
632 | { | ||
633 | sendEstateMessage("teleporthomeuser", avatar); // Kick first, just to be sure | ||
634 | sendEstateBan(avatar); | ||
635 | } | ||
636 | |||
637 | // static | ||
638 | void LLFloaterMap::sendFreeze(const LLUUID& avatar_id, bool freeze) | ||
639 | { | ||
640 | U32 flags = 0x0; | ||
641 | if (!freeze) | ||
642 | { | ||
643 | // unfreeze | ||
644 | flags |= 0x1; | ||
645 | } | ||
646 | |||
647 | LLMessageSystem* msg = gMessageSystem; | ||
648 | LLViewerObject* avatar = gObjectList.findObject(avatar_id); | ||
649 | |||
650 | if (avatar) | ||
651 | { | ||
652 | msg->newMessage("FreezeUser"); | ||
653 | msg->nextBlock("AgentData"); | ||
654 | msg->addUUID("AgentID", gAgent.getID()); | ||
655 | msg->addUUID("SessionID", gAgent.getSessionID()); | ||
656 | msg->nextBlock("Data"); | ||
657 | msg->addUUID("TargetID", avatar_id ); | ||
658 | msg->addU32("Flags", flags ); | ||
659 | msg->sendReliable( avatar->getRegion()->getHost() ); | ||
660 | } | ||
661 | } | ||
662 | |||
663 | // static | ||
664 | void LLFloaterMap::sendEject(const LLUUID& avatar_id, bool ban) | ||
665 | { | ||
666 | LLMessageSystem* msg = gMessageSystem; | ||
667 | LLViewerObject* avatar = gObjectList.findObject(avatar_id); | ||
668 | |||
669 | if (avatar) | ||
670 | { | ||
671 | U32 flags = 0x0; | ||
672 | if ( ban ) | ||
673 | { | ||
674 | // eject and add to ban list | ||
675 | flags |= 0x1; | ||
676 | } | ||
677 | |||
678 | msg->newMessage("EjectUser"); | ||
679 | msg->nextBlock("AgentData"); | ||
680 | msg->addUUID("AgentID", gAgent.getID() ); | ||
681 | msg->addUUID("SessionID", gAgent.getSessionID() ); | ||
682 | msg->nextBlock("Data"); | ||
683 | msg->addUUID("TargetID", avatar_id ); | ||
684 | msg->addU32("Flags", flags ); | ||
685 | msg->sendReliable( avatar->getRegion()->getHost() ); | ||
686 | } | ||
687 | } | ||
688 | |||
689 | // static | ||
690 | void LLFloaterMap::sendEstateMessage(const char* request, const LLUUID &target) | ||
691 | { | ||
692 | |||
693 | LLMessageSystem* msg = gMessageSystem; | ||
694 | LLUUID invoice; | ||
695 | |||
696 | // This seems to provide an ID so that the sim can say which request it's | ||
697 | // replying to. I think this can be ignored for now. | ||
698 | invoice.generate(); | ||
699 | |||
700 | llinfos << "Sending estate request '" << request << "'" << llendl; | ||
701 | msg->newMessage("EstateOwnerMessage"); | ||
702 | msg->nextBlockFast(_PREHASH_AgentData); | ||
703 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
704 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
705 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | ||
706 | msg->nextBlock("MethodData"); | ||
707 | msg->addString("Method", request); | ||
708 | msg->addUUID("Invoice", invoice); | ||
709 | |||
710 | // Agent id | ||
711 | msg->nextBlock("ParamList"); | ||
712 | msg->addString("Parameter", gAgent.getID().asString().c_str()); | ||
713 | |||
714 | // Target | ||
715 | msg->nextBlock("ParamList"); | ||
716 | msg->addString("Parameter", target.asString().c_str()); | ||
717 | |||
718 | msg->sendReliable(gAgent.getRegion()->getHost()); | ||
719 | } | ||
720 | |||
721 | // static | ||
722 | void LLFloaterMap::sendEstateBan(const LLUUID& agent) | ||
723 | { | ||
724 | LLUUID invoice; | ||
725 | U32 flags = ESTATE_ACCESS_BANNED_AGENT_ADD; | ||
726 | |||
727 | invoice.generate(); | ||
728 | |||
729 | LLMessageSystem* msg = gMessageSystem; | ||
730 | msg->newMessage("EstateOwnerMessage"); | ||
731 | msg->nextBlockFast(_PREHASH_AgentData); | ||
732 | msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); | ||
733 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | ||
734 | msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used | ||
735 | |||
736 | msg->nextBlock("MethodData"); | ||
737 | msg->addString("Method", "estateaccessdelta"); | ||
738 | msg->addUUID("Invoice", invoice); | ||
739 | |||
740 | char buf[MAX_STRING]; /* Flawfinder: ignore*/ | ||
741 | gAgent.getID().toString(buf); | ||
742 | msg->nextBlock("ParamList"); | ||
743 | msg->addString("Parameter", buf); | ||
744 | |||
745 | snprintf(buf, MAX_STRING, "%u", flags); /* Flawfinder: ignore */ | ||
746 | msg->nextBlock("ParamList"); | ||
747 | msg->addString("Parameter", buf); | ||
748 | |||
749 | agent.toString(buf); | ||
750 | msg->nextBlock("ParamList"); | ||
751 | msg->addString("Parameter", buf); | ||
752 | |||
753 | gAgent.sendReliableMessage(); | ||
754 | } | ||