public MessageToSend handleInput(MessageReceived message_received) { MessageToSend messageToSend = message_received.CreateReplyMessage(); messageToSend.Clear(); InputHandlerResult action = null; //new session so we append chat screen config if (current_menu_loc == MenuDefinition.UNDEFINED_MENU_ID) { AScreenOutputAdapter.appendInitialMessageConfig(this.user_profile,messageToSend); } if (current_menu_loc == MenuDefinition.UNDEFINED_MENU_ID && user_profile.user_profile_custom.user_name.StartsWith(GUEST_USER_NAME_PREFIX)) { String guest_name = GUEST_USER_NAME_PREFIX + user_profile.id; setVariable(GUEST_USER_NAME_ASSIGNED, guest_name); } else if (current_menu_loc == MenuDefinition.UNDEFINED_MENU_ID && user_profile.user_profile_custom.user_name.StartsWith(UserProfile.TEMP_USER_NAME)) { String guest_name = GUEST_USER_NAME_PREFIX + user_profile.id; user_profile.setUserName(guest_name); setVariable(GUEST_USER_NAME_ASSIGNED, guest_name); } bool is_suspended = SuspensionManager.getInstance().isSuspended(user_profile.id); if (is_suspended) { user_profile.is_suspended = true; } else { user_profile.is_suspended = false; } IInputHandler i_handler = InputHandlerFactory.getInputHandler(current_menu_loc); action = i_handler.handleInput(this, message_received); //special refer friend action. if (hasVariable(MainMenuHandler.REFER_A_FRIEND)) { removeVariable(MainMenuHandler.REFER_A_FRIEND); return null; } handleAction(action); if (this.hasVariable(AScreenOutputAdapter.COLOUR_CHANGED)) { this.removeVariable(AScreenOutputAdapter.COLOUR_CHANGED); AScreenOutputAdapter.appendInitialMessageConfig(this.user_profile, messageToSend); } MessageToSend output = MenuManager.getInstance().getScreenMessage( this, messageToSend, action); return output; }
public MessageToSend handleError(MessageReceived message_received) { MessageToSend messageToSend = message_received.CreateReplyMessage(); messageToSend.Clear(); InputHandlerResult action = new InputHandlerResult( InputHandlerResult.ROOT_MENU_ACTION, MenuDefinition.ROOT_MENU_ID, InputHandlerResult.DEFAULT_PAGE_ID); handleAction(action); MessageToSend output = MenuManager.getInstance().getScreenMessage( this, messageToSend, action); return output; }