当前位置: 首页>>代码示例>>C++>>正文


C++ LLNotificationPtr::getID方法代码示例

本文整理汇总了C++中LLNotificationPtr::getID方法的典型用法代码示例。如果您正苦于以下问题:C++ LLNotificationPtr::getID方法的具体用法?C++ LLNotificationPtr::getID怎么用?C++ LLNotificationPtr::getID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLNotificationPtr的用法示例。


在下文中一共展示了LLNotificationPtr::getID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onNotification

//static 
bool LLNotifyBox::onNotification(const LLSD& notify)
{
	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
	
	if (!notification) return false;

	if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
	{
		//bring existing notification to top
		LLNotifyBox* boxp = LLNotifyBox::getInstance(notification->getID());
		if (boxp && !boxp->isDead())
		{
			gNotifyBoxView->showOnly(boxp);
		}
		else
		{
			bool is_script_dialog = (notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup");
			LLNotifyBox* notify_box = new LLNotifyBox(
				notification,
				is_script_dialog); //layout_script_dialog);

			gNotifyBoxView->addChild(notify_box);
		}
	}
	else if (notify["sigtype"].asString() == "delete")
	{
		LLNotifyBox* boxp = LLNotifyBox::getInstance(notification->getID());
		if (boxp && !boxp->isDead())
		{
			boxp->close();
		}
	}

	return false;
}
开发者ID:Kiera,项目名称:Sausages,代码行数:36,代码来源:llnotify.cpp

示例2: processNotification

//--------------------------------------------------------------------------
bool LLIMHandler::processNotification(const LLSD& notify)
{
	if(!mChannel)
	{
		return false;
	}

	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());

	if(!notification)
		return false;

	// arrange a channel on a screen
	if(!mChannel->getVisible())
	{
		initChannel();
	}

	if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
	{
		LLSD substitutions = notification->getSubstitutions();

		// According to comments in LLIMMgr::addMessage(), if we get message
		// from ourselves, the sender id is set to null. This fixes EXT-875.
		LLUUID avatar_id = substitutions["FROM_ID"].asUUID();
		if (avatar_id.isNull())
			avatar_id = gAgentID;

		LLToastIMPanel::Params im_p;
		im_p.notification = notification;
		im_p.avatar_id = avatar_id;
		im_p.from = substitutions["FROM"].asString();
		im_p.time = substitutions["TIME"].asString();
		im_p.message = substitutions["MESSAGE"].asString();
		im_p.session_id = substitutions["SESSION_ID"].asUUID();

		LLToastIMPanel* im_box = new LLToastIMPanel(im_p);

		LLToast::Params p;
		p.notif_id = notification->getID();
		p.session_id = im_p.session_id;
		p.notification = notification;
		p.panel = im_box;
		p.can_be_stored = false;
		p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1);
		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
		if(channel)
			channel->addToast(p);

		// send a signal to the counter manager;
		mNewNotificationSignal();
	}
	else if (notify["sigtype"].asString() == "delete")
	{
		mChannel->killToastByNotificationID(notification->getID());
	}
	return false;
}
开发者ID:OS-Development,项目名称:VW.Kirsten,代码行数:59,代码来源:llimhandler.cpp

示例3: addNotifPanelToIM

// static
void LLHandlerUtil::addNotifPanelToIM(const LLNotificationPtr& notification)
{
	const std::string name = LLHandlerUtil::getSubstitutionName(notification);
	LLUUID from_id = notification->getPayload()["from_id"];

	LLUUID session_id = spawnIMSession(name, from_id);
	// add offer to session
	LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession(
			session_id);
	llassert_always(session != NULL);

	LLSD offer;
	offer["notification_id"] = notification->getID();
	offer["from"] = SYSTEM_FROM;
	offer["time"] = LLLogChat::timestamp(false);
	offer["index"] = (LLSD::Integer)session->mMsgs.size();
	session->mMsgs.push_front(offer);


	// update IM floater and counters
	LLSD arg;
	arg["session_id"] = session_id;
	arg["num_unread"] = ++(session->mNumUnread);
	arg["participant_unread"] = ++(session->mParticipantUnreadMessageCount);
	LLIMModel::getInstance()->mNewMsgSignal(arg);
}
开发者ID:OS-Development,项目名称:VW.Dolphin_v3,代码行数:27,代码来源:llnotificationhandlerutil.cpp

