func (c *IRCClient) WriteServerInfo() { err := common.RedisSave(c.serverInfo) if err != nil { log.Println("WriteServerInfo Error:", err) } }
func (c *IRCClient) WriteChatLog(timestamp time.Time, from, channel, message string) *common.IRCLog { ircLog := &common.IRCLog{ UserId: c.UserId, LogId: c.logIdSeq.Incr(), Timestamp: common.UnixMilli(timestamp), ServerId: c.ServerId, Channel: channel, From: from, Message: message, } common.RedisSave(ircLog) return ircLog }
func (c *Channel) WriteChannelInfo(memberChanged bool) *common.IRCChannel { if memberChanged { c.info.Members = make([]string, len(c.members)) i := 0 for nick, _ := range c.members { c.info.Members[i] = nick i++ } } if err := common.RedisSave(c.info); err != nil { log.Println("WriteChannelInfo Error : ", err) } return c.info }
func (c *Channel) WriteChannelInfo(memberChanged bool) common.IRCDeltaChannel { delta := c.MakeDeltaChannel() delta["topic"] = c.info.Topic delta["joined"] = c.info.Joined if memberChanged { members := make([]string, len(c.members)) c.info.Members = make([]string, len(c.members)) i := 0 for nick, _ := range c.members { c.info.Members[i] = nick members[i] = "+" + nick i++ } delta["members"] = members } if err := common.RedisSave(c.info); err != nil { log.Println("WriteChannelInfo Error : ", err) } return delta }