LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
LC::Azoth::IHaveConsole Class Referenceabstract

Interface for accounts that support protocol consoles. More...

#include "ihaveconsole.h"

Public Types

enum  PacketFormat { PacketFormat::XML, PacketFormat::PlainText, PacketFormat::Binary }
 Defines the format of the packets in this protocol. More...
 
enum  PacketDirection { PacketDirection::In, PacketDirection::Out }
 Defines the direction of a packet. More...
 

Public Member Functions

virtual ~IHaveConsole ()
 
virtual PacketFormat GetPacketFormat () const =0
 Returns the packet format used in this account. More...
 
virtual void SetConsoleEnabled (bool enabled)=0
 Enables or disables the console. More...
 

Protected Member Functions

virtual void gotConsolePacket (const QByteArray &packet, PacketDirection direction, const QString &hrEntryId)=0
 Notifies about new packet. More...
 

Detailed Description

Interface for accounts that support protocol consoles.

An example of a protocol console may be an XML console for XMPP protocol or just raw text console for IRC.

The account supporting console notifies about new packets (both incoming and outgoing) by the gotConsolePacket() signal.

Azoth core and other plugins may toggle the status of the console by the means of SetConsoleEnabled() function. By default, the console for each account should be disabled.

See also
IAccount

Definition at line 43 of file ihaveconsole.h.

Member Enumeration Documentation

◆ PacketDirection

Defines the direction of a packet.

Enumerator
In 

Incoming packet.

Out 

Outgoing packet.

Definition at line 80 of file ihaveconsole.h.

◆ PacketFormat

Defines the format of the packets in this protocol.

Enumerator
XML 

XML packets (like in XMPP).

       The packets would be represented as formatted XML text.
PlainText 

Plain text packets (like in IRC).

       The packets would be represented as unformatted plain
       text.
Binary 

Binary packets (like in Oscar).

       The packets would be converted to Base64 or Hex-encoding.

Definition at line 56 of file ihaveconsole.h.

Constructor & Destructor Documentation

◆ ~IHaveConsole()

virtual LC::Azoth::IHaveConsole::~IHaveConsole ( )
inlinevirtual

Definition at line 52 of file ihaveconsole.h.

Member Function Documentation

◆ GetPacketFormat()

virtual PacketFormat LC::Azoth::IHaveConsole::GetPacketFormat ( ) const
pure virtual

Returns the packet format used in this account.

Returns
The packet format.

◆ gotConsolePacket()

virtual void LC::Azoth::IHaveConsole::gotConsolePacket ( const QByteArray &  packet,
PacketDirection  direction,
const QString &  hrEntryId 
)
protectedpure virtual

Notifies about new packet.

This signal is used by the console-supporting account to notify about new packets, both incoming and outgoing.

This signal should be emitted if and only if the console has been explicitly enabled for this account by calling the SetConsoleEnabled() function.

Note
This function is expected to be a signal.
Parameters
[out]packetThe packet data.
[out]directionThe direction of the packet, member of the PacketDirection enum.
[out]hrEntryIdThe human-readable ID of the related entry, or null string if not applicable.

◆ SetConsoleEnabled()

virtual void LC::Azoth::IHaveConsole::SetConsoleEnabled ( bool  enabled)
pure virtual

Enables or disables the console.

This function toggles the status of the console for the corresponding account.

If the console is enabled, only this account's packets should be emitted by the gotConsolePacket() signal. If the console is disabled, gotConsolePacket() signal shouldn't be emitted at all.

By default, console for each account should be in disabled state, unless explicitly enabled by calling this function.

Parameters
[in]enabledWhether the console should be enabled.

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