LeechCraft Azoth 0.6.70-19214-g121e5318a7
Modular multiprotocol IM plugin for LeechCraft
Loading...
Searching...
No Matches
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
16class QObject;
17
18template<typename>
19class QFuture;
20
21namespace LC
22{
23namespace Util
24{
25 class ResourceLoader;
26}
27
28namespace Azoth
29{
30 struct InjectedMessage;
31 class Hooks;
32
34 {
35 public:
37
52 virtual QList<QColor> GenerateColors (const QString& scheme, QColor bg) const = 0;
53
64 virtual QString GetNickColor (const QString& nick, const QList<QColor>& colors) const = 0;
65
77 virtual QString FormatNickname (QString nick, QObject *message, const QString& color) const = 0;
78
79 virtual QString EscapeBody (QString body, IMessage::EscapePolicy) const = 0;
80
96 virtual QString FormatBody (QString body, QObject *message, const QList<QColor>& coloring) const = 0;
97
98 virtual void FormatLinks (QString& body) = 0;
99
100 virtual QStringList FindLinks (const QString&) = 0;
101 };
102
104 {
105 protected:
106 virtual ~IAvatarsManager () {}
107 public:
108 virtual QFuture<QImage> GetAvatar (QObject *entryObj, IHaveAvatars::Size size) = 0;
109
111 };
112
114 {
115 public:
116 virtual ~IProxyObject () {}
117
124
132 virtual QObject* GetSettingsManager () = 0;
133
152 virtual void SetPassword (const QString& password, QObject *account) = 0;
153
185 virtual QString GetAccountPassword (QObject *account, bool useStored = true) = 0;
186
191 virtual bool IsAutojoinAllowed () = 0;
192
199 virtual QByteArray AuthStatusToString (AuthStatus status) const = 0;
200
213 virtual AuthStatus AuthStatusFromString (const QByteArray& str) const = 0;
214
224 virtual QObject* GetAccount (const QString& accID) const = 0;
225
230 virtual QList<QObject*> GetAllAccounts () const = 0;
231
238 virtual ICLEntry* GetEntry (const GlobalStrongestId& entryID) const = 0;
239
251 virtual void OpenChat (const QString& entryID,
252 const QString& accID,
253 const QString& message = QString (),
254 const QString& variant = QString ()) const = 0;
255
256 virtual QWidget* FindOpenedChat (const QString& entryID, const QByteArray& accID) const = 0;
257
258 virtual Util::ResourceLoader* GetResourceLoader (PublicResourceLoader loader) const = 0;
259
260 virtual QIcon GetIconForState (State state) const = 0;
261
262 virtual void InjectMessage (ICLEntry&, const InjectedMessage&) = 0;
263
264 virtual QString ToPlainBody (QString body) = 0;
265
266 virtual bool IsMessageRead (QObject *msgObj) = 0;
267
268 virtual void MarkMessagesAsRead (QObject *entryObject) = 0;
269
278 virtual std::optional<CustomStatus> FindCustomStatus (const QString& name) const = 0;
279
290 virtual QStringList GetCustomStatusNames () const = 0;
291
292 virtual void RedrawItem (ICLEntry*) const = 0;
293
294 virtual QObject* GetFirstUnreadMessage (QObject *entryObj) const = 0;
295
296 virtual QImage GetDefaultAvatar (int size = -1) const = 0;
297
299
301
302 virtual Hooks& GetHooks () = 0;
303 };
304}
305}
306
307Q_DECLARE_INTERFACE (LC::Azoth::IProxyObject,
308 "org.LeechCraft.Azoth.IProxyObject/1.0")
virtual QFuture< QImage > GetAvatar(QObject *entryObj, IHaveAvatars::Size size)=0
virtual QFuture< std::optional< QByteArray > > GetStoredAvatarData(const QString &entryId, IHaveAvatars::Size size)=0
Represents a single entry in contact list.
Definition iclentry.h:49
virtual QList< QColor > GenerateColors(const QString &scheme, QColor bg) const =0
Generates the nickname colors for the given scheme.
virtual QString FormatNickname(QString nick, QObject *message, const QString &color) const =0
Formats the nickname for the given message and color.
virtual QStringList FindLinks(const QString &)=0
virtual QString EscapeBody(QString body, IMessage::EscapePolicy) const =0
virtual void FormatLinks(QString &body)=0
virtual QString GetNickColor(const QString &nick, const QList< QColor > &colors) const =0
Returns the color for the given nick and color set.
virtual QString FormatBody(QString body, QObject *message, const QList< QColor > &coloring) const =0
Formats the body for the given message.
Size
The size of the avatar.
virtual void SetPassword(const QString &password, QObject *account)=0
Stores the password for the given account.
virtual std::optional< CustomStatus > FindCustomStatus(const QString &name) const =0
Tries to find a cusotm status under the given name.
virtual QString ToPlainBody(QString body)=0
virtual void MarkMessagesAsRead(QObject *entryObject)=0
virtual QObject * GetFirstUnreadMessage(QObject *entryObj) const =0
virtual QObject * GetAccount(const QString &accID) const =0
Returns the account object for the given account ID.
virtual IFormatterProxyObject & GetFormatterProxy()=0
virtual AuthStatus AuthStatusFromString(const QByteArray &str) const =0
Converts string representation to AuthStatus element.
virtual QByteArray AuthStatusToString(AuthStatus status) const =0
Returns serialized name of the authorization status.
virtual void InjectMessage(ICLEntry &, const InjectedMessage &)=0
virtual QStringList GetCustomStatusNames() const =0
Returns the names of all available custom statuses.
virtual QObject * GetSettingsManager()=0
Returns the Core's settings manager object.
virtual QList< QObject * > GetAllAccounts() const =0
Returns all the accounts registered in Azoth.
virtual ICLEntry * GetEntry(const GlobalStrongestId &entryID) const =0
Returns the entry for the given entry ID.
virtual bool IsMessageRead(QObject *msgObj)=0
virtual IAvatarsManager * GetAvatarsManager()=0
virtual QWidget * FindOpenedChat(const QString &entryID, const QByteArray &accID) const =0
virtual bool IsAutojoinAllowed()=0
Queries whether autojoin is allowed.
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.
virtual void RedrawItem(ICLEntry *) const =0
virtual Hooks & GetHooks()=0
virtual QIcon GetIconForState(State state) const =0
virtual QString GetAccountPassword(QObject *account, bool useStored=true)=0
Retrieves password for the given account, asking user if needed.
virtual Util::ResourceLoader * GetResourceLoader(PublicResourceLoader loader) const =0
virtual QImage GetDefaultAvatar(int size=-1) const =0
State
Describes possible presence states of an account or a contact.
StrongestId< GlobalId > GlobalStrongestId
Definition azothcommon.h:89