Exemplo n.º 1
0
void FSRadar::radarAlertMsg(const LLUUID& agent_id, const LLAvatarName& av_name, const std::string& postMsg)
{
// <FS:CR> Milkshake-style radar alerts
	static LLCachedControl<bool> milkshake_radar(gSavedSettings, "FSMilkshakeRadarToasts", false);
	
	if (milkshake_radar)
	{
		LLSD payload = agent_id;
		LLSD args;
		args["NAME"] = FSRadarEntry::getRadarName(av_name);
		args["MESSAGE"] = postMsg;
		LLNotificationPtr notification;
		notification = LLNotificationsUtil::add("RadarAlert",
												args,
												payload.with("respond_on_mousedown", TRUE),
												boost::bind(&LLAvatarActions::zoomIn, agent_id));
	}
	else
	{
// </FS:CR>
		LLChat chat;
		chat.mText = postMsg;
		chat.mSourceType = CHAT_SOURCE_SYSTEM;
		chat.mFromName = FSRadarEntry::getRadarName(av_name);
		chat.mFromID = agent_id;
		chat.mChatType = CHAT_TYPE_RADAR;
		// FS:LO FIRE-1439 - Clickable avatar names on local chat radar crossing reports
		LLSD args;
		LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
	} // <FS:CR />
}
Exemplo n.º 2
0
void LLFlatListViewEx::filterItems()
{
	typedef std::vector <LLPanel*> item_panel_list_t;

	std::string cur_filter = mFilterSubString;
	LLStringUtil::toUpper(cur_filter);

	LLSD action;
	action.with("match_filter", cur_filter);

	item_panel_list_t items;
	getItems(items);

	mHasMatchedItems = false;
	for (item_panel_list_t::iterator
			 iter = items.begin(),
			 iter_end = items.end();
		 iter != iter_end; ++iter)
	{
		LLPanel* pItem = (*iter);
		// 0 signifies that filter is matched,
		// i.e. we don't hide items that don't support 'match_filter' action, separators etc.
		if (0 == pItem->notify(action))
		{
			mHasMatchedItems = true;
			pItem->setVisible(true);
		}
		else
		{
			// TODO: implement (re)storing of current selection.
			if(!mForceShowingUnmatchedItems)
			{
				selectItem(pItem, false);
			}
			pItem->setVisible(mForceShowingUnmatchedItems);
		}
	}

	sort();
	notifyParentItemsRectChanged();
}
Exemplo n.º 3
0
static void on_avatar_name_cache_notify(const LLUUID& agent_id,
										const LLAvatarName& av_name,
										bool online,
										LLSD payload)
{
	// Popup a notify box with online status of this agent
	// Use display name only because this user is your friend
	LLSD args;
	args["NAME"] = av_name.mDisplayName;

	LLNotificationPtr notification;
	if (online)
	{
		notification =
			LLNotificationsUtil::add("FriendOnline",
									 args,
									 payload.with("respond_on_mousedown", TRUE),
									 boost::bind(&LLAvatarActions::startIM, agent_id));
	}
	else
	{
		notification =
			LLNotificationsUtil::add("FriendOffline", args, payload);
	}

	// If there's an open IM session with this agent, send a notification there too.
	LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id);
	std::string notify_msg = notification->getMessage();
	LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg);

	// If desired, also send it to nearby chat, this allows friends'
	// online/offline times to be referenced in chat & logged.
	if (gSavedSettings.getBOOL("OnlineOfflinetoNearbyChat")) {
		LLChat chat;
		chat.mText = notify_msg;
		chat.mSourceType = CHAT_SOURCE_SYSTEM;
		args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
		LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
	}
}
Exemplo n.º 4
0
static void on_avatar_name_cache_notify(const LLUUID& agent_id,
										const LLAvatarName& av_name,
										bool online,
										LLSD payload)
{
	// Popup a notify box with online status of this agent
	// Use display name only because this user is your friend
	LLSD args;
	// <FS:Ansariel> Make name clickable
	//	args["NAME"] = av_name.getDisplayName();
	std::string used_name = FSCommon::getAvatarNameByDisplaySettings(av_name);
	args["NAME"] = used_name;
	// </FS:Ansariel>
	
	args["STATUS"] = online ? LLTrans::getString("OnlineStatus") : LLTrans::getString("OfflineStatus");

	args["AGENT-ID"] = agent_id;

	LLNotificationPtr notification;

	if (online)
	{
		make_ui_sound("UISndFriendOnline"); // <FS:PP> FIRE-2731: Online/offline sound alert for friends
		notification =
			LLNotifications::instance().add("FriendOnlineOffline",
									 args,
									 payload.with("respond_on_mousedown", TRUE),
									 boost::bind(&LLAvatarActions::startIM, agent_id));
	}
	else
	{
		make_ui_sound("UISndFriendOffline"); // <FS:PP> FIRE-2731: Online/offline sound alert for friends
		notification =
			LLNotifications::instance().add("FriendOnlineOffline", args, payload);
	}

	// If there's an open IM session with this agent, send a notification there too.
	LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id);
	std::string notify_msg = notification->getMessage();

	LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg);
	// If desired, also send it to nearby chat, this allows friends'
	// online/offline times to be referenced in chat & logged.
	// [FIRE-3522 : SJ] Only show Online/Offline toast for groups which have enabled "Show notice for this set" and in the settingpage of CS is checked that the messages need to be in Toasts
	//                  or for groups which have enabled "Show notice for this set" and in the settingpage of CS is checked that the messages need to be in Nearby Chat
	static LLCachedControl<bool> OnlineOfflinetoNearbyChat(gSavedSettings, "OnlineOfflinetoNearbyChat");
	static LLCachedControl<bool> FSContactSetsNotificationNearbyChat(gSavedSettings, "FSContactSetsNotificationNearbyChat");
	if ((OnlineOfflinetoNearbyChat) || (FSContactSetsNotificationNearbyChat && LGGContactSets::getInstance()->notifyForFriend(agent_id)))
	{
		static LLCachedControl<bool> history_only(gSavedSettings, "OnlineOfflinetoNearbyChatHistory"); // LO - Adding a setting to show online/offline notices only in chat history. Helps prevent your screen from being filled with online notices on login.
		LLChat chat;
		chat.mText = (online ? LLTrans::getString("FriendOnlineNotification") : LLTrans::getString("FriendOfflineNotification"));
		chat.mSourceType = CHAT_SOURCE_SYSTEM;
		chat.mChatType = CHAT_TYPE_RADAR;
		chat.mFromID = agent_id;
		chat.mFromName = used_name;
		if (history_only)
		{
			FSFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<FSFloaterNearbyChat>("fs_nearby_chat", LLSD());
			nearby_chat->addMessage(chat, true, LLSD());
		}
		else
		{
			LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
		}

		// <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
		chat.mText = notify_msg;
		if (FSKeywords::getInstance()->chatContainsKeyword(chat, true))
		{
			FSKeywords::notify(chat);
		}
		// </FS:PP>
	}
}
Exemplo n.º 5
0
//static 
void LLFirstUse::firstUseNotification(const std::string& control_var, bool enable, const std::string& notification_name, LLSD args, LLSD payload)
{
	init();

	if (enable)
	{
		if (gSavedSettings.getBOOL("EnableUIHints"))
		{
			LL_DEBUGS("LLFirstUse") << "Trigger first use notification " << notification_name << LL_ENDL;

			// if notification doesn't already exist and this notification hasn't been disabled...
			if (gWarningSettings.getBOOL(control_var))
			{ // create new notification
				LLNotifications::instance().add(LLNotification::Params().name(notification_name).substitutions(args).payload(payload.with("control_var", control_var)));
			}
		}
	}	
	else
	{
		LL_DEBUGS("LLFirstUse") << "Disabling first use notification " << notification_name << LL_ENDL;
		LLNotifications::instance().cancelByName(notification_name);
		// redundantly clear settings var here, in case there are no notifications to cancel
		gWarningSettings.setBOOL(control_var, FALSE);
	}

}
Exemplo n.º 6
0
void LLFlatListView::detachItems(std::vector<LLPanel*>& detached_items)
{
	LLSD action;
	action.with("detach", LLSD());
	// Clear detached_items list
	detached_items.clear();
	// Go through items and detach valid items, remove them from items panel
	// and add to detached_items.
	for (pairs_iterator_t
			 iter = mItemPairs.begin(),
			 iter_end = mItemPairs.end();
		 iter != iter_end; ++iter)
	{
		LLPanel* pItem = (*iter)->first;
		if (1 == pItem->notify(action))
		{
			selectItemPair((*iter), false);
			mItemsPanel->removeChild(pItem);
			detached_items.push_back(pItem);
		}
	}
	if (!detached_items.empty())
	{
		// Some items were detached, clean ourself from unusable memory
		if (detached_items.size() == mItemPairs.size())
		{
			// This way will be faster if all items were disconnected
			for (pairs_iterator_t
					 iter = mItemPairs.begin(),
					 iter_end = mItemPairs.end();
				 iter != iter_end; ++iter)
			{
				(*iter)->first = NULL;
				delete *iter;
			}
			mItemPairs.clear();
			// Also set items panel height to zero.
			// Reshape it to allow reshaping of non-item children.
			LLRect rc = mItemsPanel->getRect();
			rc.mBottom = rc.mTop;
			mItemsPanel->reshape(rc.getWidth(), rc.getHeight());
			mItemsPanel->setRect(rc);
			setNoItemsCommentVisible(true);
		}
		else
		{
			for (std::vector<LLPanel*>::const_iterator
					 detached_iter = detached_items.begin(),
					 detached_iter_end = detached_items.end();
				 detached_iter != detached_iter_end; ++detached_iter)
			{
				LLPanel* pDetachedItem = *detached_iter;
				for (pairs_iterator_t
						 iter = mItemPairs.begin(),
						 iter_end = mItemPairs.end();
					 iter != iter_end; ++iter)
				{
					item_pair_t* item_pair = *iter;
					if (item_pair->first == pDetachedItem)
					{
						mItemPairs.erase(iter);
						item_pair->first = NULL;
						delete item_pair;
						break;
					}
				}
			}
			rearrangeItems();
		}
		notifyParentItemsRectChanged();
	}
}
Exemplo n.º 7
0
void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
{
	S32 count = msg->getNumberOfBlocksFast(_PREHASH_AgentBlock);
	BOOL chat_notify = gSavedSettings.getBOOL("ChatOnlineNotification");

	lldebugs << "Received " << count << " online notifications **** " << llendl;
	if(count > 0)
	{
		LLUUID agent_id;
		const LLRelationship* info = NULL;
		LLUUID tracking_id;
		if(mTrackingData)
		{
			tracking_id = mTrackingData->mAvatarID;
		}
		BOOL notify = FALSE;
		LLSD args;
		LLSD payload;
		for(S32 i = 0; i < count; ++i)
		{
			msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_AgentID, agent_id, i);
			payload["FROM_ID"] = agent_id;
			info = getBuddyInfo(agent_id);
			if(info)
			{
				setBuddyOnline(agent_id,online);
				if(chat_notify)
				{
					std::string first, last;
					if(gCacheName->getName(agent_id, first, last))
					{
						notify = TRUE;
						args["FIRST"] = first;
						args["LAST"] = last;
					}

				}
			}
			else
			{
				llwarns << "Received online notification for unknown buddy: " 
					<< agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << llendl;
			}

			if(tracking_id == agent_id)
			{
				// we were tracking someone who went offline
				deleteTrackingData();
			}
			// *TODO: get actual inventory id
			gInventory.addChangedMask(LLInventoryObserver::CALLING_CARD, LLUUID::null);
		}
		if(notify)
		{
			// Popup a notify box with online status of this agent
			LLNotificationPtr notification;

			if (online)
			{
				notification =
					LLNotificationsUtil::add("FriendOnline",
											 args,
											 payload.with("respond_on_mousedown", TRUE),
											 boost::bind(&LLAvatarActions::startIM, agent_id));
			}
			else
			{
				notification =
					LLNotificationsUtil::add("FriendOffline", args, payload);
			}

			// If there's an open IM session with this agent, send a notification there too.
			LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id);
			std::string notify_msg = notification->getMessage();
			LLIMModel::instance().proccessOnlineOfflineNotification(session_id, notify_msg);
		}

		mModifyMask |= LLFriendObserver::ONLINE;
		instance().notifyObservers();
		gInventory.notifyObservers();
	}
}