Home · Modules · All Classes · All Namespaces
Public Member Functions | List of all members
Tp::ProtocolInfo Class Reference

The ProtocolInfo class represents a Telepathy Protocol. More...

#include <TelepathyQt/ProtocolInfo>

Public Member Functions

 ProtocolInfo ()
 
 ProtocolInfo (const ProtocolInfo &other)
 
 ~ProtocolInfo ()
 
bool isValid () const
 
ProtocolInfooperator= (const ProtocolInfo &other)
 
QString cmName () const
 
QString name () const
 
ProtocolParameterList parameters () const
 
bool hasParameter (const QString &name) const
 
bool canRegister () const
 
ConnectionCapabilities capabilities () const
 
QString vcardField () const
 
QString englishName () const
 
QString iconName () const
 
PresenceSpecList allowedPresenceStatuses () const
 
AvatarSpec avatarRequirements () const
 
QStringList addressableVCardFields () const
 
QStringList addressableUriSchemes () const
 
PendingStringnormalizeVCardAddress (const QString &vcardField, const QString &vcardAddress)
 
PendingStringnormalizeContactUri (const QString &uri)
 

Detailed Description

The ProtocolInfo class represents a Telepathy Protocol.

Constructor & Destructor Documentation

◆ ProtocolInfo() [1/2]

Tp::ProtocolInfo::ProtocolInfo ( )

◆ ProtocolInfo() [2/2]

Tp::ProtocolInfo::ProtocolInfo ( const ProtocolInfo other)

◆ ~ProtocolInfo()

Tp::ProtocolInfo::~ProtocolInfo ( )

Class destructor.

Member Function Documentation

◆ isValid()

bool Tp::ProtocolInfo::isValid ( ) const
inline

◆ operator=()

ProtocolInfo & Tp::ProtocolInfo::operator= ( const ProtocolInfo other)

◆ cmName()

QString Tp::ProtocolInfo::cmName ( ) const

Return the short name of the connection manager (e.g. "gabble") for this protocol.

Returns
The name of the connection manager for this protocol.

◆ name()

QString Tp::ProtocolInfo::name ( ) const

Return the string identifying this protocol as described in the Telepathy specification (e.g. "jabber").

This identifier is not intended to be displayed to users directly; user interfaces are responsible for mapping them to localized strings.

Returns
A string identifying this protocol.

◆ parameters()

ProtocolParameterList Tp::ProtocolInfo::parameters ( ) const

Return all supported parameters for this protocol. The parameters' names may either be the well-known strings specified by the Telepathy specification (e.g. "account" and "password"), or implementation-specific strings.

Returns
A list of parameters for this protocol.

◆ hasParameter()

bool Tp::ProtocolInfo::hasParameter ( const QString &  name) const

Return whether a given parameter can be passed to the connection manager when creating a connection to this protocol.

Parameters
nameThe name of a parameter.
Returns
true if the given parameter exists.

◆ canRegister()

bool Tp::ProtocolInfo::canRegister ( ) const

Return whether it might be possible to register new accounts on this protocol, by setting the special parameter named register to true.

Returns
The same thing as hasParameter("register").
See also
hasParameter()

◆ capabilities()

ConnectionCapabilities Tp::ProtocolInfo::capabilities ( ) const

Return the capabilities that are expected to be available from a connection to this protocol, i.e. those for which Connection::createChannel() can reasonably be expected to succeed. User interfaces can use this information to show or hide UI components.

Returns
An object representing the capabilities expected to be available from a connection to this protocol.

◆ vcardField()

QString Tp::ProtocolInfo::vcardField ( ) const

Return the name of the most common vcard field used for this protocol's contact identifiers, normalized to lower case.

