/
ChannelCreatedEvent.go
189 lines (167 loc) · 5.38 KB
/
ChannelCreatedEvent.go
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
This file is part of TS3QueryApi For Go.
TS3QueryApi For Go is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ts3api
import (
"strconv"
)
var _ Event = (*ChannelCreatedEvent)(nil)
type ChannelCreatedEvent struct {
*ApiHolder
*InvokerHolder
chId int
chParentId int
chName string
chTopic string
chCodec int
chCodecQuality int
chMaxClients int
chMaxFamilyClients int
chOrder int
chPermanent bool
chSemiPermanent bool
chDefault bool
chPassword bool
chCodecLatFactor int
chCodecIsUnencrypted bool
chDeleteDelay int
chMaxClientsUnlimited bool
chMaxFamilyclientsUnlimited bool
chMaxFamilyclientsInherited bool
chNeededTalkPower int
chNamePhonectic string
chIconId string
}
func NewChannelCreatedEvent() (event *ChannelCreatedEvent) {
event = &ChannelCreatedEvent{}
event.ApiHolder = &ApiHolder{}
event.InvokerHolder = &InvokerHolder{}
return
}
func (event *ChannelCreatedEvent) setParam(key, val string) (err error) {
switch key {
case "cid":
event.chId, err = strconv.Atoi(val)
case "cpid":
event.chParentId, err = strconv.Atoi(val)
case "channel_name":
event.chName = val
case "channel_topic":
event.chTopic = val
case "channel_codec":
event.chCodec, err = strconv.Atoi(val)
case "channel_codec_quality":
event.chCodecQuality, err = strconv.Atoi(val)
case "channel_maxclients":
event.chMaxClients, err = strconv.Atoi(val)
case "channel_maxfamilyclients":
event.chMaxFamilyClients, err = strconv.Atoi(val)
case "channel_order":
event.chOrder, err = strconv.Atoi(val)
case "channel_flag_permanent":
event.chPermanent, err = getBoolFromString(val)
case "channel_flag_semi_permanent":
event.chSemiPermanent, err = getBoolFromString(val)
case "channel_flag_default":
event.chDefault, err = getBoolFromString(val)
case "channel_flag_password":
event.chPassword, err = getBoolFromString(val)
case "channel_codec_latency_factor":
event.chCodecLatFactor, err = strconv.Atoi(val)
case "channel_codec_is_unencrypted":
event.chCodecIsUnencrypted, err = getBoolFromString(val)
case "channel_delete_delay":
event.chDeleteDelay, err = strconv.Atoi(val)
case "channel_flag_maxclients_unlimited":
event.chMaxClientsUnlimited, err = getBoolFromString(val)
case "channel_flag_maxfamilyclients_unlimited":
event.chMaxFamilyclientsUnlimited, err = getBoolFromString(val)
case "channel_flag_maxfamilyclients_inherited":
event.chMaxFamilyclientsInherited, err = getBoolFromString(val)
case "channel_needed_talk_power":
event.chNeededTalkPower, err = strconv.Atoi(val)
case "channel_name_phonetic":
event.chNamePhonectic = val
case "channel_icon_id":
event.chNamePhonectic = val
default:
err = event.InvokerHolder.setParam(key, val)
}
return
}
func (event *ChannelCreatedEvent) ChannelId() int {
return event.chId
}
func (event *ChannelCreatedEvent) ParentId() int {
return event.chParentId
}
func (event *ChannelCreatedEvent) Name() string {
return event.chName
}
func (event *ChannelCreatedEvent) Topic() string {
return event.chTopic
}
func (event *ChannelCreatedEvent) Codec() int {
return event.chCodec
}
func (event *ChannelCreatedEvent) CodecQuality() int {
return event.chCodecQuality
}
func (event *ChannelCreatedEvent) MaxClients() int {
return event.chMaxClients
}
func (event *ChannelCreatedEvent) MaxFamilyClients() int {
return event.chMaxFamilyClients
}
func (event *ChannelCreatedEvent) Order() int {
return event.chOrder
}
func (event *ChannelCreatedEvent) Permanent() bool {
return event.chPermanent
}
func (event *ChannelCreatedEvent) SemiPermanent() bool {
return event.chSemiPermanent
}
func (event *ChannelCreatedEvent) Default() bool {
return event.chDefault
}
func (event *ChannelCreatedEvent) Password() bool {
return event.chPassword
}
func (event *ChannelCreatedEvent) CodecLatFactor() int {
return event.chCodecLatFactor
}
func (event *ChannelCreatedEvent) CodecIsUnencrypted() bool {
return event.chCodecIsUnencrypted
}
func (event *ChannelCreatedEvent) DeleteDelay() int {
return event.chDeleteDelay
}
func (event *ChannelCreatedEvent) MaxClientsUnlimited() bool {
return event.chMaxClientsUnlimited
}
func (event *ChannelCreatedEvent) MaxFamilyclientsUnlimited() bool {
return event.chMaxFamilyclientsUnlimited
}
func (event *ChannelCreatedEvent) MaxFamilyClientsInherited() bool {
return event.chMaxFamilyclientsInherited
}
func (event *ChannelCreatedEvent) NeededTalkPower() int {
return event.chNeededTalkPower
}
func (event *ChannelCreatedEvent) NamePhonectic() string {
return event.chNamePhonectic
}
func (event *ChannelCreatedEvent) IconId() string {
return event.chIconId
}