/// <summary>Updates this user with the information given in the message.</summary> /// <param name="message"></param> public void OnStatusChangedMessage(MessageEventArgs_304 message) { if (message.UserId != userId) { throw new ApplicationException("The user from the given " + "message ('" + message + "') did not match the current " + "user ('" + this + "')"); } userId = message.UserId; idle = message.Idle; admin = message.Admin; icon = message.Icon; nick = message.Nick; status = message.Status; Color = new NickColor(nick).RGB; if (Updated != null) { Updated(this); } }
/// <summary> /// Changes the status for the user in the given message. /// Call this method when a Status Changed Message (304) is /// received from the server. /// </summary> /// <param name="message"></param> public void OnStatusChangedMessage(MessageEventArgs_304 message) { var u = GetUser(message.UserId); if (u != null) { u.OnStatusChangedMessage(message); } }
// 304 private void OnStatusChangeEvent(object sender, int messageId, string messageName, string message) { if (StatusChangeEvent != null) { var words = SplitMessage(message); // If we thing we want to set the variable to -1 instead // of catching exception when something fails we can do it like this. // int userId; // if(!(int.TryParse(words[0], out userId))) // userId = -1; var userId = int.Parse(words[0]); var idle = Utility.ConvertIntToBool(int.Parse(words[1])); var admin = Utility.ConvertIntToBool(int.Parse(words[2])); var icon = int.Parse(words[3]); var nick = words[4]; var status = words[5]; var m = new MessageEventArgs_304(messageId, messageName, userId, idle, admin, icon, nick, status); StatusChangeEvent(m); } }