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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }