LeechCraft Azoth  0.6.70-6645-gcd10d7e
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  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #pragma once
31 
32 #include <boost/optional.hpp>
33 #include <QString>
34 #include "azothcommon.h"
35 #include "ihaveavatars.h"
36 
37 class QObject;
38 class QWebFrame;
39 
40 template<typename>
41 class QFuture;
42 
43 namespace LeechCraft
44 {
45 namespace Util
46 {
47  class ResourceLoader;
48 }
49 
50 namespace Azoth
51 {
53  {
54  public:
55  virtual ~IFormatterProxyObject () {}
56 
71  virtual QList<QColor> GenerateColors (const QString& scheme, QColor bg) const = 0;
72 
83  virtual QString GetNickColor (const QString& nick, const QList<QColor>& colors) const = 0;
84 
94  virtual QString FormatDate (QDateTime date, QObject *message) const = 0;
95 
107  virtual QString FormatNickname (QString nick, QObject *message, const QString& color) const = 0;
108 
124  virtual QString FormatBody (QString body, QObject *message, const QList<QColor>& coloring) const = 0;
125 
133  virtual void PreprocessMessage (QObject *message) = 0;
134 
135  virtual void FormatLinks (QString& body) = 0;
136 
137  virtual QStringList FindLinks (const QString&) = 0;
138  };
139 
141  {
142  protected:
143  virtual ~IAvatarsManager () {}
144  public:
145  virtual QFuture<QImage> GetAvatar (QObject *entryObj, IHaveAvatars::Size size) = 0;
146  };
147 
149  {
150  public:
151  virtual ~IProxyObject () {}
152 
154  {
157  PRLSystemIcons
158  };
159 
167  virtual QObject* GetSettingsManager () = 0;
168 
187  virtual void SetPassword (const QString& password, QObject *account) = 0;
188 
220  virtual QString GetAccountPassword (QObject *account, bool useStored = true) = 0;
221 
226  virtual bool IsAutojoinAllowed () = 0;
227 
232  virtual QString StateToString (State state) const = 0;
233 
240  virtual QString AuthStatusToString (AuthStatus status) const = 0;
241 
254  virtual AuthStatus AuthStatusFromString (const QString& str) const = 0;
255 
265  virtual QObject* GetAccount (const QString& accID) const = 0;
266 
271  virtual QList<QObject*> GetAllAccounts () const = 0;
272 
284  virtual QObject* GetEntry (const QString& entryID, const QString& accID = {}) const = 0;
285 
297  virtual void OpenChat (const QString& entryID,
298  const QString& accID,
299  const QString& message = QString (),
300  const QString& variant = QString ()) const = 0;
301 
302  virtual QWidget* FindOpenedChat (const QString& entryID, const QByteArray& accID) const = 0;
303 
304  virtual Util::ResourceLoader* GetResourceLoader (PublicResourceLoader loader) const = 0;
305 
306  virtual QIcon GetIconForState (State state) const = 0;
307 
308  virtual QObject* CreateCoreMessage (const QString& body,
309  const QDateTime& date,
310  IMessage::Type type,
312  QObject *other,
313  QObject *parent = nullptr) = 0;
314 
315  virtual QString ToPlainBody (QString body) = 0;
316 
317  virtual bool IsMessageRead (QObject *msgObj) = 0;
318 
319  virtual void MarkMessagesAsRead (QObject *entryObject) = 0;
320 
333  virtual QString PrettyPrintDateTime (const QDateTime& datetime) = 0;
334 
343  virtual boost::optional<CustomStatus> FindCustomStatus (const QString& name) const = 0;
344 
355  virtual QStringList GetCustomStatusNames () const = 0;
356 
357  virtual void RedrawItem (QObject*) const = 0;
358 
359  virtual QObject* GetFirstUnreadMessage (QObject *entryObj) const = 0;
360 
361  virtual QImage GetDefaultAvatar (int size = -1) const = 0;
362 
363  virtual IFormatterProxyObject& GetFormatterProxy () = 0;
364 
365  virtual IAvatarsManager* GetAvatarsManager () = 0;
366  };
367 }
368 }
369 
371  "org.LeechCraft.Azoth.IProxyObject/1.0");
State
Describes possible presence states of an account or a contact.
Definition: azothcommon.h:43
Size
The size of the avatar.
Definition: ihaveavatars.h:49
Type
Represents possible message types.
Definition: imessage.h:83
Direction
Represents the direction of the message.
Definition: imessage.h:70
Q_DECLARE_INTERFACE(LeechCraft::Azoth::IProxyObject,"org.LeechCraft.Azoth.IProxyObject/1.0")