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

void FileTransfer::userStarted2_ContactAccepts ( const MimeMessage message ) [private, virtual]

Step 2 of a user-started chat: the contact accepts.

This method should be implemented by a derived class, handling the accept message. Either this method should call userStarted3_UserPrepares() (typically for MimeApplication classes), or asks the contact to send a prepare message (for P2PApplication classes).

Reimplemented from Application.

Definition at line 782 of file filetransfer.cpp.

References Application::generateCookie(), Application::getContactHandle(), Application::getCookie(), Application::getExternalIp(), Application::modifyOfferMessage(), and Application::showEventMessage().

{
#ifdef KMESSDEBUG_FILETRANSFER_GENERAL
  kmDebug();
#endif
#ifdef KMESSTEST
  KMESS_ASSERT( msnFtpConnection_ == 0 );
#endif

  QString html;
  QString portString;
  QString authCookie;

  // Remove the accept links
  modifyOfferMessage();

  // Create a message showing that the transfer was accepted.
  showEventMessage( i18n( "The contact has accepted the transfer of the file "%1".", fileName_ ),
                    ChatMessage::CONTENT_APP_STARTED,
                    true );

  // Get the authorisation cookie to use
  authCookie = generateCookie();

  // Initialize the msnftp connection class
  msnFtpConnection_ = new MsnFtpConnection( getContactHandle(), authCookie );
  connectMsnFtpConnection();

  // Get the IP,port to use
  portString  = QString::number( msnFtpConnection_->getLocalServerPort() );

  // Initialize the progress dialog
  initializeProgressDialog();

  // Set the first status message.
  slotMsnFtpStatusMessage( i18n("Negotiating options to connect"), MsnFtpConnection::STATUS_DIALOG );

  // Create the invitation message
  // TODO: PortX-Internal and PortX should be another port.
  //       We should be listening to port 11178 as well for internal transfers
  MimeMessage response;
  response.addField( "Invitation-Command",  "ACCEPT"         );
  response.addField( "Invitation-Cookie",   getCookie()      );
  response.addField( "IP-Address",          getExternalIp()  );
//  response.addField( "IP-Address-Internal", getLocalIp()     );
//  response.addField( "PortX-Internal",      portString       );
  response.addField( "Port",                portString       );
//  response.addField( "PortX",               portString       );
  response.addField( "Launch-Application",  "FALSE"          );
  response.addField( "AuthCookie",          authCookie       );

  sendMessage( response );
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index