private void ucCtrlPager_BeforeChangePageIndex(ChangePageIndexArgs e) { foreach (RepeaterItem item in rptItems.Items) { if (item.ItemType == ListItemType.Item) { CheckBox cbCheck = item.FindControl("cbCheck") as CheckBox; if (cbCheck.Checked) { IgnoreList.Add(cbCheck.ID); } } } if (IgnoreList.Count > 0) { JavaScriptSerializer ser = new JavaScriptSerializer(); string json = ser.Serialize(IgnoreList); json = CompressionHelper.Compress(json); ucCtrlPager.GoToPageIndex(e.PageIndex, new KeyValuePair <string, string>("IgnoreList", json)); } else { ucCtrlPager.GoToPageIndex(e.PageIndex); } }
/// <summary> /// Adds word to user's ignore word list. /// </summary> /// <param name="word">The word to add to the user ignore word list.</param> public void AddIgnoreWord(string word) { if (!IgnoreList.Contains(word)) { IgnoreList.Add(word); } }
static HostIgnoreList() { string hostname = Environment.GetEnvironmentVariable("DISTRO"); if (hostname == null) { return; } if (File.Exists(IgnoreListName)) { using (Stream stream = File.OpenRead(IgnoreListName)) using (StreamReader sr = new StreamReader(stream)) { string line = sr.ReadLine(); while (line != null) { if (line.StartsWith(hostname)) { IgnoreList.Add(line.Substring(hostname.Length + 1)); } line = sr.ReadLine(); } } } }
public void IgnoreItem(object item) { if (item.GetType() == typeof(FoundItem)) { IgnoreList.Add(((FoundItem)item).ID); } else if (item.GetType() == typeof(int)) { IgnoreList.Add((int)item); } }
/// <summary> /// Ignores all instances of the CurrentWord in the Text Property /// </summary> public void IgnoreAllWord() { if (CurrentWord.Length == 0) { TraceWriter.TraceWarning("No current word"); return; } // Add current word to ignore list IgnoreList.Add(CurrentWord); IgnoreWord(); }
/// <summary> /// Interprets local commands. /// </summary> private string ProcessInternalCommand(string cmd, string[] args) { if (args.Length > 0) { string commandName = args[0].ToLower(); switch (commandName) { case "getmails": return("== Mails in database ==\n" + string.Join("\n", mailDatabase)); case "getignored": return("== Ignore list ==\n" + string.Join("\n", ignoreList)); case "addignored": case "removeignored": if (args.Length > 1 && IsValidName(args[1])) { string username = args[1].ToLower(); if (commandName == "addignored") { lock (readWriteLock) { if (!ignoreList.Contains(username)) { ignoreList.Add(username); ignoreList.SaveToFile(Settings.Mailer_IgnoreListFile); } } return("Added " + args[1] + " to the ignore list!"); } else { lock (readWriteLock) { if (ignoreList.Contains(username)) { ignoreList.Remove(username); ignoreList.SaveToFile(Settings.Mailer_IgnoreListFile); } } return("Removed " + args[1] + " from the ignore list!"); } } else { return("Missing or invalid name. Usage: " + commandName + " <username>"); } } } return("See usage: /help mailer"); }
/// <summary> /// Interprets local commands. /// </summary> private string ProcessInternalCommand(string cmd, string[] args) { if (args.Length > 0) { string commandName = args[0].ToLower(); switch (commandName) { case "getmails": // Sorry, I (ReinforceZwei) replaced "=" to "-" because it would affect the parsing of translation file (key=value) return(Translations.Get("bot.mailer.cmd.getmails", string.Join("\n", mailDatabase))); case "getignored": return(Translations.Get("bot.mailer.cmd.getignored", string.Join("\n", ignoreList))); case "addignored": case "removeignored": if (args.Length > 1 && IsValidName(args[1])) { string username = args[1].ToLower(); if (commandName == "addignored") { lock (readWriteLock) { if (!ignoreList.Contains(username)) { ignoreList.Add(username); ignoreList.SaveToFile(Settings.Mailer_IgnoreListFile); } } return(Translations.Get("bot.mailer.cmd.ignore.added", args[1])); } else { lock (readWriteLock) { if (ignoreList.Contains(username)) { ignoreList.Remove(username); ignoreList.SaveToFile(Settings.Mailer_IgnoreListFile); } } return(Translations.Get("bot.mailer.cmd.ignore.removed", args[1])); } } else { return(Translations.Get("bot.mailer.cmd.ignore.invalid", commandName)); } } } return(Translations.Get("bot.mailer.cmd.help") + ": /help mailer"); }
/// <summary> /// Read ignore list from file /// </summary> /// <param name="filePath">Path to the ignore list</param> /// <returns>Ignore list</returns> public static IgnoreList FromFile(string filePath) { IgnoreList ignoreList = new IgnoreList(); foreach (string line in FileMonitor.ReadAllLinesWithRetries(filePath)) { if (!line.StartsWith("#")) { string entry = line.ToLower(); if (!ignoreList.Contains(entry)) { ignoreList.Add(entry); } } } return(ignoreList); }
/// <summary> /// Adds or removes a specified user to or from the chat ignore list /// depending on whether they already are on the ignore list. /// </summary> /// <param name="ident">The ident of the IRCUser.</param> public void ToggleIgnoreUser(string ident) { if (string.IsNullOrEmpty(ident)) { return; } if (IsIgnored(ident)) { IgnoreList.Remove(ident); } else { IgnoreList.Add(ident); } UserIgnoreToggled?.Invoke(this, new IdentEventArgs(ident)); }
public void IgnoreUser(string username) { username = username.ToLower(); if (username == this.Me.UserName.ToLowerInvariant()) { return; } var user = new User(new Jid(username + "@" + this.Config.ChatHost)); if (Ignorees.Contains(user)) { return; } var order = (IgnoreList.Count == 0) ? 1 : IgnoreList.Max(x => x.Order) + 1; var block = RuleManager.BlockByJid(user.JidUser, order, Stanza.Message); IgnoreList.Add(block); PrivacyManager.AddList("ignore", IgnoreList.ToArray(), OnIgnorelistUpdated, null); PrivacyManager.ChangeActiveList("ignore"); PrivacyManager.ChangeDefaultList("ignore"); }
/// <summary> /// Adds the given text to the ignore list so that that warning isn't shown. /// </summary> /// <param name="text">The text to add to the ignore list</param> private void AddToIngoreList(string text) { // Add it to the ignore list and remove it from being warned right now if it's there. IgnoreList.Add(text); StopWarning(text); }
public userConextMenu(ChatMessage parent) : base() { this.Items.Add(new MenuItem() { Header = "Open profile" }); if (!FriendList.Exists(parent.Nickname)) { this.Items.Add(new MenuItem() { Header = "Add to friend list" }); ((MenuItem)Items[1]).Click += (o, e) => { App.FriendList.Add(parent.Nickname); //osu_chat.MainWindow.friends.Add(await osu_chat.MainWindow.GetChatUser(parent.Nickname)); }; } else { this.Items.Add(new MenuItem() { Header = "Remove from friend list" }); ((MenuItem)Items[1]).Click += (o, e) => { App.FriendList.Remove(parent.Nickname); //osu_chat.MainWindow.friends.Remove(osu_chat.MainWindow.friends.Where(u => u.Nickname == parent.Nickname).First()); }; } if (!IgnoreList.Exists(parent.Nickname)) { this.Items.Add(new MenuItem() { Header = "Add to ignore list" }); ((MenuItem)Items[2]).Click += (o, e) => { IgnoreList.Add(parent.Nickname); //osu_chat.MainWindow.ignoredUser.Add(await osu_chat.MainWindow.GetChatUser(parent.Nickname)); }; } else { this.Items.Add(new MenuItem() { Header = "Remove from ignore list" }); ((MenuItem)Items[2]).Click += (o, e) => { IgnoreList.Remove(parent.Nickname); }; } ((MenuItem)Items[0]).Click += async(o, e) => { // zameniti na user id Process.Start(string.Format("http://osu.ppy.sh/u/{0}", (await Osu.Api.GetUserAsync(ApiKey, parent.Nickname)).UserId)); }; }