本文整理汇总了C++中LLNotificationPtr类的典型用法代码示例。如果您正苦于以下问题:C++ LLNotificationPtr类的具体用法?C++ LLNotificationPtr怎么用?C++ LLNotificationPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLNotificationPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isScriptTextbox
bool LLScriptFloater::isScriptTextbox(LLNotificationPtr notification)
{
// get a form for the notification
LLNotificationFormPtr form(notification->getForm());
if (form)
{
// get number of elements in the form
int num_options = form->getNumElements();
// if ANY of the buttons have the magic lltextbox string as
// name, then treat the whole dialog as a simple text entry
// box (i.e. mixed button and textbox forms are not supported)
for (int i=0; i<num_options; ++i)
{
LLSD form_element = form->getElement(i);
if (form_element["name"].asString() == TEXTBOX_MAGIC_TOKEN)
{
return true;
}
}
}
return false;
}
示例2: onLLNotification
bool GrowlManager::onLLNotification(const LLSD& notice)
{
if(notice["sigtype"].asString() != "add")
return false;
LLNotificationPtr notification = LLNotifications::instance().find(notice["id"].asUUID());
std::string name = notification->getName();
LLSD substitutions = notification->getSubstitutions();
if(gGrowlManager->mNotifications.find(name) != gGrowlManager->mNotifications.end())
{
GrowlNotification* growl_notification = &gGrowlManager->mNotifications[name];
std::string body = "";
std::string title = "";
if(growl_notification->useDefaultTextForTitle)
title = notification->getMessage();
else if(growl_notification->growlTitle != "")
{
title = growl_notification->growlTitle;
LLStringUtil::format(title, substitutions);
}
if(growl_notification->useDefaultTextForBody)
body = notification->getMessage();
else if(growl_notification->growlBody != "")
{
body = growl_notification->growlBody;
LLStringUtil::format(body, substitutions);
}
//TM:FS no need to log whats sent to growl
//LL_INFOS("GrowlLLNotification") << "Notice: " << title << ": " << body << LL_ENDL;
if(name == "ObjectGiveItem" || name == "ObjectGiveItemUnknownUser" || name == "UserGiveItem" || name == "SystemMessageTip")
{
LLUrlMatch urlMatch;
LLWString newLine = utf8str_to_wstring(body);
LLWString workLine = utf8str_to_wstring(body);
while (LLUrlRegistry::instance().findUrl(workLine, urlMatch) && !urlMatch.getUrl().empty())
{
LLWStringUtil::replaceString(newLine, utf8str_to_wstring(urlMatch.getUrl()), utf8str_to_wstring(urlMatch.getLabel()));
// Remove the URL from the work line so we don't end in a loop in case of regular URLs!
// findUrl will always return the very first URL in a string
workLine = workLine.erase(0, urlMatch.getEnd() + 1);
}
body = wstring_to_utf8str(newLine);
}
gGrowlManager->notify(title, body, growl_notification->growlName);
}
return false;
}
示例3: updateVisibleIMFLoaterMesages
// static
void LLHandlerUtil::updateVisibleIMFLoaterMesages(const LLNotificationPtr& notification)
{
const std::string name = LLHandlerUtil::getSubstitutionName(notification);
LLUUID from_id = notification->getPayload()["from_id"];
LLUUID session_id = spawnIMSession(name, from_id);
updateIMFLoaterMesages(session_id);
}
示例4: update
void LLNotifications::update(const LLNotificationPtr pNotif)
{
LLNotificationSet::iterator it=mItems.find(pNotif);
if (it != mItems.end())
{
updateItem(LLSD().insert("sigtype", "change").insert("id", pNotif->id()), pNotif);
}
}
示例5: mDelNotificationSignal
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());
}
}
示例6: name
// static
void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only)
{
const std::string name = LLHandlerUtil::getSubstitutionName(notification);
const std::string& session_name = notification->getPayload().has(
"SESSION_NAME") ? notification->getPayload()["SESSION_NAME"].asString() : name;
// don't create IM p2p session with objects, it's necessary condition to log
if (notification->getName() != OBJECT_GIVE_ITEM)
{
LLUUID from_id = notification->getPayload()["from_id"];
//there still appears a log history file with weird name " .txt"
if (" " == session_name || "{waiting}" == session_name || "{nobody}" == session_name)
{
llwarning("Weird session name (" + session_name + ") for notification " + notification->getName(), 666)
}
if(to_file_only)
{
logToIM(IM_NOTHING_SPECIAL, session_name, "", notification->getMessage(),
LLUUID(), LLUUID());
}
else
{
logToIM(IM_NOTHING_SPECIAL, session_name, INTERACTIVE_SYSTEM_FROM, notification->getMessage(),
from_id, LLUUID());
}
}
示例7: canSpawnIMSession
// static
bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification)
{
// return OFFER_FRIENDSHIP == notification->getName()
// || USER_GIVE_ITEM == notification->getName()
// || TELEPORT_OFFERED == notification->getName();
// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a
// return
// (canEmbedNotificationInIM(notification)) &&
// ( (OFFER_FRIENDSHIP == notification->getName()) || (USER_GIVE_ITEM == notification->getName()) ||
// (TELEPORT_OFFERED == notification->getName()) );
// [/SL:KB]
// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h
return
(canEmbedNotificationInIM(notification)) &&
( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStartIM(notification->getPayload()["from_id"].asUUID())) ) &&
( (OFFER_FRIENDSHIP == notification->getName()) || (USER_GIVE_ITEM == notification->getName()) ||
(TELEPORT_OFFERED == notification->getName()) );
// [/RLVa:KB]
}
示例8: uniqueHandler
bool LLNotifications::uniqueHandler(const LLSD& payload)
{
LLNotificationPtr pNotif = LLNotifications::instance().find(payload["id"].asUUID());
if (pNotif && pNotif->hasUniquenessConstraints())
{
if (payload["sigtype"].asString() == "add")
{
// not a duplicate according to uniqueness criteria, so we keep it
// and store it for future uniqueness checks
mUniqueNotifications.insert(std::make_pair(pNotif->getName(), pNotif));
}
else if (payload["sigtype"].asString() == "delete")
{
mUniqueNotifications.erase(pNotif->getName());
}
}
return false;
}
示例9: initObjectTypeMap
// static
LLScriptFloaterManager::EObjectType LLScriptFloaterManager::getObjectType(const LLUUID& notification_id)
{
if(notification_id.isNull())
{
llwarns << "Invalid notification ID" << llendl;
return OBJ_UNKNOWN;
}
static const object_type_map TYPE_MAP = initObjectTypeMap();
LLNotificationPtr notification = LLNotificationsUtil::find(notification_id);
object_type_map::const_iterator it = TYPE_MAP.find(notification->getName());
if(it != TYPE_MAP.end())
{
return it->second;
}
llwarns << "Unknown object type" << llendl;
return OBJ_UNKNOWN;
}
示例10: add
void LLNotifications::add(const LLNotificationPtr pNotif)
{
// first see if we already have it -- if so, that's a problem
LLNotificationSet::iterator it=mItems.find(pNotif);
if (it != mItems.end())
{
llerrs << "Notification added a second time to the master notification channel." << llendl;
}
updateItem(LLSD().insert("sigtype", "add").insert("id", pNotif->id()), pNotif);
}
示例11: logToNearbyChat
// static
void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type)
{
LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
if(nearby_chat)
{
LLChat chat_msg(notification->getMessage());
chat_msg.mSourceType = type;
chat_msg.mFromName = SYSTEM_FROM;
chat_msg.mFromID = LLUUID::null;
nearby_chat->addMessage(chat_msg);
}
}
示例12: getSubstitutionName
// static
std::string LLHandlerUtil::getSubstitutionName(const LLNotificationPtr& notification)
{
std::string res = notification->getSubstitutions().has("NAME")
? notification->getSubstitutions()["NAME"]
: notification->getSubstitutions()["[NAME]"];
if (res.empty())
{
LLUUID from_id = notification->getPayload()["FROM_ID"];
//*TODO all keys everywhere should be made of the same case, there is a mix of keys in lower and upper cases
if (from_id.isNull())
{
from_id = notification->getPayload()["from_id"];
}
if(!gCacheName->getFullName(from_id, res))
{
res = "";
}
}
return res;
}
示例13: canSpawnToast
// static
bool LLHandlerUtil::canSpawnToast(const LLNotificationPtr& notification)
{
if(INVENTORY_DECLINED == notification->getName()
|| INVENTORY_ACCEPTED == notification->getName())
{
// return false for inventory accepted/declined notifications if respective IM window is open (EXT-5909)
return ! isIMFloaterOpened(notification);
}
if(FRIENDSHIP_ACCEPTED == notification->getName())
{
// don't show FRIENDSHIP_ACCEPTED if IM window is opened and focused - EXT-6441
return ! isIMFloaterFocused(notification);
}
if(OFFER_FRIENDSHIP == notification->getName()
|| USER_GIVE_ITEM == notification->getName()
|| TELEPORT_OFFERED == notification->getName())
{
// When ANY offer arrives, show toast, unless IM window is already open - EXT-5904
return ! isIMFloaterOpened(notification);
}
return true;
}
示例14: handleIgnoredNotification
bool handleIgnoredNotification(const LLSD& payload)
{
if (payload["sigtype"].asString() == "add")
{
LLNotificationPtr pNotif = LLNotifications::instance().find(payload["id"].asUUID());
if (!pNotif) return false;
LLNotificationFormPtr form = pNotif->getForm();
LLSD response;
switch(form->getIgnoreType())
{
case LLNotificationForm::IGNORE_WITH_DEFAULT_RESPONSE:
response = pNotif->getResponseTemplate(LLNotification::WITH_DEFAULT_BUTTON);
break;
case LLNotificationForm::IGNORE_WITH_LAST_RESPONSE:
response = LLUI::sIgnoresGroup->getLLSD("Default" + pNotif->getName());
break;
case LLNotificationForm::IGNORE_SHOW_AGAIN:
break;
default:
return false;
}
pNotif->setIgnored(true);
pNotif->respond(response);
return true; // don't process this item any further
}
return false;
}
示例15: on_avatar_name_cache_notify
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);
}
}