示例4: onChange

void LLAlertHandler::onChange( LLNotificationPtr notification )
{
	LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
	LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
	if(channel)
		channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
}
开发者ID:CaseyraeStarfinder,项目名称:Firestorm-Viewer,代码行数:7,代码来源:llnotificationalerthandler.cpp

示例5: onNewNotification

//static 
bool LLAlertDialog::onNewNotification(const LLSD& notify, bool is_modal)
{
	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
	
	if(notification)
	{
		if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "load")
		{
			LLAlertDialog* dialog = new LLAlertDialog(notification, is_modal);
			dialog->show();
		}
		else if (notify["sigtype"].asString() == "change")
		{
			LLAlertDialog* dialog = getInstance(notification->getID());
			if (dialog)
			{
				dialog->show();
			}
			else
			{
				LLAlertDialog* dialog = new LLAlertDialog(notification, is_modal);
				dialog->show();
			}
		}
	}

	return false;
}
开发者ID:1234-,项目名称:SingularityViewer,代码行数:29,代码来源:llalertdialog.cpp

示例6: processNotification

//--------------------------------------------------------------------------
bool LLAlertHandler::processNotification(const LLNotificationPtr& notification)
{
	if(mChannel.isDead())
	{
		return false;
	}

	// arrange a channel on a screen
	if(!mChannel.get()->getVisible())
	{
		initChannel();
	}

	if (notification->canLogToIM() && notification->hasFormElements())
	{
		const std::string name = LLHandlerUtil::getSubstitutionName(notification);

		LLUUID from_id = notification->getPayload()["from_id"];

// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9)
		// Don't spawn an IM session for non-chat related events:
		//   - LLHandlerUtil::logToIMP2P() below will still be called with to_file_only == false
		//   - LLHandlerUtil::logToIM() will eventually be called as a result and without an open IM session it will log the
		//     same message as it would for an open session whereas to_file_only == true would take a different code path
		if ( (RlvActions::hasOpenP2PSession(from_id)) || (RlvActions::canStartIM(from_id)) )
		{
// [/RLVa:KB]
			// firstly create session...
			LLHandlerUtil::spawnIMSession(name, from_id);
// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9)
		}
// [/RLVa:KB]

		// ...then log message to have IM Well notified about new message
		LLHandlerUtil::logToIMP2P(notification);
	}

	LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
	LLToast::Params p;
	p.notif_id = notification->getID();
	p.notification = notification;
	p.panel = dynamic_cast<LLToastPanel*>(alert_dialog);
	p.enable_hide_btn = false;
	p.can_fade = false;
	p.is_modal = mIsModal;
	p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1);

	// Show alert in middle of progress view (during teleport) (EXT-1093)
	LLProgressView* progress = gViewerWindow->getProgressView();
	LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled();
	mChannel.get()->updatePositionAndSize(rc);

	LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
	if(channel)
		channel->addToast(p);
	
	return false;
}
开发者ID:CaseyraeStarfinder,项目名称:Firestorm-Viewer,代码行数:59,代码来源:llnotificationalerthandler.cpp

示例7: onNotification

//static 
bool LLNotifyBox::onNotification(const LLSD& notify)
{
	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
	
	if (!notification) return false;

	if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
	{
		//bring existing notification to top
		//This getInstance is ugly, as LLNotifyBox is derived from both LLInstanceTracker and LLEventTimer, which also is derived from its own LLInstanceTracker
		//Have to explicitly determine which getInstance function to use.
		LLNotifyBox* boxp = LLInstanceTracker<LLNotifyBox, LLUUID>::getInstance(notification->getID());
		if (boxp && !boxp->isDead())
		{
			gNotifyBoxView->showOnly(boxp);
		}
		else
		{
			bool is_script_dialog = (notification->getName() == "ScriptDialog" || notification->getName() == "ScriptDialogGroup");
			LLNotifyBox* notify_box = new LLNotifyBox(
				notification,
				is_script_dialog); //layout_script_dialog);

			gNotifyBoxView->addChild(notify_box);
		}
	}
	else if (notify["sigtype"].asString() == "delete")
	{
		LLNotifyBox* boxp = LLInstanceTracker<LLNotifyBox, LLUUID>::getInstance(notification->getID());
		if (boxp && !boxp->isDead())
		{
			boxp->close();
		}
	}

	return false;
}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:38,代码来源:llnotify.cpp

