public static LocalUser GetUser(ResponseChannel rc, VBotService.RemoteUser remoteUser) { LocalUser luser = VBotDB.Instance.LocalUsers.FirstOrDefault( u => u.Screenname == rc.ToName && u.Service == rc.Connection.Alias); if (luser == null) { luser = new LocalUser { Screenname = rc.ToName, Service = rc.Connection.Alias, BoardUserID = remoteUser.UserID, LastUpdate = DateTime.Now }; VBotDB.Instance.LocalUsers.InsertOnSubmit(luser); VBotDB.Instance.SubmitChanges(); } else { luser.LastUpdate = DateTime.Now; VBotDB.Instance.SubmitChanges(); } if (luser != null) { luser.ResponseChannel = rc; } return luser; }
public static UserLocation LoadLocation(UserLocationType locType, LocalUser user) { UserLocation ul = VBotDB.Instance.UserLocations.FirstOrDefault( l => l.LocalUserID == user.LocalUserID && l.UserLocationType == locType.ToString().ToLower()); if (ul != null) { ul.ParseList(ul.List); } return ul; }
public static UserLocation GetDefaultLocation(UserLocationType locType, LocalUser owner) { UserLocation ul = new UserLocation(); if (locType == VBulletinBot.UserLocationType.FORUM) { ul.PerPage = 5; ul.PageNumber = 1; ul.Title = @"INDEX"; ul.LocationRemoteID = -1; ul.List = string.Empty; ul.UserLocationType = @"forum"; ul.LocalUserID = owner.LocalUserID; } else if (locType == VBulletinBot.UserLocationType.THREAD) { ul.PerPage = 5; ul.PageNumber = 1; ul.Title = string.Empty; ul.LocationRemoteID = 0; ul.List = string.Empty; ul.UserLocationType = @"thread"; ul.LocalUserID = owner.LocalUserID; } else if (locType == VBulletinBot.UserLocationType.POST) { ul.PerPage = 5; ul.PageNumber = 1; ul.Title = string.Empty; ul.LocationRemoteID = 0; ul.List = string.Empty; ul.UserLocationType = @"post"; ul.LocalUserID = owner.LocalUserID; } return ul; }
partial void InsertLocalUser(LocalUser instance);
public Result ListForum(LocalUser user) { return ListForum(user, null); }
public Result GotoThread(LocalUser user, string[] options) { Result rs = null; if (options != null && options.Count() > 0) { int iNewThreadID = 0; if (int.TryParse(options[0], out iNewThreadID)) { UserLocation postLoc = UserLocation.LoadLocation(UserLocationType.POST, user); if (postLoc == null) { postLoc = UserLocation.GetDefaultLocation(UserLocationType.POST, user); } VBotService.UserCredentials uc = BotService.Credentialize(ResponseChannel); VBotService.PostListResult r = BotService.Instance.ListPosts(uc, iNewThreadID, (int)postLoc.PageNumber, (int)postLoc.PerPage); if (r.Result.Code == 0) { // TODO: build the postLoc location title here postLoc.Title = string.Format("{0} - {1} created by {2}", Regex.Replace(r.Thread.ThreadTitle, @"[\']", string.Empty), r.Thread.DateLineText, r.Thread.PostUsername); postLoc.LocationRemoteID = iNewThreadID; postLoc.ParseIDList(r.PostList); postLoc.SaveLocation(); rs = ListPosts(user, new string[] { postLoc.PageNumber.ToString(), postLoc.PerPage.ToString() }, r); } else { return new Result(ResultCode.Error, "Invalid thread."); } } else { return new Result(ResultCode.Error, "Inavlid threadid."); } } else { return new Result(ResultCode.Error, "Please specify which thread you wish to navigate to."); } return rs; }
public Result GotoPostIndex(int iChoice, LocalUser user) { return GotoPostIndex(iChoice, user, null); }
public Result GotoNextPost(LocalUser user, bool bGotoNext) { Result rs = null; UserLocation curThreadLocation = UserLocation.LoadLocation(UserLocationType.POST, user); if (curThreadLocation != null) { UserPostIndex upi = VBotDB.Instance.UserPostIndexes.FirstOrDefault(u => u.LocalUserID == user.LocalUserID); if (upi != null) { int iPostIndex = upi.PostIndex.Value; if (bGotoNext) iPostIndex++; else iPostIndex--; rs = GotoPostIndex(iPostIndex, user); } else { rs = new Result(ResultCode.Error, @"Invalid post index. Use `lp` to browse a thread."); log.WarnFormat("Invalid `UserPostIndex` for LocalUserID {0}", user.LocalUserID); } } else { rs = new Result(ResultCode.Error, @"No active thread set. Use `lt` and browse to a thread"); } return rs; }
public Result GotoForumIndex(int iIndex, LocalUser user) { return GotoForumIndex(iIndex, user, false); }
public string GetString(LocalUser user) { string strRet = string.Empty; DateTime start = DateTime.Now; _inputs[user.LocalUserID] = new InputState(InputStateEnum.Waiting); while (_inputs[user.LocalUserID].State == InputStateEnum.Waiting) { TimeSpan span = DateTime.Now - start; if (span.TotalMinutes > 9) // ten minute wait for input { break; } else { System.Threading.Thread.Sleep(500); } }; // state is set to 'Responded' in the callback.... if (_inputs[user.LocalUserID].State == InputStateEnum.Responded) { strRet = _inputs[user.LocalUserID].PageText; } _inputs.Remove(user.LocalUserID); return strRet; }
public Result ListThreads(LocalUser user, string[] options) { lock (this) { ResultCode rc = ResultCode.Unknown; string strResponse = string.Empty; UserLocation loc = UserLocation.LoadLocation(UserLocationType.THREAD, user); if (loc == null) { Result ret = new Result(ResultCode.Error, @"No active forum. Use `lf` to browse to a forum."); return ret; } if (loc != null) { int iPageNumber = 0; int iPerPage = 0; if (options.Length < 1 || !int.TryParse(options[0], out iPageNumber)) { iPageNumber = 1; } if (options.Length < 2 || !int.TryParse(options[1], out iPerPage)) { iPerPage = 5; } if (iPerPage > 30) { iPerPage = 30; } VBotService.UserCredentials uc = BotService.Credentialize(ResponseChannel); VBotService.ThreadListResult r = BotService.Instance.ListThreads(uc, (int)loc.LocationRemoteID, iPageNumber, iPerPage); if (r.Result.Code != 0) { log.ErrorFormat("Could not list threads: {0}", r.Result.Text); return new Result(ResultCode.Error, ResponseChannel.FetchTemplate(r.Result.Text)); } bool bShowIDs = false; foreach (string strOption in options) { if (strOption.ToLower() == "ids") { bShowIDs = true; break; } } bool bForumsExist = false; string strIsNew = string.Empty; string strIsSubscribed = string.Empty; int iTotalPages = 0; if (r.ThreadList != null && r.ThreadList.Count() > 0) { iTotalPages = (int)Math.Ceiling((double)r.ThreadCount / (double)iPerPage); iTotalPages += 1; int iCount = 1; foreach (VBotService.Thread thread in r.ThreadList) { string strID = string.Empty; if (bShowIDs) { strID = " [" + thread.ThreadID.ToString() + "]"; } strIsNew = string.Empty; if (thread.IsNew) { strIsNew = "*"; } strIsSubscribed = thread.IsSubscribed ? "#" : string.Empty; bForumsExist = true; strResponse += ResponseChannel.FetchTemplate("thread_list_inline", new object[] { iCount, strIsSubscribed, strIsNew, thread.ThreadTitle, strID, thread.ReplyCount + 1, thread.DateLineText, thread.LastPoster }); iCount++; } } if (!bForumsExist) { strResponse = "There are no threads in this forum."; rc = ResultCode.Error; } else { loc.PageNumber = iPageNumber; loc.PerPage = iPerPage; loc.ParseIDList(r.ThreadList); loc.SaveLocation(); strResponse = ResponseChannel.FetchTemplate("thread_list", new object[] { loc.Title, iPageNumber, iTotalPages, iPerPage, strResponse }); rc = ResultCode.Success; } } else { strResponse = "No forum selected. (Try typing `lf` and selecting a forum.)"; rc = ResultCode.Error; } user.SaveLastList(@"thread"); return new Result(rc, strResponse); } }
public Result ListPosts(LocalUser user, string[] options, VBotService.PostListResult result) { lock (this) { ResultCode rc = ResultCode.Unknown; UserLocation loc = UserLocation.LoadLocation(UserLocationType.POST, user); if (loc == null) { Result ret = new Result(ResultCode.Error, @"No active thread. Use `lt` to browse to a thread."); return ret; } int iPageNumber = 0; int iPerPage = 0; if (options.Length < 1 || !int.TryParse(options[0], out iPageNumber)) { iPageNumber = 1; } if (options.Length < 2 || !int.TryParse(options[1], out iPerPage)) { iPerPage = 5; } if (iPerPage > 30) { iPerPage = 30; } if (result == null) { VBotService.UserCredentials uc = BotService.Credentialize(ResponseChannel); result = BotService.Instance.ListPosts(uc, (int)loc.LocationRemoteID, iPageNumber, iPerPage); if (result.Result.Code != 0) { log.ErrorFormat("Could not list posts: {0}", result.Result.Text); return new Result(ResultCode.Error, ResponseChannel.FetchTemplate(result.Result.Text)); } } string strResponse = string.Empty; double dTotalPosts = (double)(result.Thread.ReplyCount + 1); int iTotalPages = (int)Math.Ceiling(dTotalPosts / (double)iPerPage); string strIsNew = string.Empty; if (result.PostList.Count() > 0) { int iCount = ((iPageNumber - 1) * iPerPage) + 1; foreach (VBotService.Post postInfo in result.PostList) { strIsNew = string.Empty; if (postInfo.IsNew) { strIsNew = "*"; } strResponse += ResponseChannel.FetchTemplate("post_list_inline", new object[] { iCount, strIsNew, postInfo.GetShortPostText(), postInfo.DateLineText, postInfo.Username }); iCount++; } strResponse = ResponseChannel.FetchTemplate("post_list", new object[] { loc.Title, iPageNumber, iTotalPages, iPerPage, strResponse }); rc = ResultCode.Success; } else { strResponse += "Invalid page number"; rc = ResultCode.Error; } user.SaveLastList(@"post"); user.SaveLastPostIndex(1); return new Result(rc, strResponse); } }
public Result ListPosts(LocalUser user, string[] options) { return ListPosts(user, options, null); }
partial void DeleteLocalUser(LocalUser instance);
partial void UpdateLocalUser(LocalUser instance);
public bool GetConfirmation(LocalUser user) { return GetConfirmation(user, @"Are you sure? (y or n)"); }
public bool GetConfirmation(LocalUser user, string strMessage) { bool bRetval = false; //Connection c = user.Connection; //c.SendMessage(new InstantMessage(user.UserConnectionName, strMessage)); user.ResponseChannel.SendMessage(strMessage); string strResponse = GetString(user); if (strResponse.ToLower() == "yes" || strResponse.ToLower() == "y") { bRetval = true; } return bRetval; }
public Result MarkRead(LocalUser user, string strField) { object[] objs = { user, strField }; System.Threading.Thread t = new System.Threading.Thread(new ParameterizedThreadStart(DoMarkRead)); t.Start(objs); return new Result(ResultCode.Halt, string.Empty); }
public Result DoCommand(string strCommand,LocalUser user) { Result retval = new Result(); CommandParser parser = new CommandParser(strCommand); if (parser.Parse()) { int iListChoice = 0; if (int.TryParse(parser.ApplicationName, out iListChoice) && iListChoice > 0) { // user entered a number, let's deal with the lastlists UserLastList ll = VBotDB.Instance.UserLastLists.FirstOrDefault(l => l.LocalUserID == user.LocalUserID); if (ll != null) { switch (ll.Name) { case @"forum": retval = GotoForumIndex(iListChoice, user); break; case @"thread": retval = GotoThreadIndex(iListChoice, user); break; case @"post": retval = GotoPostIndex(iListChoice, user, parser); break; default: log.ErrorFormat("Unknown lastlist {0}", ll.Name); break; } } else { retval = new Result(ResultCode.Error, @"Use `lf`,`lt` or `lp` to browse forums, threads and posts."); } } else { // assume a command was entered switch (parser.ApplicationName.ToLower()) { #region long switch statement to be refactored case @"\": case "/": retval = GotoForumIndex(-1, user, true); break; case @".": retval = GotoParentForum(user); break; case @"cp": retval = GotoPostIndex(user.PostIndex,user,parser); break; case @"gt": retval = GotoThread(user, parser.Parameters); break; case @"im": retval = TurnOnOffAutoIMS(user, parser.Parameters); break; case "lf": retval = ListForum(user); break; case @"lp": retval = ListPosts(user, parser.Parameters); break; case "lt": retval = ListThreads(user, parser.Parameters); break; case "mfr": retval = MarkRead(user, @"forum"); break; case "mtr": retval = MarkRead(user, @"thread"); break; case @"n": retval = GotoNextPost(user, true); break; case @"nt": retval = NewThread(user); break; case @"p": retval = GotoNextPost(user, false); break; case @"r": retval = ThreadReply(user,false); break; case @"rq": retval = ThreadReply(user, true); break; case "sub": retval = SubscribeThread(user, parser.Parameters); break; case "unsub": retval = UnsubscribeThread(user, parser.Parameters); break; case @"whereami": retval = WhereAmI(user); break; case "whoami": // TODO: the string in UserConnectionName should come from somewhere else? retval = WhoAmI(ResponseChannel.ToName, ResponseChannel.Connection.Alias); break; default: retval = new Result(ResultCode.Error, @"Unknown command. Please see http://code.google.com/p/vbulletinbot/ for help."); break; #endregion } } } return retval; }
public Result NewThread(LocalUser LocalUser) { System.Threading.Thread replyThread = new System.Threading.Thread(new ParameterizedThreadStart(DoNewThread)); replyThread.Start(LocalUser); return new Result(ResultCode.Halt, string.Empty); }
public Result GotoForumIndex(int iIndex, LocalUser user, bool bGotoRoot) { Result retval = null; UserLocation curLoc = UserLocation.LoadLocation(UserLocationType.FORUM, user); if (curLoc == null) { // this location does not exist curLoc = UserLocation.GetDefaultLocation(UserLocationType.FORUM, user); VBotService.ForumListResult result = BotService.Instance.ListForums(BotService.Credentialize(ResponseChannel), (int)curLoc.LocationRemoteID); if (result.Result.Code == 0) { curLoc.SetCurrentForum(result.CurrentForum); //curLoc.ParseForumsList(result.ForumList); curLoc.ParseIDList(result.ForumList); curLoc.SaveLocation(); } } if (iIndex > curLoc.IDList.Count || iIndex < 0 && !bGotoRoot) { retval = new Result(ResultCode.Error, @"Invalid Forums Index"); } else { int iNewForumID = 0; string strNewForumID = "-1"; if (!bGotoRoot) { strNewForumID = curLoc.IDList[--iIndex]; } if (!int.TryParse(strNewForumID, out iNewForumID)) { throw new Exception(@"Corrupt ID in IDList"); } // set the FORUMS location VBotService.ForumListResult res = BotService.Instance.ListForums(BotService.Credentialize(ResponseChannel), iNewForumID); // TODO: error checking of the above call curLoc.SetCurrentForum(res.CurrentForum); curLoc.ParseIDList(res.ForumList); curLoc.SaveLocation(); // reset the THREAD location UserLocation threadLoc = UserLocation.LoadLocation(UserLocationType.THREAD, user); if (threadLoc == null) { threadLoc = UserLocation.GetDefaultLocation(UserLocationType.THREAD, user); } threadLoc.Title = curLoc.Title; threadLoc.LocationRemoteID = iNewForumID; threadLoc.SaveLocation(); retval = ListForum(user,res.ForumList); } return retval; }
public Result SubscribeThread(LocalUser user, string[] options) { int iThreadID = 0; if (options.Count() > 0) { if (!int.TryParse(options[0],out iThreadID)) { return new Result(ResultCode.Error, @"Invalid thread id"); } } object[] parameters = { user, iThreadID }; System.Threading.Thread replyThread = new System.Threading.Thread(new ParameterizedThreadStart(DoSubscribeThread)); replyThread.Start(parameters); return new Result(ResultCode.Halt, string.Empty); }
public Result GotoParentForum(LocalUser user) { Result ret = null; UserLocation forumLoc = UserLocation.LoadLocation(UserLocationType.FORUM, user); if (forumLoc != null) { VBotService.ForumListResult result = BotService.Instance.ListParentForums(BotService.Credentialize(ResponseChannel), (int)forumLoc.LocationRemoteID); if (result.Result.Code == 0) { forumLoc.SetCurrentForum(result.CurrentForum); forumLoc.ParseIDList(result.ForumList); forumLoc.SaveLocation(); // reset the THREAD location UserLocation threadLoc = UserLocation.LoadLocation(UserLocationType.THREAD, user); if (threadLoc != null) { threadLoc.Title = forumLoc.Title; threadLoc.LocationRemoteID = forumLoc.LocationRemoteID; threadLoc.SaveLocation(); } ret = ListForum(user, result.ForumList); } else { ret = new Result(ResultCode.Error, @"Error navigating to parent forum. Please try again."); // TODO: log error? } } else { ret = new Result(ResultCode.Error, @"No current forum set. Use `lf` to select a forum."); } return ret; }
public Result ThreadReply(LocalUser user, bool bDoQuote) { System.Threading.Thread replyThread = new System.Threading.Thread(new ParameterizedThreadStart(DoThreadReply)); replyThread.Start(new object[] { user, bDoQuote} ); return new Result(ResultCode.Halt, string.Empty); }
public Result GotoPostIndex(int iChoice, LocalUser user, CommandParser parser) { Result rs = null; bool bShowBBCode = false; if (parser != null) { // TODO: need to refactor/rewrite the command parser foreach (string strOption in parser.Parameters) { if (strOption.ToLower() == "b") { bShowBBCode = true; break; } } } UserLocation curPostLoc = UserLocation.LoadLocation(UserLocationType.POST, user); if (curPostLoc != null) { VBotService.UserCredentials uc = BotService.Credentialize(ResponseChannel); VBotService.GetPostResult r = BotService.Instance.GetPostByIndex(uc, (int)curPostLoc.LocationRemoteID, iChoice, bShowBBCode); if (r.Result.Code == 0) { if (r.Post != null && r.Post.PostID > 0) { string strText = ResponseChannel.FetchTemplate(@"postbit", new object[] {r.Post.PageText,iChoice,r.Post.DateLineText,r.Post.Username}); user.SaveLastPostIndex(iChoice); rs = new Result(ResultCode.Success, strText); } else { rs = new Result(ResultCode.Error, @"Invalid post index."); } } else { rs = new Result(ResultCode.Error, @"Invalid request."); } } else {// no location for a thread exists in the local db rs = new Result(ResultCode.Error, @"Invalid thread id. Use `lt` and browse to a thread"); } return rs; }
public Result TurnOnOffAutoIMS(LocalUser user, string[] options) { Result ret = null; if (options.Count() != 1) { ret = new Result(ResultCode.Error, @"Use `im on` or `im off` to turn on/off IM Notification"); } else if (options[0].ToLower() == @"on") { object[] objs = { user, true }; System.Threading.Thread t = new System.Threading.Thread(new ParameterizedThreadStart(DoTurnOnOffAutoIMS)); t.Start(objs); ret = new Result(ResultCode.Halt, string.Empty); } else if (options[0].ToLower() == @"off") { object[] objs = { user, false }; System.Threading.Thread t = new System.Threading.Thread(new ParameterizedThreadStart(DoTurnOnOffAutoIMS)); t.Start(objs); ret = new Result(ResultCode.Halt, string.Empty); } else { ret = new Result(ResultCode.Error, @"Use `im on` or `im off` to turn on/off IM Notification"); } return ret; }
public Result GotoThreadIndex(int iChoice, LocalUser user) { Result rs = null; UserLocation curLoc = UserLocation.LoadLocation(UserLocationType.THREAD, user); if (curLoc != null) { if (iChoice > curLoc.IDList.Count) { // invalid choice rs = new Result(ResultCode.Error, @"Invalid Thread Index"); } else { int iNewThreadID = 0; string strNewThreadID = curLoc.IDList[iChoice - 1]; UserLocation postLoc = UserLocation.LoadLocation(UserLocationType.POST, user); if (postLoc == null) { postLoc = UserLocation.GetDefaultLocation(UserLocationType.POST, user); } if (int.TryParse(strNewThreadID, out iNewThreadID)) { VBotService.UserCredentials uc = BotService.Credentialize(ResponseChannel); VBotService.PostListResult r = BotService.Instance.ListPosts(uc, iNewThreadID, (int)postLoc.PageNumber, (int)postLoc.PerPage); if (r.Result.Code == 0) { // TODO: build the postLoc location title here postLoc.Title = string.Format("{0} - {1} created by {2}", Regex.Replace(r.Thread.ThreadTitle, @"[\']", string.Empty), r.Thread.DateLineText, r.Thread.PostUsername); postLoc.LocationRemoteID = iNewThreadID; postLoc.ParseIDList(r.PostList); postLoc.SaveLocation(); rs = ListPosts(user, new string[] { postLoc.PageNumber.ToString(), postLoc.PerPage.ToString() }, r); } } else { // there's a non-integer in the IDList, something is seriously f****d rs = new Result(ResultCode.Error, @"This should be an excetion"); } } } else {// no location for a thread exists in the local db rs = new Result(ResultCode.Error, @"Invalid forum id. Use `lf` and browse to a forum"); } return rs; }
public Result UnsubscribeThread(LocalUser user, string[] options) { Result ret = null; int iThread = 0; if (options.Count() > 0 && options[0].ToLower() == @"all") { iThread = -1; } else if (options.Count() > 0) { if (!int.TryParse(options[0], out iThread)) { // TODO: what happens to iThread if TryParse fails? iThread = 0; } } else { // no parameters, get the current thread UserLocation threadLoc = UserLocation.LoadLocation(UserLocationType.POST, user); if (threadLoc != null) { iThread = (int)threadLoc.LocationRemoteID; } else { return new Result(ResultCode.Error, @"No current thread. User `lt` to browse to a thread."); } } if (iThread != 0) { object[] param = { user, iThread }; System.Threading.Thread t = new System.Threading.Thread(new ParameterizedThreadStart(DoUnsubscribeThread)); t.Start(param); ret = new Result(ResultCode.Halt, string.Empty); } else { ret = new Result(ResultCode.Error, @"Invalid parameter to `unsub` command"); } return ret; }
public Result ListForum(LocalUser user, VBotService.Forum[] forums) { lock (this) { Result resval = null; UserLocation loc = UserLocation.LoadLocation(UserLocationType.FORUM, user); if (loc == null) { // this location does not exist loc = UserLocation.GetDefaultLocation(UserLocationType.FORUM, user); VBotService.ForumListResult res = BotService.Instance.ListForums(BotService.Credentialize(ResponseChannel), (int)loc.LocationRemoteID); // TODO: error checking of the above call loc.SetCurrentForum(res.CurrentForum); loc.ParseIDList(res.ForumList); loc.SaveLocation(); } if (forums == null) { VBotService.ForumListResult res = BotService.Instance.ListForums(BotService.Credentialize(ResponseChannel), (int)loc.LocationRemoteID); if (res.Result.Code != 0) { log.ErrorFormat("Could not list forums: {0}", res.Result.Text); return new Result(ResultCode.Error, ResponseChannel.FetchTemplate(res.Result.Text)); } forums = res.ForumList; } string strResponse = string.Empty; bool bForumsExist = false; string strIsNew = string.Empty; if (forums.Count() > 0) { int iCount = 1; foreach (VBotService.Forum foruminfo in forums) { strIsNew = string.Empty; if (foruminfo.IsNew) { strIsNew = "*"; } bForumsExist = true; strResponse += ResponseChannel.FetchTemplate("forum_list_inline", new object[] { iCount, strIsNew, foruminfo.Title }); iCount++; } user.SaveLastList(@"forum"); } if (!bForumsExist) { strResponse += "No subforums"; strResponse = ResponseChannel.FetchTemplate("forum_list", new object[] { loc.Title, strResponse }); resval = new Result(ResultCode.Error, strResponse); } else { strResponse = ResponseChannel.FetchTemplate("forum_list", new object[] { loc.Title, strResponse }); resval = new Result(ResultCode.Success, strResponse); } return resval; } }
/// <summary> /// Returns the current Forum and Thread of the user /// </summary> /// <param name="user">The user</param> /// <returns></returns> public Result WhereAmI(LocalUser user) { string strNewLine = ResponseChannel.Connection.NewLine; string strResponse = strNewLine; UserLocation forumLoc = UserLocation.LoadLocation(UserLocationType.FORUM, user); strResponse += "Current Forum: "; if (forumLoc != null) { strResponse += string.Format("{0} ({1}){2}", forumLoc.Title, forumLoc.LocationRemoteID, strNewLine); } else { strResponse += "None" + strNewLine; } UserLocation threadLoc = UserLocation.LoadLocation(UserLocationType.POST, user); strResponse += "Current Thread: "; if (threadLoc != null) { strResponse += string.Format("{0} ({1}){2}", threadLoc.Title, threadLoc.LocationRemoteID, strNewLine); } else { strResponse += "None" + strNewLine; } return new Result(ResultCode.Success, strResponse); }