public ValidateLoginTask(ChannelConfiguration configuration, IClientInputChannel channel)
     : base(configuration, channel)
 {
     this.configuration = configuration;
     this.channel = channel;
     this.context = new SetupChannelClientContext();
 }
Example #2
0
        internal static string BuildChannelError(IClientInputChannel channel, ConnectResult result, bool isException)
        {
            var messageBuilder = new StringBuilder();

            messageBuilder.Append(Strings.UnableToConnect);
            messageBuilder.Append(", ");

            if (isException)
            {
                messageBuilder.Append(Strings.DueToAnApplicationError);
            }
            else
            {
                switch (result)
                {
                case ConnectResult.AuthFailure:
                    messageBuilder.AppendFormat(Strings.ServerSaid, channel.AuthMessage);
                    break;

                default:
                    messageBuilder.Append(Strings.DueToAChannelError);
                    break;
                }
            }

            return(messageBuilder.ToString());
        }
Example #3
0
 public ReceiveMessageDetailsTask(ChannelConfiguration config, IClientInputChannel channel, ChannelMessageHeader header, ChannelFolder folder)
 {
     this.config  = config;
     this.channel = channel;
     this.header  = header;
     this.folder  = folder;
 }
        internal static string BuildChannelError(IClientInputChannel channel, ConnectResult result, bool isException)
        {
            var messageBuilder = new StringBuilder();

            messageBuilder.Append(Strings.UnableToConnect);
            messageBuilder.Append(", ");

            if (isException)
            {
                messageBuilder.Append(Strings.DueToAnApplicationError);
            }
            else
            {
                switch (result)
                {
                    case ConnectResult.AuthFailure:
                        messageBuilder.AppendFormat(Strings.ServerSaid, channel.AuthMessage);
                        break;
                    default:
                        messageBuilder.Append(Strings.DueToAChannelError);
                        break;
                }
            }

            return messageBuilder.ToString();
        }
 public ReceiveMessageDetailsTask(ChannelConfiguration config, IClientInputChannel channel, ChannelMessageHeader header, ChannelFolder folder)
 {
     this.config = config;
     this.channel = channel;
     this.header = header;
     this.folder = folder;
 }
 public ReceiveFoldersTask(ChannelConfiguration config, IClientInputChannel channel)
     : base(config, channel)
 {
     this.config = config;
     this.channel = channel;
     this.folders = new List<ChannelFolder>();
 }
        public static string BuildChannelError(IClientInputChannel channel, ConnectResult result, bool isException)
        {
            var messageBuilder = new StringBuilder();

            messageBuilder.AppendFormat("Unable to connect ");

            if (isException)
            {
                messageBuilder.AppendFormat(" due to an application error");
            }
            else
            {
                switch (result)
                {
                case ConnectResult.AuthFailure:
                    messageBuilder.AppendFormat(", server said: {0}", channel.AuthMessage);
                    break;

                default:
                    messageBuilder.AppendFormat(" due to a channel error");
                    break;
                }
            }

            return(messageBuilder.ToString());
        }
 public ReceiveFoldersTask(ChannelConfiguration config, IClientInputChannel channel) : base(config, channel)
 {
     this.config      = config;
     this.channel     = channel;
     this.folders     = new List <ChannelFolder>();
     this.dataService = ClientState.Current.DataService;
 }
 public ValidateLoginTask(ChannelConfiguration configuration, IClientInputChannel channel)
     : base(configuration, channel)
 {
     this.configuration = configuration;
     this.channel       = channel;
     this.context       = new SetupChannelClientContext();
 }
Example #10
0
        public static string BuildChannelError(IClientInputChannel channel, ConnectResult result, bool isException)
        {
            var messageBuilder = new StringBuilder();

            messageBuilder.AppendFormat("Unable to connect ");

            if (isException)
            {
                messageBuilder.AppendFormat(" due to an application error");
            }
            else
            {
                switch (result)
                {
                    case ConnectResult.AuthFailure:
                        messageBuilder.AppendFormat(", server said: {0}", channel.AuthMessage);
                        break;
                    default:
                        messageBuilder.AppendFormat(" due to a channel error");
                        break;
                }
            }

            return messageBuilder.ToString();
        }
 public ReceiveFoldersTask(ChannelConfiguration config, IClientInputChannel channel)
     : base(config, channel)
 {
     this.config = config;
     this.channel = channel;
     this.folders = new List<ChannelFolder>();
     this.dataService = ClientState.Current.DataService;
 }
 public ReceiveMessagesTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel)
 {
     this.config = config;
     this.channel = channel;
     this.folder = folder;
     this.range = range;
     this.dataService = ClientState.Current.DataService;
 }
 public ReceiveMessagesTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel)
 {
     this.config      = config;
     this.channel     = channel;
     this.folder      = folder;
     this.range       = range;
     this.dataService = ClientState.Current.DataService;
 }
        public ReceiveMessagesTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
            : base(config, channel)
        {
            this.config  = config;
            this.channel = channel;
            this.folder  = folder;
            this.range   = range;

            mailbox = VirtualMailBox.Current;
        }
        public ReceiveMessagesTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
            : base(config, channel)
        {
            this.config = config;
            this.channel = channel;
            this.folder = folder;
            this.range = range;

            mailbox = VirtualMailBox.Current;
        }
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(String.Empty);
            }

            if (value is IClientInputChannel)
            {
                IClientInputChannel channel = (IClientInputChannel)value;

                return(channel.GetSourceAddress().Address);
            }

            if (value is long)
            {
                IClientInputChannel channel =
                    ChannelsManager.GetChannelObject((long)value).InputChannel;

                return(channel.GetSourceAddress().Address);
            }

            return(String.Empty);
        }
