summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-06-20 00:42:25 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-06-20 00:44:31 +0300
commit09b814a2dc6d3a647d75bcf0a310eba2678a0228 (patch)
tree4da1b6ab54d95bac6ef0fc364c8dff9b7929bb13 /indra/newview/scripts/lua
parentb2d484d7258508f0f82098ff113fa636554d67b8 (diff)
Use LLLeapListener to listen to LLNearbyChat pump
Diffstat (limited to 'indra/newview/scripts/lua')
-rw-r--r--indra/newview/scripts/lua/LLChatListener.lua12
-rw-r--r--indra/newview/scripts/lua/test_LLChatListener.lua3
2 files changed, 10 insertions, 5 deletions
diff --git a/indra/newview/scripts/lua/LLChatListener.lua b/indra/newview/scripts/lua/LLChatListener.lua
index d615ae5dbc..b4e90d272c 100644
--- a/indra/newview/scripts/lua/LLChatListener.lua
+++ b/indra/newview/scripts/lua/LLChatListener.lua
@@ -1,8 +1,10 @@
local fiber = require 'fiber'
local inspect = require 'inspect'
+local leap = require 'leap'
local LLChatListener = {}
local waitfor = {}
+local listener_name = {}
function LLChatListener:new()
local obj = setmetatable({}, self)
@@ -13,14 +15,16 @@ function LLChatListener:new()
end
function LLChatListener:handleMessages(event_data)
- --print(inspect(event_data))
+ print(inspect(event_data))
return true
end
function LLChatListener:start()
waitfor = leap.WaitFor:new(-1, self.name)
function waitfor:filter(pump, data)
- return data
+ if pump == "LLNearbyChat" then
+ return data
+ end
end
fiber.launch(self.name, function()
@@ -30,11 +34,11 @@ function LLChatListener:start()
end
end)
- leap.send('LLChatBar', {op='listen'})
+ listener_name = leap.request(leap.cmdpump(), {op='listen', source='LLNearbyChat', listener="ChatListener", tweak=true}).listener
end
function LLChatListener:stop()
- leap.send('LLChatBar', {op='stopListening'})
+ leap.send(leap.cmdpump(), {op='stoplistening', source='LLNearbyChat', listener=listener_name})
waitfor:close()
end
diff --git a/indra/newview/scripts/lua/test_LLChatListener.lua b/indra/newview/scripts/lua/test_LLChatListener.lua
index 2c7b1dc3e5..b9696e7cfc 100644
--- a/indra/newview/scripts/lua/test_LLChatListener.lua
+++ b/indra/newview/scripts/lua/test_LLChatListener.lua
@@ -1,5 +1,6 @@
local LLChatListener = require 'LLChatListener'
local LLChat = require 'LLChat'
+local leap = require 'leap'
function openOrEcho(message)
local floater_name = string.match(message, "^open%s+(%w+)")
@@ -21,7 +22,7 @@ function listener:handleMessages(event_data)
else
openOrEcho(event_data.message)
end
- return LLChatListener.handleMessages(self, event_data)
+ return true
end
listener:start()