|
@@ -22,6 +22,10 @@ To see in-depth help for a specific ChanServ command, try:
|
22
|
22
|
Here are the commands you can use:
|
23
|
23
|
%s`
|
24
|
24
|
|
|
25
|
+func chanregEnabled(server *Server) bool {
|
|
26
|
+ return server.ChannelRegistrationEnabled()
|
|
27
|
+}
|
|
28
|
+
|
25
|
29
|
var (
|
26
|
30
|
chanservCommands = map[string]*serviceCommand{
|
27
|
31
|
"op": {
|
|
@@ -32,6 +36,7 @@ OP makes the given nickname, or yourself, a channel admin. You can only use
|
32
|
36
|
this command if you're the founder of the channel.`,
|
33
|
37
|
helpShort: `$bOP$b makes the given user (or yourself) a channel admin.`,
|
34
|
38
|
authRequired: true,
|
|
39
|
+ enabled: chanregEnabled,
|
35
|
40
|
},
|
36
|
41
|
"register": {
|
37
|
42
|
handler: csRegisterHandler,
|
|
@@ -42,6 +47,15 @@ given admin privs on it. Modes set on the channel and the topic will also be
|
42
|
47
|
remembered.`,
|
43
|
48
|
helpShort: `$bREGISTER$b lets you own a given channel.`,
|
44
|
49
|
authRequired: true,
|
|
50
|
+ enabled: chanregEnabled,
|
|
51
|
+ },
|
|
52
|
+ "unregister": {
|
|
53
|
+ handler: csUnregisterHandler,
|
|
54
|
+ help: `Syntax: $bUNREGISTER #channel$b
|
|
55
|
+
|
|
56
|
+UNREGISTER deletes a channel registration, allowing someone else to claim it.`,
|
|
57
|
+ helpShort: `$bUNREGISTER$b deletes a channel registration.`,
|
|
58
|
+ enabled: chanregEnabled,
|
45
|
59
|
},
|
46
|
60
|
"amode": {
|
47
|
61
|
handler: csAmodeHandler,
|
|
@@ -53,6 +67,7 @@ account the +o operator mode every time they join #channel. To list current
|
53
|
67
|
accounts and modes, use $bAMODE #channel$b. Note that users are always
|
54
|
68
|
referenced by their registered account names, not their nicknames.`,
|
55
|
69
|
helpShort: `$bAMODE$b modifies persistent mode settings for channel members.`,
|
|
70
|
+ enabled: chanregEnabled,
|
56
|
71
|
},
|
57
|
72
|
}
|
58
|
73
|
)
|
|
@@ -197,11 +212,6 @@ func csOpHandler(server *Server, client *Client, command, params string, rb *Res
|
197
|
212
|
}
|
198
|
213
|
|
199
|
214
|
func csRegisterHandler(server *Server, client *Client, command, params string, rb *ResponseBuffer) {
|
200
|
|
- if !server.channelRegistrationEnabled {
|
201
|
|
- csNotice(rb, client.t("Channel registration is not enabled"))
|
202
|
|
- return
|
203
|
|
- }
|
204
|
|
-
|
205
|
215
|
channelName := strings.TrimSpace(params)
|
206
|
216
|
if channelName == "" {
|
207
|
217
|
csNotice(rb, ircfmt.Unescape(client.t("Syntax: $bREGISTER #channel$b")))
|
|
@@ -246,3 +256,33 @@ func csRegisterHandler(server *Server, client *Client, command, params string, r
|
246
|
256
|
}
|
247
|
257
|
}
|
248
|
258
|
}
|
|
259
|
+
|
|
260
|
+func csUnregisterHandler(server *Server, client *Client, command, params string, rb *ResponseBuffer) {
|
|
261
|
+ channelName := strings.TrimSpace(params)
|
|
262
|
+ channelKey, err := CasefoldChannel(channelName)
|
|
263
|
+ if channelKey == "" || err != nil {
|
|
264
|
+ csNotice(rb, client.t("Channel name is not valid"))
|
|
265
|
+ return
|
|
266
|
+ }
|
|
267
|
+
|
|
268
|
+ channel := server.channels.Get(channelKey)
|
|
269
|
+ if channel == nil {
|
|
270
|
+ csNotice(rb, client.t("No such channel"))
|
|
271
|
+ return
|
|
272
|
+ }
|
|
273
|
+
|
|
274
|
+ hasPrivs := client.HasRoleCapabs("chanreg")
|
|
275
|
+ if !hasPrivs {
|
|
276
|
+ founder := channel.Founder()
|
|
277
|
+ hasPrivs = founder != "" && founder == client.Account()
|
|
278
|
+ }
|
|
279
|
+ if !hasPrivs {
|
|
280
|
+ csNotice(rb, client.t("Insufficient privileges"))
|
|
281
|
+ return
|
|
282
|
+ }
|
|
283
|
+
|
|
284
|
+ info := channel.ExportRegistration(0)
|
|
285
|
+ channel.SetUnregistered()
|
|
286
|
+ go server.channelRegistry.Delete(channelKey, info)
|
|
287
|
+ csNotice(rb, fmt.Sprintf(client.t("Channel %s is now unregistered"), channelKey))
|
|
288
|
+}
|