Example #17
0
 public EnumerateLabelsFolderTask(List <Message> changed, ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel, folder, range)
 {
     this.changed = changed;
 }
 public EnumerateMessagesFolderTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel, folder, range)
 {
 }
Example #19
0
        void ReceiveFoldersTask_FinishedSuccess(ReceiveFoldersTask foldersTask, ChannelConfiguration config, IClientInputChannel inputChannel)
        {
            var gate = new ConcurrencyGate(config.InputChannel.MaxConcurrentConnections);
            var folders = foldersTask.Folders.OrderByDescending(f => (int) f.FolderType);
            var group = new ProgressGroup { SourceChannelId = config.ChannelId };

            // Folders are pushed by descending order into concurrency gate and then popped again,
            // this way the Inbox folder is processed before the sent items folder etc.
            foreach (var folder in folders)
            {
                if (folder.FolderType == ChannelFolderType.Inbox
                    || folder.FolderType == ChannelFolderType.SentItems)
                {
                    gate.Add(new ReceiveMessagesTask(config, inputChannel.Clone(), folder, range));
                }
                else if (folder.FolderType == ChannelFolderType.Trash || folder.FolderType == ChannelFolderType.Spam)
                {
                    gate.Add(new EnumerateMessagesFolderTask(config, inputChannel.Clone(), folder, range) { ProgressGroup = group });
                }
                else if (folder.FolderType == ChannelFolderType.Label)
                {
                    if (config.Charasteristics.SupportsLabels)
                        gate.Add(new EnumerateLabelsFolderTask(config, inputChannel.Clone(), folder, range) { ProgressGroup = group });
                }
            }

            gate.Execute();
            group.IsCompleted = true;

            // Process any labels that we might have received
            if (config.Charasteristics.SupportsLabels)
                new ProcessLabelsTask(config).Execute();

            if (inputChannel is IPoolableChannel)
                ((IPoolableChannel)inputChannel).FreeAllConnections();
        }
 public EnumerateLabelsFolderTask(ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel, folder, range)
 {
 }
Example #21
0
 public ReceiveFoldersTask(ChannelConfiguration config, IClientInputChannel channel) : base(config, channel)
 {
     this.config  = config;
     this.channel = channel;
     this.folders = new List <ChannelFolder>();
 }
Example #22
0
        void ReceiveFoldersTask_FinishedSuccess(ReceiveFoldersTask foldersTask, ChannelConfiguration config, IClientInputChannel inputChannel)
        {
            var gate    = new ConcurrencyGate(config.InputChannel.MaxConcurrentConnections);
            var folders = foldersTask.Folders.OrderByDescending(f => (int)f.FolderType);
            var group   = new ProgressGroup {
                SourceChannelId = config.ChannelId
            };

            // Folders are pushed by descending order into concurrency gate and then popped again,
            // this way the Inbox folder is processed before the sent items folder etc.
            foreach (var folder in folders)
            {
                if (folder.FolderType == ChannelFolderType.Inbox ||
                    folder.FolderType == ChannelFolderType.SentItems)
                {
                    gate.Add(new ReceiveMessagesTask(config, inputChannel.Clone(), folder, range));
                }
                else if (folder.FolderType == ChannelFolderType.Trash || folder.FolderType == ChannelFolderType.Spam)
                {
                    gate.Add(new EnumerateMessagesFolderTask(config, inputChannel.Clone(), folder, range)
                    {
                        ProgressGroup = group
                    });
                }
                else if (folder.FolderType == ChannelFolderType.Label)
                {
                    if (config.Charasteristics.SupportsLabels)
                    {
                        gate.Add(new EnumerateLabelsFolderTask(config, inputChannel.Clone(), folder, range)
                        {
                            ProgressGroup = group
                        });
                    }
                }
            }

            gate.Execute();
            group.IsCompleted = true;

            // Process any labels that we might have received
            if (config.Charasteristics.SupportsLabels)
            {
                new ProcessLabelsTask(config).Execute();
            }

            if (inputChannel is IPoolableChannel)
            {
                ((IPoolableChannel)inputChannel).FreeAllConnections();
            }
        }
 public EnumerateLabelsFolderTask(List<Message> changed, ChannelConfiguration config, IClientInputChannel channel, ChannelFolder folder, ReceiveRange range)
     : base(config, channel, folder, range)
 {
     this.changed = changed;
 }
 public static SourceAddress GetSourceAddress(this IClientInputChannel channel)
 {
     return(new SourceAddress(channel.SourceAdress, ClientState.Current.Context.DisplayName));
 }