Exemplo n.º 1
0
        public static void Send(IPublishable item, Uri itemUrl)
        {
            foreach (var url in GetUrlsFromContent(item.Content))
            {
                var trackbackSent = false;

                if (BlogSettings.Instance.EnableTrackBackSend)
                {
                    var remoteFile   = new RemoteFile(url, true);
                    var pageContent  = remoteFile.GetFileAsString();
                    var trackbackUrl = GetTrackBackUrlFromPage(pageContent);

                    if (trackbackUrl != null)
                    {
                        var message = new TrackbackMessage(item, trackbackUrl, itemUrl);
                        trackbackSent = Trackback.Send(message);
                    }
                }

                if (!trackbackSent && BlogSettings.Instance.EnablePingBackSend)
                {
                    Pingback.Send(itemUrl, url);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sends the trackback or pingback message.
        ///     <remarks>
        /// It will try to send a trackback message first, and if the refered web page
        ///         doesn't support trackbacks, a pingback is sent.
        ///     </remarks>
        /// </summary>
        /// <param name="item">
        /// The publishable item.
        /// </param>
        /// <param name="itemUrl">
        /// The item Url.
        /// </param>
        public static void Send(IPublishable item, Uri itemUrl)
        {
            foreach (var url in GetUrlsFromContent(item.Content))
            {
                var trackbackSent = false;

                if (BlogSettings.Instance.EnableTrackBackSend)
                {
                    // ignoreRemoteDownloadSettings should be set to true
                    // for backwards compatibilty with Utils.DownloadWebPage.
                    var remoteFile   = new RemoteFile(url, true);
                    var pageContent  = remoteFile.GetFileAsString(); // ReadFromWeb(url);
                    var trackbackUrl = GetTrackBackUrlFromPage(pageContent);

                    if (trackbackUrl != null)
                    {
                        var message = new TrackbackMessage(item, trackbackUrl, itemUrl);
                        trackbackSent = Trackback.Send(message);
                    }
                }

                if (!trackbackSent && BlogSettings.Instance.EnablePingBackSend)
                {
                    Pingback.Send(itemUrl, url);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sends the trackback or pingback message.
        /// <remarks>
        /// It will try to send a trackback message first, and if the refered web page
        /// doesn't support trackbacks, a pingback is sent.
        /// </remarks>
        /// </summary>
        public static void Send(IPublishable item, Uri itemUrl)
        {
            foreach (Uri url in GetUrlsFromContent(item.Content))
            {
                string pageContent     = ReadFromWeb(url);
                Uri    trackbackUrl    = GetTrackBackUrlFromPage(pageContent);
                bool   isTrackbackSent = false;

                if (trackbackUrl != null)
                {
                    TrackbackMessage message = new TrackbackMessage(item, trackbackUrl, itemUrl);
                    isTrackbackSent = Trackback.Send(message);
                }

                if (!isTrackbackSent)
                {
                    Pingback.Send(itemUrl, url);
                }
            }
        }
Exemplo n.º 4
0
 protected virtual void SendPingback(Uri itemUrl, Uri url)
 {
     Pingback.Send(itemUrl, url);
 }