X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=room.go;h=99ec208e573ff97be207abeb8fd6f475807a8ec6;hb=3016635f6a6bd23e34461e93cef3e8d861ce4275;hp=3f8901caf894732e369863b8c514f6bfe62e84be;hpb=cfeaaad88f71bf1b0846251b7f448bf41bde26d9;p=goircd.git diff --git a/room.go b/room.go index 3f8901c..99ec208 100644 --- a/room.go +++ b/room.go @@ -1,6 +1,6 @@ /* goircd -- minimalistic simple Internet Relay Chat (IRC) server -Copyright (C) 2014 Sergey Matveev +Copyright (C) 2014-2015 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,6 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ + package main import ( @@ -41,12 +42,16 @@ type Room struct { topic string key string members map[*Client]bool - hostname string + hostname *string logSink chan<- LogEvent stateSink chan<- StateEvent } -func NewRoom(hostname, name string, logSink chan<- LogEvent, stateSink chan<- StateEvent) *Room { +func (room Room) String() string { + return room.name +} + +func NewRoom(hostname *string, name string, logSink chan<- LogEvent, stateSink chan<- StateEvent) *Room { room := Room{name: name} room.members = make(map[*Client]bool) room.topic = "" @@ -124,7 +129,7 @@ func (room *Room) Processor(events <-chan ClientEvent) { room.StateSave() case EventWho: 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") case EventMode: @@ -136,6 +141,10 @@ func (room *Room) Processor(events <-chan ClientEvent) { client.Msg(fmt.Sprintf("324 %s %s %s", client.nickname, room.name, mode)) continue } + if strings.HasPrefix(event.text, "b") { + client.ReplyNicknamed("368", room.name, "End of channel ban list") + continue + } if strings.HasPrefix(event.text, "-k") || strings.HasPrefix(event.text, "+k") { if _, subscribed := room.members[client]; !subscribed { client.ReplyParts("442", room.name, "You are not on that channel")