LeechCraft Azoth  0.6.70-15082-g543737046d
Modular multiprotocol IM plugin for LeechCraft
iproxyobject.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <optional>
12 #include <QString>
13 #include "azothcommon.h"
14 #include "ihaveavatars.h"
15 
16 class QObject;
17 
18 template<typename>
19 class QFuture;
20 
21 namespace LC
22 {
23 namespace Util
24 {
25  class ResourceLoader;
26 }
27 
28 namespace Azoth
29 {
31  {
32  public:
33  virtual ~IFormatterProxyObject () {}
34 
49  virtual QList<QColor> GenerateColors (const QString& scheme, QColor bg) const = 0;
50 
61  virtual QString GetNickColor (const QString& nick, const QList<QColor>& colors) const = 0;
62 
72  virtual QString FormatDate (QDateTime date, QObject *message) const = 0;
73 
85  virtual QString FormatNickname (QString nick, QObject *message, const QString& color) const = 0;
86 
87  virtual QString EscapeBody (QString body, IMessage::EscapePolicy) const = 0;
88 
104  virtual QString FormatBody (QString body, QObject *message, const QList<QColor>& coloring) const = 0;
105 
113  virtual void PreprocessMessage (QObject *message) = 0;
114 
115  virtual void FormatLinks (QString& body) = 0;
116 
117  virtual QStringList FindLinks (const QString&) = 0;
118  };
119 
121  {
122  protected:
123  virtual ~IAvatarsManager () {}
124  public:
125  virtual QFuture<QImage> GetAvatar (QObject *entryObj, IHaveAvatars::Size size) = 0;
126 
127  virtual QFuture<std::optional<QByteArray>> GetStoredAvatarData (const QString& entryId, IHaveAvatars::Size size) = 0;
128  };
129 
131  {
132  public:
133  virtual ~IProxyObject () {}
134 
136  {
140  };
141 
149  virtual QObject* GetSettingsManager () = 0;
150 
169  virtual void SetPassword (const QString& password, QObject *account) = 0;
170 
202  virtual QString GetAccountPassword (QObject *account, bool useStored = true) = 0;
203 
208  virtual bool IsAutojoinAllowed () = 0;
209 
214  virtual QString StateToString (State state) const = 0;
215 
222  virtual QByteArray AuthStatusToString (AuthStatus status) const = 0;
223 
236  virtual AuthStatus AuthStatusFromString (const QByteArray& str) const = 0;
237 
247  virtual QObject* GetAccount (const QString& accID) const = 0;
248 
253  virtual QList<QObject*> GetAllAccounts () const = 0;
254 
266  virtual QObject* GetEntry (const QString& entryID, const QString& accID = {}) const = 0;
267 
279  virtual void OpenChat (const QString& entryID,
280  const QString& accID,
281  const QString& message = QString (),
282  const QString& variant = QString ()) const = 0;
283 
284  virtual QWidget* FindOpenedChat (const QString& entryID, const QByteArray& accID) const = 0;
285 
286  virtual Util::ResourceLoader* GetResourceLoader (PublicResourceLoader loader) const = 0;
287 
288  virtual QIcon GetIconForState (State state) const = 0;
289 
290  virtual QObject* CreateCoreMessage (const QString& body,
291  const QDateTime& date,
292  IMessage::Type type,
294  QObject *other,
295  QObject *parent = nullptr) = 0;
296 
297  virtual QString ToPlainBody (QString body) = 0;
298 
299  virtual bool IsMessageRead (QObject *msgObj) = 0;
300 
301  virtual void MarkMessagesAsRead (QObject *entryObject) = 0;
302 
315  virtual QString PrettyPrintDateTime (const QDateTime& datetime) = 0;
316 
325  virtual std::optional<CustomStatus> FindCustomStatus (const QString& name) const = 0;
326 
337  virtual QStringList GetCustomStatusNames () const = 0;
338 
339  virtual void RedrawItem (QObject*) const = 0;
340 
341  virtual QObject* GetFirstUnreadMessage (QObject *entryObj) const = 0;
342 
343  virtual QImage GetDefaultAvatar (int size = -1) const = 0;
344 
345  virtual IFormatterProxyObject& GetFormatterProxy () = 0;
346 
347  virtual IAvatarsManager* GetAvatarsManager () = 0;
348  };
349 }
350 }
351 
352 Q_DECLARE_INTERFACE (LC::Azoth::IProxyObject,
353  "org.LeechCraft.Azoth.IProxyObject/1.0")
LC::Azoth::IFormatterProxyObject::FindLinks
virtual QStringList FindLinks(const QString &)=0
LC::Azoth::IProxyObject::GetAccount
virtual QObject * GetAccount(const QString &accID) const =0
Returns the account object for the given account ID.
ihaveavatars.h
LC::Azoth::IProxyObject::CreateCoreMessage
virtual QObject * CreateCoreMessage(const QString &body, const QDateTime &date, IMessage::Type type, IMessage::Direction dir, QObject *other, QObject *parent=nullptr)=0
LC::Azoth::IProxyObject::GetResourceLoader
virtual Util::ResourceLoader * GetResourceLoader(PublicResourceLoader loader) const =0
LC::Azoth::IProxyObject::GetAccountPassword
virtual QString GetAccountPassword(QObject *account, bool useStored=true)=0
Retrieves password for the given account, asking user if needed.
LC::Azoth::IProxyObject::GetIconForState
virtual QIcon GetIconForState(State state) const =0
LC::Azoth::IProxyObject::AuthStatusFromString
virtual AuthStatus AuthStatusFromString(const QByteArray &str) const =0
Converts string representation to AuthStatus element.
LC::Azoth::IFormatterProxyObject::GetNickColor
virtual QString GetNickColor(const QString &nick, const QList< QColor > &colors) const =0
Returns the color for the given nick and color set.
QList
Definition: iaccountactionsprovider.h:16
LC::Azoth::IMessage::EscapePolicy
EscapePolicy
Definition: imessage.h:165
LC::Azoth::IProxyObject::FindOpenedChat
virtual QWidget * FindOpenedChat(const QString &entryID, const QByteArray &accID) const =0
LC::Azoth::IProxyObject::GetCustomStatusNames
virtual QStringList GetCustomStatusNames() const =0
Returns the names of all available custom statuses.
LC::Azoth::IProxyObject::MarkMessagesAsRead
virtual void MarkMessagesAsRead(QObject *entryObject)=0
LC::Azoth::IProxyObject::StateToString
virtual QString StateToString(State state) const =0
Returns a human-readable string for the given state.
LC::Azoth::IFormatterProxyObject::~IFormatterProxyObject
virtual ~IFormatterProxyObject()
Definition: iproxyobject.h:33
LC::Azoth::IProxyObject::GetDefaultAvatar
virtual QImage GetDefaultAvatar(int size=-1) const =0
LC::Azoth::IFormatterProxyObject::EscapeBody
virtual QString EscapeBody(QString body, IMessage::EscapePolicy) const =0
LC::Azoth::IProxyObject::PublicResourceLoader
PublicResourceLoader
Definition: iproxyobject.h:135
LC::Azoth::IProxyObject::FindCustomStatus
virtual std::optional< CustomStatus > FindCustomStatus(const QString &name) const =0
Tries to find a cusotm status under the given name.
LC::Azoth::IProxyObject::GetAllAccounts
virtual QList< QObject * > GetAllAccounts() const =0
Returns all the accounts registered in Azoth.
LC::Azoth::IProxyObject::SetPassword
virtual void SetPassword(const QString &password, QObject *account)=0
Stores the password for the given account.
LC::Azoth::IProxyObject::PrettyPrintDateTime
virtual QString PrettyPrintDateTime(const QDateTime &datetime)=0
Formats the datetime according to current locale.
LC::Azoth::IHaveAvatars::Size
Size
The size of the avatar.
Definition: ihaveavatars.h:46
LC::Azoth::IProxyObject::GetSettingsManager
virtual QObject * GetSettingsManager()=0
Returns the Core's settings manager object.
LC::Azoth::IProxyObject::IsAutojoinAllowed
virtual bool IsAutojoinAllowed()=0
Queries whether autojoin is allowed.
LC::Azoth::IMessage::Direction
Direction
Represents the direction of the message.
Definition: imessage.h:49
LC::Azoth::IProxyObject::RedrawItem
virtual void RedrawItem(QObject *) const =0
LC::Azoth::IProxyObject::PRLClientIcons
@ PRLClientIcons
Definition: iproxyobject.h:137
LC::Azoth::IFormatterProxyObject
Definition: iproxyobject.h:30
LC::Azoth::IProxyObject::~IProxyObject
virtual ~IProxyObject()
Definition: iproxyobject.h:133
LC::Azoth::IProxyObject::GetFormatterProxy
virtual IFormatterProxyObject & GetFormatterProxy()=0
LC::Azoth::IFormatterProxyObject::FormatLinks
virtual void FormatLinks(QString &body)=0
LC::Azoth::IProxyObject::ToPlainBody
virtual QString ToPlainBody(QString body)=0
LC::Azoth::IProxyObject::AuthStatusToString
virtual QByteArray AuthStatusToString(AuthStatus status) const =0
Returns serialized name of the authorization status.
LC::Azoth::IProxyObject::GetAvatarsManager
virtual IAvatarsManager * GetAvatarsManager()=0
LC::Azoth::IProxyObject::GetFirstUnreadMessage
virtual QObject * GetFirstUnreadMessage(QObject *entryObj) const =0
LC::Azoth::AuthStatus
AuthStatus
Definition: azothcommon.h:81
LC::Azoth::IProxyObject::OpenChat
virtual void OpenChat(const QString &entryID, const QString &accID, const QString &message=QString(), const QString &variant=QString()) const =0
Opens the chat with the given entry.
LC::Azoth::IProxyObject::PRLSystemIcons
@ PRLSystemIcons
Definition: iproxyobject.h:139
LC::Azoth::IFormatterProxyObject::PreprocessMessage
virtual void PreprocessMessage(QObject *message)=0
Preprocesses the message before displaying it.
LC::Azoth::IProxyObject
Definition: iproxyobject.h:130
LC
Definition: activityinfo.h:13
LC::Azoth::IAvatarsManager
Definition: iproxyobject.h:120
LC::Azoth::State
State
Describes possible presence states of an account or a contact.
Definition: azothcommon.h:34
QFuture
Definition: ihaveserverhistory.h:21
LC::Azoth::IProxyObject::GetEntry
virtual QObject * GetEntry(const QString &entryID, const QString &accID={}) const =0
Returns the entry object for the given entry ID.
LC::Azoth::IAvatarsManager::GetStoredAvatarData
virtual QFuture< std::optional< QByteArray > > GetStoredAvatarData(const QString &entryId, IHaveAvatars::Size size)=0
azothcommon.h
LC::Azoth::IFormatterProxyObject::FormatBody
virtual QString FormatBody(QString body, QObject *message, const QList< QColor > &coloring) const =0
Formats the body for the given message.
LC::Azoth::IFormatterProxyObject::GenerateColors
virtual QList< QColor > GenerateColors(const QString &scheme, QColor bg) const =0
Generates the nickname colors for the given scheme.
LC::Azoth::IFormatterProxyObject::FormatDate
virtual QString FormatDate(QDateTime date, QObject *message) const =0
Formats the date for the given message.
LC::Azoth::IAvatarsManager::GetAvatar
virtual QFuture< QImage > GetAvatar(QObject *entryObj, IHaveAvatars::Size size)=0
LC::Azoth::IAvatarsManager::~IAvatarsManager
virtual ~IAvatarsManager()
Definition: iproxyobject.h:123
LC::Azoth::IFormatterProxyObject::FormatNickname
virtual QString FormatNickname(QString nick, QObject *message, const QString &color) const =0
Formats the nickname for the given message and color.
LC::Azoth::IProxyObject::PRLStatusIcons
@ PRLStatusIcons
Definition: iproxyobject.h:138
LC::Azoth::IMessage::Type
Type
Represents possible message types.
Definition: imessage.h:62
LC::Azoth::IProxyObject::IsMessageRead
virtual bool IsMessageRead(QObject *msgObj)=0