Exemplo n.º 1
0
        public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
        {
            switch (methodId)
            {
            case 1:
            {
                SubscribeRequest request = new SubscribeRequest();
                request.MergeFrom(stream);

                SubscribeResponse     response = new SubscribeResponse();
                BattlenetRpcErrorCode status   = HandleSubscribe(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.Subscribe(bgs.protocol.friends.v1.SubscribeRequest: {1}) returned bgs.protocol.friends.v1.SubscribeResponse: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 2:
            {
                SendInvitationRequest request = new SendInvitationRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleSendInvitation(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.SendInvitation(bgs.protocol.SendInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 3:
            {
                AcceptInvitationRequest request = new AcceptInvitationRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleAcceptInvitation(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.AcceptInvitation(bgs.protocol.GenericInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 4:
            {
                RevokeInvitationRequest request = new RevokeInvitationRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleRevokeInvitation(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RevokeInvitation(bgs.protocol.GenericInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 5:
            {
                DeclineInvitationRequest request = new DeclineInvitationRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleDeclineInvitation(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.DeclineInvitation(bgs.protocol.GenericInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 6:
            {
                IgnoreInvitationRequest request = new IgnoreInvitationRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleIgnoreInvitation(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.IgnoreInvitation(bgs.protocol.GenericInvitationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 8:
            {
                RemoveFriendRequest request = new RemoveFriendRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleRemoveFriend(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RemoveFriend(bgs.protocol.friends.v1.GenericFriendRequest: {1}) returned bgs.protocol.friends.v1.GenericFriendResponse: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 9:
            {
                ViewFriendsRequest request = new ViewFriendsRequest();
                request.MergeFrom(stream);

                ViewFriendsResponse   response = new ViewFriendsResponse();
                BattlenetRpcErrorCode status   = HandleViewFriends(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.ViewFriends(bgs.protocol.friends.v1.ViewFriendsRequest: {1}) returned bgs.protocol.friends.v1.ViewFriendsResponse: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 10:
            {
                UpdateFriendStateRequest request = new UpdateFriendStateRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleUpdateFriendState(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.UpdateFriendState(bgs.protocol.friends.v1.UpdateFriendStateRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 11:
            {
                UnsubscribeRequest request = new UnsubscribeRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleUnsubscribe(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.Unsubscribe(bgs.protocol.friends.v1.UnsubscribeRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 12:
            {
                RevokeAllInvitationsRequest request = new RevokeAllInvitationsRequest();
                request.MergeFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleRevokeAllInvitations(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method FriendsService.RevokeAllInvitations(bgs.protocol.friends.v1.GenericFriendRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            default:
                Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
                SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
                break;
            }
        }
Exemplo n.º 2
0
 BattlenetRpcErrorCode HandleRemoveFriend(RemoveFriendRequest request, NoData response)
 {
     Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method FriendsService.RemoveFriend: {1}",
                  GetCallerInfo(), request.ToString());
     return(BattlenetRpcErrorCode.RpcNotImplemented);
 }