Added /nick and /topic

This commit is contained in:
khlieng 2015-02-04 02:43:49 +01:00
parent ad4354adfc
commit 92c316e9ea
7 changed files with 65 additions and 2 deletions

View file

@ -123,6 +123,22 @@ func (u User) AddChannel(channel Channel) {
})
}
func (u User) SetNick(nick, address string) {
go db.Update(func(tx *bolt.Tx) error {
b := tx.Bucket([]byte("Servers"))
id := []byte(u.UUID + ":" + address)
var server Server
json.Unmarshal(b.Get(id), &server)
server.Nick = nick
data, _ := json.Marshal(server)
b.Put(id, data)
return nil
})
}
func (u User) RemoveServer(address string) {
go db.Update(func(tx *bolt.Tx) error {
serverID := []byte(u.UUID + ":" + address)