예제 #1
0
 public IEAttach OpenAttach()
 {
     try
     {
         IEMessage message = OpenMessage();
         if (message == null)
         {
             return(null);
         }
         using ( message )
         {
             if (_num == -1)
             {
                 _num = GetAttachNum(message, _attachmentIndex);
                 ResourceProxy resAttach = new ResourceProxy(_resAttach);
                 resAttach.SetPropAsync(PROP.PR_ATTACH_NUM, _num);
                 resAttach.SetPropAsync(PROP.AttachMethod, _attachMethod);
             }
             return(message.OpenAttach(_num));
         }
     }
     catch
     {
         return(null);
     }
 }
예제 #2
0
        public void SetSyncComplete()
        {
            IResource     resource = GetSyncVersionResource();
            ResourceProxy proxy    = new ResourceProxy(resource);

            proxy.SetPropAsync(PROP.SyncComplete, true);
        }
예제 #3
0
        public void RemoteSetMozillaBookmarkId(int idres, string rdfid)
        {
            IResource res = Core.ResourceStore.TryLoadResource(idres);

            if (res != null)
            {
                ResourceProxy proxy = new ResourceProxy(res);
                proxy.SetPropAsync(_propBookmarkId, rdfid);
            }
        }
예제 #4
0
 protected override void Execute()
 {
     if (_status == RSSWorkStatus.NotStarted)
     {
         ResourceProxy proxy = new ResourceProxy(_feed);
         // the immediate priority is required to make sure that the resource job to set
         // (updating) status is executed before the parse job, which also has
         // immediate priority
         proxy.AsyncPriority = JobPriority.Immediate;
         proxy.SetPropAsync(Props.UpdateStatus, "(updating)");
         _status = RSSWorkStatus.InProgress;
     }
     RSSLoadDelegate();
 }
예제 #5
0
        private void setGroupUnit_Finished(AsciiProtocolUnit unit)
        {
            AsciiSendLineGetLineUnit setGroupUnit = (AsciiSendLineGetLineUnit)unit;

            _responseLine = setGroupUnit.ResponseLine;
            string error = null;

            if (_responseLine == null)
            {
                if (_connection.LastSocketException != null)
                {
                    error = _connection.LastSocketException.Message;
                }
                else
                {
                    error = "Newsgroup could not be processed";
                }
            }
            else if (!_responseLine.StartsWith("211"))
            {
                if (_responseLine.Length > 4)
                {
                    error = _responseLine.Substring(4);
                }
                else
                {
                    error = "Newsgroup could not be processed";
                }
            }
            ResourceProxy proxy = new ResourceProxy(_group.Resource);

            if (error != null)
            {
                proxy.SetPropAsync(Core.Props.LastError, error);
            }
            else
            {
                proxy.DeletePropAsync(Core.Props.LastError);
            }
            FireFinished();
        }
예제 #6
0
        public override void DisplayResource(IResource article, WordPtr[] wordsToHighlight)
        {
            if (_downloadLabel == null)
            {
                _downloadLabel               = new JetLinkLabel();
                _downloadLabel.Text          = "Click here or press F5 to download the article";
                _downloadLabel.BackColor     = Color.Transparent;
                _downloadLabel.ClickableLink = true;
                _downloadLabel.Click        += _downloadLabel_Click;
                Controls.Add(_downloadLabel);
            }
            _downloadLabel.Visible = false;
            _ieBrowser.Visible     = true;
            bool redisplayed = _articleIsRedisplayed;

            _articleIsRedisplayed = false;

            DisposeArticleListener();

            // Set the subject, highlight if needed
            ShowSubject(article.GetPropText(Core.Props.Subject), wordsToHighlight);

            try
            {
                //  The content being indexed (plaintext) is not the same that is
                //  displayed (autogenerated HTML), so the offsets are updated by
                //  this method to correspond to the new formatting.
                string sFormattedArticle = ArticleBody2Html(article, ref wordsToHighlight);
                ShowHtml(sFormattedArticle, _ctxRestricted, wordsToHighlight);
            }
            catch (Exception e)
            {
                Utils.DisplayException(e, "Error");
                return;
            }

            /**
             * set last selected article for article's owner
             */
            IResource owner = _rbrowser.OwnerResource;

            if (owner != null && (owner.Type == NntpPlugin._newsGroup ||
                                  owner.Type == NntpPlugin._newsFolder || owner.Type == NntpPlugin._newsServer))
            {
                ResourceProxy proxy = new ResourceProxy(owner);
                proxy.AsyncPriority = JobPriority.AboveNormal;
                proxy.SetPropAsync(NntpPlugin._propLastSelectedArticle, article.Id);
            }

            _articleListener = article.ToResourceListLive();
            _articleListener.ResourceChanged += _articleListener_ResourceChanged;

            bool hasNoBody = article.HasProp(NntpPlugin._propHasNoBody);

            if (!hasNoBody)
            {
                Core.UIManager.GetStatusWriter(this, StatusPane.Network).ClearStatus();
            }
            else
            {
                if (!Utils.IsNetworkConnectedLight())
                {
                    ShowHtml("<pre>" + NntpPlugin._networkUnavailable + ".</pre>", WebSecurityContext.Internet, null);
                    return;
                }
                IResourceList groups = article.GetLinksOfType(NntpPlugin._newsGroup, NntpPlugin._propTo);
                if (groups.Count > 0)
                {
                    foreach (IResource groupRes in groups.ValidResources)
                    {
                        IResource server = new NewsgroupResource(groupRes).Server;
                        if (server != null)
                        {
                            ServerResource serverRes = new ServerResource(server);
                            if (redisplayed || serverRes.DownloadBodiesOnDeliver || serverRes.DownloadBodyOnSelection)
                            {
                                Core.UIManager.GetStatusWriter(this, StatusPane.Network).ShowStatus("Downloading article...");
                                NntpConnection          articlesConnection = NntpConnectionPool.GetConnection(server, "foreground");
                                NntpDownloadArticleUnit downloadUnit       =
                                    new NntpDownloadArticleUnit(article, groupRes, JobPriority.Immediate, true);
                                downloadUnit.OnProgress += downloadUnit_OnProgress;
                                ShowHtml("<pre>Downloading article: 0%</pre>", WebSecurityContext.Internet, null);
                                articlesConnection.StartUnit(Int32.MaxValue - 1, downloadUnit);
                                return;
                            }
                        }
                    }
                    if (!redisplayed)
                    {
                        Point location = _ieBrowser.Location;
                        _downloadLabel.Location = new Point(location.X + 8, location.Y + 8);
                        _downloadLabel.Visible  = true;
                        _ieBrowser.Visible      = false;
                    }
                }
            }
        }
예제 #7
0
        private void OnAfterExpand(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            ResourceProxy folder = new ResourceProxy((IResource)e.Node.Tag);

            folder.SetPropAsync(PROP.OpenSelectFolder, 1);
        }