func (u *User) AddServer(server *common.IRCServer) (*common.IRCServer, error) {
	server.Id = int(u.serverIdSeq.Incr())
	server.UserId = u.Id
	server.Active = false

	servers := []*common.IRCServer{server}

	err := common.RedisSliceSave(u.ServerListKey(), &servers)
	if err != nil {
		return nil, err
	}

	manager.zmq.Send <- common.MakeZmqMsg(u.Id, server.Id, common.ZmqAddServer{ServerInfo: server})

	return server, nil
}
func (u *User) SendChatMsg(serverid int, target, message string) {
	manager.zmq.Send <- common.MakeZmqMsg(u.Id, serverid, common.ZmqSendChat{Target: target, Message: message})
}
func (u *User) AddChannelMsg(serverid int, channel string) {
	manager.zmq.Send <- common.MakeZmqMsg(u.Id, serverid, common.ZmqAddChannel{Channel: &common.IRCChannel{Name: channel}})
}
Exemple #4
0
func (u *User) DelChannel(serverId int, channel string) {
	manager.zmq.Send <- common.MakeZmqMsg(u.Id, serverId, common.ZmqDelChannel{Channel: channel})
}
Exemple #5
0
func (u *User) JoinPartChannel(serverId int, channel string, join bool) {
	manager.zmq.Send <- common.MakeZmqMsg(u.Id, serverId, common.ZmqJoinPartChannel{Channel: channel, Join: join})
}
Exemple #6
0
func (c *IRCClient) MakeZmqMsg(packet common.ZmqPacket) *common.ZmqMsg {
	return common.MakeZmqMsg(c.UserId, c.ServerId, packet)
}