示例8: onNotification

//static 
bool LLNotifyBox::onNotification(const LLSD& notify)
{
	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
	
	if (!notification) return false;

	if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
	{
		if (notification->getPayload().has("SUPPRESS_TOAST"))
		{
			chat_notification(notification);
			return false;
		}
		//bring existing notification to top
		//This getInstance is ugly, as LLNotifyBox is derived from both LLInstanceTracker and LLEventTimer, which also is derived from its own LLInstanceTracker
		//Have to explicitly determine which getInstance function to use.
		LLNotifyBox* boxp = LLInstanceTracker<LLNotifyBox, LLUUID>::getInstance(notification->getID());
		if (boxp && !boxp->isDead())
		{
			gNotifyBoxView->showOnly(boxp);
		}
		else
		{
			gNotifyBoxView->addChild(new LLNotifyBox(notification));
		}
	}
	else if (notify["sigtype"].asString() == "delete")
	{
		LLNotifyBox* boxp = LLInstanceTracker<LLNotifyBox, LLUUID>::getInstance(notification->getID());
		if (boxp && !boxp->isDead())
		{
			boxp->close();
		}
	}

	return false;
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:38,代码来源:llnotify.cpp

示例9: onDeleteToast

void LLScriptHandler::onDeleteToast(LLToast* toast)
{
	// send a signal to the counter manager
	mDelNotificationSignal();

	// send a signal to a listener to let him perform some action
	// in this case listener is a SysWellWindow and it will remove a corresponding item from its list
	mNotificationIDSignal(toast->getNotificationID());

	LLNotificationPtr notification = LLNotifications::getInstance()->find(toast->getNotificationID());
	
	if( notification && 
		(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName()) )
	{
		LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
	}
}
开发者ID:OS-Development,项目名称:VW.Zen,代码行数:17,代码来源:llnotificationscripthandler.cpp

示例10: if

LLAlertDialog::LLAlertDialog( LLNotificationPtr notification, bool modal)
	:	LLModalDialog( notification->getLabel(), 100, 100, modal ),  // dummy size.  Will reshape below.
		LLInstanceTracker<LLAlertDialog, LLUUID>(notification->getID()),
		mDefaultButton( NULL ),
		mCheck(NULL),
		mCaution(notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH),
		mLabel(notification->getName()),
		mLineEditor(NULL),
		mNote(notification)
{
	const LLFontGL* font = LLResMgr::getInstance()->getRes( FONT_NAME );
	const S32 LINE_HEIGHT = llfloor(font->getLineHeight() + 0.99f);
	const S32 EDITOR_HEIGHT = 20;

	LLNotificationFormPtr form = mNote->getForm();
	std::string edit_text_name;
	std::string edit_text_contents;
	bool is_password = false;

	setBackgroundVisible(TRUE);
	setBackgroundOpaque(TRUE);

	typedef std::list<ButtonData> options_t;
	options_t options;

	// for now, get LLSD to iterator over form elements
	LLSD form_sd = form->asLLSD();

	for (LLSD::array_const_iterator it = form_sd.beginArray(); it != form_sd.endArray(); ++it)
	{
		std::string type = (*it)["type"].asString();
		if (type == "button")
		{
			options.push_back(ButtonData());
			ButtonData& button_data = options.back();
			button_data.mName = (*it)["name"].asString();
			button_data.mText = (*it)["text"].asString();
			button_data.mDefault = (*it)["default"].asBoolean();
			if(options.size()-1 == mNote->getURLOption())
				button_data.mUrl = mNote->getURL();
		}
		else if (type == "text")
		{
			edit_text_contents = (*it)["value"].asString();
			edit_text_name = (*it)["name"].asString();
		}
		else if (type == "password")
		{
			edit_text_contents = (*it)["value"].asString();
			edit_text_name = (*it)["name"].asString();
			is_password = true;
		}
	}
	// Buttons
	if (options.empty())
	{
		options.push_back(ButtonData());
		ButtonData& button_data = options.back();
		button_data.mName = "close";
		button_data.mText = "Close";
		button_data.mDefault = true;
	}

	S32 num_options = options.size();

	// Calc total width of buttons
	S32 button_width = 0;
	S32 sp = font->getWidth(std::string("OO"));
	for( options_t::iterator it = options.begin(); it != options.end(); it++ )
	{
		S32 w = S32(font->getWidth( it->mText ) + 0.99f) + sp + 2 * LLBUTTON_H_PAD;
		button_width = llmax( w, button_width );
	}
	S32 btn_total_width = button_width;
	if( num_options > 1 )
	{
		btn_total_width = (num_options * button_width) + ((num_options - 1) * BTN_HPAD);
	}

	// Message: create text box using raw string, as text has been structure deliberately
	// Use size of created text box to generate dialog box size
	std::string msg = mNote->getMessage();
	llwarns << "Alert: " << msg << llendl;
	LLTextBox* msg_box = new LLTextBox( std::string("Alert message"), msg, (F32)MAX_ALLOWED_MSG_WIDTH, font );

	const LLRect& text_rect = msg_box->getRect();
	S32 dialog_width = llmax( btn_total_width, text_rect.getWidth() ) + 2 * HPAD;
	S32 dialog_height = text_rect.getHeight() + 3 * VPAD + BTN_HEIGHT;

	if (hasTitleBar())
	{
		dialog_height += LINE_HEIGHT; // room for title bar
	}

	// it's ok for the edit text body to be empty, but we want the name to exist if we're going to draw it
	if (!edit_text_name.empty())
	{
		dialog_height += EDITOR_HEIGHT + VPAD;
		dialog_width = llmax(dialog_width, (S32)(font->getWidth( edit_text_contents ) + 0.99f));
	}
//.........这里部分代码省略.........
开发者ID:1234-,项目名称:SingularityViewer,代码行数:101,代码来源:llalertdialog.cpp

示例11: init

LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, const LLRect& rect, bool show_images)
    :	LLToastPanel(notification),
      LLInstanceTracker<LLToastNotifyPanel, LLUUID, LLInstanceTrackerReplaceOnCollision>(notification->getID())
{
    init(rect, show_images);
}
开发者ID:Belxjander,项目名称:Kirito,代码行数:6,代码来源:lltoastnotifypanel.cpp

示例12: processNotification

//--------------------------------------------------------------------------
bool LLTipHandler::processNotification(const LLSD& notify)
{
	if(mChannel.isDead())
	{
		return false;
	}

	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());

	if(!notification)
		return false;	

	// arrange a channel on a screen
	if(!mChannel.get()->getVisible())
	{
		initChannel();
	}

	if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
	{
		// archive message in nearby chat
		if (LLHandlerUtil::canLogToNearbyChat(notification))
		{
			LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);

			// don't show toast if Nearby Chat is opened
			LLFloaterNearbyChat* nearby_chat = LLFloaterNearbyChat::getInstance();
			// <FS:Zi> Remove floating chat bar
			// LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance();
			// if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible())
			if (nearby_chat->getVisible())
			// </FS:Zi>
			{
				return false;
			}
		}

		std::string session_name = notification->getPayload()["SESSION_NAME"];
		const std::string name = notification->getSubstitutions()["NAME"];
		const LLUUID agent_id = notification->getSubstitutions()["AGENT-ID"];
		
		if (session_name.empty())
		{
			session_name = name;
		}
		LLUUID from_id = notification->getPayload()["from_id"];
		if (LLHandlerUtil::canLogToIM(notification))
		{
//			LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name,
//					notification->getMessage(), from_id, from_id);
// [SL:KB] - Patch: Chat-Logs | Checked: 2010-11-18 (Catznip-2.4.0c) | Added: Catznip-2.4.0c
			LLHandlerUtil::logToIMP2P(notification, false);
// [/SL:KB]
		}

		if (LLHandlerUtil::canSpawnIMSession(notification))
		{
			LLHandlerUtil::spawnIMSession(name, from_id);
		}

		// don't spawn toast for inventory accepted/declined offers if respective IM window is open (EXT-5909)
		if (!LLHandlerUtil::canSpawnToast(notification))
		{
			return false;
		}

		// [FIRE-3522 : SJ] Only show Online/Offline toast when ChatOnlineNotification is enabled or the Friend is one you want to have on/offline notices from
		if (!gSavedSettings.getBOOL("ChatOnlineNotification") && ("FriendOffline" == notification->getName() || "FriendOnline" == notification->getName()))
		{
			// [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
			if (!(gSavedSettings.getBOOL("FSContactSetsNotificationToast") && LGGContactSets::getInstance()->notifyForFriend(agent_id)))
			{
				return false;
			}
		}

		LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);

		LLToast::Params p;
		p.notif_id = notification->getID();
		p.notification = notification;
		p.lifetime_secs = gSavedSettings.getS32("NotificationTipToastLifeTime");
		p.panel = notify_box;
		p.is_tip = true;
		p.can_be_stored = false;
		
		removeExclusiveNotifications(notification);

		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
		if(channel)
			channel->addToast(p);
	}
	else if (notify["sigtype"].asString() == "delete")
	{
		mChannel.get()->killToastByNotificationID(notification->getID());
	}
	return false;
}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:99,代码来源:llnotificationtiphandler.cpp

