Class used to send a remote notification such as to Weblogs.com or a trackback/pingback.
Exemplo n.º 1
0
        /// <summary>
        /// Posts trackbacks and pingbacks for the specified entry.
        /// </summary>
        public static void Run(Entry entry, Blog blog, BlogUrlHelper urlHelper)
        {
            if (!blog.TrackbacksEnabled)
            {
                return;
            }

            if (!Config.Settings.Tracking.EnablePingBacks && !Config.Settings.Tracking.EnableTrackBacks)
            {
                return;
            }

            if (entry != null)
            {
                VirtualPath blogUrl = urlHelper.BlogUrl();
                Uri fullyQualifiedUrl = blogUrl.ToFullyQualifiedUrl(blog);

                var notify = new Notifier
                {
                    FullyQualifiedUrl = fullyQualifiedUrl.AbsoluteUri,
                    BlogName = blog.Title,
                    Title = entry.Title,
                    PostUrl = urlHelper.EntryUrl(entry).ToFullyQualifiedUrl(blog),
                    Description = entry.HasDescription ? entry.Description : entry.Title,
                    Text = entry.Body
                };

                //This could take a while, do it on another thread
                ThreadHelper.FireAndForget(notify.Notify, "Exception occured while attempting trackback notification");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Posts trackbacks and pingbacks for the specified entry.
        /// </summary>
        /// <param name="entry">The entry.</param>
        public static void Run(Entry entry)
        {
            if(entry != null)
            {
                Notifier notify = new Notifier();

                notify.FullyQualifiedUrl = Config.CurrentBlog.RootUrl.ToString();
                notify.BlogName = Config.CurrentBlog.Title;

                notify.Title = entry.Title;

                notify.PostUrl = entry.FullyQualifiedUrl;

                if(entry.HasDescription)
                {
                    notify.Description = entry.Description;
                }
                else
                {
                    notify.Description = entry.Title;
                }

                notify.Text = entry.Body;

                //This could take a while, do it on another thread
                ManagedThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(notify.Notify));
            }
        }