Support for encr_chat

This commit is contained in:
yago 2015-03-10 20:35:19 +01:00
parent e30fb76ac5
commit 9d52c6103c
2 changed files with 5 additions and 2 deletions

View File

@ -39,7 +39,7 @@ function msg_valid(msg)
print("Not valid, msg from us") print("Not valid, msg from us")
return false return false
end end
if msg.date < now then if msg.date < (now - 60) then
print("Not valid, old msg") print("Not valid, old msg")
return false return false
end end
@ -87,7 +87,7 @@ function do_action(msg)
-- print("Trying", text, "against", pattern) -- print("Trying", text, "against", pattern)
matches = { string.match(text, pattern) } matches = { string.match(text, pattern) }
if matches[1] then if matches[1] then
mark_read(get_receiver(msg), ok_cb, false) mark_read(receiver, ok_cb, false)
print(" matches", pattern) print(" matches", pattern)
if desc.run ~= nil then if desc.run ~= nil then
-- If plugin is for privileged user -- If plugin is for privileged user

View File

@ -8,6 +8,9 @@ function get_receiver(msg)
if msg.to.type == 'chat' then if msg.to.type == 'chat' then
return 'chat#id'..msg.to.id return 'chat#id'..msg.to.id
end end
if msg.to.type == 'encr_chat' then
return msg.to.print_name
end
end end
function is_chat_msg( msg ) function is_chat_msg( msg )