Content:MirLua/Examples/protocols

From Miranda NG
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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)