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

UnknownApplication Class Reference
[network/applications]

#include <unknownapplication.h>

Inheritance diagram for UnknownApplication:

P2PApplication P2PApplicationBase Application

List of all members.


Detailed Description

Unknown application notification class.

This class can be used to give useful error messages to the user when unsupported applications are requested by contacts.

Author:
Valerio Pilo

Definition at line 34 of file unknownapplication.h.


Public Types

enum  ApplicationMode { APP_MODE_NORMAL, APP_MODE_ERROR_HANDLER, APP_MODE_DATACAST }

Signals

void applicationMessage (const ChatMessage &message)
void deleteMe (Application *object)
void updateApplicationMessage (const QString &messageId, const QString &newMessage)

Public Member Functions

virtual void contactAborted (const QString &message=QString::null)
 The contact aborted the session.
QString getBranch () const
 Return the identifier the SLP INVITE message.
QString getCallID () const
 Return the identifier of the SLP session.
ChatgetChat () const
 Return the chat the application was originally created for (may be null).
const QString & getContactHandle () const
 Return the handle of the other contact.
const QString & getCookie () const
 Return the application's identifying cookie.
unsigned long getLastContactMessageID () const
 Return the message ID used in the previous message from the contact.
int getMode () const
 Return the current mode of the application.
const QString & getNonce () const
 Returns the nonce that's being expected.
quint32 getSessionID () const
 Return the session ID, this identifies the P2P session.
void gotCommand (QString command)
 A command for the application was received (i.e. "Accept" or "Reject").
void gotMessage (const P2PMessage &p2pMessage)
 Main entry function for incoming incoming messages.
bool hasUnAckedMessage (const P2PMessage &p2pMessage)
 Returns whether the application can handle the given ACK message.
bool isClosing () const
 Indicate whether the application is closing or not.
virtual bool isPrivateChatRequired () const
 Returns whether the application can operate in a multi-chat session, or requires a private chat.
bool sendNextDataParts (int preferredFragments)
 Called when the connection is ready to send more file data.
void setChat (Chat *chat)
 Set the chat the application was originally created for.
void setMode (ApplicationMode mode)
 Change the current mode.
void start ()
 Start the application.
 UnknownApplication (ApplicationList *applicationList, const QString &eufGuid)
virtual void userAborted ()
 Called when the user aborted the application.
virtual ~UnknownApplication ()

Static Public Member Functions

static QString getGamesAppId ()
static QString getMeetingAppId ()
static QString getRemoteDesktopAppId ()
static QString getVoiceAppId ()
static QString getWebcamPullAppId ()
static QString getWebcamPushAppId ()

Protected Types

enum  ApplicationCancelReason {
  CANCEL_INVITATION, CANCEL_ABORT, CANCEL_NOT_INSTALLED, CANCEL_TIMEOUT,
  CANCEL_FAILED, CANCEL_INVALID_SLP_CONTENT_TYPE
}
enum  P2PDataType {
  P2P_TYPE_NEGOTIATION = 0, P2P_TYPE_PICTURE = 1, P2P_TYPE_FILE = 2, P2P_TYPE_INK = 3,
  P2P_TYPE_WEBCAM = 4
}
 The data type being sent. More...
enum  P2PMessageType {
  P2P_MSG_UNKNOWN = 0, P2P_MSG_SESSION_INVITATION = 1, P2P_MSG_SESSION_OK = 2, P2P_MSG_TRANSFER_INVITATION = 9,
  P2P_MSG_TRANSFER_OK = 3, P2P_MSG_DATA_PREPARATION = 4, P2P_MSG_DATA = 5, P2P_MSG_SESSION_BYE = 6,
  P2P_MSG_SESSION_DECLINE = 10, P2P_MSG_TRANSFER_DECLINE = 7, P2P_MSG_SLP_ERROR = 8, P2P_MSG_WEBCAM_SETUP = 11,
  P2P_MSG_WEBCAM_SYN = 12, P2P_MSG_WEBCAM_ACK = 13
}
 The meta type of a P2P message. More...
enum  P2PWaitingState {
  P2P_WAIT_DEFAULT = 0, P2P_WAIT_FOR_SLP_OK_ACK = 1, P2P_WAIT_FOR_FILE_DATA = 2, P2P_WAIT_FOR_WEBCAM_DATA = 19,
  P2P_WAIT_FOR_PREPARE = 3, P2P_WAIT_FOR_PREPARE_ACK = 4, P2P_WAIT_FOR_SLP_BYE = 5, P2P_WAIT_FOR_SLP_BYE_ACK = 6,
  P2P_WAIT_FOR_SLP_ERR_ACK = 7, P2P_WAIT_FOR_INVITE_ACK = 18, P2P_WAIT_CONTACT_ACCEPT = 8, P2P_WAIT_FOR_TRANSFER_ACCEPT = 9,
  P2P_WAIT_FOR_INVITE_TR_ACK = 19, P2P_WAIT_FOR_CONNECTION = 10, P2P_WAIT_FOR_DATA_ACK = 11, P2P_WAIT_FOR_TRANSFER_ACK = 12,
  P2P_WAIT_FOR_HANDSHAKE = 13, P2P_WAIT_FOR_HANDSHAKE_OK = 14, P2P_WAIT_FOR_CONNECTION2 = 15, P2P_WAIT_USER_ACCEPT = 16,
  P2P_WAIT_END_APPLICATION = 17
}
 An indication which message is expected from the contact. More...

Protected Member Functions

void abortDataSending ()
 Make sure no more data will be sent.
void contactRejected (const QString &message=QString::null)
 The contact declined the invitation.
virtual void contactStarted2_UserAccepts ()
 Step 2 of a contact-started chat: the user accepts.
