// static
void LLPanelGroupGeneral::onClickCopyLink(void* userdata)
{
	LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)userdata;

	if (!self || (self->mGroupID).isNull()) return;

	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(self->mGroupID);

	// make sure we don't have junk
	if (gdatap)
	{
		std::string buffer = LLURLDispatcher::createGroupJoinLink(gdatap->getID());

		// Say same info in chat -- MC
		LLStringUtil::format_map_t targs;	
		targs["[IZURL]"] = buffer;
		std::string msg = self->getString("copy_group_link_info");
		LLStringUtil::format(msg, targs);

		LLChat chat;
		chat.mSourceType = CHAT_SOURCE_SYSTEM;
		chat.mText = msg;
		LLFloaterChat::addChat(chat);

		gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer));
	}
	else
	{
		llwarns << "Trying to copy group izurl link with no group data!" << llendl;
	}
}
// static
void LLGroupActions::leave(const LLUUID& group_id)
{
//	if (group_id.isNull())
// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f
	if ( (group_id.isNull()) || ((gAgent.getGroupID() == group_id) && (gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP))) )
// [/RLVa:KB]
	{
		return;
	}

	LLGroupData group_data;
	if (gAgent.getGroupData(group_id, group_data))
	{
		LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
		if (!gdatap || !gdatap->isMemberDataComplete())
		{
			if (gFetchLeaveGroupData != NULL)
			{
				delete gFetchLeaveGroupData;
				gFetchLeaveGroupData = NULL;
			}
			gFetchLeaveGroupData = new LLFetchLeaveGroupData(group_id);
		}
		else
		{
			processLeaveGroupDataResponse(group_id);
		}
	}
}
示例#3
0
// static
void LLGroupActions::leave(const LLUUID& group_id)
{
	if (group_id.isNull())
	{
		return;
	}

	LLGroupData group_data;
	if (gAgent.getGroupData(group_id, group_data))
	{
		LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id);
		if (!gdatap || !gdatap->isMemberDataComplete())
		{
			if (gFetchLeaveGroupData != NULL)
			{
				delete gFetchLeaveGroupData;
				gFetchLeaveGroupData = NULL;
			}
			gFetchLeaveGroupData = new LLFetchLeaveGroupData(group_id);
		}
		else
		{
			processLeaveGroupDataResponse(group_id);
		}
	}
}
void FSParticipantList::FSParticipantListMenu::banSelectedMember(const LLUUID& participant_uuid)
{
	LLSpeakerMgr * speaker_manager = mParent.mSpeakerMgr;
	if (NULL == speaker_manager)
	{
		LL_WARNS() << "Speaker manager is missing" << LL_ENDL;
		return;
	}

	LLUUID group_uuid = speaker_manager->getSessionID();
	LLGroupMgrGroupData* gdatap	= LLGroupMgr::getInstance()->getGroupData(group_uuid);
	if(!gdatap)
	{
		LL_WARNS("Groups") << "Unable to get group data for group " << group_uuid << LL_ENDL;
		return;
	}
	std::vector<LLUUID> ids;
	ids.push_back(participant_uuid);

	LLGroupBanData ban_data;
	gdatap->createBanEntry(participant_uuid, ban_data);
	LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, group_uuid, LLGroupMgr::BAN_CREATE, ids);
	LLGroupMgr::getInstance()->sendGroupMemberEjects(group_uuid, ids);
	LLGroupMgr::getInstance()->sendGroupMembersRequest(group_uuid);
	LLSD args;
	std::string name;
	gCacheName->getFullName(participant_uuid, name);
	args["AVATAR_NAME"] = name;
	args["GROUP_NAME"] = gdatap->mName;
	LLNotifications::instance().add(LLNotification::Params("EjectAvatarFromGroup").substitutions(args));
}
void LLPanelGroupGeneral::updateMembers()
{
	mPendingMemberUpdate = FALSE;

	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

	if (!mListVisibleMembers 
		|| !gdatap 
		|| !gdatap->isMemberDataComplete()
		|| gdatap->mMembers.empty())
	{
		return;
	}

	LLTimer update_time;
	update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME);

	LLAvatarName av_name;

	for( ; mMemberProgress != gdatap->mMembers.end() && !update_time.hasExpired(); 
			++mMemberProgress)
	{
		LLGroupMemberData* member = mMemberProgress->second;
		if (!member)
		{
			continue;
		}

		if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
		{
			addMember(mMemberProgress->second);
		}
		else
		{
			// If name is not cached, onNameCache() should be called when it is cached and add this member to list.
			avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(mMemberProgress->first);
			if (it != mAvatarNameCacheConnections.end())
			{
				if (it->second.connected())
				{
					it->second.disconnect();
				}
				mAvatarNameCacheConnections.erase(it);
			}
			mAvatarNameCacheConnections[mMemberProgress->first] = LLAvatarNameCache::get(mMemberProgress->first, boost::bind(&LLPanelGroupGeneral::onNameCache, this, gdatap->getMemberVersion(), member, _2, _1));
		}
	}

	if (mMemberProgress == gdatap->mMembers.end())
	{
		lldebugs << "   member list completed." << llendl;
		mListVisibleMembers->setEnabled(TRUE);
	}
	else
	{
		mPendingMemberUpdate = TRUE;
		mListVisibleMembers->setEnabled(FALSE);
	}
}
void LLPanelGroupInvite::updateLists()
{
	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
	bool waiting = false;

	if (gdatap) 
	{
		if (gdatap->isGroupPropertiesDataComplete()) 
		{
			if (mImplementation->mGroupName) 
			{
				mImplementation->mGroupName->setText(gdatap->mName);
			}
		} 
		else 
		{
			waiting = true;
		}
		if (gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete()) 
		{
			if ( mImplementation->mRoleNames )
			{
				mImplementation->mRoleNames->clear();
				mImplementation->mRoleNames->removeall();

				//add the role names and select the everybody role by default
				mImplementation->addRoleNames(gdatap);
				mImplementation->mRoleNames->setCurrentByID(mStoreSelected);
			}
		} 
		else 
		{
			waiting = true;
		}
	} 
	else 
	{
		waiting = true;
	}

	if (waiting) 
	{
		if (!mPendingUpdate) 
		{
			LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID);
			LLGroupMgr::getInstance()->sendGroupMembersRequest(mImplementation->mGroupID);
			LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID);
		}
		mPendingUpdate = TRUE;
	} 
	else
	{
		mPendingUpdate = FALSE;
		if (mImplementation->mOKButton && mImplementation->mRoleNames->getItemCount()) 
		{
			mImplementation->mOKButton->setEnabled(TRUE);
		}
	}
}
void LLPanelGroupGeneral::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name)
{
    LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

    if (!gdatap
            || !gdatap->isMemberDataComplete()
            || gdatap->getMemberVersion() != update_id)
    {
        // Stale data
        return;
    }

    addMember(member);
}
void LLPanelGroupBulk::updateGroupName()
{
	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);

	if(	gdatap &&
		gdatap->isGroupPropertiesDataComplete())
	{
		// Only do work if the current group name differs
		if(mImplementation->mGroupName->getText().compare(gdatap->mName) != 0)
			mImplementation->setGroupName(gdatap->mName);
	}
	else
	{
		mImplementation->setGroupName(mImplementation->mLoadingText);
	}
}
	void changed(LLGroupChange gc)
	{
		if (gc == GC_PROPERTIES && !mRequestProcessed)
		{
			LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupId);
			if (!gdatap)
			{
				LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData() was NULL" << LL_ENDL;
			} 
			else if (!gdatap->isMemberDataComplete())
			{
				LL_WARNS() << "LLGroupMgr::getInstance()->getGroupData()->isMemberDataComplete() was FALSE" << LL_ENDL;
				processGroupData();
				mRequestProcessed = true;
			}
		}
	}
