LeechCraft Azoth  0.6.70-3565-g2d86529
Modular multiprotocol IM plugin for LeechCraft
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
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 
36 class QObject;
37 class QWebFrame;
38 
39 namespace LeechCraft
40 {
41 namespace Util
42 {
43  class ResourceLoader;
44 }
45 
46 namespace Azoth
47 {
49  {
50  public:
51  virtual ~IFormatterProxyObject () {}
52 
67  virtual QList<QColor> GenerateColors (const QString& scheme, QColor bg) const = 0;
68 
79  virtual QString GetNickColor (const QString& nick, const QList<QColor>& colors) const = 0;
80 
90  virtual QString FormatDate (QDateTime date, QObject *message) const = 0;
91 
103  virtual QString FormatNickname (QString nick, QObject *message, const QString& color) const = 0;
104 
120  virtual QString FormatBody (QString body, QObject *message, const QList<QColor>& coloring) const = 0;
121 
129  virtual void PreprocessMessage (QObject *message) = 0;
130 
131  virtual void FormatLinks (QString& body) = 0;
132 
133  virtual QStringList FindLinks (const QString&) = 0;
134  };
135 
137  {
138  public:
139  virtual ~IProxyObject () {}
140 
142  {
146  };
147 
155  virtual QObject* GetSettingsManager () = 0;
156 
175  virtual void SetPassword (const QString& password, QObject *account) = 0;
176 
208  virtual QString GetAccountPassword (QObject *account, bool useStored = true) = 0;
209 
214  virtual bool IsAutojoinAllowed () = 0;
215 
220  virtual QString StateToString (State state) const = 0;
221 
228  virtual QString AuthStatusToString (AuthStatus status) const = 0;
229 
242  virtual AuthStatus AuthStatusFromString (const QString& str) const = 0;
243 
253  virtual QObject* GetAccount (const QString& accID) const = 0;
254 
259  virtual QList<QObject*> GetAllAccounts () const = 0;
260 
272  virtual QObject* GetEntry (const QString& entryID, const QString& accID = {}) const = 0;
273 
285  virtual void OpenChat (const QString& entryID,
286  const QString& accID,
287  const QString& message = QString (),
288  const QString& variant = QString ()) const = 0;
289 
290  virtual QWidget* FindOpenedChat (const QString& entryID, const QByteArray& accID) const = 0;
291 
292  virtual Util::ResourceLoader* GetResourceLoader (PublicResourceLoader loader) const = 0;
293 
294  virtual QIcon GetIconForState (State state) const = 0;
295 
296  virtual QObject* CreateCoreMessage (const QString& body,
297  const QDateTime& date,
298  IMessage::Type type,
300  QObject *other,
301  QObject *parent = nullptr) = 0;
302 
303  virtual QString ToPlainBody (QString body) = 0;
304 
305  virtual bool IsMessageRead (QObject *msgObj) = 0;
306 
307  virtual void MarkMessagesAsRead (QObject *entryObject) = 0;
308 
321  virtual QString PrettyPrintDateTime (const QDateTime& datetime) = 0;
322 
331  virtual boost::optional<CustomStatus> FindCustomStatus (const QString& name) const = 0;
332 
343  virtual QStringList GetCustomStatusNames () const = 0;
344 
345  virtual void RedrawItem (QObject*) const = 0;
346 
347  virtual QObject* GetFirstUnreadMessage (QObject *entryObj) const = 0;
348 
349  virtual IFormatterProxyObject& GetFormatterProxy () = 0;
350  };
351 }
352 }
353 
355  "org.LeechCraft.Azoth.IProxyObject/1.0");
virtual QObject * GetFirstUnreadMessage(QObject *entryObj) const =0
virtual QString StateToString(State state) const =0
Returns a human-readable string for the given state.
virtual QIcon GetIconForState(State state) const =0
virtual QString FormatDate(QDateTime date, QObject *message) const =0
Formats the date for the given message.
virtual QString AuthStatusToString(AuthStatus status) const =0
Returns serialized name of the authorization status.
virtual QString GetNickColor(const QString &nick, const QList< QColor > &colors) const =0
Returns the color for the given nick and color set.
virtual QStringList GetCustomStatusNames() const =0
Returns the names of all available custom statuses.
virtual boost::optional< CustomStatus > FindCustomStatus(const QString &name) const =0
Tries to find a cusotm status under the given name.
virtual void RedrawItem(QObject *) const =0
virtual bool IsMessageRead(QObject *msgObj)=0
virtual QString PrettyPrintDateTime(const QDateTime &datetime)=0
Formats the datetime according to current locale.
virtual QWidget * FindOpenedChat(const QString &entryID, const QByteArray &accID) const =0
virtual QList< QObject * > GetAllAccounts() const =0
Returns all the accounts registered in Azoth.
virtual IFormatterProxyObject & GetFormatterProxy()=0
virtual void MarkMessagesAsRead(QObject *entryObject)=0
virtual void SetPassword(const QString &password, QObject *account)=0
Stores the password for the given account.
virtual Util::ResourceLoader * GetResourceLoader(PublicResourceLoader loader) const =0
virtual QStringList FindLinks(const QString &)=0
virtual void FormatLinks(QString &body)=0
virtual bool IsAutojoinAllowed()=0
Queries whether autojoin is allowed.
virtual QString GetAccountPassword(QObject *account, bool useStored=true)=0
Retrieves password for the given account, asking user if needed.
virtual QString FormatNickname(QString nick, QObject *message, const QString &color) const =0
Formats the nickname for the given message and color.
Type
Represents possible message types.
Definition: imessage.h:83
virtual void PreprocessMessage(QObject *message)=0
Preprocesses the message before displaying it.
virtual QList< QColor > GenerateColors(const QString &scheme, QColor bg) const =0
Generates the nickname colors for the given scheme.
Direction
Represents the direction of the message.
Definition: imessage.h:70
virtual QObject * CreateCoreMessage(const QString &body, const QDateTime &date, IMessage::Type type, IMessage::Direction dir, QObject *other, QObject *parent=nullptr)=0
virtual QObject * GetEntry(const QString &entryID, const QString &accID={}) const =0
Returns the entry object for the given entry ID.
virtual QString ToPlainBody(QString body)=0
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 QObject * GetSettingsManager()=0
Returns the Core's settings manager object.
virtual QString FormatBody(QString body, QObject *message, const QList< QColor > &coloring) const =0
Formats the body for the given message.
virtual AuthStatus AuthStatusFromString(const QString &str) const =0
Converts string representation to AuthStatus element.
virtual QObject * GetAccount(const QString &accID) const =0
Returns the account object for the given account ID.
Q_DECLARE_INTERFACE(LeechCraft::Azoth::IProxyObject,"org.LeechCraft.Azoth.IProxyObject/1.0")