Summary description for WeblogsNotificatinProxy.
Inheritance: CookComputing.XmlRpc.XmlRpcClientProtocol
コード例 #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 PingBackNotificatinProxy())
            {
                //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);
                    }
                }
            }
        }
コード例 #2
0
ファイル: Notifier.cs プロジェクト: ayende/Subtext
        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
            StringCollection links = HtmlHelper.GetLinks(Text);

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

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

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

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