// 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()); } }
bool LLNotification::isEquivalentTo(LLNotificationPtr that) const { if (this->mTemplatep->mName != that->mTemplatep->mName) { return false; // must have the same template name or forget it } if (this->mTemplatep->mUnique) { const LLSD& these_substitutions = this->getSubstitutions(); const LLSD& those_substitutions = that->getSubstitutions(); const LLSD& this_payload = this->getPayload(); const LLSD& that_payload = that->getPayload(); // highlander bit sez there can only be one of these for (std::vector<std::string>::const_iterator it = mTemplatep->mUniqueContext.begin(), end_it = mTemplatep->mUniqueContext.end(); it != end_it; ++it) { // if templates differ in either substitution strings or payload with the given field name // then they are considered inequivalent // use of get() avoids converting the LLSD value to a map as the [] operator would if (these_substitutions.get(*it).asString() != those_substitutions.get(*it).asString() || this_payload.get(*it).asString() != that_payload.get(*it).asString()) { return false; } } return true; } return false; }
//static bool LLGroupNotifyBox::onNewNotification(const LLSD& notify) { LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); if (notification) { const LLSD& payload = notification->getPayload(); // Get the group data LLGroupData group_data; if (!gAgent.getGroupData(payload["group_id"].asUUID(),group_data)) { llwarns << "Group notice for unkown group: " << payload["group_id"].asUUID() << llendl; return false; } LLGroupNotifyBox* self; self = new LLGroupNotifyBox(payload["subject"].asString(), payload["message"].asString(), payload["sender_name"].asString(), payload["group_id"].asUUID(), group_data.mInsigniaID, group_data.mName, notification->getDate(), payload["inventory_offer"].isDefined(), payload["inventory_name"].asString(), payload["inventory_offer"]); gNotifyBoxView->addChild(self); } return false; }
// 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); }
// 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); }
//-------------------------------------------------------------------------- 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; }
LLUUID notification_id_to_object_id(const LLUUID& notification_id) { LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id); if(notification) { return notification->getPayload()["object_id"].asUUID(); } return LLUUID::null; }
// 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; }
//static bool LLFirstUse::processNotification(const LLSD& notify) { if (notify["sigtype"].asString() == "delete") { LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); if (notification) { // disable any future notifications gWarningSettings.setBOOL(notification->getPayload()["control_var"], FALSE); } } return false; }
LLPanelOnlineStatus::LLPanelOnlineStatus( const LLNotificationPtr& notification) : LLPanelTipToast(notification) { buildFromFile( "panel_online_status_toast.xml"); getChild<LLUICtrl>("avatar_icon")->setValue(notification->getPayload()["FROM_ID"]); getChild<LLUICtrl>("message")->setValue(notification->getMessage()); if (notification->getPayload().has("respond_on_mousedown") && notification->getPayload()["respond_on_mousedown"]) { setMouseDownCallback(boost::bind(&LLNotification::respond, notification, notification->getResponseTemplate())); } S32 max_line_count = gSavedSettings.getS32("TipToastMessageLineCount"); snapToMessageHeight(getChild<LLTextBox> ("message"), max_line_count); }
// static bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) { bool res = false; LLUUID from_id = notification->getPayload()["from_id"]; LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); LLIMFloater* im_floater = LLFloaterReg::findTypedInstance<LLIMFloater>( "impanel", session_id); if (im_floater != NULL) { res = im_floater->getVisible() == TRUE; } return res; }
bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification) { LLUUID media_id = notification->getPayload()["media_id"].asUUID(); LLMediaCtrl* media_instance = LLMediaCtrl::getInstance(media_id); if (media_instance) { media_instance->showNotification(notification); } else if (LLViewerMediaFocus::instance().getControlsMediaID() == media_id) { LLViewerMediaImpl* impl = LLViewerMedia::getMediaImplFromTextureID(media_id); if (impl) { impl->showNotification(notification); } } return false; }
// 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] }
// static void LLHandlerUtil::decIMMesageCounter(const LLNotificationPtr& notification) { const std::string name = LLHandlerUtil::getSubstitutionName(notification); LLUUID from_id = notification->getPayload()["from_id"]; LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id); LLIMModel::LLIMSession * session = LLIMModel::getInstance()->findIMSession( session_id); if (session == NULL) { return; } LLSD arg; arg["session_id"] = session_id; session->mNumUnread--; arg["num_unread"] = session->mNumUnread; session->mParticipantUnreadMessageCount--; arg["participant_unread"] = session->mParticipantUnreadMessageCount; LLIMModel::getInstance()->mNewMsgSignal(arg); }
// static void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only) { // 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"]; if (from_id.isNull()) { llwarns << " from_id for notification " << notification->getName() << " is null " << llendl; return; } if(to_file_only) { gCacheName->get(from_id, false, boost::bind(&log_name_callback, _2, "", notification->getMessage(), LLUUID())); } else { gCacheName->get(from_id, false, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, notification->getMessage(), from_id)); } } }
//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; }
//static void GrowlManager::onScriptDialog(const LLSD& data) { LLNotificationPtr notification = LLNotifications::instance().find(data["notification_id"].asUUID()); std::string name = notification->getName(); LLSD payload = notification->getPayload(); LLSD substitutions = notification->getSubstitutions(); //LL_INFOS("GrowlLLNotification") << "Script dialog: name=" << name << " - payload=" << payload << " subs=" << substitutions << LL_ENDL; 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.empty()) { title = growl_notification->growlTitle; LLStringUtil::format(title, substitutions); } if (growl_notification->useDefaultTextForBody) { body = notification->getMessage(); } else if (!growl_notification->growlBody.empty()) { body = growl_notification->growlBody; LLStringUtil::format(body, substitutions); } gGrowlManager->notify(title, body, growl_notification->growlName); } }
// static void LLHandlerUtil::logGroupNoticeToIMGroup( const LLNotificationPtr& notification) { const LLSD& payload = notification->getPayload(); LLGroupData groupData; if (!gAgent.getGroupData(payload["group_id"].asUUID(), groupData)) { llwarns << "Group notice for unknown group: " << payload["group_id"].asUUID() << llendl; return; } const std::string group_name = groupData.mName; const std::string sender_name = payload["sender_name"].asString(); // we can't retrieve sender id from group notice system message, so try to lookup it from cache LLUUID sender_id; gCacheName->getUUID(sender_name, sender_id); logToIM(IM_SESSION_GROUP_START, group_name, sender_name, payload["message"], payload["group_id"], sender_id); }
void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) { if(notification_id.isNull()) { llwarns << "Invalid notification ID" << llendl; return; } // get scripted Object's ID LLUUID object_id = notification_id_to_object_id(notification_id); // Need to indicate of "new message" for object chiclets according to requirements // specified in the Message Bar design specification. See EXT-3142. bool set_new_message = false; EObjectType obj_type = getObjectType(notification_id); // LLDialog can spawn only one instance, LLLoadURL and LLGiveInventory can spawn unlimited number of instances if(OBJ_SCRIPT == obj_type) { // // If an Object spawns more-than-one floater, only the newest one is shown. // // The previous is automatically closed. // script_notification_map_t::const_iterator it = findUsingObjectId(object_id); // [SL:KB] - Patch: UI-ScriptDialog | Checked: 2011-01-17 (Catznip-2.4.0h) | Added: Catznip-2.4.0h script_notification_map_t::const_iterator it = mNotifications.end(); switch (gSavedSettings.getS32("ScriptDialogPerObject")) { case 0: // One script dialog per object (viewer 2 default) { // If an Object spawns more-than-one floater, only the newest one is shown. // The previous is automatically closed. it = findUsingObjectId(object_id); } break; case 1: // One script dialog per reply channel per object { // We'll allow an object to have more than one script dialog floater open, but we'll limit it to one per chat channel // (in practice a lot of objects open a new listen channel for each new dialog but it still reduces chiclets somewhat) LLNotificationPtr newNotif = LLNotifications::instance().find(notification_id); if (newNotif) { S32 nNewChannel = newNotif->getPayload()["chat_channel"].asInteger(); for (it = mNotifications.begin(); it != mNotifications.end(); ++it) { if (it->second == object_id) { LLNotificationPtr curNotif = LLNotifications::instance().find(it->first); if (curNotif) { S32 nCurChannel = curNotif->getPayload()["chat_channel"].asInteger(); if (nNewChannel == nCurChannel) break; } } } } } break; case 2: // Unconstrained default: break; } // [/SL:KB] if(it != mNotifications.end()) { LLIMChiclet* chiclet = LLChicletBar::getInstance()->getChicletPanel()->findChiclet<LLIMChiclet>(it->first); if(chiclet) { // Pass the new_message icon state further. set_new_message = chiclet->getShowNewMessagesIcon(); } LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", it->first); if(floater) { // Generate chiclet with a "new message" indicator if a docked window was opened but not in focus. See EXT-3142. set_new_message |= !floater->hasFocus(); } removeNotification(it->first); } } mNotifications.insert(std::make_pair(notification_id, object_id)); // Create inventory offer chiclet for offer type notifications if( OBJ_GIVE_INVENTORY == obj_type ) { LLChicletBar::instance().getChicletPanel()->createChiclet<LLInvOfferChiclet>(notification_id); } else { LLChicletBar::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(notification_id); } LLIMWellWindow::getInstance()->addObjectRow(notification_id, set_new_message); LLSD data; data["notification_id"] = notification_id; data["new_message"] = set_new_message; data["unread"] = 1; // each object has got only one floater mNewObjectSignal(data); toggleScriptFloater(notification_id, set_new_message); }
//-------------------------------------------------------------------------- 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; }
//-------------------------------------------------------------------------- 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 false; } } std::string session_name = notification->getPayload()["SESSION_NAME"]; const std::string name = notification->getSubstitutions()["NAME"]; 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; } 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); if(channel) channel->addToast(p); } else if (notify["sigtype"].asString() == "delete") { mChannel->killToastByNotificationID(notification->getID()); } return false; }
//-------------------------------------------------------------------------- bool LLOfferHandler::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") { if( notification->getPayload().has("give_inventory_notification") && !notification->getPayload()["give_inventory_notification"] ) { // This is an original inventory offer, so add a script floater LLScriptFloaterManager::instance().onAddNotification(notification->getID()); } else { notification->setReusable(LLHandlerUtil::isNotificationReusable(notification)); LLUUID session_id; if (LLHandlerUtil::canSpawnIMSession(notification)) { const std::string name = LLHandlerUtil::getSubstitutionName(notification); LLUUID from_id = notification->getPayload()["from_id"]; session_id = LLHandlerUtil::spawnIMSession(name, from_id); } bool show_toast = LLHandlerUtil::canSpawnToast(notification); bool add_notid_to_im = LLHandlerUtil::canAddNotifPanelToIM(notification); if (add_notid_to_im) { LLHandlerUtil::addNotifPanelToIM(notification); } if (notification->getPayload().has("SUPPRESS_TOAST") && notification->getPayload()["SUPPRESS_TOAST"]) { LLNotificationsUtil::cancel(notification); } else if(show_toast) { LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); // don't close notification on panel destroy since it will be used by IM floater notify_box->setCloseNotificationOnDestroy(!add_notid_to_im); LLToast::Params p; p.notif_id = notification->getID(); p.notification = notification; p.panel = notify_box; p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1); // we not save offer notifications to the syswell floater that should be added to the IM floater p.can_be_stored = !add_notid_to_im; LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); if(channel) channel->addToast(p); // if we not add notification to IM - add it to notification well if (!add_notid_to_im) { // send a signal to the counter manager mNewNotificationSignal(); } } if (LLHandlerUtil::canLogToNearbyChat(notification)) { LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM); } if (LLHandlerUtil::canLogToIM(notification)) { // log only to file if notif panel can be embedded to IM and IM is opened if (add_notid_to_im && LLHandlerUtil::isIMFloaterOpened(notification)) { LLHandlerUtil::logToIMP2P(notification, true); } else { LLHandlerUtil::logToIMP2P(notification); } } } } else if (notify["sigtype"].asString() == "delete") { if( notification->getPayload().has("give_inventory_notification") && !notification->getPayload()["give_inventory_notification"] ) { // Remove original inventory offer script floater LLScriptFloaterManager::instance().onRemoveNotification(notification->getID()); } else { if (LLHandlerUtil::canAddNotifPanelToIM(notification) && !LLHandlerUtil::isIMFloaterOpened(notification)) { LLHandlerUtil::decIMMesageCounter(notification); } mChannel->killToastByNotificationID(notification->getID()); } } return false; }
//-------------------------------------------------------------------------- bool LLAlertHandler::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() == "load") { if (LLHandlerUtil::canSpawnSessionAndLogToIM(notification)) { const std::string name = LLHandlerUtil::getSubstitutionName(notification); LLUUID from_id = notification->getPayload()["from_id"]; // firstly create session... LLHandlerUtil::spawnIMSession(name, from_id); // ...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->updatePositionAndSize(rc); LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); if(channel) channel->addToast(p); } else if (notify["sigtype"].asString() == "change") { LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal); LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); if(channel) channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog); } else { LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); if(channel) channel->killToastByNotificationID(notification->getID()); } return false; }
//-------------------------------------------------------------------------- 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; }
//-------------------------------------------------------------------------- bool LLOfferHandler::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") { if( notification->getPayload().has("give_inventory_notification") && !notification->getPayload()["give_inventory_notification"] ) { // This is an original inventory offer, so add a script floater LLScriptFloaterManager::instance().onAddNotification(notification->getID()); } else { notification->setReusable(LLHandlerUtil::isNotificationReusable(notification)); LLUUID session_id; // if (LLHandlerUtil::canSpawnIMSession(notification)) // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.2a) | Added: RLVa-1.2.0f // Don't spawn a new IM session for inventory offers if this notification was subject to @shownames=n // RELEASE-RLVa: [SL-2.3.0] Test on every new release to make sure the notification gets routed the way we want it to be bool fSpawnIM = (LLHandlerUtil::canSpawnIMSession(notification)) && (!notification->getPayload().has("rlv_shownames")); if (fSpawnIM) // [/RLVa:KB] { const std::string name = LLHandlerUtil::getSubstitutionName(notification); LLUUID from_id = notification->getPayload()["from_id"]; session_id = LLHandlerUtil::spawnIMSession(name, from_id); } bool show_toast = LLHandlerUtil::canSpawnToast(notification); // bool add_notid_to_im = LLHandlerUtil::canAddNotifPanelToIM(notification); // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.2a) | Added: RLVa-1.2.0f // NOTE: add_notid_to_im needs to be FALSE if we suppressed spawning an IM because in that case the notification needs to // be routed to the "syswell" or the inventory offer floater will dissapear and the user won't be able to accept it bool add_notid_to_im = (fSpawnIM) && (LLHandlerUtil::canAddNotifPanelToIM(notification)); // [/RLVa:KB] if (add_notid_to_im) { LLHandlerUtil::addNotifPanelToIM(notification); } if (notification->getPayload().has("SUPPRESS_TOAST") && notification->getPayload()["SUPPRESS_TOAST"]) { LLNotificationsUtil::cancel(notification); } else if(show_toast) { LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); // don't close notification on panel destroy since it will be used by IM floater notify_box->setCloseNotificationOnDestroy(!add_notid_to_im); LLToast::Params p; p.notif_id = notification->getID(); p.notification = notification; p.panel = notify_box; p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1); // we not save offer notifications to the syswell floater that should be added to the IM floater p.can_be_stored = !add_notid_to_im; LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); if(channel) channel->addToast(p); // if we not add notification to IM - add it to notification well if (!add_notid_to_im) { // send a signal to the counter manager mNewNotificationSignal(); } } if (LLHandlerUtil::canLogToIM(notification)) { // log only to file if notif panel can be embedded to IM and IM is opened // [RLVa:KB] - Checked: 2010-04-20 (RLVa-1.2.2a) | Added: RLVa-1.2.0f if (notification->getPayload().has("rlv_shownames")) { // Log to chat history if this notification was subject to @shownames=n LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM); } else if (add_notid_to_im && LLHandlerUtil::isIMFloaterOpened(notification)) // [/RLVa:KB] // if (add_notid_to_im && LLHandlerUtil::isIMFloaterOpened(notification)) { LLHandlerUtil::logToIMP2P(notification, true); } else { LLHandlerUtil::logToIMP2P(notification); } } } } else if (notify["sigtype"].asString() == "delete") { if( notification->getPayload().has("give_inventory_notification") && !notification->getPayload()["give_inventory_notification"] ) { // Remove original inventory offer script floater LLScriptFloaterManager::instance().onRemoveNotification(notification->getID()); } else { // if (LLHandlerUtil::canAddNotifPanelToIM(notification) // && !LLHandlerUtil::isIMFloaterOpened(notification)) // [SL:KB] - Checked: 2010-04-20 (RLVa-1.2.2a) | Added: RLVa-1.2.0f // Repro: // 1) have someone drop you 2 inventory items (new IM session will be spawned) // 2) accept/decline the inventory offers as they come in // -> unread IM counter shows 0 // 3) toggle "Enable plain text chat history" while the IM session with the inventory offers isn't the active session // -> unread IM counter shows -2 // -> LLHandlerUtil::decIMMesageCounter() really should be fixed to check for "0" before decreasing the count but // there are enough bugfixes in RLVa as it is already :( // Fix: // - the one and only time we need to decrease the unread IM count is when we've clicked any of the buttons on the *toast* // - since LLIMFloater::updateMessages() hides the toast when we open the IM (which resets the unread count to 0) we should // *only* decrease the unread IM count if there's a visible toast since the unread count will be at 0 otherwise anyway LLScreenChannel* pChannel = dynamic_cast<LLScreenChannel*>(mChannel); LLToast* pToast = (pChannel) ? pChannel->getToastByNotificationID(notification->getID()) : NULL; if ( (pToast) && (!pToast->getCanBeStored()) ) // [/SL:KB] { LLHandlerUtil::decIMMesageCounter(notification); } mChannel->killToastByNotificationID(notification->getID()); } } return false; }