コード例 #1
0
ファイル: EmailManager.java プロジェクト: Cauac/MailLibrary
  public boolean sendMessage(Letter l) throws IOException, ProtocolException {
    boolean result = false;
    Socket s = this.getOutGoingSocket();
    PostProtocol protocol = this.getOutGoingProtocol(s);

    protocol.startSession(info.getOutgoingServerName());
    protocol.authorization(info.getUsername(), info.getPassword());
    result = protocol.sendMessage(l);
    protocol.closeSession();
    s.close();
    return result;
  }
コード例 #2
0
ファイル: EmailManager.java プロジェクト: Cauac/MailLibrary
  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;
  }
コード例 #3
0
ファイル: EmailManager.java プロジェクト: Cauac/MailLibrary
  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;
  }
コード例 #4
0
ファイル: EmailManager.java プロジェクト: Cauac/MailLibrary
  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;
  }
コード例 #5
0
ファイル: EmailManager.java プロジェクト: Cauac/MailLibrary
  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;
  }