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

void MsnNotificationConnection::goOnline (  )  [private]

Called when the user is ready to go online.

This method is called by gotSyn() or gotLst() when the entire contact list data is received. It changes some final things before the user goes online:

  • set the initial user status, e.g. "online" or "invisible".
  • ses the initial personal message.
  • requests other server data, like Hotmail email URL's. Finally, the connected() signal is fired.

Definition at line 841 of file msnnotificationconnection.cpp.

References changePersonalMessage(), changeStatus(), MsnStatus::getCode(), Account::getEmailSupported(), Account::getInitialStatus(), Account::getPersonalMessage(), CurrentAccount::getUrlInformation(), MsnConnection::sendCommand(), STATUS_OFFLINE, and unlockNotifications().

{
  int ack;

  if(KMESS_NULL(currentAccount_)) return;

  // Stop the authentication timer, we're done with that part
  loginTimer_.stop();

  // Start the ping timer: from now on, it's its duty to verify that the connection is still active
  setSendPings( true );

  // Load the contact list settings
  readProperties();

  // Get the initial status to use: if we were previously disconnected by an error or network
  // issue, use the last status instead
  int initialStatus = currentAccount_->getInitialStatus();
  if( lastStatus_ != -1 && lastStatus_ != STATUS_OFFLINE )
  {
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
    kDebug() << "Last status was set:" << MsnStatus::getCode( (Status)lastStatus_ );
#endif
    initialStatus = lastStatus_;
    lastStatus_ = -1;
  }

  // Change to the initial status
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
  kDebug() << "Changing initial status to" << MsnStatus::getCode( (Status)initialStatus );
#endif
  changeStatus( (Status)initialStatus );

  // Reset status fields.
  lastCurrentMedia_ = QString::null;
  lastPsm_ = QString::null;

  // Start with default personal message (may be empty)
  changePersonalMessage( currentAccount_->getPersonalMessage( STRING_ORIGINAL ) );

  // When the account supports email (e.g. Hotmail), request the URL's.
  // This didn't give problems with non-email accounts,
  // but restricted accounts return a "710" error for this command.
  if( currentAccount_->getEmailSupported() )
  {
    // The ACK is temporary stored as inbox-command,
    // so the response can be mapped back to the requested folder.
    QHash<QString,QString>& hash = currentAccount_->getUrlInformation();
    // Ask for inbox URL
    ack = sendCommand("URL", "INBOX");
    hash.insert( QString::number(ack), "INBOX" );

    // Ask for compose URL
    ack = sendCommand("URL", "COMPOSE");
    hash.insert( QString::number(ack), "COMPOSE" );

    // Ask the personal profile URL
    ack = sendCommand("URL", "PROFILE");
    hash.insert( QString::number(ack), "PROFILE" );

    // Ask the URL for change account info
    ack = sendCommand("URL", "PERSON");
    hash.insert( QString::number(ack), "PERSON" );
  }

  // Notify observers that the server is connected
  emit connected();

  // Start a timer: for the first three seconds after connecting, do not display any notifications.
  // See unlockNotifications() for more details
  QTimer::singleShot( 3000, this, SLOT( unlockNotifications() ) );
}


Generated by  Doxygen 1.6.0   Back to index