Ejemplo n.º 1
0
        public override void SendNotification(IRpcController controller, Notification request, Action <NoData> done)
        {
            Logger.Trace("SendNotification()");
            Logger.Debug("notification:\n{0}", request.ToString());

            switch (request.GetNotificationType())
            {
            case NotificationTypeHelper.NotificationType.Whisper:
                // Hackztime deluxe
                // TODO: The notification on the recipient's side will end up with no name, and
                // the recipient doesn't even send a subscribe request or something like that when trying to respond
                // Need more data to figure this out..
                var account = ToonManager.GetAccountByToonLowID(request.TargetId.Low);
                var method  = bnet.protocol.notification.NotificationListener.Descriptor.FindMethodByName("OnNotificationReceived");
                account.LoggedInBNetClient.CallMethod(method, request, 0);
                break;

            default:
                Logger.Warn("Unhandled notification type: {0}", request.Type);
                break;
            }

            var builder = NoData.CreateBuilder();

            done(builder.Build());
        }
Ejemplo n.º 2
0
        public override void Update(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.presence.UpdateRequest request, System.Action <bnet.protocol.NoData> done)
        {
            Logger.Trace("Update() {0}: {1}", request.EntityId.GetHighIdType(), request.EntityId.Low);
            //Logger.Warn("request:\n{0}", request.ToString());
            // This "UpdateRequest" is not, as it may seem, a request to update the client on the state of an object,
            // but instead the *client* requesting to change fields on an object that it has subscribed to.
            // Check docs/rpc/presence.txt in branch wip-docs (or master)

            switch (request.EntityId.GetHighIdType())
            {
            case EntityIdHelper.HighIdType.AccountId:
                var account = AccountManager.GetAccountByEntityID(request.EntityId);
                break;

            case EntityIdHelper.HighIdType.ToonId:
                var toon = ToonManager.GetToonByLowID(request.EntityId.Low);
                break;

            default:
                Logger.Warn("Recieved an unhandled Presence.Update request with type {0}", request.EntityId.GetHighIdType());
                break;
            }

            var builder = NoData.CreateBuilder();

            done(builder.Build());
        }
Ejemplo n.º 3
0
        public override void Subscribe(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.presence.SubscribeRequest request, System.Action <bnet.protocol.NoData> done)
        {
            Logger.Trace("Subscribe() {0}: {1}", request.EntityId.GetHighIdType(), request.EntityId.Low);

            switch (request.EntityId.GetHighIdType())
            {
            case EntityIdHelper.HighIdType.AccountId:
                this.Client.Account.AddSubscriber((BNetClient)this.Client, request.ObjectId);
                break;

            case EntityIdHelper.HighIdType.ToonId:
                var toon = ToonManager.GetToonByLowID(request.EntityId.Low);
                // The client will send us a Subscribe with ToonId of 0 the first time it
                // tries to create a toon with a name that already exists. Let's handle that here.
                if (toon != null)
                {
                    toon.AddSubscriber((BNetClient)this.Client, request.ObjectId);
                }
                break;

            default:
                Logger.Warn("Recieved an unhandled Presence.Subscribe request with type {0}", request.EntityId.GetHighIdType());
                break;
            }

            var builder = NoData.CreateBuilder();

            done(builder.Build());
        }
Ejemplo n.º 4
0
        public override void UnsubscribeOrderStatusChange(IRpcController controller, UnsubscribeOrderStatusChangeRequest request, Action <NoData> done)
        {
            Logger.Trace("UnsubscribeOrderStatusChange() Stub");
            var builder = NoData.CreateBuilder();

            done(builder.Build());
        }