Logo Search packages:      
Sourcecode: kmess version File versions

void MsnSwitchboardConnection::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 982 of file msnswitchboardconnection.cpp.

{
  if ( command[0] == "ACK" )
  {
    gotAck( command );
  }
  else if ( command[0] == "ANS" )
  {
    // Do nothing.
  }
  else if ( command[0] == "BYE" )
  {
    gotBye( command );
  }
  else if ( command[0] == "CAL" )
  {
    // Do nothing
  }
  else if ( command[0] == "IRO" )
  {
    gotIro( command );
  }
  else if ( command[0] == "JOI" )
  {
    gotJoi( command );
  }
  else if ( command[0] == "NAK" )
  {
    gotNak( command );
  }
  else if ( command[0] == "OUT" )
  {
    gotOut( command );
  }
  else if ( command[0] == "USR" )
  {
    gotUsr( command );
  }
  else
  {
    kDebug() << "got unhandled command " << command[0] << " (contacts=" << contactsInChat_ << ").";
  }
}


Generated by  Doxygen 1.6.0   Back to index