/// <summary> /// Report a user as a spammer, maybe. /// </summary> /// <remarks> /// <para> /// This method submits a user to /r/reportthespammers, maybe. /// </para> /// <para> /// The method first queries the user. If the user is /// already shadow-banned, this method does nothing further, /// and returns. /// </para> /// <para> /// If the user has an age of over 15 days, and has posted more than 3 items, // and has a link karma below 20, then the account gets // reported as a spammer. /// </para> /// </remarks> public void MaybeReportUserAsSpammer(string username) { if (GetDeadUsers().Contains(username)) { return; } Data.Listing list = mGetUserRecentPosts(username); if (list == null || list.error != null) { return; } Data.Account acct = mGetAccount(username); if (acct == null || acct.data == null) { return; } // report as spammer if.... // .... account is older than 15 days // .... has link karma less than 20 // .... has posted more than 3 items // .... has not been reported already var age = DateTime.Now - acct.data.createdTime; if (age > fifteenDays && //!acct.data.is_mod && acct.data.link_karma < 20 && list.data.children.Count(x => x.kind.Equals("t3")) > 3 && !reportedUsers.Contains(username) && (!checkedUserCache.ContainsKey(username) || !checkedUserCache[username])) { ReportUserAsSpammer(username); reportedUsers.Add(username); if (ExternalDeadList != null) { if (!ExternalDeadList.Contains(username)) { ExternalDeadList.Add(username); } } checkedUserCache[username] = true; // dead } }
public Data.Account GetAccount(string username) { Data.Account acct = mGetAccount(username); return(acct); }