private void Events_UserLogoffEvent(BotShell bot, UserLogoffArgs e) { if (!e.First) { this.Output("Notify", String.Format("[Notify List] {0} has logged off", e.Sender)); } }
internal void OnUserLogoff(BotShell bot, UserLogoffArgs e) { if (this.UserLogoffEvent != null) { try { this.UserLogoffEvent(bot, e); } catch { } } }
private void UserLogoffEvent(BotShell bot, UserLogoffArgs e) { if (e.First) { return; } if (!e.Sections.Contains("notify")) { return; } this.SendNotify(bot, HTML.CreateColorString(bot.ColorHeaderHex, e.Sender) + " has logged off"); }
public void OnNotifyAction(object sender, BuddyStatusEventArgs e) { Chat bot = (Chat)sender; string user = bot.GetUserName(e.CharacterID); if (this.Parent.IsBot(user)) { lock (this.Config) this.Config.ExecuteNonQuery("DELETE FROM CORE_Notify WHERE Username = '******'"); this.RebuildCache(); } List <string> sections = this.GetSections(user); if (sections.Count < 1) { bot.SendFriendRemove(e.CharacterID); lock (this.OnlineFriends) if (this.OnlineFriends.ContainsKey(e.CharacterID)) { this.OnlineFriends.Remove(e.CharacterID); } lock (this.OfflineFriends) if (this.OfflineFriends.ContainsKey(e.CharacterID)) { this.OfflineFriends.Remove(e.CharacterID); } return; } bool onSlave = false; Int32 slaveID = 0; if (bot.Character != this.Parent.Character) { onSlave = true; slaveID = this.Parent.GetSlaveID(bot.Character); } Friend friend = new Friend(bot.GetUserName(e.CharacterID), e.CharacterID, DateTime.Now, onSlave, slaveID); bool first = true; lock (this.OnlineFriends) { if (this.OnlineFriends.ContainsKey(e.CharacterID)) { first = false; if (!e.Online) { this.OnlineFriends.Remove(e.CharacterID); } else { return; } } } lock (this.OfflineFriends) { if (this.OfflineFriends.ContainsKey(e.CharacterID)) { first = false; if (e.Online) { this.OfflineFriends.Remove(e.CharacterID); } else { return; } } } if (e.First) { first = true; } if (e.Online) { lock (this.OnlineFriends) this.OnlineFriends.Add(e.CharacterID, friend); UserLogonArgs args = new UserLogonArgs(this.Parent, friend.UserID, friend.User, first, sections); this.Parent.Events.OnUserLogon(this.Parent, args); } else { lock (this.OfflineFriends) this.OfflineFriends.Add(e.CharacterID, friend); UserLogoffArgs args = new UserLogoffArgs(this.Parent, friend.UserID, friend.User, first, sections); this.Parent.Events.OnUserLogoff(this.Parent, args); } if (e.Online || (!e.Online && !first)) { lock (this.Config) this.Config.ExecuteNonQuery("UPDATE CORE_Notify SET LastOnline = " + TimeStamp.Now + " WHERE Username = '******'"); } }
private void Events_UserLogoffEvent(BotShell bot, UserLogoffArgs e) { lock (this.QueueOffline) this.QueueOffline.Add(e.Sender); }