gloox
1.0.28
|
#include <carbons.h>
Public Types | |
enum | Type { Received , Sent , Enable , Disable , Private , Invalid } |
Public Member Functions | |
Carbons (Type type) | |
Carbons (const Tag *tag=0) | |
virtual | ~Carbons () |
Type | type () const |
virtual Stanza * | embeddedStanza () const |
virtual Tag * | embeddedTag () const |
virtual const std::string & | filterString () const |
virtual StanzaExtension * | newInstance (const Tag *tag) const |
virtual Tag * | tag () const |
virtual StanzaExtension * | clone () const |
Public Member Functions inherited from StanzaExtension | |
StanzaExtension (int type) | |
virtual | ~StanzaExtension () |
int | extensionType () const |
An implementation of Message Carbons (XEP-0280) as a StanzaExtension.
Before using Message Carbons you have to check your server for support of the extension. You can do so using Disco::getDiscoInfo(). You can check the result (in DiscoHandler::handleDiscoInfo()) for a feature of XMLNS_MESSAGE_CARBONS
(use Disco::Info::hasFeature()).
If the feature exists, you can enable Message Carbons with the server.
Chat
to all other Carbons-enabled resources of the current account. You have to make sure that you actually send messages of type Chat
. The default is currently Normal
.Once enabled, you can easily disable Message carbons. The code is almost identical to the code used to enable the feature, except that you use a Carbons::Type of Carbons::Disable when you add the Carbons extension to the IQ:
To disable carbon copies for a single message, add a Carbons extension of type Private:
The server will not copy this message to your other connected resources.
When receiving a message (sent by either another connected client of the current user, or by a 3rd party), a carbon copy will have the following characteristics:
from
attribute will be the bare JID of the receiving entity. from
attribute will be the full JID of the receiving entity. from/to
attributes.Some sample code:
You can also determine whether a carbon was sent by a 3rd party or a different client of the current user by checking the return value of Carbons::type().
XEP Version: 0.8
enum Type |
The types of Message Carbons stanza extensions.
Carbons | ( | Carbons::Type | type | ) |
Constructs a new Carbons instance of the given type. You should only use the Enable
, Disable
and Private
types.
type | The Carbons type to create. |
Definition at line 30 of file carbons.cpp.
Constructs a new Carbons instance from the given tag.
Definition at line 35 of file carbons.cpp.
|
virtual |
Virtual destructor.
Definition at line 59 of file carbons.cpp.
|
virtual |
Returns an identical copy of the current StanzaExtension.
Implements StanzaExtension.
Definition at line 98 of file carbons.cpp.
|
virtual |
This function returns the embedded Stanza, if any. You only have to reimplement it if your protocol flow contains embedded Stanzas.
Reimplemented from StanzaExtension.
Definition at line 70 of file carbons.cpp.
|
virtual |
This function returns the embedded Tag that the embedded Stanza is based on, if any. You only have to reimplement it if your protocol flow contains embedded Stanzas.
Reimplemented from StanzaExtension.
Definition at line 78 of file carbons.cpp.
|
virtual |
Returns an XPath expression that describes a path to child elements of a stanza that an extension handles.
Implements StanzaExtension.
Definition at line 64 of file carbons.cpp.
|
inlinevirtual |
Returns a new Instance of the derived type. Usually, for a derived class FooExtension, the implementation of this function looks like:
Implements StanzaExtension.
|
virtual |
Returns a Tag representation of the extension.
Implements StanzaExtension.
Definition at line 86 of file carbons.cpp.
|
inline |