Logo Search packages:      
Sourcecode: kmess version File versions  Download package

void P2PApplication::gotSlpInvite ( const MimeMessage slpMimeMessage  )  [private]

Got an MSNSLP INVITE message

Definition at line 1034 of file p2papplication.cpp.

References contactStarted1_ContactInvitesUser(), MimeMessage::getBody(), MimeMessage::getValue(), and sendCancelMessage().

Referenced by gotNegotiationMessage().

{
#ifdef KMESSDEBUG_P2PAPPLICATION_GENERAL
  kdDebug() << "P2PApplication: Got SLP INVITE message" << endl;
#endif
#ifdef KMESSTEST
  ASSERT( waitingState_ == P2P_WAIT_DEFAULT || waitingState_ == P2P_WAIT_FOR_FILE_DATA );
#endif

  // Reset the waiting state if this is the second INVITE for a file transfer
  if(waitingState_ == P2P_WAIT_FOR_FILE_DATA)
  {
    waitingState_ = P2P_WAIT_DEFAULT;
  }

  // Session invitation

  // Extract the fields of the message. This is required for userRejected()
  MimeMessage slpMimeContent(slpMimeMessage.getBody());

  // Set global fields from INVITE message.
  QString slpVia         = slpMimeMessage.getValue("Via");
  callID_                = slpMimeMessage.getValue("Call-ID");
  invitationCSeq_        = slpMimeMessage.getValue("CSeq").toInt();
  invitationContentType_ = slpMimeMessage.getValue("Content-Type");

  if(invitationContentType_ == "application/x-msnmsgr-sessionreqbody")
  {
    invitationSessionID_ = slpMimeContent.getValue("SessionID").toULong();
  }

  // Extract branch from the "Via" parameter
  QRegExp callRE(";branch=(.+)");     // don't use a guid-pattern here, msn6 seams to accept random strings.
  callRE.search(slpVia);
  branch_ = callRE.cap(1);


  // Don't forget the initialize the base class
  startByInvite(generateCookie());


  // Indicate this is an SLP message (sendCancelMessage() uses this)
  // This value is reset once a message is sent.
  gotSlpMessage_ = true;


  // Validate the content type
  if(invitationContentType_ != "application/x-msnmsgr-sessionreqbody" &&
     invitationContentType_ != "application/x-msnmsgr-transreqbody")
  {
    kdWarning() << "P2PApplication: Received unexpected Content-Type: " << invitationContentType_ << "." << endl;

    // Indicate we don't like that content-type:
    sendCancelMessage(CANCEL_INVALID_SLP_CONTENT_TYPE);
    // Don't QUIT, the error will be ACK-ed.
    return;
  }


  // Extract the body of the SLP message
  MimeMessage slpContent(slpMimeMessage.getBody());

  // Tell the derived class we've got an invitation
  contactStarted1_ContactInvitesUser(slpContent);
}


Generated by  Doxygen 1.6.0   Back to index