示例13: processNotification

//--------------------------------------------------------------------------
bool LLIMHandler::processNotification(const LLSD& notify)
{
	if(mChannel.isDead())
	{
		return false;
	}

	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());

	if(!notification)
		return false;

	static LLCachedControl<bool> fsUseNearbyChatConsole(gSavedSettings, "FSUseNearbyChatConsole");
	if (FSLogImToChatConsole && fsUseNearbyChatConsole)
	{
		if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
		{
			LLSD substitutions = notification->getSubstitutions();

			// FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name
			std::string group;
			LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(substitutions["SESSION_ID"]);
			if(session)
			{
				S32 groupNameLength = gSavedSettings.getS32("FSShowGroupNameLength");
				if(groupNameLength != 0 && session->isGroupSessionType())
				{
					group = session->mName.substr(0,groupNameLength);
				}
			}
			// FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name

			// Filter notifications with empty ID and empty message
			if (substitutions["FROM_ID"].asString() == "" && substitutions["MESSAGE"].asString() == "") return false;

			// Ansarial, replace long lock of local DN handling with the following call
			//LLAvatarNameCache::get(LLUUID(substitutions["FROM_ID"].asString()), boost::bind(&LLIMHandler::onAvatarNameLookup, this, _1, _2, substitutions["MESSAGE"].asString()));
			LLAvatarNameCache::get(LLUUID(substitutions["FROM_ID"].asString()), boost::bind(&LLIMHandler::onAvatarNameLookup, this, _1, _2, substitutions["MESSAGE"].asString(),group)); // FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name
		}
	}
	else
	{
		// arrange a channel on a screen
		if(!mChannel.get()->getVisible())
		{
			initChannel();
		}

		if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
		{
			LLSD substitutions = notification->getSubstitutions();

			// According to comments in LLIMMgr::addMessage(), if we get message
			// from ourselves, the sender id is set to null. This fixes EXT-875.
			LLUUID avatar_id = substitutions["FROM_ID"].asUUID();
			if (avatar_id.isNull())
				avatar_id = gAgentID;

			LLToastIMPanel::Params im_p;
			im_p.notification = notification;
			im_p.avatar_id = avatar_id;
			im_p.from = substitutions["FROM"].asString();
			im_p.time = substitutions["TIME"].asString();
			im_p.message = substitutions["MESSAGE"].asString();
			im_p.session_id = substitutions["SESSION_ID"].asUUID();

			LLToastIMPanel* im_box = new LLToastIMPanel(im_p);

			LLToast::Params p;
			p.notif_id = notification->getID();
			p.session_id = im_p.session_id;
			p.notification = notification;
			p.panel = im_box;
			p.can_be_stored = false;
			p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1);
			LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
			if(channel)
				channel->addToast(p);

			// send a signal to the counter manager;
			mNewNotificationSignal();
		}
		else if (notify["sigtype"].asString() == "delete")
		{
			mChannel.get()->killToastByNotificationID(notification->getID());
		}
	}
	return false;
}
开发者ID:wish-ds,项目名称:firestorm-ds,代码行数:90,代码来源:llimhandler.cpp

