| 1 | // Copyright (c) 2014-2015 The Notify Authors. All rights reserved. |
| 2 | // Use of this source code is governed by the MIT license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // +build !windows |
| 6 | |
| 7 | package notify |
| 8 | |
| 9 | // eventmask uses ei to create a new event which contains internal flags used by |
| 10 | // notify package logic. |
| 11 | func eventmask(ei EventInfo, extra Event) Event { |
| 12 | return ei.Event() | extra |
| 13 | } |
| 14 | |
| 15 | // matches reports a match only when: |
| 16 | // |
| 17 | // - for user events, when event is present in the given set |
| 18 | // - for internal events, when additionally both event and set have omit bit set |
| 19 | // |
| 20 | // Internal events must not be sent to user channels and vice versa. |
| 21 | func matches(set, event Event) bool { |
| 22 | return (set&omit)^(event&omit) == 0 && set&event == event |
| 23 | } |