void LLPanelGroupBulk::updateGroupData()
{
	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
	if(gdatap && gdatap->isGroupPropertiesDataComplete())
	{
		mPendingGroupPropertiesUpdate = false;
	}
	else
	{
		if(!mPendingGroupPropertiesUpdate)
		{
			mPendingGroupPropertiesUpdate = true;
			LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID);
		}
	}

	if(gdatap && gdatap->isRoleDataComplete())
	{
		mPendingRoleDataUpdate = false;
	}
	else
	{
		if(!mPendingRoleDataUpdate)
		{
			mPendingRoleDataUpdate = true;
			LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID);
		}
	}

	if(gdatap && gdatap->isMemberDataComplete())
	{
		mPendingMemberDataUpdate = false;
	}
	else
	{
		if(!mPendingMemberDataUpdate)
		{
			mPendingMemberDataUpdate = true;
			LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID);
		}
	}
}
void LLPanelGroupGeneral::activate()
{
    LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
    if (mGroupID.notNull()
            && (!gdatap || mFirstUse))
    {
        LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);
        LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mGroupID);

        if (!gdatap || !gdatap->isMemberDataComplete() )
        {
            LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID);
        }

        mFirstUse = FALSE;
    }
    mChanged = FALSE;

    update(GC_ALL);
}
void LLPanelGroupGeneral::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name, const LLUUID& av_id)
{
	avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(av_id);
	if (it != mAvatarNameCacheConnections.end())
	{
		if (it->second.connected())
		{
			it->second.disconnect();
		}
		mAvatarNameCacheConnections.erase(it);
	}

	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

	if (!gdatap
		|| !gdatap->isMemberDataComplete()
		|| gdatap->getMemberVersion() != update_id)
	{
		// Stale data
		return;
	}

	addMember(member);
}
// virtual
void LLPanelGroupGeneral::update(LLGroupChange gc)
{
    if (mGroupID.isNull()) return;

    LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

    if (!gdatap) return;

    LLGroupData agent_gdatap;
    bool is_member = false;
    if (gAgent.getGroupData(mGroupID,agent_gdatap)) is_member = true;

    if (mComboActiveTitle)
    {
        mComboActiveTitle->setVisible(is_member);

        if ( mActiveTitleLabel) mActiveTitleLabel->setVisible(is_member);

        if (is_member)
        {
            LLUUID current_title_role;

            mComboActiveTitle->clear();
            mComboActiveTitle->removeall();
            bool has_selected_title = false;

            if (1 == gdatap->mTitles.size())
            {
                // Only the everyone title.  Don't bother letting them try changing this.
                mComboActiveTitle->setEnabled(FALSE);
            }
            else
            {
                mComboActiveTitle->setEnabled(TRUE);
            }

            std::vector<LLGroupTitle>::const_iterator citer = gdatap->mTitles.begin();
            std::vector<LLGroupTitle>::const_iterator end = gdatap->mTitles.end();

            for ( ; citer != end; ++citer)
            {
                mComboActiveTitle->add(citer->mTitle,citer->mRoleID, (citer->mSelected ? ADD_TOP : ADD_BOTTOM));
                if (citer->mSelected)
                {
                    mComboActiveTitle->setCurrentByID(citer->mRoleID);
                    has_selected_title = true;
                }
            }

            if (!has_selected_title)
            {
                mComboActiveTitle->setCurrentByID(LLUUID::null);
            }
        }

        mComboActiveTitle->resetDirty();
    }

    // After role member data was changed in Roles->Members
    // need to update role titles. See STORM-918.
    if (gc == GC_ROLE_MEMBER_DATA)
        LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);

    // If this was just a titles update, we are done.
    if (gc == GC_TITLES) return;

    bool can_change_ident = false;
    bool can_change_member_opts = false;
    can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
    can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);

    if (mCtrlShowInGroupList)
    {
        mCtrlShowInGroupList->set(gdatap->mShowInList);
        mCtrlShowInGroupList->setEnabled(can_change_ident);
        mCtrlShowInGroupList->resetDirty();

    }
    if (mComboMature)
    {
        if(gdatap->mMaturePublish)
        {
            mComboMature->setCurrentByIndex(MATURE_CONTENT);
        }
        else
        {
            mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
        }
        mComboMature->setEnabled(can_change_ident);
        mComboMature->setVisible( !gAgent.isTeen() );
        mComboMature->resetDirty();
    }
    if (mCtrlOpenEnrollment)
    {
        mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment);
        mCtrlOpenEnrollment->setEnabled(can_change_member_opts);
        mCtrlOpenEnrollment->resetDirty();
    }
    if (mCtrlEnrollmentFee)
    {
        mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0);
        mCtrlEnrollmentFee->setEnabled(can_change_member_opts);
        mCtrlEnrollmentFee->resetDirty();
    }

    if (mSpinEnrollmentFee)
    {
        S32 fee = gdatap->mMembershipFee;
        mSpinEnrollmentFee->set((F32)fee);
        mSpinEnrollmentFee->setEnabled(fee && can_change_member_opts);
        mSpinEnrollmentFee->resetDirty();
    }
    if ( mBtnJoinGroup )
    {
        std::string fee_buff;
        bool visible;

        visible = !is_member && gdatap->mOpenEnrollment;
        mBtnJoinGroup->setVisible(visible);

        if ( visible )
        {
            fee_buff = llformat( "Join (%s%d)",
                                 gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(),
                                 gdatap->mMembershipFee);
            mBtnJoinGroup->setLabelSelected(fee_buff);
            mBtnJoinGroup->setLabelUnselected(fee_buff);
        }
    }
    if ( mBtnInfo )
    {
        mBtnInfo->setVisible(is_member && !mAllowEdit);
    }

    if(gc == GC_ALL || gc == GC_PROPERTIES)
    {
        if (mCtrlReceiveNotices)
        {
            mCtrlReceiveNotices->setVisible(is_member);
            if (is_member)
            {
                if(!mCtrlReceiveNotices->isDirty())	//If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc.
                {
                    mCtrlReceiveNotices->set(agent_gdatap.mAcceptNotices);
                    mCtrlReceiveNotices->resetDirty();
                }
            }
        }

        if (mCtrlListGroup)
        {
            mCtrlListGroup->setVisible(is_member);
            if (is_member)
            {
                if(!mCtrlListGroup->isDirty())	//If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc.
                {
                    mCtrlListGroup->set(agent_gdatap.mListInProfile);
                    mCtrlListGroup->resetDirty();
                }
            }
        }

        if (mCtrlReceiveChat)
        {
            mCtrlReceiveChat->setVisible(is_member);
            if (is_member)
            {
                if(!mCtrlReceiveChat->isDirty())	//If the user hasn't edited this then refresh it. Value may have changed in groups panel, etc.
                {
                    mCtrlReceiveChat->set(!gIMMgr->getIgnoreGroup(mGroupID));
                    mCtrlReceiveChat->resetDirty();
                }
            }
        }

        if (mInsignia) mInsignia->setEnabled(can_change_ident);
        if (mEditCharter) mEditCharter->setEnabled(can_change_ident);

        if (mGroupName) mGroupName->setText(gdatap->mName);
        if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
        if (mFounderName) mFounderName->setNameID(gdatap->mFounderID,FALSE);

        LLNameEditor* key_edit = getChild<LLNameEditor>("group_key");
        if(key_edit)
        {
            key_edit->setText(gdatap->getID().asString());
        }

        if (mInsignia)
        {
            if (gdatap->mInsigniaID.notNull())
            {
                mInsignia->setImageAssetID(gdatap->mInsigniaID);
            }
            else
            {
                mInsignia->setImageAssetID(mDefaultIconID);
            }
        }

        if (mEditCharter)
        {
            mEditCharter->setText(gdatap->mCharter);
            mEditCharter->resetDirty();
        }
    }

    if (mListVisibleMembers)
    {
        mListVisibleMembers->deleteAllItems();

        if (gdatap->isMemberDataComplete())
        {
            mMemberProgress = gdatap->mMembers.begin();
            mPendingMemberUpdate = TRUE;

            sSDTime = 0.0f;
            sElementTime = 0.0f;
            sAllTime = 0.0f;
        }
        else
        {
            std::stringstream pending;
            pending << "Retrieving member list (" << gdatap->mMembers.size() << "\\" << gdatap->mMemberCount  << ")";

            LLSD row;
            row["columns"][0]["value"] = pending.str();
            row["columns"][0]["column"] = "name";

            mListVisibleMembers->setEnabled(FALSE);
            mListVisibleMembers->addElement(row);
        }
    }
}
示例#14
0
void LLPanelGroupGeneral::updateMembers()
{
	mPendingMemberUpdate = FALSE;

	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

	if (!mListVisibleMembers || !gdatap 
		|| !gdatap->isMemberDataComplete())
	{
		return;
	}

	static LLTimer all_timer;
	static LLTimer sd_timer;
	static LLTimer element_timer;

	all_timer.reset();
	S32 i = 0;

	for( ; mMemberProgress != gdatap->mMembers.end() && i<UPDATE_MEMBERS_PER_FRAME; 
			++mMemberProgress, ++i)
	{
		//llinfos << "Adding " << iter->first << ", " << iter->second->getTitle() << llendl;
		LLGroupMemberData* member = mMemberProgress->second;
		if (!member)
		{
			continue;
		}
		// Owners show up in bold.
		std::string style = "NORMAL";
		if ( member->isOwner() )
		{
			style = "BOLD";
		}
		
		sd_timer.reset();
		LLSD row;
		row["id"] = member->getID();

		row["columns"][0]["column"] = "name";
		row["columns"][0]["font-style"] = style;
		// value is filled in by name list control

		row["columns"][1]["column"] = "title";
		row["columns"][1]["value"] = member->getTitle();
		row["columns"][1]["font-style"] = style;
		
		row["columns"][2]["column"] = "online";
		row["columns"][2]["value"] = member->getOnlineStatus();
		row["columns"][2]["font-style"] = style;

		sSDTime += sd_timer.getElapsedTimeF32();

		element_timer.reset();
		mListVisibleMembers->addElement(row);//, ADD_SORTED);
		sElementTime += element_timer.getElapsedTimeF32();
	}
	sAllTime += all_timer.getElapsedTimeF32();

	llinfos << "Updated " << i << " of " << UPDATE_MEMBERS_PER_FRAME << "members in the list." << llendl;
	if (mMemberProgress == gdatap->mMembers.end())
	{
		llinfos << "   member list completed." << llendl;
		mListVisibleMembers->setEnabled(TRUE);

		llinfos << "All Time: " << sAllTime << llendl;
		llinfos << "SD Time: " << sSDTime << llendl;
		llinfos << "Element Time: " << sElementTime << llendl;
	}
	else
	{
		mPendingMemberUpdate = TRUE;
		mListVisibleMembers->setEnabled(FALSE);
	}
}
示例#15
0
// virtual
void LLPanelGroupGeneral::update(LLGroupChange gc)
{
	if (mGroupID.isNull()) return;

	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

	if (!gdatap) return;

	LLGroupData agent_gdatap;
	bool is_member = false;
	if (gAgent.getGroupData(mGroupID,agent_gdatap)) is_member = true;

	if (mComboActiveTitle)
	{
		mComboActiveTitle->setVisible(is_member);
		mComboActiveTitle->setEnabled(mAllowEdit);
		
		if ( mActiveTitleLabel) mActiveTitleLabel->setVisible(is_member);

		if (is_member)
		{
			LLUUID current_title_role;

			mComboActiveTitle->clear();
			mComboActiveTitle->removeall();
			bool has_selected_title = false;

			if (1 == gdatap->mTitles.size())
			{
				// Only the everyone title.  Don't bother letting them try changing this.
				mComboActiveTitle->setEnabled(FALSE);
			}
			else
			{
				mComboActiveTitle->setEnabled(TRUE);
			}

			std::vector<LLGroupTitle>::const_iterator citer = gdatap->mTitles.begin();
			std::vector<LLGroupTitle>::const_iterator end = gdatap->mTitles.end();
			
			for ( ; citer != end; ++citer)
			{
				mComboActiveTitle->add(citer->mTitle,citer->mRoleID, (citer->mSelected ? ADD_TOP : ADD_BOTTOM));
				if (citer->mSelected)
				{
					mComboActiveTitle->setCurrentByID(citer->mRoleID);
					has_selected_title = true;
				}
			}
			
			if (!has_selected_title)
			{
				mComboActiveTitle->setCurrentByID(LLUUID::null);
			}
		}
	}

	// If this was just a titles update, we are done.
	if (gc == GC_TITLES) return;

	bool can_change_ident = false;
	bool can_change_member_opts = false;
	can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
	can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);

	if (mCtrlShowInGroupList) 
	{
		mCtrlShowInGroupList->set(gdatap->mShowInList);
		mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident);
	}
	if (mComboMature)
	{
		if(gdatap->mMaturePublish)
		{
			mComboMature->setCurrentByIndex(MATURE_CONTENT);
		}
		else
		{
			mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
		}
		mComboMature->setEnabled(mAllowEdit && can_change_ident);
		mComboMature->setVisible( !gAgent.isTeen() );
	}
	if (mCtrlOpenEnrollment) 
	{
		mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment);
		mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts);
	}
	if (mCtrlEnrollmentFee) 
	{	
		mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0);
		mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts);
	}
	
	if (mSpinEnrollmentFee)
	{
		S32 fee = gdatap->mMembershipFee;
		mSpinEnrollmentFee->set((F32)fee);
		mSpinEnrollmentFee->setEnabled( mAllowEdit 
								&& (fee > 0) && can_change_member_opts);
	}
	if ( mBtnJoinGroup )
	{
		std::string fee_buff;
		bool visible;

		visible = !is_member && gdatap->mOpenEnrollment;
		mBtnJoinGroup->setVisible(visible);

		if ( visible )
		{
			fee_buff = llformat( "Join (L$%d)", gdatap->mMembershipFee);
			mBtnJoinGroup->setLabelSelected(fee_buff);
			mBtnJoinGroup->setLabelUnselected(fee_buff);
		}
	}
	if ( mBtnInfo )
	{
		mBtnInfo->setVisible(is_member && !mAllowEdit);
	}

	if (mCtrlReceiveNotices)
	{
		mCtrlReceiveNotices->setVisible(is_member);
		if (is_member)
		{
			mCtrlReceiveNotices->setEnabled(mAllowEdit);
		}
	}
	

	if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
	if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
	
	if (mGroupName) mGroupName->setText(gdatap->mName);
	if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
	if (mFounderName) mFounderName->setNameID(gdatap->mFounderID,FALSE);
	if (mInsignia)
	{
		if (gdatap->mInsigniaID.notNull())
		{
			mInsignia->setImageAssetID(gdatap->mInsigniaID);
		}
		else
		{
			
			mInsignia->setImageAssetID(mDefaultIconID);
		}
	}
	if (mEditCharter) mEditCharter->setText(gdatap->mCharter);
	
	if (mListVisibleMembers)
	{
		mListVisibleMembers->deleteAllItems();

		if (gdatap->isMemberDataComplete())
		{
			mMemberProgress = gdatap->mMembers.begin();
			mPendingMemberUpdate = TRUE;

			sSDTime = 0.0f;
			sElementTime = 0.0f;
			sAllTime = 0.0f;
		}
		else
		{
			std::stringstream pending;
			pending << "Retrieving member list (" << gdatap->mMembers.size() << "\\" << gdatap->mMemberCount  << ")";

			LLSD row;
			row["columns"][0]["value"] = pending.str();

			mListVisibleMembers->setEnabled(FALSE);
			mListVisibleMembers->addElement(row);
		}
	}
}
void LLPanelGroupGeneral::updateMembers()
{
	mPendingMemberUpdate = FALSE;

	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

	if (!mListVisibleMembers 
		|| !gdatap 
		|| !gdatap->isMemberDataComplete()
		|| gdatap->mMembers.empty())
	{
		return;
	}

	LLTimer update_time;
	update_time.setTimerExpirySec(UPDATE_MEMBERS_SECONDS_PER_FRAME);
	
	// <FS:ND> FIRE-6074; If the group changes, mMemberPRogresss is invalid, as it belongs to a different LLGroupMgrGroupData. Reset it, start over.
	if( mIteratorGroup != mGroupID )
	{
		mMemberProgress = gdatap->mMembers.begin();
		mIteratorGroup = mGroupID;
	}
	// </FS:ND> FIRE-6074


	LLAvatarName av_name;

	for( ; mMemberProgress != gdatap->mMembers.end() && !update_time.hasExpired(); 
			++mMemberProgress)
	{
		LLGroupMemberData* member = mMemberProgress->second;
		if (!member)
		{
			continue;
		}

//		if (LLAvatarNameCache::get(mMemberProgress->first, &av_name))
		{
			addMember(mMemberProgress->second);
		}
//		else
//		{
//			// If name is not cached, onNameCache() should be called when it is cached and add this member to list.
//			LLAvatarNameCache::get(mMemberProgress->first, 
//									boost::bind(&LLPanelGroupGeneral::onNameCache,
//												this, gdatap->getMemberVersion(), member, _2));
//		}
	}

	if (mMemberProgress == gdatap->mMembers.end())
	{
		lldebugs << "   member list completed." << llendl;
		mListVisibleMembers->setEnabled(TRUE);
	}
	else
	{
		mPendingMemberUpdate = TRUE;
		mListVisibleMembers->setEnabled(FALSE);
	}
}
示例#17
0
void LLIMMgr::inviteToSession(
	const LLUUID& session_id, 
	const std::string& session_name, 
	const LLUUID& caller_id, 
	const std::string& caller_name,
	EInstantMessage type,
	EInvitationType inv_type,
	const std::string& session_handle,
	const std::string& session_uri)
{
	//ignore invites from muted residents
	if (LLMuteList::getInstance()->isMuted(caller_id))
	{
		return;
	}

	std::string notify_box_type;

	BOOL ad_hoc_invite = FALSE;
	if(type == IM_SESSION_P2P_INVITE)
	{
		//P2P is different...they only have voice invitations
		notify_box_type = "VoiceInviteP2P";
	}
	else if ( gAgent.isInGroup(session_id) )
	{
		//only really old school groups have voice invitations
		notify_box_type = "VoiceInviteGroup";
	}
	else if ( inv_type == INVITATION_TYPE_VOICE )
	{
		//else it's an ad-hoc
		//and a voice ad-hoc
		notify_box_type = "VoiceInviteAdHoc";
		ad_hoc_invite = TRUE;
	}
	else if ( inv_type == INVITATION_TYPE_IMMEDIATE )
	{
		notify_box_type = "InviteAdHoc";
		ad_hoc_invite = TRUE;
	}

	LLSD payload;
	payload["session_id"] = session_id;
	payload["session_name"] = session_name;
	payload["caller_id"] = caller_id;
	payload["caller_name"] = caller_name;
	payload["type"] = type;
	payload["inv_type"] = inv_type;
	payload["session_handle"] = session_handle;
	payload["session_uri"] = session_uri;
	payload["notify_box_type"] = notify_box_type;
	
	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id);
	if (channelp && channelp->callStarted())
	{
		// you have already started a call to the other user, so just accept the invite
		LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 0);
		return;
	}

	if (type == IM_SESSION_P2P_INVITE || ad_hoc_invite)
	{
		// is the inviter a friend?
		if (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL)
		{
			// if not, and we are ignoring voice invites from non-friends
			// then silently decline
			if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly"))
			{
				// invite not from a friend, so decline
				LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 1);
				return;
			}
		}
	}

	if ( !mPendingInvitations.has(session_id.asString()) )
	{
		if (caller_name.empty())
		{
			gCacheName->getName(caller_id, onInviteNameLookup, new LLSD(payload));
		}
		else
		{
			LLSD args;
			args["NAME"] = caller_name;
			//args["GROUP"] = session_name;
			LLGroupMgrGroupData* temp = LLGroupMgr::getInstance()->getGroupData(session_id);
			bool waiting = false;
			if(temp)
			{
				if (temp->isGroupPropertiesDataComplete())
				{
					args["GROUP"] = temp->mName;
				}
				else
				{
					waiting = true;
				}
			}
			else
			{
				waiting = true;
			}
			if(waiting)
			{
				LLGroupMgr::getInstance()->sendGroupPropertiesRequest(session_id);
			}

			LLNotifications::instance().add(notify_box_type, 
					     args, 
						 payload,
						 &inviteUserResponse);

		}
		mPendingInvitations[session_id.asString()] = LLSD();
	}
}
示例#18
0
void LLPanelGroupInvite::updateLists()
{
	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID);
	bool waiting = false;

	if (gdatap) 
	{
		if (gdatap->isGroupPropertiesDataComplete()) 
		{
			if (mImplementation->mGroupName) 
			{
				mImplementation->mGroupName->setText(gdatap->mName);
			}
		} 
		else 
		{
			waiting = true;
		}
		if (gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete()
			&& (gdatap->isRoleMemberDataComplete() || !gdatap->mMembers.size())) // MAINT-5270: large groups receives an empty members list without some powers, so RoleMemberData wouldn't be complete for them
		{
			if ( mImplementation->mRoleNames )
			{
				mImplementation->mRoleNames->clear();
				mImplementation->mRoleNames->removeall();

				//add the role names and select the everybody role by default
				mImplementation->addRoleNames(gdatap);
				mImplementation->mRoleNames->setCurrentByID(mStoreSelected);
			}
		} 
		else 
		{
			waiting = true;
		}
	} 
	else 
	{
		waiting = true;
	}

	if (waiting) 
	{
		if (!mPendingUpdate) 
		{
			LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID);
			LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID);
			LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(mImplementation->mGroupID);
			LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID);
		}
		mPendingUpdate = TRUE;
	} 
	else
	{
		mPendingUpdate = FALSE;
		if (mImplementation->mOKButton && mImplementation->mRoleNames->getItemCount()) 
		{
			mImplementation->mOKButton->setEnabled(TRUE);
		}
	}
}
// virtual
void LLPanelGroupGeneral::update(LLGroupChange gc)
{
	if (mGroupID.isNull()) return;

	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);

	if (!gdatap) return;

	LLGroupData agent_gdatap;
	bool is_member = false;
	if (gAgent.getGroupData(mGroupID,agent_gdatap)) is_member = true;

	if (mComboActiveTitle)
	{
		mComboActiveTitle->setVisible(is_member);
		mComboActiveTitle->setEnabled(mAllowEdit);
		
		if ( mActiveTitleLabel) mActiveTitleLabel->setVisible(is_member);

		if (is_member)
		{
			LLUUID current_title_role;

			mComboActiveTitle->clear();
			mComboActiveTitle->removeall();
			bool has_selected_title = false;

			if (1 == gdatap->mTitles.size())
			{
				// Only the everyone title.  Don't bother letting them try changing this.
				mComboActiveTitle->setEnabled(FALSE);
			}
			else
			{
				mComboActiveTitle->setEnabled(TRUE);
			}

			std::vector<LLGroupTitle>::const_iterator citer = gdatap->mTitles.begin();
			std::vector<LLGroupTitle>::const_iterator end = gdatap->mTitles.end();
			
			for ( ; citer != end; ++citer)
			{
				mComboActiveTitle->add(citer->mTitle,citer->mRoleID, (citer->mSelected ? ADD_TOP : ADD_BOTTOM));
				if (citer->mSelected)
				{
					mComboActiveTitle->setCurrentByID(citer->mRoleID);
					has_selected_title = true;
				}
			}
			
			if (!has_selected_title)
			{
				mComboActiveTitle->setCurrentByID(LLUUID::null);
			}
		}

	}

	// After role member data was changed in Roles->Members
	// need to update role titles. See STORM-918.
	if (gc == GC_ROLE_MEMBER_DATA)
		LLGroupMgr::getInstance()->sendGroupTitlesRequest(mGroupID);

	// If this was just a titles update, we are done.
	if (gc == GC_TITLES) return;

	bool can_change_ident = false;
	bool can_change_member_opts = false;
	can_change_ident = gAgent.hasPowerInGroup(mGroupID,GP_GROUP_CHANGE_IDENTITY);
	can_change_member_opts = gAgent.hasPowerInGroup(mGroupID,GP_MEMBER_OPTIONS);

	if (mCtrlShowInGroupList) 
	{
		mCtrlShowInGroupList->set(gdatap->mShowInList);
		mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident);
	}
	if (mComboMature)
	{
		if(gdatap->mMaturePublish)
		{
			mComboMature->setCurrentByIndex(MATURE_CONTENT);
		}
		else
		{
			mComboMature->setCurrentByIndex(NON_MATURE_CONTENT);
		}
		mComboMature->setEnabled(mAllowEdit && can_change_ident);
		mComboMature->setVisible( !gAgent.isTeen() );
	}
	if (mCtrlOpenEnrollment) 
	{
		mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment);
		mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts);
	}
	if (mCtrlEnrollmentFee) 
	{	
		mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0);
		mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts);
	}
	
	if (mSpinEnrollmentFee)
	{
		S32 fee = gdatap->mMembershipFee;
		mSpinEnrollmentFee->set((F32)fee);
		mSpinEnrollmentFee->setEnabled( mAllowEdit &&
						(fee > 0) &&
						can_change_member_opts);
	}
	if (mCtrlReceiveNotices)
	{
		mCtrlReceiveNotices->setVisible(is_member);
		if (is_member)
		{
			mCtrlReceiveNotices->setEnabled(mAllowEdit);
		}
	}

	// <exodus>
	if (mCtrlReceiveGroupChat)
	{
		mCtrlReceiveGroupChat->setVisible(is_member);
		if (is_member)
		{
			mCtrlReceiveGroupChat->setEnabled(mAllowEdit);
		}
	}
	// </exodus>

	if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
	if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
	
	if (mGroupNameEditor) mGroupNameEditor->setVisible(FALSE);
	if (mFounderName) mFounderName->setText(LLSLURL("agent", gdatap->mFounderID, "inspect").getSLURLString());
	if (mInsignia)
	{
		if (gdatap->mInsigniaID.notNull())
		{
			mInsignia->setImageAssetID(gdatap->mInsigniaID);
		}
		else
		{
			mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
		}
	}

	if (mEditCharter)
	{
		mEditCharter->setText(gdatap->mCharter);
	}
	
	if (mListVisibleMembers)
	{
		mListVisibleMembers->deleteAllItems();

		if (gdatap->isMemberDataComplete())
		{
			mMemberProgress = gdatap->mMembers.begin();
			mPendingMemberUpdate = TRUE;
			mIteratorGroup = mGroupID; // <FS:ND/> FIRE-6074

			sSDTime = 0.0f;
			sElementTime = 0.0f;
			sAllTime = 0.0f;
		}
		else
		{
			std::stringstream pending;
			pending << "Retrieving member list (" << gdatap->mMembers.size() << "\\" << gdatap->mMemberCount  << ")";

			LLSD row;
			row["columns"][0]["value"] = pending.str();
			row["columns"][0]["column"] = "name";

			mListVisibleMembers->setEnabled(FALSE);
			mListVisibleMembers->addElement(row);
		}
	}

	// <FS:Ansariel> Copy group name button
	childSetEnabled("copy_name", !gdatap->mName.empty());
	mGroupName = gdatap->mName;
	// </FS:Ansariel>

	resetDirty();
}