Trailing gets added to the end of params
This commit is contained in:
parent
3214e5931a
commit
d69281cdd6
@ -20,7 +20,7 @@ var selectedTabStore = Reflux.createStore({
|
||||
|
||||
select: function(server, channel) {
|
||||
selectedTab.server = server;
|
||||
selectedTab.channel = channel;
|
||||
selectedTab.channel = channel || null;
|
||||
|
||||
if (channel) {
|
||||
selectedTab.name = channel;
|
||||
|
8
irc.go
8
irc.go
@ -94,7 +94,7 @@ func (i *IRC) Connect(address string) error {
|
||||
}
|
||||
i.Server = address
|
||||
|
||||
dialer := &net.Dialer{Timeout: 10 * time.Second}
|
||||
dialer := &net.Dialer{Timeout: 30 * time.Second}
|
||||
|
||||
if i.TLS {
|
||||
if i.TLSConfig == nil {
|
||||
@ -227,7 +227,7 @@ func parseMessage(line string) *Message {
|
||||
msg.Prefix = line[1 : cmdStart-1]
|
||||
}
|
||||
|
||||
if i := strings.LastIndex(line, " :"); i > 0 {
|
||||
if i := strings.Index(line, " :"); i > 0 {
|
||||
cmdEnd = i
|
||||
msg.Trailing = line[i+2:]
|
||||
}
|
||||
@ -238,6 +238,10 @@ func parseMessage(line string) *Message {
|
||||
msg.Params = cmd[1:]
|
||||
}
|
||||
|
||||
if msg.Trailing != "" {
|
||||
msg.Params = append(msg.Params, msg.Trailing)
|
||||
}
|
||||
|
||||
return &msg
|
||||
}
|
||||
|
||||
|
@ -24,26 +24,19 @@ func handleMessages(irc *IRC, session *Session) {
|
||||
|
||||
case JOIN:
|
||||
user := msg.Prefix
|
||||
var channel string
|
||||
|
||||
if len(msg.Params) > 0 {
|
||||
channel = msg.Params[0]
|
||||
} else {
|
||||
channel = msg.Trailing
|
||||
}
|
||||
|
||||
session.sendJSON("join", Join{
|
||||
Server: irc.Host,
|
||||
User: user,
|
||||
Channels: []string{channel},
|
||||
Channels: msg.Params,
|
||||
})
|
||||
|
||||
channelStore.AddUser(user, irc.Host, channel)
|
||||
channelStore.AddUser(user, irc.Host, msg.Params[0])
|
||||
|
||||
if user == irc.nick {
|
||||
session.user.AddChannel(storage.Channel{
|
||||
Server: irc.Host,
|
||||
Name: channel,
|
||||
Name: msg.Params[0],
|
||||
})
|
||||
}
|
||||
|
||||
@ -116,7 +109,7 @@ func handleMessages(irc *IRC, session *Session) {
|
||||
session.sendJSON("pm", Chat{
|
||||
Server: irc.Host,
|
||||
From: msg.Prefix,
|
||||
Message: strings.Join(append(msg.Params[1:], msg.Trailing), " "),
|
||||
Message: strings.Join(msg.Params[1:], " "),
|
||||
})
|
||||
|
||||
case RPL_TOPIC:
|
||||
|
Loading…
Reference in New Issue
Block a user