Class: LibSL::SearchManager
- Inherits:
-
Object
- Object
- LibSL::SearchManager
- Defined in:
- lib/search.rb
Constant Summary collapse
- PARCEL_CATEGORIES =
{ :none => 0, :linden => 1, :adult => 2, :arts => 3, :business => 4, :educational => 5, :gaming => 6, :hangout => 7, :newcomer => 8, :park => 9, :residential => 10, :shopping => 11, :stage => 12, :other => 13, :any => -1 }
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#event(query, mature = false, start = 0) {|SearchResult| ... } ⇒ Object
Start an event search query.
-
#group(query, start = 0) {|SearchResult| ... } ⇒ Object
Start a group search query.
-
#initialize(client) ⇒ SearchManager
constructor
A new instance of SearchManager.
-
#person(query, online = false, start = 0) {|SearchResult| ... } ⇒ Object
Start a person search query.
-
#pick_avatar(name) {|SearchResult| ... } ⇒ Object
Pick a list of avatars by name.
-
#place(query = "", sim_name = "", parcel_category = :any, start = 0) {|SearchResult| ... } ⇒ Object
Start a places search query.
Constructor Details
#initialize(client) ⇒ SearchManager
Returns a new instance of SearchManager.
37 38 39 40 41 |
# File 'lib/search.rb', line 37 def initialize(client) @client = client @results = [] register_handlers end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
34 35 36 |
# File 'lib/search.rb', line 34 def client @client end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
35 36 37 |
# File 'lib/search.rb', line 35 def results @results end |
Instance Method Details
#event(query, mature = false, start = 0) {|SearchResult| ... } ⇒ Object
Start an event search query. Searches for all upcoming events.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/search.rb', line 113 def event(query, mature=false, start=0, &block) query_id = LLUUID.new register_callback(query_id, block) flags = 0x20 flags |= 0x2000 unless mature packet = DirFindQueryPacket.new({ :AgentData => { :AgentID => @client.network_manager.agent_id, :SessionID => @client.network_manager.session_id }, :QueryData => { :QueryID => query_id, :QueryText => LLVariable1.new("u|0|"+query), :QueryFlags => LLU32.new(flags), :QueryStart => LLS32.new(start) } }) @client.network_manager.send_packet packet end |
#group(query, start = 0) {|SearchResult| ... } ⇒ Object
Start a group search query
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/search.rb', line 89 def group(query, start=0, &block) query_id = LLUUID.new register_callback(query_id, block) flags = 0x10 packet = DirFindQueryPacket.new({ :AgentData => { :AgentID => @client.network_manager.agent_id, :SessionID => @client.network_manager.session_id }, :QueryData => { :QueryID => query_id, :QueryText => LLVariable1.new(query), :QueryFlags => LLU32.new(flags), :QueryStart => LLS32.new(start) } }) @client.network_manager.send_packet packet end |
#person(query, online = false, start = 0) {|SearchResult| ... } ⇒ Object
Start a person search query
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/search.rb', line 65 def person(query, online=false, start=0, &block) query_id = LLUUID.new register_callback(query_id, block) flags = 0x01 flags |= 0x02 if online packet = DirFindQueryPacket.new({ :AgentData => { :AgentID => @client.network_manager.agent_id, :SessionID => @client.network_manager.session_id }, :QueryData => { :QueryID => query_id, :QueryText => LLVariable1.new(query), :QueryFlags => LLU32.new(flags), :QueryStart => LLS32.new(start) } }) @client.network_manager.send_packet packet end |
#pick_avatar(name) {|SearchResult| ... } ⇒ Object
Pick a list of avatars by name
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/search.rb', line 46 def pick_avatar(name, &block) query_id = LLUUID.new register_callback(query_id, block) packet = AvatarPickerRequestPacket.new({ :AgentData => { :AgentID => @client.network_manager.agent_id, :SessionID => @client.network_manager.session_id, :QueryID => query_id }, :Data => { :Name => LLVariable1.new(name) } }) @client.network_manager.send_packet packet end |
#place(query = "", sim_name = "", parcel_category = :any, start = 0) {|SearchResult| ... } ⇒ Object
Start a places search query
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/search.rb', line 139 def place(query="", sim_name="", parcel_category=:any, start=0, &block) query_id = LLUUID.new register_callback(query_id, block) flags = 0 flags |= 0x40 if query == "" # Agent owned category = PARCEL_CATEGORIES[parcel_category] or -1 packet = DirPlacesQueryPacket.new({ :AgentData => { :AgentID => @client.network_manager.agent_id, :SessionID => @client.network_manager.session_id }, :QueryData => { :QueryID => query_id, :QueryText => LLVariable1.new(query), :QueryFlags => LLU32.new(flags), :Category => LLS8.new(category), :SimName => LLVariable1.new(sim_name), :QueryStart => LLS32.new(start) } }) @client.network_manager.send_packet packet end |