Exemple #1
0
        void Notify()
        {
            Configuration.Tracking track = Config.Settings.Tracking;

            //First, ping weblogs.com
            try
            {
                PingWeblogsDotCom(track);
            }
            catch (HttpException e)
            {
                Log.Warn("Had a problem pinging weblogs.com. continuing.", e);
            }

            //Get the links from the last post
            ICollection <string> links = HtmlHelper.GetLinks(Text);

            //Do we have links
            if (links == null || links.Count == 0)
            {
                return;
            }

            //Create our notification Components
            using (var pbnp = new PingBackNotificationProxy())
            {
                //for each link, try to pingback and/or trackback
                foreach (string link in links)
                {
                    //get the page text
                    Uri url = link.ParseUri();
                    if (url == null)
                    {
                        continue;
                    }

                    string pageText = HttpHelper.GetPageText(url);
                    if (pageText == null || !track.EnableTrackBacks)
                    {
                        continue;
                    }

                    if (track.EnablePingBacks &&
                        !TrackBackNotificationProxy.TrackBackPing(pageText, url, Title, PostUrl, BlogName, Description))
                    {
                        Log.DebugFormat("Trackback failed to '{0}'. Let's try a PingBack.", url);
                        pbnp.Ping(pageText, PostUrl, url);
                    }
                }
            }
        }
Exemple #2
0
        void Notify()
        {
            Configuration.Tracking track = Config.Settings.Tracking;

            //First, ping weblogs.com
            try
            {
                PingWeblogsDotCom(track);
            }
            catch (HttpException e)
            {
                Log.Warn("Had a problem pinging weblogs.com. continuing.", e);
            }

            //Get the links from the last post
            ICollection<string> links = HtmlHelper.GetLinks(Text);

            //Do we have links
            if (links == null || links.Count == 0)
            {
                return;
            }

            //Create our notification Components
            using (var pbnp = new PingBackNotificationProxy())
            {
                //for each link, try to pingback and/or trackback
                foreach (string link in links)
                {
                    //get the page text
                    Uri url = link.ParseUri();
                    if (url == null)
                    {
                        continue;
                    }

                    string pageText = HttpHelper.GetPageText(url);
                    if (pageText == null || !track.EnableTrackBacks)
                    {
                        continue;
                    }

                    if (track.EnablePingBacks &&
                       !TrackBackNotificationProxy.TrackBackPing(pageText, url, Title, PostUrl, BlogName, Description))
                    {
                        Log.DebugFormat("Trackback failed to '{0}'. Let's try a PingBack.", url);
                        pbnp.Ping(pageText, PostUrl, url);
                    }
                }
            }
        }