One valid use of this field is to answer the question: given a contact's vcard containing an X-JABBER field, how can you communicate with the contact? By iterating through protocols looking for an x-jabber VCardField, one can build up a list of protocols that handle x-jabber, then offer the user a list of accounts for those protocols and/or the option to create a new account for one of those protocols. It is not necessarily valid to interpret contacts' identifiers as values of this vcard field. For instance, telepathy-sofiasip supports contacts whose identifiers are of the form sip:jenny.nosp@m.@exa.nosp@m.mple..nosp@m.com or tel:8675309, which would not normally both be represented by any single vcard field.

Returns
The most common vcard field used for this protocol's contact identifiers, or an empty string if there is no such field.

◆ englishName()

QString Tp::ProtocolInfo::englishName ( ) const

Return the English-language name of this protocol, such as "AIM" or "Yahoo!".

The name can be used as a fallback if an application doesn't have a localized name for this protocol.

If the manager file or the CM service doesn't specify the english name, it is inferred from this protocol name, such that for example "google-talk" becomes "Google Talk", but "local-xmpp" becomes "Local Xmpp".

Returns
An English-language name for this protocol.

◆ iconName()

QString Tp::ProtocolInfo::iconName ( ) const

Return the name of an icon for this protocol in the system's icon theme, such as "im-msn".

If the manager file or the CM service doesn't specify the icon name, "im-<protocolname>" is assumed.

Returns
The likely name of an icon for this protocol.

◆ allowedPresenceStatuses()

PresenceSpecList Tp::ProtocolInfo::allowedPresenceStatuses ( ) const

Return a list of PresenceSpec representing the possible presence statuses from a connection to this protocol.

Returns
A list of PresenceSpec representing the possible presence statuses from a connection to this protocol.

◆ avatarRequirements()

AvatarSpec Tp::ProtocolInfo::avatarRequirements ( ) const

Return the requirements (size limits, supported MIME types, etc) for avatars used on to this protocol.

Returns
The requirements for avatars used on this protocol.

◆ addressableVCardFields()

QStringList Tp::ProtocolInfo::addressableVCardFields ( ) const

Return the vcard fields that can be used to request a contact with on this protocol, normalized to lower case.

Returns
The vcard fields normalized to lower case.
See also
addressableUriSchemes()

◆ addressableUriSchemes()

QStringList Tp::ProtocolInfo::addressableUriSchemes ( ) const

Return the URI schemes that are supported by this protocol.

Returns
The URI schemes.
See also
addressableVCardFields()

◆ normalizeVCardAddress()

PendingString * Tp::ProtocolInfo::normalizeVCardAddress ( const QString &  vcardField,
const QString &  vcardAddress 
)

Attempt to normalize the given vcardAddress.

For example, a vcard TEL field formatted as +1 (206) 555 1234, could be normalized to +12065551234.

If a vcard address X would be normalized to Y, a successful ContactManager contact request using ContactManager::contactsForVCardAddresses() for vcard address X would result in a contact with Y reported as an address that can identify it in Contact::vcardAddresses().

Parameters
vcardFieldThe vcard field the vcardAddress belongs to.
vcardAddressThe address to normalize.
Returns
A PendingString which will emit PendingString::finished when the address has been normalized or an error occurred.
See also
normalizeContactUri()

◆ normalizeContactUri()

PendingString * Tp::ProtocolInfo::normalizeContactUri ( const QString &  uri)

Attempt to normalize the given contact uri.

If the URI has extra information beyond what's necessary to identify a particular contact, such as an XMPP resource or an action to carry out, this extra information wil be removed.

An example would be xmpp:romeo.nosp@m.@Exa.nosp@m.mple..nosp@m.Com/Empathy?message;body=Hello, which would be normalized to xmpp:romeo.nosp@m.@exa.nosp@m.mple..nosp@m.com.

If a URI address X would be normalized to Y, a successful ContactManager contact request using ContactManager::contactsForUris() for URI address X would result in a contact with Y reported as an address that can identify it in Contact::uris().

Parameters
uriThe URI to normalize.
Returns
A PendingString which will emit PendingString::finished when the uri has been normalized or an error occurred.
See also
normalizeVCardAddress()