示例14: processNotification

//--------------------------------------------------------------------------
bool LLScriptHandler::processNotification(const LLSD& notify)
{
	if(!mChannel)
	{
		return false;
	}

	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());

	if(!notification)
		return false;

	// arrange a channel on a screen
	if(!mChannel->getVisible())
	{
		initChannel();
	}
	
	if(notify["sigtype"].asString() == "add")
	{
		// Don't log persisted notifications a second time
		if (!notification->isPersisted())
		{
			// Archive message in nearby chat if desired
			if (LLHandlerUtil::canLogToNearbyChat(notification))
			{
				LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
			}
			// Archive message in instant message if desired
			if (LLHandlerUtil::canLogToIM(notification))
			{
				LLHandlerUtil::logToIMP2P(notification);
			}
		}

		if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName())
		{
			LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID());
		}
		else
		{
			LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);

			LLToast::Params p;
			p.notif_id = notification->getID();
			p.notification = notification;
			p.panel = notify_box;	
			p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1);

			LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
			if(channel)
			{
				channel->addToast(p);
			}

			// send a signal to the counter manager
			mNewNotificationSignal();
		}
	}
	else if (notify["sigtype"].asString() == "delete")
	{
		if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName())
		{
			LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
		}
		else
		{
			mChannel->killToastByNotificationID(notification->getID());
		}
	}
	return false;
}
开发者ID:OS-Development,项目名称:VW.Zen,代码行数:73,代码来源:llnotificationscripthandler.cpp

