• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdenetwork
  • Sitemap
  • Contact Us
 

kopete/protocols/messenger/libpapillon

Papillon::NetworkMessage

Papillon::NetworkMessage Class Reference

#include <Papillon/NetworkMessage>

List of all members.


Detailed Description

A network message is the data received and transmitted from/to the Messenger server.

A NetworkMessage have always a command and arguments. It can have a transaction ID, a payload length, and the payload data.

Author:
Michaƫl Larouche <larouche@kde.org>

Definition at line 39 of file networkmessage.h.


Public Types

enum  NetworkMessageTypeValues { NormalMessage, TransactionMessage, PayloadMessage }

Public Member Functions

QStringList arguments () const
QString command () const
 NetworkMessage (const NetworkMessageType &type=NormalMessage)
QByteArray payloadData () const
int payloadLength () const
void setArguments (const QString &argumentString)
void setArguments (const QStringList &arguments)
void setCommand (const QString &command)
void setPayloadData (const QByteArray &data)
void setTransactionId (const QString &transactionId)
QByteArray toRawCommand () const
QString toString () const
QString transactionId () const
NetworkMessageType type () const
 ~NetworkMessage ()

Member Enumeration Documentation

enum Papillon::NetworkMessage::NetworkMessageTypeValues

NetworkMessageTypeValues is the possible type of message that we can build.

Enumerator:
NormalMessage  A basic network message.
TransactionMessage  A network message with a transaction ID attached to it.
PayloadMessage  A network message with data attaced to it.

Definition at line 46 of file networkmessage.h.


Constructor & Destructor Documentation

Papillon::NetworkMessage::NetworkMessage ( const NetworkMessageType &  type = NormalMessage  ) 

Build a new NetworkMessage.

The default type for NetworkMessage is NormalMessage.

Parameters:
type The type of NetworkMessage. Default is NormalMessage

Definition at line 33 of file networkmessage.cpp.

Papillon::NetworkMessage::~NetworkMessage (  ) 

Definition at line 39 of file networkmessage.cpp.


Member Function Documentation

QStringList Papillon::NetworkMessage::arguments (  )  const

Return the arguments of the command.

Definition at line 73 of file networkmessage.cpp.

QString Papillon::NetworkMessage::command (  )  const

Return the command name.

Definition at line 49 of file networkmessage.cpp.

QByteArray Papillon::NetworkMessage::payloadData (  )  const

Return the payload data.

Definition at line 95 of file networkmessage.cpp.

int Papillon::NetworkMessage::payloadLength (  )  const

Return the length of the payload data.

Definition at line 88 of file networkmessage.cpp.

void Papillon::NetworkMessage::setArguments ( const QString &  argumentString  ) 

This is a convience method to set arguments to a transfer.

It take a QString instead of a QStringList.

Parameters:
argumentString A string containing the arguments separated by an empty space.

Definition at line 83 of file networkmessage.cpp.

void Papillon::NetworkMessage::setArguments ( const QStringList &  arguments  ) 

Set the arugments for the transfer.

Parameters:
arguments Argument list.

Definition at line 78 of file networkmessage.cpp.

void Papillon::NetworkMessage::setCommand ( const QString &  command  ) 

Set the command name.

Parameters:
command The command name. (ex: USR)

Definition at line 54 of file networkmessage.cpp.

void Papillon::NetworkMessage::setPayloadData ( const QByteArray &  data  ) 

Set the payload data to be send.

The transfer must be set to PayloadTransfer type.

Parameters:
data payload data to sent.

Definition at line 102 of file networkmessage.cpp.

void Papillon::NetworkMessage::setTransactionId ( const QString &  transactionId  ) 

Set the transaction ID.

The transfer must be set to TransactionTransfer type.

Parameters:
transactionId the Transaction ID.

Definition at line 66 of file networkmessage.cpp.

QByteArray Papillon::NetworkMessage::toRawCommand (  )  const

Return the current transfer as a raw command.

This method should be used only when sending transfer with payload data.

Definition at line 135 of file networkmessage.cpp.

QString Papillon::NetworkMessage::toString (  )  const

Return the current transfert in a string.

If the transfer is PayloadTransfer type, the payload length is appended at the end of the line, if not already in the argument list.

This is for text-only transfer that doesn't have payload data. You should use asRawCommand() instead.

Definition at line 109 of file networkmessage.cpp.

QString Papillon::NetworkMessage::transactionId (  )  const

Return the transaction ID if any.

Definition at line 59 of file networkmessage.cpp.

NetworkMessage::NetworkMessageType Papillon::NetworkMessage::type (  )  const

Return the NetworkMessage type.

Definition at line 44 of file networkmessage.cpp.


The documentation for this class was generated from the following files:
  • networkmessage.h
  • networkmessage.cpp

kopete/protocols/messenger/libpapillon

Skip menu "kopete/protocols/messenger/libpapillon"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal