blob: 5bc3167d2f16e6111a9f41e689a837877d627bf3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
package gumbleutil
import (
"layeh.com/gumble/gumble"
)
// Listener is a struct that implements the gumble.EventListener interface. The
// corresponding event function in the struct is called if it is non-nil.
type Listener struct {
Connect func(e *gumble.ConnectEvent)
Disconnect func(e *gumble.DisconnectEvent)
TextMessage func(e *gumble.TextMessageEvent)
UserChange func(e *gumble.UserChangeEvent)
ChannelChange func(e *gumble.ChannelChangeEvent)
PermissionDenied func(e *gumble.PermissionDeniedEvent)
UserList func(e *gumble.UserListEvent)
ACL func(e *gumble.ACLEvent)
BanList func(e *gumble.BanListEvent)
ContextActionChange func(e *gumble.ContextActionChangeEvent)
ServerConfig func(e *gumble.ServerConfigEvent)
}
var _ gumble.EventListener = (*Listener)(nil)
// OnConnect implements gumble.EventListener.OnConnect.
func (l Listener) OnConnect(e *gumble.ConnectEvent) {
if l.Connect != nil {
l.Connect(e)
}
}
// OnDisconnect implements gumble.EventListener.OnDisconnect.
func (l Listener) OnDisconnect(e *gumble.DisconnectEvent) {
if l.Disconnect != nil {
l.Disconnect(e)
}
}
// OnTextMessage implements gumble.EventListener.OnTextMessage.
func (l Listener) OnTextMessage(e *gumble.TextMessageEvent) {
if l.TextMessage != nil {
l.TextMessage(e)
}
}
// OnUserChange implements gumble.EventListener.OnUserChange.
func (l Listener) OnUserChange(e *gumble.UserChangeEvent) {
if l.UserChange != nil {
l.UserChange(e)
}
}
// OnChannelChange implements gumble.EventListener.OnChannelChange.
func (l Listener) OnChannelChange(e *gumble.ChannelChangeEvent) {
if l.ChannelChange != nil {
l.ChannelChange(e)
}
}
// OnPermissionDenied implements gumble.EventListener.OnPermissionDenied.
func (l Listener) OnPermissionDenied(e *gumble.PermissionDeniedEvent) {
if l.PermissionDenied != nil {
l.PermissionDenied(e)
}
}
// OnUserList implements gumble.EventListener.OnUserList.
func (l Listener) OnUserList(e *gumble.UserListEvent) {
if l.UserList != nil {
l.UserList(e)
}
}
// OnACL implements gumble.EventListener.OnACL.
func (l Listener) OnACL(e *gumble.ACLEvent) {
if l.ACL != nil {
l.ACL(e)
}
}
// OnBanList implements gumble.EventListener.OnBanList.
func (l Listener) OnBanList(e *gumble.BanListEvent) {
if l.BanList != nil {
l.BanList(e)
}
}
// OnContextActionChange implements gumble.EventListener.OnContextActionChange.
func (l Listener) OnContextActionChange(e *gumble.ContextActionChangeEvent) {
if l.ContextActionChange != nil {
l.ContextActionChange(e)
}
}
// OnServerConfig implements gumble.EventListener.OnServerConfig.
func (l Listener) OnServerConfig(e *gumble.ServerConfigEvent) {
if l.ServerConfig != nil {
l.ServerConfig(e)
}
}
|