Rename message.message to message.content
This commit is contained in:
parent
c4609574c7
commit
ebee2746d6
11 changed files with 55 additions and 55 deletions
|
@ -121,10 +121,10 @@ func (i *ircHandler) mode(msg *irc.Message) {
|
|||
}
|
||||
|
||||
func (i *ircHandler) message(msg *irc.Message) {
|
||||
message := Chat{
|
||||
message := Message{
|
||||
Server: i.client.Host,
|
||||
From: msg.Nick,
|
||||
Message: msg.LastParam(),
|
||||
Content: msg.LastParam(),
|
||||
}
|
||||
|
||||
if msg.Params[0] == i.client.GetNick() {
|
||||
|
@ -159,10 +159,10 @@ func (i *ircHandler) info(msg *irc.Message) {
|
|||
go i.session.user.SetNick(msg.Params[0], i.client.Host)
|
||||
}
|
||||
|
||||
i.session.sendJSON("pm", Chat{
|
||||
i.session.sendJSON("pm", Message{
|
||||
Server: i.client.Host,
|
||||
From: msg.Nick,
|
||||
Message: strings.Join(msg.Params[1:], " "),
|
||||
Content: strings.Join(msg.Params[1:], " "),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -130,11 +130,11 @@ func TestHandleIRCMessage(t *testing.T) {
|
|||
Params: []string{"#chan", "the message"},
|
||||
})
|
||||
|
||||
checkResponse(t, "message", Chat{
|
||||
checkResponse(t, "message", Message{
|
||||
Server: "host.com",
|
||||
From: "nick",
|
||||
To: "#chan",
|
||||
Message: "the message",
|
||||
Content: "the message",
|
||||
}, res)
|
||||
|
||||
res = dispatchMessage(&irc.Message{
|
||||
|
@ -143,10 +143,10 @@ func TestHandleIRCMessage(t *testing.T) {
|
|||
Params: []string{"nick", "the message"},
|
||||
})
|
||||
|
||||
checkResponse(t, "pm", Chat{
|
||||
checkResponse(t, "pm", Message{
|
||||
Server: "host.com",
|
||||
From: "someone",
|
||||
Message: "the message",
|
||||
Content: "the message",
|
||||
}, res)
|
||||
}
|
||||
|
||||
|
@ -176,10 +176,10 @@ func TestHandleIRCWelcome(t *testing.T) {
|
|||
New: "nick",
|
||||
}, <-res)
|
||||
|
||||
checkResponse(t, "pm", Chat{
|
||||
checkResponse(t, "pm", Message{
|
||||
Server: "host.com",
|
||||
From: "nick",
|
||||
Message: "some text",
|
||||
Content: "some text",
|
||||
}, <-res)
|
||||
}
|
||||
|
||||
|
|
|
@ -60,11 +60,11 @@ type Quit struct {
|
|||
Reason string `json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
type Chat struct {
|
||||
type Message struct {
|
||||
Server string `json:"server"`
|
||||
From string `json:"from,omitempty"`
|
||||
To string `json:"to,omitempty"`
|
||||
Message string `json:"message"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type Topic struct {
|
||||
|
|
|
@ -128,9 +128,9 @@ func (s *Session) sendError(err error, server string) {
|
|||
}
|
||||
|
||||
func (s *Session) print(server string, a ...interface{}) {
|
||||
s.sendJSON("print", Chat{
|
||||
s.sendJSON("print", Message{
|
||||
Server: server,
|
||||
Message: fmt.Sprintln(a...),
|
||||
Content: fmt.Sprintln(a...),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -156,12 +156,12 @@ func (h *wsHandler) quit(b []byte) {
|
|||
}
|
||||
}
|
||||
|
||||
func (h *wsHandler) chat(b []byte) {
|
||||
var data Chat
|
||||
func (h *wsHandler) message(b []byte) {
|
||||
var data Message
|
||||
json.Unmarshal(b, &data)
|
||||
|
||||
if i, ok := h.session.getIRC(data.Server); ok {
|
||||
i.Privmsg(data.To, data.Message)
|
||||
i.Privmsg(data.To, data.Content)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ func (h *wsHandler) initHandlers() {
|
|||
"join": h.join,
|
||||
"part": h.part,
|
||||
"quit": h.quit,
|
||||
"chat": h.chat,
|
||||
"message": h.message,
|
||||
"nick": h.nick,
|
||||
"invite": h.invite,
|
||||
"kick": h.kick,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue