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

void MsnNotificationConnection::parseCommand ( const QStringList &  command  )  [private, virtual]

Process a received command.

A command may look like:

ADC 27 AL N=someone@kmessdemo.org
This is a confirmation of a sent command (with ACK-number 27) that the contact someone@kmessdemo.org was added to the allow (AL) list.

The command is always a three-letter acronym, stored in command[0] Arguments are separated by spaces, stored in the remaining command[1..n] elements.

Most commands sent with sendCommand() are echo'ed back to the client. This is not only a confirmation, but also allow event-based development (or Model-Viewer-Controller; the server is the model in this situation). Instead of assuming a command like "add contact" succeeds, the client simply waits for a returned ADC command. Hence, the same ADC command is also used to report about new contacts. The client only have to execute that the server intructs to do.

When an error occurs, the command is a three-diget code, followed by the ACK-number of the sent command. For example, in response to a CAL command, the server may return code 217; "person is offline or invisible".

>>> CAL 2 myname@kmessdemo.org
<<< 217 2

Some commands, like MSG or UBX are followed by a payload. These commands are handled by parseMimeMessage() or parsePayloadMessage().

Parameters:
command The command and arguments.

Implements MsnConnection.

Definition at line 1832 of file msnnotificationconnection.cpp.

References MsnSocketBase::ERROR_INTERNAL, gotNln(), gotRng(), gotUsr(), gotXfr(), putAdl(), and slotError().

{
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
  kDebug() << "Parsing command '" << command[0] << "'.";
#endif

  // Allow some time until the next message is received
  if( loginTimer_.isActive() )
  {
    loginTimer_.start( NOTIFICATION_COMMAND_INTERVAL_TIMEOUT );
  }

  // Find out what kind of command we've received. Numbers are errors, the others server commands.
  bool isNumber = false;
  command[0].toInt( &isNumber );

  // If it's not a command, something has went wrong.
  if( isNumber )
  {
    kWarning() << "Invalid command received:" << command;
    return;
  }

  // Identify and handle the command
  if( command[0] == "ADL" )
  {
    gotAdl( command );
  }
  else if ( command[0] == "BLP" )
  {
    // Unimplemented. This is a privacy setting. (buddy-list-policy?)
  }
  else if ( command[0] == "BPR" )
  {
    // Unimplemented. This contains buddy properties.
  }
  else if ( command[0] == "CHG" )
  {
    gotChg( command );  // Status change
  }
  else if ( command[0] == "CHL" )
  {
    gotChl( command );  // Server-side ping, aka 'challenge'
  }
  else if ( command[0] == "CVR" )
  {
    gotCvr( command );  // Client version info
  }
  else if ( command[0] == "FLN" )
  {
    gotFln( command );  // Contact offline
  }
  else if ( command[0] == "ILN" )
  {
    gotIln( command );  // Contact initially online
  }
  else if ( command[0] == "NLN" )
  {
    gotNln( command );  // Contact now online
  }
  else if ( command[0] == "OUT" )
  {
    gotOut( command );  // Disconnection from server
  }
  else if ( command[0] == "PRP" )
  {
    gotPrp( command );  // Contact property change
  }
  else if ( command[0] == "QRY" )
  {
    // Ignored. Indicates the challenge was succesful, contains no parameters.
  }
  else if ( command[0] == "RNG" )
  {
    gotRng( command );  // Chat or connection requests
  }
  else if( command[0] == "RML" )
  {
    gotRml( command );
  }
  else if( command[0] == "RFS" )
  {
    // Receveid the request for refresh list
    // so the client reply with adl command
    putAdl();
  }
  else if( command[0] == "UBN" )
  {
    // For the moment is useless
    // Require more investigate
  }
  else if ( command[0] == "SBP" )
  {
    // Unimplemented.
  }
  else if ( command[0] == "SBS" )
  {
    // Ignored. The meaning of this command is unknown, but it's related to the
    // user's mobile credits (MSN Mobile).
    // See: http://msnpiki.msnfanatic.com/index.php/MSNP11:Changes#SBS for details
  }
  else if ( command[0] == "URL" )
  {
    gotUrl( command );  // Hotmail folder info
  }
  else if ( command[0] == "USR" )
  {
    gotUsr( command );  // User authentication information
  }
  else if ( command[0] == "UUX" )
  {
    // Ignored. It's an echo back from our UUX command. Unlike other commands,
    // the UI is updated for this command already before the server confirms.
  }
  else if ( command[0] == "VER" )
  {
    gotVer( command );  // Version information
  }
  else if ( command[0] == "XFR" )
  {
    gotXfr( command );  // Server transfer data
  }
  else
  {
    // No need to bugger the common user with strange error messages
    kWarning() << "Unknown command" << command[0] << "received from the server! Full string:" << command.join( " " );
#ifdef KMESSDEBUG_NOTIFICATION_GENERAL
    slotError( i18n( "Unknown command received from the server: %1", command[0] ), MsnSocketBase::ERROR_INTERNAL );
#endif
  }
}


Generated by  Doxygen 1.6.0   Back to index