コード例 #1
0
        public Message RecipientNotFound(ServerClient currentClient, Message currentMessage)
        {
            string originalRecipientGUID = currentMessage.RecipientGUID;

            currentMessage = currentMessage.Redact();
            currentMessage.RecipientGUID = currentMessage.SenderGUID;
            currentMessage.SenderGUID    = ServerGUID;
            currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
            currentMessage.Success       = false;
            currentMessage.SyncResponse  = currentMessage.SyncRequest;
            currentMessage.SyncRequest   = false;

            if (!String.IsNullOrEmpty(originalRecipientGUID))
            {
                currentMessage.Data = FailureData.ToBytes(ErrorTypes.RecipientNotFound, "Unknown recipient", originalRecipientGUID);
            }
            else if (!String.IsNullOrEmpty(currentMessage.ChannelGUID))
            {
                currentMessage.Data = FailureData.ToBytes(ErrorTypes.ChannelNotFound, "Unknown channel", currentMessage.ChannelGUID);
            }
            else
            {
                currentMessage.Data = FailureData.ToBytes(ErrorTypes.BadRequest, "No recipient or channel supplied", null);
            }
            return(currentMessage);
        }
コード例 #2
0
 public Message AuthorizationFailed(Message currentMessage)
 {
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = false;
     currentMessage.SyncRequest   = false;
     currentMessage.SyncResponse  = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.AuthorizationFailed, "Authorization failed", null);
     return(currentMessage);
 }
コード例 #3
0
 public Message UnknownCommand(ServerClient currentClient, Message currentMessage)
 {
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = false;
     currentMessage.SyncResponse  = currentMessage.SyncRequest;
     currentMessage.SyncRequest   = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.UnknownCommand, "Unknown command", currentMessage.Command);
     return(currentMessage);
 }
コード例 #4
0
 public Message ChannelCreateFailure(ServerClient currentClient, Message currentMessage)
 {
     currentMessage = currentMessage.Redact();
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = false;
     currentMessage.SyncResponse  = currentMessage.SyncRequest;
     currentMessage.SyncRequest   = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.UnableToCreateChannel, "Unable to create channel", null);
     return(currentMessage);
 }
コード例 #5
0
 public Message ChannelAlreadyExists(ServerClient currentClient, Message currentMessage, Channel currentChannel)
 {
     currentMessage = currentMessage.Redact();
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = false;
     currentMessage.SyncResponse  = currentMessage.SyncRequest;
     currentMessage.SyncRequest   = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.ChannelAlreadyExists, "Channel already exists", currentChannel.ChannelGUID);
     return(currentMessage);
 }
コード例 #6
0
 public Message ChannelNotFound(ServerClient currentClient, Message currentMessage)
 {
     currentMessage = currentMessage.Redact();
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = false;
     currentMessage.SyncResponse  = currentMessage.SyncRequest;
     currentMessage.SyncRequest   = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.ChannelNotFound, "Channel not found", currentMessage.ChannelGUID);
     return(currentMessage);
 }
コード例 #7
0
 public Message DataError(ServerClient currentClient, Message currentMessage, string message)
 {
     currentMessage = currentMessage.Redact();
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = false;
     currentMessage.SyncResponse  = currentMessage.SyncRequest;
     currentMessage.SyncRequest   = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.DataError, "Data error encountered", message);
     return(currentMessage);
 }
コード例 #8
0
 public Message NotChannelMember(ServerClient currentClient, Message currentMessage, Channel currentChannel)
 {
     currentMessage = currentMessage.Redact();
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = false;
     currentMessage.SyncResponse  = currentMessage.SyncRequest;
     currentMessage.SyncRequest   = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.NotAChannelMember, "You are not a member of this channel", currentChannel.ChannelGUID);
     return(currentMessage);
 }
コード例 #9
0
 public Message ChannelUnsubscribeFailure(ServerClient currentClient, Message currentMessage, Channel currentChannel)
 {
     currentMessage = currentMessage.Redact();
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.ChannelGUID   = currentChannel.ChannelGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = false;
     currentMessage.SyncResponse  = currentMessage.SyncRequest;
     currentMessage.SyncRequest   = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.UnableToUnsubscribeChannel, "Unable to unsubscribe from channel", currentChannel.ChannelGUID);
     return(currentMessage);
 }
コード例 #10
0
        public Message LoginRequired()
        {
            Message ResponseMessage = new Message();

            ResponseMessage.RecipientGUID = null;
            ResponseMessage.SenderGUID    = ServerGUID;
            ResponseMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
            ResponseMessage.Success       = false;
            ResponseMessage.SyncRequest   = false;
            ResponseMessage.SyncResponse  = false;
            ResponseMessage.Data          = FailureData.ToBytes(ErrorTypes.LoginRequired, "Login required", null);
            return(ResponseMessage);
        }
コード例 #11
0
 public Message ChannelNoSubscribers(ServerClient currentClient, Message currentMessage, Channel currentChannel)
 {
     currentMessage = currentMessage.Redact();
     currentMessage.RecipientGUID = currentMessage.SenderGUID;
     currentMessage.SenderGUID    = ServerGUID;
     currentMessage.ChannelGUID   = currentChannel.ChannelGUID;
     currentMessage.CreatedUtc    = DateTime.Now.ToUniversalTime();
     currentMessage.Success       = true;
     currentMessage.SyncResponse  = currentMessage.SyncRequest;
     currentMessage.SyncRequest   = false;
     currentMessage.Data          = FailureData.ToBytes(ErrorTypes.NoChannelSubscribers, "No subscribers in channel", currentChannel.ChannelGUID);
     return(currentMessage);
 }