Mercurial > hg > RemoteEditor > REPSessionManager
diff rep/SessionManager.java @ 70:248d774be113
*** empty log message ***
author | pin |
---|---|
date | Sat, 17 Nov 2007 05:49:21 +0900 |
parents | 9dd7471b771a |
children | f03307651df8 |
line wrap: on
line diff
--- a/rep/SessionManager.java Sat Nov 17 05:27:24 2007 +0900 +++ b/rep/SessionManager.java Sat Nov 17 05:49:21 2007 +0900 @@ -183,11 +183,11 @@ case REP.SMCMD_SELECT: // sessionlist.addEditor(channel, repCmd.sid, repCmd); //sessionlistへ追加 - Editor editor2 = new Editor(channel); - Session session2 = sessionlist.getSession(repCmd.sid); - if(session2.isOwner()){ - int eid = session2.addEditor(editor2); - editor2.setEID(eid); + editor = new Editor(channel); + session = sessionlist.getSession(repCmd.sid); + if(session.isOwner()){ + int eid = session.addEditor(editor); + editor.setEID(eid); REPPacketSend send = new REPPacketSend(channel); repCmd.setCMD(REP.SMCMD_SELECT_ACK); repCmd.setEID(eid); @@ -196,15 +196,13 @@ } -// repCmd.setCMD(REP.SMCMD_SELECT_ACK); -// REPPacketSend repSend3 = new REPPacketSend(channel); -// repSend3.send(repCmd); //ACKを返す break; case REP.SMCMD_SELECT_ACK: repCmd.setCMD(REP.SMCMD_JOIN_ACK); repCmd.setEID(repCmd.eid); session = sessionlist.getSession(repCmd.sid); + session.sendToEditor(repCmd); //Editor editor3 = session3.getEditorList().get(0); //REPPacketSend send = new REPPacketSend(editor3.getChannel()); //send.send(repCmd); @@ -230,16 +228,18 @@ break; case REP.SMCMD_UPDATE: - //int sessionID2 = sessionlist.addSession(channel, repCmd.string); //Sessionを作成 - //sessionlist.addEditor(channel, sessionID2, repCmd); - //sessionmanagerGUI.setComboSession(sessionID2, repCmd.string); //ComboBoxにSessionを追加 SessionXMLDecoder decoder = new SessionXMLDecoder(repCmd.string); + editor = new Editor(channel); editor.setName(repCmd.string); + session = new Session(editor); - session.setSID(repCmd.sid); + session.addEditor(editor); + sessionlist.addSession(session); + sessionmanagerGUI.setComboSession(session.getSID(), session.getName()); + if(isMaster){ repCmd.setCMD(REP.SMCMD_UPDATE_ACK); smList.sendToSlave(repCmd); @@ -374,8 +374,13 @@ System.out.println("Action!"); SocketChannel editorChannel = event.getEditorChannel(); int sid = event.getSID(); - int eid = event.getEID(); - sessionlist.addEditor(editorChannel, sid, eid); + int eid = 0; + //int eid = event.getEID(); + //sessionlist.addEditor(editorChannel, sid, eid); + Editor editor = new Editor(editorChannel); + Session session = sessionlist.getSession(sid); + session.addEditor(editor); + REPPacketSend send = new REPPacketSend(editorChannel); send.send(new REPCommand(REP.SMCMD_SELECT_ACK, sid, eid, 0,0,0,"")); sessionlist.sendSelect(sid);