void HandleChatGroup(JObject message) { var username = Convert.ToString(message["from"]); var user = GetUser(username); var groupname = Convert.ToString(message["via"]); Group group; if (!groups.TryGetValue(groupname, out group)) { log.Warn("Got a chat message from a group we don't know about."); return; } var args = new GroupChatEventArgs( group, user, ParseFont(message["font"]), new UTF8Encoding(false, true).GetString(Convert.FromBase64String(Convert.ToString(message["body"]))), DateTime.Parse(message["timestamp"].ToString(), null, System.Globalization.DateTimeStyles.RoundtripKind) ); GroupChat.SafeInvoke(this, args); }