|
@@ -1,131 +0,0 @@
|
1
|
|
-// Copyright (c) 2012-2014 Jeremy Latt
|
2
|
|
-// Copyright (c) 2014-2015 Edmund Huber
|
3
|
|
-// released under the MIT license
|
4
|
|
-
|
5
|
|
-package irc
|
6
|
|
-
|
7
|
|
-type TheaterClient Name
|
8
|
|
-
|
9
|
|
-func (c TheaterClient) Id() Name {
|
10
|
|
- return Name(c)
|
11
|
|
-}
|
12
|
|
-
|
13
|
|
-func (c TheaterClient) Nick() Name {
|
14
|
|
- return Name(c)
|
15
|
|
-}
|
16
|
|
-
|
17
|
|
-/*
|
18
|
|
-func (m *TheaterIdentifyCommand) LoadPassword(s *Server) {
|
19
|
|
- m.hash = s.theaters[m.channel]
|
20
|
|
-}
|
21
|
|
-
|
22
|
|
- if upperSubCmd := strings.ToUpper(args[0]); upperSubCmd == "IDENTIFY" && len(args) == 3 {
|
23
|
|
- return &TheaterIdentifyCommand{
|
24
|
|
- channel: NewName(args[1]),
|
25
|
|
- PassCommand: PassCommand{password: []byte(args[2])},
|
26
|
|
- }, nil
|
27
|
|
- } else if upperSubCmd == "PRIVMSG" && len(args) == 4 {
|
28
|
|
- return &TheaterPrivMsgCommand{
|
29
|
|
- channel: NewName(args[1]),
|
30
|
|
- asNick: NewName(args[2]),
|
31
|
|
- message: NewText(args[3]),
|
32
|
|
- }, nil
|
33
|
|
- } else if upperSubCmd == "ACTION" && len(args) == 4 {
|
34
|
|
- return &TheaterActionCommand{
|
35
|
|
- channel: NewName(args[1]),
|
36
|
|
- asNick: NewName(args[2]),
|
37
|
|
- action: NewCTCPText(args[3]),
|
38
|
|
- }, nil
|
39
|
|
- } else {
|
40
|
|
- return nil, ErrParseCommand
|
41
|
|
- }
|
42
|
|
-func (m *TheaterIdentifyCommand) HandleServer(s *Server) {
|
43
|
|
- client := m.Client()
|
44
|
|
- if !m.channel.IsChannel() {
|
45
|
|
- client.ErrNoSuchChannel(m.channel)
|
46
|
|
- return
|
47
|
|
- }
|
48
|
|
-
|
49
|
|
- channel := s.channels.Get(m.channel)
|
50
|
|
- if channel == nil {
|
51
|
|
- client.ErrNoSuchChannel(m.channel)
|
52
|
|
- return
|
53
|
|
- }
|
54
|
|
-
|
55
|
|
- if (m.hash == nil) || (m.err != nil) {
|
56
|
|
- client.ErrPasswdMismatch()
|
57
|
|
- return
|
58
|
|
- }
|
59
|
|
-
|
60
|
|
- if channel.members.AnyHasMode(Theater) {
|
61
|
|
- client.Reply(RplNotice(s, client, "someone else is +T in this channel"))
|
62
|
|
- return
|
63
|
|
- }
|
64
|
|
-
|
65
|
|
- channel.members[client][Theater] = true
|
66
|
|
-}
|
67
|
|
-
|
68
|
|
-type TheaterPrivMsgCommand struct {
|
69
|
|
- BaseCommand
|
70
|
|
- channel Name
|
71
|
|
- asNick Name
|
72
|
|
- message Text
|
73
|
|
-}
|
74
|
|
-
|
75
|
|
-func (m *TheaterPrivMsgCommand) HandleServer(s *Server) {
|
76
|
|
- client := m.Client()
|
77
|
|
-
|
78
|
|
- if !m.channel.IsChannel() {
|
79
|
|
- client.ErrNoSuchChannel(m.channel)
|
80
|
|
- return
|
81
|
|
- }
|
82
|
|
-
|
83
|
|
- channel := s.channels.Get(m.channel)
|
84
|
|
- if channel == nil {
|
85
|
|
- client.ErrNoSuchChannel(m.channel)
|
86
|
|
- return
|
87
|
|
- }
|
88
|
|
-
|
89
|
|
- if !channel.members.HasMode(client, Theater) {
|
90
|
|
- client.Reply(RplNotice(s, client, "you are not +T"))
|
91
|
|
- return
|
92
|
|
- }
|
93
|
|
-
|
94
|
|
- reply := RplPrivMsg(TheaterClient(m.asNick), channel, m.message)
|
95
|
|
- for member := range channel.members {
|
96
|
|
- member.Reply(reply)
|
97
|
|
- }
|
98
|
|
-}
|
99
|
|
-
|
100
|
|
-type TheaterActionCommand struct {
|
101
|
|
- BaseCommand
|
102
|
|
- channel Name
|
103
|
|
- asNick Name
|
104
|
|
- action CTCPText
|
105
|
|
-}
|
106
|
|
-
|
107
|
|
-func (m *TheaterActionCommand) HandleServer(s *Server) {
|
108
|
|
- client := m.Client()
|
109
|
|
-
|
110
|
|
- if !m.channel.IsChannel() {
|
111
|
|
- client.ErrNoSuchChannel(m.channel)
|
112
|
|
- return
|
113
|
|
- }
|
114
|
|
-
|
115
|
|
- channel := s.channels.Get(m.channel)
|
116
|
|
- if channel == nil {
|
117
|
|
- client.ErrNoSuchChannel(m.channel)
|
118
|
|
- return
|
119
|
|
- }
|
120
|
|
-
|
121
|
|
- if !channel.members.HasMode(client, Theater) {
|
122
|
|
- client.Reply(RplNotice(s, client, "you are not +T"))
|
123
|
|
- return
|
124
|
|
- }
|
125
|
|
-
|
126
|
|
- reply := RplCTCPAction(TheaterClient(m.asNick), channel, m.action)
|
127
|
|
- for member := range channel.members {
|
128
|
|
- member.Reply(reply)
|
129
|
|
- }
|
130
|
|
-}
|
131
|
|
-*/
|