|
@@ -127,6 +127,10 @@ func (it *IdleTimer) processTimeout() {
|
127
|
127
|
|
128
|
128
|
// Stop stops counting idle time.
|
129
|
129
|
func (it *IdleTimer) Stop() {
|
|
130
|
+ if it == nil {
|
|
131
|
+ return
|
|
132
|
+ }
|
|
133
|
+
|
130
|
134
|
it.Lock()
|
131
|
135
|
defer it.Unlock()
|
132
|
136
|
it.state = TimerDead
|
|
@@ -232,6 +236,20 @@ func (nt *NickTimer) Touch() {
|
232
|
236
|
}
|
233
|
237
|
}
|
234
|
238
|
|
|
239
|
+// Stop stops counting time and cleans up the timer
|
|
240
|
+func (nt *NickTimer) Stop() {
|
|
241
|
+ if nt == nil {
|
|
242
|
+ return
|
|
243
|
+ }
|
|
244
|
+
|
|
245
|
+ nt.Lock()
|
|
246
|
+ defer nt.Unlock()
|
|
247
|
+ if nt.timer != nil {
|
|
248
|
+ nt.timer.Stop()
|
|
249
|
+ nt.timer = nil
|
|
250
|
+ }
|
|
251
|
+}
|
|
252
|
+
|
235
|
253
|
func (nt *NickTimer) sendWarning() {
|
236
|
254
|
baseNotice := "Nickname is reserved; you must change it or authenticate to NickServ within %v"
|
237
|
255
|
nt.client.Notice(fmt.Sprintf(nt.client.t(baseNotice), nt.timeout))
|