lib/plugins/plugin.rb in rsence-pre-2.1.0.12 vs lib/plugins/plugin.rb in rsence-pre-2.1.0.13

- old
+ new

@@ -190,17 +190,20 @@ # This method returns (or creates and returns) the entry in the session based on the name your plugin is registered as. It's advised to use this call instead of manually managing {Message#session msg#session} in most cases. # # Uses the first name registered for the plugin and converts it to a symbol. # # @param [Message] msg The message is supplied by the system. + # @param [Symbol] key (optional) returns a ses key, if defined. # # @return [Hash] Plugin-specific session hash - def get_ses( msg ) + def get_ses( msg, key=false ) name_sym = name_with_manager_s.to_sym unless msg.session.has_key?( name_sym ) msg.session[ name_sym ] = {} end - return msg.session[ name_sym ] + ses = msg.session[ name_sym ] + return ses[key] if key + return ses end # Returns the source code of the javascript file +js_name+ in the 'js' subdirectory of the plugin bundle. Use it to send raw javascript command code to the client. Use {#read_js_once} for libraries. # # @param [String] js_name Javascript source file name without the '.js' suffix.