function set_idle_status(mark_as_away) local servers = {} for c in hexchat.iterate("channels") do -- Extract servers from channel. if c.type == 2 then if servers[tostring(c.server)] == nil then servers[tostring(c.server)] = (bit.band(c.flags, 4) ~= 0) end end end for srv,away in pairs(servers) do local srv_context = hexchat.find_context(srv, nil) if mark_as_away and not away then if hexchat.set_context(srv_context) then hexchat.command("AWAY Marked as away automatically") end elseif not mark_as_away and away then if hexchat.set_context(srv_context) then hexchat.command("BACK") end end end end