public boolean deleteMessage(int number) throws IOException, ProtocolException { boolean result = false; Socket s = this.getIncommingSocket(); ReceiveProtocol protocol = this.getIncommingProtocol(s); protocol.startSession(); protocol.authorization(info.getUsername(), info.getPassword()); result = protocol.deleteMessage(number); protocol.closeSession(); s.close(); return result; }
public Letter getLetter(int number) throws IOException, ProtocolException { Letter l; Socket s = this.getIncommingSocket(); ReceiveProtocol protocol = this.getIncommingProtocol(s); protocol.startSession(); protocol.authorization(info.getUsername(), info.getPassword()); l = protocol.openMessage(number); protocol.closeSession(); s.close(); return l; }
public int getMailsCount() throws IOException, ProtocolException { int count = 0; Socket s = this.getIncommingSocket(); ReceiveProtocol protocol = this.getIncommingProtocol(s); protocol.startSession(); protocol.authorization(info.getUsername(), info.getPassword()); count = protocol.letterCount(); protocol.closeSession(); s.close(); return count; }
public LetterInfo[] getMailsInfoList() throws IOException, ProtocolException { LetterInfo[] letterInfo; Socket s = this.getIncommingSocket(); ReceiveProtocol protocol = this.getIncommingProtocol(s); protocol.startSession(); protocol.authorization(info.getUsername(), info.getPassword()); int letterCount = protocol.letterCount(); letterInfo = new LetterInfo[letterCount]; for (int i = 0; i < letterCount; i++) { letterInfo[i] = protocol.messageInfo(letterCount - i); } protocol.closeSession(); s.close(); return letterInfo; }