/// <summary>
        ///   Replace newlines and carriage-returns from titles with
        ///   a vertical bar.  This cleans the title for display.
        /// </summary>
        public static string CleanTitle(Reddit.Data.OneItemData post)
        {
            var title = post.title;

            if (title == null)
            {
                return("--no title--");
            }
            string t = title.Replace('\r', '|').Replace('\n', '|');

            return(t);
        }
 /// <summary>
 ///   Get the URL link for a particular comment on a post.
 /// </summary>
 /// <seealso cref='GetItemUrl'/>
 /// <seealso cref='GetPermalink'/>
 public static string GetCommentUrl(Reddit.Data.OneItemData post)
 {
     // eg,  /r/news/comments/t8298/Man_bites_dog/c4keg94
     //
     // The middle segment can be anything, but must be present.
     // The first id is for the link/post, the second is for the
     // comment.
     return(string.Format("{0}/r/{1}/comments/{2}/x/{3}",
                          redditBaseAddr, post.subreddit,
                          Lop3(post.link_id),
                          Lop3(post.name)));
 }
 private static string MsgForPost(Reddit.Data.OneItemData post)
 {
     return((post == null || post.title == null)
             ? "..comment from " + post.author + ".."
             : CleanTitle(post));
 }
 /// <summary>
 ///   Get the full permalink for a post.
 /// </summary>
 /// <seealso cref='GetItemUrl'/>
 /// <seealso cref='GetCommentUrl'/>
 public static string GetPermalink(Reddit.Data.OneItemData post)
 {
     return(System.Net.WebUtility.HtmlDecode(redditBaseAddr + post.permalink));
 }
 public static string GetAuthorUrl(Reddit.Data.OneItemData post)
 {
     return(GetAuthorUrl(post.author));
 }
 /// <summary>
 ///   Returns the full link to the post or the comment.
 /// </summary>
 /// <remarks>
 ///   <para>
 ///     OneItemData is a class that holds metadata about one post, or
 ///     one comment.
 ///   </para>
 ///   <para>
 ///     This method returns the link for either the post or the
 ///     comment referenced in the object.  This works whether
 ///     post refers to a comment or a post.
 ///   </para>
 /// </remarks>
 /// <seealso cref='GetItemUrl'/>
 /// <seealso cref='GetCommentUrl'/>
 public static string GetItemUrl(Reddit.Data.OneItemData post)
 {
     return((String.IsNullOrEmpty(post.permalink))
         ?  Dino.Reddit.Client.GetCommentUrl(post)
         : Dino.Reddit.Client.GetPermalink(post));
 }