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

#include "iproxyobject.h"

Public Member Functions

virtual ~IFormatterProxyObject ()
 
virtual QList< QColor > GenerateColors (const QString &scheme, QColor bg) const =0
 Generates the nickname colors for the given scheme. More...
 
virtual QString GetNickColor (const QString &nick, const QList< QColor > &colors) const =0
 Returns the color for the given nick and color set. More...
 
virtual QString FormatDate (QDateTime date, QObject *message) const =0
 Formats the date for the given message. More...
 
virtual QString FormatNickname (QString nick, QObject *message, const QString &color) const =0
 Formats the nickname for the given message and color. More...
 
virtual QString EscapeBody (QString body, IMessage::EscapePolicy) const =0
 
virtual QString FormatBody (QString body, QObject *message, const QList< QColor > &coloring) const =0
 Formats the body for the given message. More...
 
virtual void PreprocessMessage (QObject *message)=0
 Preprocesses the message before displaying it. More...
 
virtual void FormatLinks (QString &body)=0
 
virtual QStringList FindLinks (const QString &)=0
 

Detailed Description

Definition at line 30 of file iproxyobject.h.

Constructor & Destructor Documentation

◆ ~IFormatterProxyObject()

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

Definition at line 33 of file iproxyobject.h.

Member Function Documentation

◆ EscapeBody()

virtual QString LC::Azoth::IFormatterProxyObject::EscapeBody ( QString  body,
IMessage::EscapePolicy   
) const
pure virtual

◆ FindLinks()

virtual QStringList LC::Azoth::IFormatterProxyObject::FindLinks ( const QString &  )
pure virtual

◆ FormatBody()

virtual QString LC::Azoth::IFormatterProxyObject::FormatBody ( QString  body,
QObject *  message,
const QList< QColor > &  coloring 
) const
pure virtual

Formats the body for the given message.

This function should be used to format the body of the given message.

This function also accepts the list of colors used for nick coloring in the current chat window, since the body of the message may also be colored if it contains other participants' nicks.

Parameters
[in]bodyThe body to format.
[in]messageThe message object implementing IMessage.
[in]coloringThe set of colors used for nick coloring.
Returns
The formatted body.

◆ FormatDate()

virtual QString LC::Azoth::IFormatterProxyObject::FormatDate ( QDateTime  date,
QObject *  message 
) const
pure virtual

Formats the date for the given message.

This function should be used to format the date of a message when displaying it.

Parameters
[in]dateThe timestamp of the message to format.
[in]messageThe message object implementing IMessage.
Returns
The formatted date string.

◆ FormatLinks()

virtual void LC::Azoth::IFormatterProxyObject::FormatLinks ( QString &  body)
pure virtual

◆ FormatNickname()

virtual QString LC::Azoth::IFormatterProxyObject::FormatNickname ( QString  nick,
QObject *  message,
const QString &  color 
) const
pure virtual

Formats the nickname for the given message and color.

This function should be used to format the nick when displaying the given message. The color should be the one from GetNickColor().

Parameters
[in]nickThe nickname to format.
[in]messageThe message object implementing IMessage.
[in]colorThe color of the nickname.
Returns
The formatted nickname.

◆ GenerateColors()

virtual QList<QColor> LC::Azoth::IFormatterProxyObject::GenerateColors ( const QString &  scheme,
QColor  bg 
) const
pure virtual

Generates the nickname colors for the given scheme.

If the scheme is empty or equals "hash", then a random set of colors is generated based on bg and settings.

Otherwise, scheme is interpreted as space-separated list of colors, either named, like "green" or "cyan", or their RGB values in forms like "#FA12BB".

Parameters
[in]schemeThe color scheme to use.
[in]bgThe background color to generate colors for. Pass an invalid color to use application palette's background.
Returns
The list of colors matching the given color scheme.

◆ GetNickColor()

virtual QString LC::Azoth::IFormatterProxyObject::GetNickColor ( const QString &  nick,
const QList< QColor > &  colors 
) const
pure virtual

Returns the color for the given nick and color set.

This function should be used to choose a color for the given nick. Internally, it calculates a hash from the nick and uses it to choose a corresponding color.

Parameters
[in]nickThe nickname for which to choose the color.
[in]colorsThe list of colors to choose from.
Returns
The color name to use.

◆ PreprocessMessage()

virtual void LC::Azoth::IFormatterProxyObject::PreprocessMessage ( QObject *  message)
pure virtual

Preprocesses the message before displaying it.

This function should be called once on each message before displaying it.

Parameters
[in]messageThe message to preprocess.

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