Exemplo n.º 1
0
        public override void SendMessage(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.channel.SendMessageRequest request, System.Action <bnet.protocol.NoData> done)
        {
            var channel = ChannelManager.GetChannelByDynamicId(this.LastCallHeader.ObjectId);

            Logger.Trace("{0} sent a message to channel {1}.", this.Client.Account.CurrentGameAccount.CurrentToon, channel);

            var builder = bnet.protocol.NoData.CreateBuilder();

            done(builder.Build());

            if (!request.HasMessage)
            {
                return; // only continue if the request actually contains a message.
            }
            if (request.Message.AttributeCount == 0 || !request.Message.AttributeList.First().HasValue)
            {
                return;                                                                                                     // check if it has attributes.
            }
            var parsedAsCommand = CommandManager.TryParse(request.Message.AttributeList[0].Value.StringValue, this.Client); // try parsing the message as a command

            if (!parsedAsCommand)
            {
                channel.SendMessage(this.Client, request.Message); // if it's not parsed as an command - let channel itself to broadcast message to it's members.
            }
        }
Exemplo n.º 2
0
        public override void SendMessage(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.channel.SendMessageRequest request, System.Action <bnet.protocol.NoData> done)
        {
            Logger.Trace("SendMessage()");
            //Logger.Warn("request:\n{0}", request.ToString());

            var builder = bnet.protocol.NoData.CreateBuilder();

            done(builder.Build());
        }