• Skip to content
  • Skip to link menu
  • KDE API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • KTp
  • Message
Public Types | Public Member Functions | Protected Member Functions | List of all members
KTp::Message Class Reference

#include <message.h>

Public Types

enum  MessageDirection { LocalToRemote, RemoteToLocal }

Public Member Functions

 Message (const KTp::Message &other)
virtual ~Message ()
void appendMessagePart (const QString &part)
void appendScript (const QString &script)
MessageDirection direction () const
QString finalizedMessage () const
QString finalizedScript () const
bool isHistory () const
QString mainMessagePart () const
KTp::Message & operator= (const KTp::Message &other)
int partsSize () const
QVariant property (const char *name) const
QString senderAlias () const
QString senderId () const
void setMainMessagePart (const QString &message)
void setProperty (const char *name, const QVariant &value)
QDateTime time () const
QString token () const
Tp::ChannelTextMessageType type () const

Protected Member Functions

 Message (const Tp::Message &original, const KTp::MessageContext &context)
 Message (const Tp::ReceivedMessage &original, const KTp::MessageContext &context)
 Message (const Tpl::TextEventPtr &original, const KTp::MessageContext &context)
 Message (const QString &messageText, const KTp::MessageContext &context)

Detailed Description

An encapsualtion of a Tp::Message that can be procesesd by many MessageFilters concurrently.
Contains multiple parts created by plugins, to be displayed by user interfaces. Also contains internal metadata for use by other plugins.
Note
Methods in this class are currently not thread safe. They will be in a later version. Setting properties concurrently is undefined.
Author
Lasath Fernando kde@l.nosp@m.asat.nosp@m.h.org

Definition at line 52 of file message.h.

Member Enumeration Documentation

enum KTp::Message::MessageDirection
Enumerator:
LocalToRemote 
RemoteToLocal 

Definition at line 55 of file message.h.

Constructor & Destructor Documentation

Message::Message ( const KTp::Message &  other)

Definition at line 142 of file message.cpp.

Message::~Message ( )
virtual

Definition at line 147 of file message.cpp.

Message::Message ( const Tp::Message &  original,
const KTp::MessageContext &  context 
)
protected

Definition at line 55 of file message.cpp.

Message::Message ( const Tp::ReceivedMessage &  original,
const KTp::MessageContext &  context 
)
protected

Definition at line 73 of file message.cpp.

Message::Message ( const Tpl::TextEventPtr &  original,
const KTp::MessageContext &  context 
)
protected

Definition at line 99 of file message.cpp.

Message::Message ( const QString &  messageText,
const KTp::MessageContext &  context 
)
explicitprotected

Definition at line 125 of file message.cpp.

Member Function Documentation

void Message::appendMessagePart ( const QString &  part)

Add new visual content to the end of the message.

Each plugin that adds visual components should call this once thier processing is complete. Once a message part is added, it cannot be changed!
Parameters
partthe content to be added, in valid HTML

Definition at line 161 of file message.cpp.

void Message::appendScript ( const QString &  script)

Append a script.

Each plugin that requires to run a script after the page is updated can use this method to add a script will be run after the message is appended

Definition at line 166 of file message.cpp.

KTp::Message::MessageDirection Message::direction ( ) const

Definition at line 245 of file message.cpp.

QString Message::finalizedMessage ( ) const

Construct the final procesesd content.

This will concatenate all the visual 'parts' of the message into one (Qt supported) HTML string.
Note
All user interfaces need only care about this

Definition at line 175 of file message.cpp.

QString Message::finalizedScript ( ) const

Construct the final script.

This will concatenate all the scripts parts of the message into one script that must be executed after the finalized message is appended.

Definition at line 184 of file message.cpp.

bool Message::isHistory ( ) const

Returns if the message is history (either from logger or scrollack.

Definition at line 240 of file message.cpp.

QString Message::mainMessagePart ( ) const

The body of the message.

Returns
the contents of the body of the message, as HTML

Definition at line 151 of file message.cpp.

Message & Message::operator= ( const KTp::Message &  other)

Definition at line 50 of file message.cpp.

int Message::partsSize ( ) const
Returns
the number of appended parts

Definition at line 235 of file message.cpp.

QVariant Message::property ( const char *  name) const

Sets the contents of a property.

These messages contain meta-data for plugins in the form of 'properties'. A property can be set to any QMetaType (i.e type that can stuck in a QVariant) and is identified by a string (name).
These are set by plugins for use in other plugins, creating implicit dependencies between plugins. Since these plugins are (or will be) run concurrently, calling this method on a property that hasn't been set yet will block until it has been set by some plugin. If it isn't set when all plugins are finished, this plugin will be cancelled.
Parameters
namethe identifier of the property

Definition at line 200 of file message.cpp.

QString Message::senderAlias ( ) const
Returns
the alias of the contact who composed this message

Definition at line 225 of file message.cpp.

QString Message::senderId ( ) const
Returns
the Id of the contact who composed this message

Definition at line 230 of file message.cpp.

void Message::setMainMessagePart ( const QString &  message)

Edit the main component of the message.

Parameters
messagethe string to replace the body with. Must be correct HTML

Definition at line 156 of file message.cpp.

void Message::setProperty ( const char *  name,
const QVariant &  value 
)

Definition at line 205 of file message.cpp.

QDateTime Message::time ( ) const
Returns
the time the message was sent

Definition at line 210 of file message.cpp.

QString Message::token ( ) const
Returns
the unique token from the message

Definition at line 215 of file message.cpp.

Tp::ChannelTextMessageType Message::type ( ) const
Returns
the type of the message

Definition at line 220 of file message.cpp.


The documentation for this class was generated from the following files:
  • message.h
  • message.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Mar 22 2013 10:58:52 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktp-common-internals API Reference

Skip menu "ktp-common-internals API Reference"
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal