Content:MirLua/Examples/protocols

From Miranda NG
Jump to navigation Jump to search

Switch all protocols statuses to online:

local protos = require('m_protocols')

local ID_STATUS_OFFLINE = 40071
local ID_STATUS_ONLINE = 40072

m.HookEvent('Miranda/System/ModulesLoaded', function()
  for acc in protos.Accounts() do
    if acc.IsEnabled and not acc.IsVirtual then
      local status = acc:CallService('/GetStatus')
      if (status == ID_STATUS_OFFLINE) then
        acc:CallService('/SetStatus', ID_STATUS_ONLINE)
      end
    end
  end
end)