void LLCommandDispatcherListener::enumerate(const LLSD& params) const
{
    LLReqID reqID(params);
    LLSD response(LLCommandDispatcher::enumerate());
    reqID.stamp(response);
    LLEventPumps::instance().obtain(params["reply"]).post(response);
}
Beispiel #2
0
bool sendReply(const LLSD& reply, const LLSD& request, const std::string& replyKey)
{
    // Copy 'reply' to modify it.
    LLSD newreply(reply);
    // Get the ["reqid"] element from request
    LLReqID reqID(request);
    // and copy it to 'newreply'.
    reqID.stamp(newreply);
    // Send reply on LLEventPump named in request[replyKey]. Don't forget to
    // send the modified 'newreply' instead of the original 'reply'.
    return LLEventPumps::instance().obtain(request[replyKey]).post(newreply);
}
void Application::InsertSecurityListRequest( const FIX::Message & message )
{
  /* 320  */ FIX::FieldBase reqID( FIX::FIELD::SecurityReqID, "0" );
  /* 320  */ message.getFieldIfSet( reqID );

  std::ostringstream s;
  s << "INSERT INTO `security_list_request` " <<
    "( `ReqID` ) " <<
    "VALUES " <<
    "( '" << reqID << "' )";
  
  FIX::MySQLQuery q( s.str() );
  m_sql->execute( q );
}
void LLNotificationsListener::listChannels(const LLSD& params) const
{
    LLReqID reqID(params);
    LLSD response(reqID.makeResponse());
    for (LLNotifications::ChannelMap::const_iterator cmi(mNotifications.mChannels.begin()),
                                                     cmend(mNotifications.mChannels.end());
         cmi != cmend; ++cmi)
    {
        LLSD channelInfo;
        channelInfo["parent"] = cmi->second->getParentChannelName();
        response[cmi->first] = channelInfo;
    }
    LLEventPumps::instance().obtain(params["reply"]).post(response);
}
void LLNotificationsListener::listChannelNotifications(const LLSD& params) const
{
    LLReqID reqID(params);
    LLSD response(reqID.makeResponse());
    LLNotificationChannelPtr channel(mNotifications.getChannel(params["channel"]));
    if (channel)
    {
        LLSD notifications(LLSD::emptyArray());
        for (LLNotificationChannel::Iterator ni(channel->begin()), nend(channel->end());
             ni != nend; ++ni)
        {
            notifications.append(asLLSD(*ni));
        }
        response["notifications"] = notifications;
    }
    LLEventPumps::instance().obtain(params["reply"]).post(response);
}
void LLFloaterRegListener::clickButton(const LLSD& event) const
{
    // If the caller requests a reply, build the reply.
    LLReqID reqID(event);
    LLSD reply(reqID.makeResponse());

    LLFloater* floater = LLFloaterReg::findInstance(event["name"], event["key"]);
    if (! LLFloater::isShown(floater))
    {
        reply["type"]  = "LLFloater";
        reply["name"]  = event["name"];
        reply["key"]   = event["key"];
        reply["error"] = floater? "!isShown()" : "NULL";
    }
    else
    {
        // Here 'floater' points to an LLFloater instance with the specified
        // name and key which isShown().
        LLButton* button = floater->findChild<LLButton>(event["button"]);
        if (! LLButton::isAvailable(button))
        {
            reply["type"]  = "LLButton";
            reply["name"]  = event["button"];
            reply["error"] = button? "!isAvailable()" : "NULL";
        }
        else
        {
            // Here 'button' points to an isAvailable() LLButton child of
            // 'floater' with the specified button name. Pretend to click it.
            button->onCommit();
            // Leave reply["error"] isUndefined(): no error, i.e. success.
        }
    }

    // Send a reply only if caller asked for a reply.
    LLSD replyPump(event["reply"]);
    if (replyPump.isString())       // isUndefined() if absent
    {
        LLEventPumps::instance().obtain(replyPump).post(reply);
    }
}
bool sendReply(const LLSD& reply, const LLSD& request, const std::string& replyKey)
{
    // If the original request has no value for replyKey, it's pointless to
    // construct or send a reply event: on which LLEventPump should we send
    // it? Allow that to be optional: if the caller wants to require replyKey,
    // it can so specify when registering the operation method.
    if (! request.has(replyKey))
    {
        return false;
    }

    // Here the request definitely contains replyKey; reasonable to proceed.

    // Copy 'reply' to modify it.
    LLSD newreply(reply);
    // Get the ["reqid"] element from request
    LLReqID reqID(request);
    // and copy it to 'newreply'.
    reqID.stamp(newreply);
    // Send reply on LLEventPump named in request[replyKey]. Don't forget to
    // send the modified 'newreply' instead of the original 'reply'.
    return LLEventPumps::instance().obtain(request[replyKey]).post(newreply);
}