示例15: processNotification

//--------------------------------------------------------------------------
bool LLTipHandler::processNotification(const LLSD& notify)
{
	if(!mChannel)
	{
		return false;
	}

	LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());

	if(!notification)
		return false;	

	// arrange a channel on a screen
	if(!mChannel->getVisible())
	{
		initChannel();
	}

	if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
	{
		// archive message in nearby chat
		if (LLHandlerUtil::canLogToNearbyChat(notification))
		{
			LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);

			// don't show toast if Nearby Chat is opened
			LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<
					LLNearbyChat>("nearby_chat", LLSD());
			if (nearby_chat->getVisible())
			{
				return true;
			}
		}

		const std::string name = notification->getSubstitutions()["NAME"];
		LLUUID from_id = notification->getPayload()["from_id"];
		if (LLHandlerUtil::canLogToIM(notification))
		{
			LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, name, name,
					notification->getMessage(), from_id, from_id);
		}

		if (LLHandlerUtil::canSpawnIMSession(notification))
		{
			LLHandlerUtil::spawnIMSession(name, from_id);
		}

		// don't spawn toast for inventory accepted/declined offers if respective IM window is open (EXT-5909)
		if (!LLHandlerUtil::canSpawnToast(notification))
		{
			return true;
		}

		LLToastPanel* notify_box = NULL;
		if("FriendOffline" == notification->getName() || "FriendOnline" == notification->getName())
		{
			LLOnlineStatusToast::Params p;
			p.notification = notification;
			p.message = notification->getMessage();
			p.avatar_id = notification->getPayload()["FROM_ID"];
			notify_box = new LLOnlineStatusToast(p);
		}
		else
		{
			notify_box = new LLToastNotifyPanel(notification);
		}

		LLToast::Params p;
		p.notif_id = notification->getID();
		p.notification = notification;
		p.lifetime_secs = gSavedSettings.getS32("NotificationTipToastLifeTime");
		p.panel = notify_box;
		p.is_tip = true;
		p.can_be_stored = false;
		
		removeExclusiveNotifications(notification);

		LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
		if(channel)
			channel->addToast(p);
	}
	else if (notify["sigtype"].asString() == "delete")
	{
		mChannel->killToastByNotificationID(notification->getID());
	}
	return true;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:88,代码来源:llnotificationtiphandler.cpp


注:本文中的LLNotificationPtr::getID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。