kopete/protocols/messenger/libpapillon
Papillon::NetworkMessage Class Reference
#include <Papillon/NetworkMessage>
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.
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
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 |
| QString Papillon::NetworkMessage::command | ( | ) | const |
| QByteArray Papillon::NetworkMessage::payloadData | ( | ) | const |
| int Papillon::NetworkMessage::payloadLength | ( | ) | const |
| 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 |
| NetworkMessage::NetworkMessageType Papillon::NetworkMessage::type | ( | ) | const |
The documentation for this class was generated from the following files:
KDE 4.2 API Reference