BugzillaInterface.Query.PostComment C# (CSharp) Method

PostComment() public method

public PostComment ( int bugId, string text ) : bool
bugId int
text string
return bool
        public bool PostComment(int bugId, string text)
        {
            Console.WriteLine ("Posting comment");
            // Set the source if it hasn't been set alreayd
            Generator.SetSource (SplatterCore.Instance.Sources[this.SourceID]);

            Tracer trace = new Tracer();
            trace.Attach(Generator.bugProxy);
            PostCommentParams postCommentParams = new PostCommentParams();
            postCommentParams.id = bugId;
            postCommentParams.comment = text;

            // Make the request;
            XmlRpcStruct result;
            try{
            result = Generator.bugProxy.PostComment(postCommentParams);
            }
            catch{
                return false;
            }

            // This is probably stupid. Let's reconstruct the entire comment :);
            Comment target = new Comment();
            target.bug_id = bugId;
            target.id = (int)result["id"];
            target.text = text;

            // Retrieve the author
            this.Source = SplatterCore.Instance.Sources[SourceID];
            target.author = Source.UserName;

            target.time = DateTime.Now;
            //target.is_private = false;

            // Add the comment to the bug
            BugReport bug = BugFromBugId(bugId);

            bug.Comments.Add(target);

            return true;
        }