Package net.sf.jml.protocol.msnslp

Examples of net.sf.jml.protocol.msnslp.MsnslpRequest


        }
    }

    private void sendBye()
    {
        MsnslpRequest req = new MsnslpRequest();
        MsnFileByeMessage bye = new MsnFileByeMessage();
        bye.setSlpMessage(req);
        int lastRandomIdentifier = NumberUtils.getIntRandom();

        // Set the destination for the message (the MsnObject creator)
        bye.setP2PDest(fileTransfer.getEmail().getEmailAddress());

        // Set the binary Header
        bye.setSessionId(Integer.parseInt(fileTransfer.getID()));
        bye.setIdentifier(getNextIdentifier());
        bye.setFlag(MsnP2PMessage.FLAG_OLD_NONE);
        bye.setField7(lastRandomIdentifier);
        bye.setField8(0);
        bye.setField9(0);

        // Set body
        req.setRequestMethod(MsnP2PByeMessage.METHOD_BYE);
        req.setRequestURI("MSNMSGR:" + fileTransfer.getSession().getMessenger().getOwner().getEmail().getEmailAddress());
        req.setTo("<msnmsgr:" + fileTransfer.getEmail().getEmailAddress() + ">");
        req.setFrom("<msnmsgr:" +
            fileTransfer.getSession().getMessenger().getOwner().getEmail().getEmailAddress() + ">");
        req.setVia(
            "MSNSLP/1.0/TLP ;branch={A0D624A6-6C0C-4283-A9E0-BC97B4B46D32}");
        req.setCSeq(0);
        req.setCallId(fileTransfer.getReqMessage().getSlpMessage().getCallId());
        req.setMaxForwards(0);
        req.setContentType("application/x-msnmsgr-sessionclosebody");
        req.setBody(JmlConstants.LINE_SEPARATOR + "\0");

        // Get the size of the message to be setted
        int slpMessageLength = Charset.encodeAsByteArray(req.toString()).length;
        bye.setTotalLength(slpMessageLength);
        bye.setCurrentLength(slpMessageLength);

        OutgoingMSG[] outgoingOkMessages = bye.toOutgoingMsg(
            fileTransfer.getSession().getMessenger().getActualMsnProtocol());
View Full Code Here


        }
  }

    public void sendDeny(MsnP2PSlpMessage msg)
    {
        MsnslpRequest msnslpRequest = (MsnslpRequest)msg.getSlpMessage();
        MsnslpResponse okSlpMessage = new MsnslpResponse();
        okSlpMessage.setStatusCode(405);
        okSlpMessage.setReasonPhrase("Not supported");
        okSlpMessage.setTo(msnslpRequest.getFrom());
        okSlpMessage.setFrom(msnslpRequest.getTo());
        okSlpMessage.setVia(msnslpRequest.getVia());
        okSlpMessage.setCSeq(msnslpRequest.getCSeq() + 1);
        okSlpMessage.setCallId(msnslpRequest.getCallId());
        okSlpMessage.setMaxForwards(msnslpRequest.getMaxForwards());
        okSlpMessage.setContentType(msnslpRequest.getContentType());

        StringHolder body = new StringHolder();
        body.setProperty("SessionID", fileTransfer.getID());
        okSlpMessage.setBody(body.toString() + JmlConstants.LINE_SEPARATOR
                + "\0");
View Full Code Here

      MsnP2PSlpMessage slpMessage = new MsnP2PSlpMessage();
      slpMessage.parseMessage(message);

      MsnslpMessage msg = slpMessage.getSlpMessage();
      if (msg instanceof MsnslpRequest) {
        MsnslpRequest msnslpRequest = (MsnslpRequest) slpMessage
            .getSlpMessage();
        if (msnslpRequest.getRequestMethod() != null &&
          msnslpRequest.getRequestMethod().
                equals(MsnP2PByeMessage.METHOD_BYE)) {
          return new MsnP2PByeMessage();
        }
        if (msnslpRequest.getRequestMethod() != null
            && msnslpRequest.getRequestMethod().
                equals(MsnP2PInvitationMessage.METHOD_INVITE)) {
          return new MsnP2PInvitationMessage();
        }
      }
      return slpMessage;
    }

        if(flag == MsnP2PMessage.FLAG_OLD_NONE)
        {
            MsnP2PSlpMessage slpMessage = new MsnP2PSlpMessage();
      slpMessage.parseMessage(message);

      MsnslpMessage msg = slpMessage.getSlpMessage();
      if (msg instanceof MsnslpRequest)
            {
        MsnslpRequest msnslpRequest = (MsnslpRequest) slpMessage
            .getSlpMessage();
                if (msnslpRequest.getRequestMethod() == null)
                    return slpMessage;

        if (msnslpRequest.getRequestMethod().
                equals(MsnFileInviteMessage.METHOD_INVITE))
                {
          return new MsnFileInviteMessage();
        }

                // bye
                if (msnslpRequest.getRequestMethod().
                equals(MsnFileByeMessage.METHOD_BYE))
                {
          return new MsnFileByeMessage();
        }
      }
View Full Code Here

  @Override
  protected void messageReceived(MsnSession session, MsnContact contact) {
   
    // Get Slp message
        MsnslpRequest msnslpRequest = (MsnslpRequest) getSlpMessage();
       
        // Get a properties
        String method = msnslpRequest.getRequestMethod();
        String guid_euf = msnslpRequest.getBodys().getProperty(KEY_GUID_EUF);
        String context = msnslpRequest.getBodys().getProperty(KEY_CONTEXT);
       
        if (method != null && method.equals(METHOD_INVITE) &&
            msnslpRequest.getCSeq() == 0 &&
            guid_euf != null && guid_euf.equals(GUID_EUF) &&
          context != null) {
         
        // Create a new work to send the MsnObject 
            context = StringUtils.decodeBase64(context);
View Full Code Here

  }

  @Override
  protected void messageReceived(MsnSession session, MsnContact contact)
    {
        MsnslpRequest msnslpResponse = (MsnslpRequest) getSlpMessage();
        String sessionID = msnslpResponse.getBodys().getProperty("SessionID");

        if(sessionID == null)
            sessionID = String.valueOf(getSessionId());

        MsnFileTransferImpl ft = (MsnFileTransferImpl)session.getMessenger().
View Full Code Here

      totalLength == currentLength) {
      MsnP2PSlpMessage slpMessage = new MsnP2PSlpMessage();
      slpMessage.parseMessage(message);
      MsnslpMessage msg = slpMessage.getSlpMessage();
      if (msg instanceof MsnslpRequest) {
        MsnslpRequest msnslpRequest = (MsnslpRequest) slpMessage
            .getSlpMessage();
        if (msnslpRequest.getRequestMethod() != null &&
          msnslpRequest.getRequestMethod().
                equals(MsnP2PByeMessage.METHOD_BYE)) {
          return new MsnP2PByeMessage();
        }
        if (msnslpRequest.getRequestMethod() != null
            && msnslpRequest.getRequestMethod().
                equals(MsnP2PInvitationMessage.METHOD_INVITE)) {
            return new MsnP2PInvitationMessage();
        }
      }
      return slpMessage;
    }

        if(flag == MsnP2PMessage.FLAG_OLD_NONE)
        {
            MsnP2PSlpMessage slpMessage = new MsnP2PSlpMessage();
      slpMessage.parseMessage(message);

      MsnslpMessage msg = slpMessage.getSlpMessage();
      if (msg instanceof MsnslpRequest)
            {
        MsnslpRequest msnslpRequest = (MsnslpRequest) slpMessage
            .getSlpMessage();
                if (msnslpRequest.getRequestMethod() == null)
                    return slpMessage;

        if (msnslpRequest.getRequestMethod().
                equals(MsnFileInviteMessage.METHOD_INVITE))
                {
          return new MsnFileInviteMessage();
        }

                // bye
                if (msnslpRequest.getRequestMethod().
                equals(MsnFileByeMessage.METHOD_BYE))
                {
          return new MsnFileByeMessage();
        }
      }
View Full Code Here

        }
    }

    private void sendBye()
    {
        MsnslpRequest req = new MsnslpRequest();
        MsnFileByeMessage bye = new MsnFileByeMessage();
        bye.setSlpMessage(req);
        int lastRandomIdentifier = NumberUtils.getIntRandom();

        // Set the destination for the message (the MsnObject creator)
        bye.setP2PDest(fileTransfer.getEmail().getEmailAddress());

        // Set the binary Header
        bye.setSessionId(Integer.parseInt(fileTransfer.getID()));
        bye.setIdentifier(getNextIdentifier());
        bye.setFlag(MsnP2PMessage.FLAG_OLD_NONE);
        bye.setField7(lastRandomIdentifier);
        bye.setField8(0);
        bye.setField9(0);

        // Set body
        req.setRequestMethod(MsnP2PByeMessage.METHOD_BYE);
        req.setRequestURI("MSNMSGR:" + fileTransfer.getSession().getMessenger().getOwner().getEmail().getEmailAddress());
        req.setTo("<msnmsgr:" + fileTransfer.getEmail().getEmailAddress() + ">");
        req.setFrom("<msnmsgr:" +
            fileTransfer.getSession().getMessenger().getOwner().getEmail().getEmailAddress() + ">");
        req.setVia(
            "MSNSLP/1.0/TLP ;branch={A0D624A6-6C0C-4283-A9E0-BC97B4B46D32}");
        req.setCSeq(0);
        req.setCallId(fileTransfer.getReqMessage().getSlpMessage().getCallId());
        req.setMaxForwards(0);
        req.setContentType("application/x-msnmsgr-sessionclosebody");
        req.setBody(JmlConstants.LINE_SEPARATOR + "\0");

        // Get the size of the message to be setted
        int slpMessageLength = Charset.encodeAsByteArray(req.toString()).length;
        bye.setTotalLength(slpMessageLength);
        bye.setCurrentLength(slpMessageLength);

        OutgoingMSG[] outgoingOkMessages = bye.toOutgoingMsg(
            fileTransfer.getSession().getMessenger().getActualMsnProtocol());
View Full Code Here

        }
  }

    public void sendDeny(MsnP2PSlpMessage msg)
    {
        MsnslpRequest msnslpRequest = (MsnslpRequest)msg.getSlpMessage();
        MsnslpResponse okSlpMessage = new MsnslpResponse();
        okSlpMessage.setStatusCode(405);
        okSlpMessage.setReasonPhrase("Not supported");
        okSlpMessage.setTo(msnslpRequest.getFrom());
        okSlpMessage.setFrom(msnslpRequest.getTo());
        okSlpMessage.setVia(msnslpRequest.getVia());
        okSlpMessage.setCSeq(msnslpRequest.getCSeq() + 1);
        okSlpMessage.setCallId(msnslpRequest.getCallId());
        okSlpMessage.setMaxForwards(msnslpRequest.getMaxForwards());
        okSlpMessage.setContentType(msnslpRequest.getContentType());

        StringHolder body = new StringHolder();
        body.setProperty("SessionID", fileTransfer.getID());
        okSlpMessage.setBody(body.toString() + JmlConstants.LINE_SEPARATOR
                + "\0");
View Full Code Here

  }

  @Override
  protected void messageReceived(MsnSession session, MsnContact contact) {
    // Get Slp message
        MsnslpRequest msnslpRequest = (MsnslpRequest) getSlpMessage();
       
        // Get a properties
        String method = msnslpRequest.getRequestMethod();
        String guid_euf = msnslpRequest.getBodys().getProperty(KEY_GUID_EUF);
        String context = msnslpRequest.getBodys().getProperty(KEY_CONTEXT);
        if (method != null && method.equals(METHOD_INVITE) &&
            msnslpRequest.getCSeq() == 0 &&
            guid_euf != null && guid_euf.equals(GUID_EUF) &&
          context != null) {
        // Create a new work to send the MsnObject 
            context = StringUtils.decodeBase64(context);
            context = context.substring(0,context.length()-1);
View Full Code Here

  }

  @Override
  protected void messageReceived(MsnSession session, MsnContact contact) {
     
    MsnslpRequest msnslpRequest = (MsnslpRequest) getSlpMessage();
    if (msnslpRequest.getRequestMethod() != null
        && msnslpRequest.getRequestMethod().equals(METHOD_BYE)) {
     
            MsnP2PByeAckMessage ack = new MsnP2PByeAckMessage(MsnP2PBaseIdGenerator.getInstance().getNextId(),
                    contact.getEmail().getEmailAddress(), this);
            OutgoingMSG[] outgoing = ack.toOutgoingMsg(session
                    .getMessenger().getActualMsnProtocol());
View Full Code Here

TOP

Related Classes of net.sf.jml.protocol.msnslp.MsnslpRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.