diff options
author | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:54 -0500 |
commit | b2afb8800bb033a04bb3ecdf0363068d56648ef1 (patch) | |
tree | 3568129b5bbddb47cd39d622b4137a8fbff4abaf /linden/indra/newview/llinventoryactions.cpp | |
parent | Second Life viewer sources 1.14.0.1 (diff) | |
download | meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.zip meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.gz meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.bz2 meta-impy-b2afb8800bb033a04bb3ecdf0363068d56648ef1.tar.xz |
Second Life viewer sources 1.15.0.2
Diffstat (limited to 'linden/indra/newview/llinventoryactions.cpp')
-rw-r--r-- | linden/indra/newview/llinventoryactions.cpp | 137 |
1 files changed, 85 insertions, 52 deletions
diff --git a/linden/indra/newview/llinventoryactions.cpp b/linden/indra/newview/llinventoryactions.cpp index 756ba63..6452c87 100644 --- a/linden/indra/newview/llinventoryactions.cpp +++ b/linden/indra/newview/llinventoryactions.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | 5 | * Copyright (c) 2001-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -499,72 +500,104 @@ class LLBeginIMSession : public inventory_panel_listener_t | |||
499 | { | 500 | { |
500 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) | 501 | bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) |
501 | { | 502 | { |
502 | LLString who = userdata.asString(); | ||
503 | bool only_online = false; | ||
504 | if ("everyone" == who) | ||
505 | { | ||
506 | only_online = false; | ||
507 | } | ||
508 | else // "online" | ||
509 | { | ||
510 | only_online = true; | ||
511 | } | ||
512 | LLInventoryPanel *panel = mPtr; | 503 | LLInventoryPanel *panel = mPtr; |
513 | LLInventoryModel* model = panel->getModel(); | 504 | LLInventoryModel* model = panel->getModel(); |
514 | if(!model) return true; | 505 | if(!model) return true; |
515 | std::set<LLUUID> selected_items; | 506 | std::set<LLUUID> selected_items; |
516 | panel->getRootFolder()->getSelectionList(selected_items); | 507 | panel->getRootFolder()->getSelectionList(selected_items); |
517 | LLUUID item = *selected_items.begin(); | 508 | |
518 | LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item); | 509 | LLString name; |
519 | if(!folder_item) return true; | 510 | static int session_num = 1; |
520 | LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getListener(); | 511 | |
521 | if(!bridge) return true; | 512 | LLDynamicArray<LLUUID> members; |
522 | LLViewerInventoryCategory* cat = bridge->getCategory(); | 513 | EInstantMessage type = IM_SESSION_CONFERENCE_START; |
523 | if(!cat) return true; | 514 | |
524 | LLUniqueBuddyCollector is_buddy; | 515 | std::set<LLUUID>::const_iterator iter; |
525 | LLInventoryModel::cat_array_t cat_array; | 516 | for (iter = selected_items.begin(); iter != selected_items.end(); iter++) |
526 | LLInventoryModel::item_array_t item_array; | ||
527 | model->collectDescendentsIf(bridge->getUUID(), | ||
528 | cat_array, | ||
529 | item_array, | ||
530 | LLInventoryModel::EXCLUDE_TRASH, | ||
531 | is_buddy); | ||
532 | S32 count = item_array.count(); | ||
533 | if(count > 0) | ||
534 | { | 517 | { |
535 | // create the session | 518 | |
536 | gIMView->setFloaterOpen(TRUE); | 519 | LLUUID item = *iter; |
537 | LLDynamicArray<LLUUID> members; | 520 | LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item); |
538 | //members.put(gAgent.getID()); | 521 | |
539 | S32 i; | 522 | if(folder_item) |
540 | EInstantMessage type = IM_SESSION_ADD; | ||
541 | if(only_online) | ||
542 | { | 523 | { |
543 | LLAvatarTracker& at = LLAvatarTracker::instance(); | 524 | LLFolderViewEventListener* fve_listener = folder_item->getListener(); |
544 | LLUUID id; | 525 | if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY)) |
545 | for(i = 0; i < count; ++i) | ||
546 | { | 526 | { |
547 | id = item_array.get(i)->getCreatorUUID(); | 527 | |
548 | if(at.isBuddyOnline(id)) | 528 | LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getListener(); |
529 | if(!bridge) return true; | ||
530 | LLViewerInventoryCategory* cat = bridge->getCategory(); | ||
531 | if(!cat) return true; | ||
532 | name = cat->getName(); | ||
533 | LLUniqueBuddyCollector is_buddy; | ||
534 | LLInventoryModel::cat_array_t cat_array; | ||
535 | LLInventoryModel::item_array_t item_array; | ||
536 | model->collectDescendentsIf(bridge->getUUID(), | ||
537 | cat_array, | ||
538 | item_array, | ||
539 | LLInventoryModel::EXCLUDE_TRASH, | ||
540 | is_buddy); | ||
541 | S32 count = item_array.count(); | ||
542 | if(count > 0) | ||
549 | { | 543 | { |
550 | members.put(id); | 544 | // create the session |
545 | gIMView->setFloaterOpen(TRUE); | ||
546 | S32 i; | ||
547 | |||
548 | LLAvatarTracker& at = LLAvatarTracker::instance(); | ||
549 | LLUUID id; | ||
550 | for(i = 0; i < count; ++i) | ||
551 | { | ||
552 | id = item_array.get(i)->getCreatorUUID(); | ||
553 | if(at.isBuddyOnline(id)) | ||
554 | { | ||
555 | members.put(id); | ||
556 | } | ||
557 | } | ||
551 | } | 558 | } |
552 | } | 559 | } |
553 | } | 560 | else |
554 | else | ||
555 | { | ||
556 | type = IM_SESSION_OFFLINE_ADD; | ||
557 | for(i = 0; i < count; ++i) | ||
558 | { | 561 | { |
559 | members.put(item_array.get(i)->getCreatorUUID()); | 562 | LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item); |
560 | } | 563 | if(!folder_item) return true; |
564 | LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getListener(); | ||
565 | |||
566 | if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD) | ||
567 | { | ||
568 | LLInventoryItem* inv_item = gInventory.getItem(listenerp->getUUID()); | ||
569 | |||
570 | if (inv_item) | ||
571 | { | ||
572 | LLAvatarTracker& at = LLAvatarTracker::instance(); | ||
573 | LLUUID id = inv_item->getCreatorUUID(); | ||
574 | |||
575 | if(at.isBuddyOnline(id)) | ||
576 | { | ||
577 | members.put(id); | ||
578 | } | ||
579 | } | ||
580 | } //if IT_CALLINGCARD | ||
581 | } //if !IT_CATEGORY | ||
561 | } | 582 | } |
562 | // the session_id is always the item_id of the inventory folder | 583 | } //for selected_items |
563 | gIMView->addSession(cat->getName(), | 584 | |
564 | type, | 585 | // the session_id is randomly generated UUID which will be replaced later |
565 | bridge->getUUID(), | 586 | // with a server side generated number |
566 | members); | 587 | |
588 | if (name.empty()) | ||
589 | { | ||
590 | char buffer [50]; | ||
591 | sprintf(buffer, "Session %d", session_num++); | ||
592 | name = buffer; | ||
567 | } | 593 | } |
594 | |||
595 | |||
596 | gIMView->addSession(name, | ||
597 | type, | ||
598 | members[0], | ||
599 | members); | ||
600 | |||
568 | return true; | 601 | return true; |
569 | } | 602 | } |
570 | }; | 603 | }; |