private bool onReceiveMessage(DataMessage message) { message.createReader(); int userId = message.readInt32(); string userMessage = message.readString(); message.closeReader(); ChatUser user = getUser(userId); if (user == null) { user = new ChatUser(); user.setUnknown(userId); users.Add(userId, user); requestUserInfo(userId); } ChatDialogMessage dialogMessage = new ChatDialogMessage(userMessage, user.userId, -1); if (dialogs.ContainsKey(userId)) { dialogs[userId].messages.Add(dialogMessage); } else { ChatDialogWithUser dialog = new ChatDialogWithUser(); dialog.withUser = user; dialog.messages.Add(dialogMessage); dialogs.Add(userId, dialog); } postUpdate(UiUpdates.ReceivedMessage, dialogMessage); return false; }