this.maxOpCodeToGui = messageBuffer.readInt32(); this.maxOpCodeFromGui = messageBuffer.readInt32();
	private void decodeMessage( short opcode, int messageLength, MessageBuffer messageBuffer, boolean pollModeEnabled ) {		switch ( opcode ) {			case Message.R_COREPROTOCOL :									coreProtocol = messageBuffer.readInt32();					/* can we speak the coreprotocol? */					int i = coreProtocol - PROTOCOL_VERSION;					if ( i <= 0 )						this.usingVersion = coreProtocol;					else						this.usingVersion = PROTOCOL_VERSION;					this.sendPullmode( pollModeEnabled );					this.sendPassword();					this.modelFactory = ModelFactory.getFactory( this.usingVersion, this );					this.maxOpCodeToGui = messageBuffer.readInt32();					this.maxOpCodeFromGui = messageBuffer.readInt32();					if (G2Gui.debug){						System.out.println("core/gui "+coreProtocol+"/"+PROTOCOL_VERSION);						System.out.println("GUI Protocol-Version: "+this.usingVersion);					}					break;								case Message.R_DEFINE_SEARCH :					this.getModelFactory().getDefineSearchMap().readStream( messageBuffer );					break;					case Message.R_RESULT_INFO :					ResultInfo result = getModelFactory().getResultInfo();					result.readStream( messageBuffer );					this.resultInfo.put( result.getResultID(), result );					break;								case Message.R_SEARCH_RESULT :					this.getModelFactory().getResultInfoIntMap().readStream( messageBuffer );							break;								case Message.R_OPTIONS_INFO :					/*					 * when we first receive this msg in push-mode,					 * we passed the badPassword msg so release the waiterobj 					 * that the G2Gui.main() can continue					 */					if ( !initialized ) {						badPassword = false;						synchronized ( waiterObj ) {							waiterObj.notify();						}						initialized = true;					}					this.getModelFactory().getOptionsInfoMap().readStream( messageBuffer );								break;							case Message.R_FILE_UPDATE_AVAILABILITY :					int fileId = messageBuffer.readInt32();					int clientId = messageBuffer.readInt32();					String availability = messageBuffer.readString();					if ( ( ( ClientInfoIntMap ) this.getModelFactory().getClientInfoIntMap() ).containsKey( clientId ) )						( ( ClientInfoIntMap ) this.getModelFactory().getClientInfoIntMap() ).get( clientId )							.putAvail( fileId, availability );					break;								case Message.R_FILE_ADD_SOURCE :					int fileIdentifier = messageBuffer.readInt32();					int clientIdentifier = messageBuffer.readInt32();					/*check for null-objects...*/					if ( ( ( FileInfoIntMap )this.getModelFactory().getFileInfoIntMap()   ).contains( fileIdentifier ) )											if ( ( ( ClientInfoIntMap )this.getModelFactory().getClientInfoIntMap() ).get( clientIdentifier ) != null ) {												/*everything's fine, we can execute:*/							( ( FileInfoIntMap ) this.getModelFactory().getFileInfoIntMap() ).get( fileIdentifier )								.addClientInfo( ( ( ClientInfoIntMap ) this.getModelFactory().getClientInfoIntMap() )									.get( clientIdentifier ) );						}					break;											case Message.R_SERVER_STATE :					if ( advancedMode ) {						this.getModelFactory().getServerInfoIntMap().update( messageBuffer );					}					break;										case Message.R_CLIENT_INFO :				this.getModelFactory().getClientInfoIntMap().readStream( messageBuffer );					break;						case Message.R_ADD_SECTION_OPTION :					( ( OptionsInfoMap )this.getModelFactory().getOptionsInfoMap() ).readGeneralOptionDetails( messageBuffer );					break;								case Message.R_ADD_PLUGIN_OPTION :					( ( OptionsInfoMap )this.getModelFactory().getOptionsInfoMap() ).readPluginOptionDetails( messageBuffer );					break;										case Message.R_CLIENT_STATE :					this.getModelFactory().getClientInfoIntMap().update( messageBuffer );					break;									case Message.R_ROOM_INFO :					this.getModelFactory().getRoomInfoIntMap().readStream( messageBuffer );								break;										case Message.R_SHARED_FILE_UPLOAD :					this.getModelFactory().getSharedFileInfoIntMap().update( messageBuffer );						break;								case Message.R_BAD_PASSWORD :					/* tell the master thread to continue */					synchronized ( waiterObj ) {						waiterObj.notify();					}					break;													case Message.R_SHARED_FILE_INFO :					this.getModelFactory().getSharedFileInfoIntMap().readStream( messageBuffer );					break;					case Message.R_FILE_DOWNLOAD_UPDATE :					this.getModelFactory().getFileInfoIntMap().update( messageBuffer );					break;									case Message.R_CLIENT_STATS :					/*					 * when we first receive this msg in poll-mode,					 * we passed the badPassword msg so release the waiterobj 					 * that the G2Gui.main() can continue					 */					if ( !initialized ) {						badPassword = false;						synchronized ( waiterObj ) {							waiterObj.notify();						}						initialized = true;					}					this.getModelFactory().getClientStats().readStream( messageBuffer );					break;									case Message.R_DOWNLOAD :					( ( FileInfoIntMap )this.getModelFactory().getFileInfoIntMap() ).add( messageBuffer );					break;								case Message.R_CONSOLE :						if ( advancedMode ) {						this.getModelFactory().getConsoleMessage().readStream( messageBuffer );					}					break;							case Message.R_NETWORK_INFO :					this.getModelFactory().getNetworkInfoIntMap().readStream( messageBuffer );					break;								case Message.R_USER_INFO :					UserInfo user = this.getModelFactory().getUserInfo();					user.readStream( messageBuffer );					this.userInfo.put( user.getUserId(), user );					break;										case Message.R_SERVER_INFO :					if ( advancedMode ) {						this.getModelFactory().getServerInfoIntMap().readStream( messageBuffer );					}						break;										case Message.R_DOWNLOADING_LIST :					this.getModelFactory().getFileInfoIntMap().readStream( messageBuffer );					break;					 			case Message.R_DOWNLOADED_LIST :					 break;					 			case Message.R_CLEAN_TABLE :					( ( ClientInfoIntMap )this.getModelFactory().getClientInfoIntMap() ).clean( messageBuffer );					( ( ServerInfoIntMap )this.getModelFactory().getServerInfoIntMap() ).clean( messageBuffer );					break;								case Message.R_MESSAGE_FROM_CLIENT :					if ( advancedMode ) {						ClientMessage clientMessage = this.getModelFactory().getClientMessage();						clientMessage.readStream( messageBuffer );						this.setChanged();						this.notifyObservers( clientMessage );					}					break;			case Message.R_FILE_REMOVE_SOURCE :					getFileInfoIntMap().fileRemoveSource(messageBuffer);								break;			default :					if ( G2Gui.debug )								System.out.println( "unknown opcode: " + opcode + " length: " + messageLength );					break;						}	}