Split long lines

This commit is contained in:
Sergey Matveev 2015-10-05 23:57:31 +03:00
parent 5fcf63baf8
commit ad68cf29f6

34
room.go
View File

@ -125,11 +125,25 @@ func (room *Room) Processor(events <-chan ClientEvent) {
room.topic = strings.TrimLeft(event.text, ":") room.topic = strings.TrimLeft(event.text, ":")
msg := fmt.Sprintf(":%s TOPIC %s :%s", client, room.name, room.topic) msg := fmt.Sprintf(":%s TOPIC %s :%s", client, room.name, room.topic)
go room.Broadcast(msg) go room.Broadcast(msg)
room.logSink <- LogEvent{room.name, client.nickname, "set topic to " + room.topic, true} room.logSink <- LogEvent{
room.name,
client.nickname,
"set topic to " + room.topic,
true,
}
room.StateSave() room.StateSave()
case EventWho: case EventWho:
for m := range room.members { for m := range room.members {
client.ReplyNicknamed("352", room.name, m.username, m.conn.RemoteAddr().String(), *room.hostname, m.nickname, "H", "0 "+m.realname) client.ReplyNicknamed(
"352",
room.name,
m.username,
m.conn.RemoteAddr().String(),
*room.hostname,
m.nickname,
"H",
"0 "+m.realname,
)
} }
client.ReplyNicknamed("315", room.name, "End of /WHO list") client.ReplyNicknamed("315", room.name, "End of /WHO list")
case EventMode: case EventMode:
@ -175,8 +189,20 @@ func (room *Room) Processor(events <-chan ClientEvent) {
room.StateSave() room.StateSave()
case EventMsg: case EventMsg:
sep := strings.Index(event.text, " ") sep := strings.Index(event.text, " ")
room.Broadcast(fmt.Sprintf(":%s %s %s :%s", client, event.text[:sep], room.name, event.text[sep+1:]), client) room.Broadcast(fmt.Sprintf(
room.logSink <- LogEvent{room.name, client.nickname, event.text[sep+1:], false} ":%s %s %s :%s",
client,
event.text[:sep],
room.name,
event.text[sep+1:]),
client,
)
room.logSink <- LogEvent{
room.name,
client.nickname,
event.text[sep+1:],
false,
}
} }
} }
} }