virtual void contactStarted3_ContactConfirmsAccept (const MimeMessage &message)
virtual void contactStarted4_ContactConfirmsPreparation ()
 Step 4 of a contact-started chat: the contact confirms the data-preparation message.
void delayDeletion (bool doDelay)
void endApplication ()
 Request to delete this application.
void endApplicationLater ()
 Scheduelle termination, but wait for last incoming packets.
QString generateCookie () const
 Generate a random cookie value.
virtual QString getContactAbortMessage () const
 Return an abort message to display.
virtual QString getContactRejectMessage () const
 Return a reject message to display.
const QString & getExternalIp () const
 Return the external IP address.
const QString & getInvitationContentType () const
 Return the Content-Type of the invitation message.
quint32 getInvitationSessionID () const
 Return the identifier of the SLP INVITE message.
const QString & getLocalIp () const
unsigned long getTransferredBytes () const
 Return the number of transferred bytes.
virtual QString getUserAbortMessage () const
 Return an abort message to display.
virtual QString getUserRejectMessage () const
 Return a reject message to display.
P2PWaitingState getWaitingState () const
 Return the current waiting state.
virtual void gotData (const P2PMessage &message)
 Called when data is received.
virtual void gotDataComplete (const P2PMessage &lastMessage)
 Called internally after all data is received.
virtual bool gotUnhandledAck (const P2PMessage &message, P2PMessageType ackedMessageType)
 Called when an ack is received, which is not handled internally.
bool hasUnAckedMessage (const P2PMessageType messageType)
 Return whether a given message type is still unacked.
bool isFirstMessageSent () const
 Test whether the first message has been sent.
bool isP2PAckSent () const
 Test whether a P2P ack was sent for the current message.
bool isTransferActive () const
 Test whether the transfer is active.
bool isTransferComplete () const
 Verify whether the transfer was initiated and was completed.
bool isUserStartedApp () const
 Return the "user started this app" state.
bool isWaitingForUser () const
 Return true if we're waiting for the user to accept.
bool isWaitingState (P2PWaitingState waitingState) const
 Test whether a given waiting state is set.
void modifyOfferMessage (const QString &newMessage=QString())
 Replace an application's accept/reject/cancel links with another text.
void offerAcceptOrReject (const QString &appHtml)
 Let the user accept or reject the application.
void offerCancel (const QString &appHtml)
 Let the user cancel the application.
void sendCancelMessage (const ApplicationCancelReason cancelReason)
 Send a cancel message.
void sendData (QIODevice *dataSource, const P2PDataType dataType)
 Send file data in P2P packets.
void sendDataPreparation ()
 Send the data preparation message.
void sendDataPreparationAck ()
 Send the data preparation ACK.
void sendDirectConnectionHandshake (const QString &nonce)
 Send the direct connection handshake.
void sendP2PAbort ()
 Send a low-level control message to terminate the session.
bool sendP2PAck ()
 Send an ACK message if this is needed.
void sendP2PMessage (const QByteArray &messageData, int flagField=0, P2PDataType footerCode=P2P_TYPE_NEGOTIATION, P2PMessageType messageType=P2P_MSG_UNKNOWN)
 Sends a complete P2P message payload.
void sendP2PWaitingError ()
 Send a low-level error message that the application is waiting for a certain message.
void sendSlpMessage (const QString &slpMessage, P2PMessageType messageType)
 Send a complete SLP message in multiple P2P packets.
void sendSlpOkMessage (const MimeMessage &message)
 Send the 200 OK message to accept the invitation.
void sendSlpSessionInvitation (quint32 sessionID, const QString &eufGuid, const int appId, const QString &context)
 Send the invitation for a normal session.
void sendSlpTransferInvitation ()
 Send the invitation for a direct connection.
void setApplicationType (ChatMessage::MessageType type)
 Set the type of application we're starting.
void setClosing (bool closing)
 Indicate the application is closing or not.
void setCurrentMessageType (P2PMessageType messageType)
 Set the current message type, for debugging.
void setDataCastSessionID (quint32 sessionID)
void setUserAborted (bool userAborted)
 Notify this base class the user is aborting the session.
void setWaitingState (P2PWaitingState waitingState, int timeout)
 Indicate which packet is expected next.
virtual void showEventMessage (const QString &message, const ChatMessage::ContentsClass contents, bool isIncoming=true)
 Show a message to notify the user of an event.
virtual void showSystemMessage (const QString &message, const ChatMessage::ContentsClass contents, bool isIncoming=true)
 Show a message to notify about a system error.
virtual void showTransferComplete ()
 Called when the transfer is complete.
virtual void showTransferMessage (const QString &message)
 Show a message to inform about a transfer event.
virtual void showTransferProgress (const ulong bytesTransferred)
 Show the progress made during a transfer.
void startByInvite (const QString &invitationCookie)
 Start the application internally (from an invite message).
bool stopWaitingTimer ()
 Stop the waiting timer.
void testDataSendingAborted ()
 Test if the contact aborted the sending of data.
virtual void userRejected ()
 Called when the user rejected (declined) the application.
virtual void userStarted1_UserInvitesContact ()
 Step 1 of a user-started chat: the user invites the contact.
virtual void userStarted2_ContactAccepts (const MimeMessage &message)
 Step 2 of a user-started chat: the contact accepts.
virtual void userStarted3_UserPrepares ()
 Step 3 of a user-started chat: the user prepares for the session.
bool writeP2PDataToFile (const P2PMessage &message, QIODevice *file)
 Utility function to write P2P data to a file, also deals with message offsets.

Private Member Functions

void contactStarted1_ContactInvitesUser (const MimeMessage &message)

Private Attributes

const QString applicationGuid_

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index