|
|
|
@ -25,7 +25,7 @@
@@ -25,7 +25,7 @@
|
|
|
|
|
|
|
|
|
|
_addon.author = 'atom0s'; |
|
|
|
|
_addon.name = 'links'; |
|
|
|
|
_addon.version = '3.0.0'; |
|
|
|
|
_addon.version = '3.0.1'; |
|
|
|
|
|
|
|
|
|
require 'common' |
|
|
|
|
|
|
|
|
@ -121,17 +121,41 @@ end);
@@ -121,17 +121,41 @@ end);
|
|
|
|
|
-- desc: Called when our addon receives an incoming packet. |
|
|
|
|
--------------------------------------------------------------------------------------------------- |
|
|
|
|
ashita.register_event('incoming_packet', function(id, size, data) |
|
|
|
|
-- Look for chat packets.. |
|
|
|
|
local msg = nil; |
|
|
|
|
|
|
|
|
|
-- 0x0017 - Chat |
|
|
|
|
if (id == 0x17) then |
|
|
|
|
-- Obtain the chat message from the packet.. |
|
|
|
|
local msg, _ = struct.unpack('s', data, 0x18 + 1); |
|
|
|
|
msg, _ = struct.unpack('s', data, 0x18 + 1); |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- 0x004D - Server Message |
|
|
|
|
if (id == 0x004D) then |
|
|
|
|
-- Obtain the chat message from the packet.. |
|
|
|
|
msg, _ = struct.unpack('s', data, 0x18 + 1); |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- 0x00CA - Bazaar Message |
|
|
|
|
if (id == 0x00CA) then |
|
|
|
|
-- Obtain the chat message from the packet.. |
|
|
|
|
msg, _ = struct.unpack('s', data, 0x04 + 1); |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- 0x00CC - Linkshell Message |
|
|
|
|
if (id == 0x00CC) then |
|
|
|
|
-- Obtain the chat message from the packet.. |
|
|
|
|
msg, _ = struct.unpack('s', data, 0x08 + 1); |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
-- Parse the message for links.. |
|
|
|
|
if (msg ~= nil) then |
|
|
|
|
local url, start = ParseForLinks(msg, 0); |
|
|
|
|
while url ~= nil do |
|
|
|
|
table.insert(urls, url); |
|
|
|
|
url, start = ParseForLinks(msg ,start); |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
end); |
|
|
|
|
|
|
|
|
|