LeechCraft Azoth  %{LEECHCRAFT_VERSION}
Modular multiprotocol IM plugin for LeechCraft
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
iclentry.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2013 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 #ifndef PLUGINS_AZOTH_INTERFACES_ICLENTRY_H
31 #define PLUGINS_AZOTH_INTERFACES_ICLENTRY_H
32 #include <QFlags>
33 #include <QMetaType>
34 #include "imessage.h"
35 #include "azothcommon.h"
36 
37 class QAction;
38 class QImage;
39 
40 namespace LeechCraft
41 {
42 namespace Azoth
43 {
44  class IAccount;
45  class IMessage;
46 
47  struct EntryStatus
48  {
50  QString StatusString_;
51 
53  : State_ (SOffline)
54  {
55  }
56 
57  EntryStatus (State state, const QString& str)
58  : State_ (state)
59  , StatusString_ (str)
60  {
61  }
62  };
63 
64  inline bool operator== (const EntryStatus& es1, const EntryStatus& es2)
65  {
66  return es1.State_ == es2.State_ &&
67  es1.StatusString_ == es2.StatusString_;
68  }
69 
70  inline bool operator!= (const EntryStatus& es1, const EntryStatus& es2)
71  {
72  return !(es1 == es2);
73  }
74 
102  class ICLEntry
103  {
104  public:
105  virtual ~ICLEntry () {}
106 
110  enum Feature
111  {
119  FPermanentEntry = 0x0000,
120 
124  FSessionEntry = 0x0001,
125 
129 
134 
138 
143  FSupportsAuth = 0x0080,
144 
148 
151  FSelfContact = 0x0200
152  };
153 
154  Q_DECLARE_FLAGS (Features, Feature)
155 
157  {
161 
165 
170 
175  };
176 
181  virtual QObject* GetQObject () = 0;
182 
188  virtual QObject* GetParentAccount () const = 0;
189 
204  virtual QObject* GetParentCLEntry () const
205  {
206  return 0;
207  }
208 
214  virtual Features GetEntryFeatures () const = 0;
215 
220  virtual EntryType GetEntryType () const = 0;
221 
228  virtual QString GetEntryName () const = 0;
229 
238  virtual void SetEntryName (const QString& name) = 0;
239 
258  virtual QString GetEntryID () const = 0;
259 
283  virtual QString GetHumanReadableID () const
284  {
285  return GetEntryID ();
286  }
287 
293  virtual QStringList Groups () const = 0;
294 
302  virtual void SetGroups (const QStringList& groups) = 0;
303 
320  virtual QStringList Variants () const = 0;
321 
341  virtual QObject* CreateMessage (IMessage::MessageType type,
342  const QString& variant,
343  const QString& body) = 0;
344 
355  virtual QList<QObject*> GetAllMessages () const = 0;
356 
371  virtual void PurgeMessages (const QDateTime& before) = 0;
372 
381  virtual void SetChatPartState (ChatPartState state,
382  const QString& variant) = 0;
383 
395  virtual EntryStatus GetStatus (const QString& variant = QString ()) const = 0;
396 
401  virtual QImage GetAvatar () const = 0;
402 
407  virtual QString GetRawInfo () const = 0;
408 
411  virtual void ShowInfo () = 0;
412 
421  virtual QList<QAction*> GetActions () const = 0;
422 
490  virtual QMap<QString, QVariant> GetClientInfo (const QString& variant) const = 0;
491 
502  virtual void MarkMsgsRead () = 0;
503 
506  virtual void ChatTabClosed () = 0;
507 
515  virtual void gotMessage (QObject *msg) = 0;
516 
525  virtual void statusChanged (const EntryStatus& st,
526  const QString& variant) = 0;
527 
536  virtual void availableVariantsChanged (const QStringList& newVars) = 0;
537 
543  virtual void avatarChanged (const QImage&) = 0;
544 
550  virtual void rawinfoChanged (const QString&) = 0;
551 
564  virtual void nameChanged (const QString& name) = 0;
565 
578  virtual void groupsChanged (const QStringList& groups) = 0;
579 
588  virtual void chatPartStateChanged (const ChatPartState& state,
589  const QString& variant) = 0;
590 
596  virtual void permsChanged () = 0;
597 
606  virtual void entryGenerallyChanged () = 0;
607  };
608 
609  Q_DECLARE_OPERATORS_FOR_FLAGS (ICLEntry::Features);
610 }
611 }
612 
614 
616  "org.Deviant.LeechCraft.Azoth.ICLEntry/1.0");
617 
618 #endif
Definition: iclentry.h:133
virtual QString GetRawInfo() const =0
Return string with raw information about the entry.
EntryStatus(State state, const QString &str)
Definition: iclentry.h:57
virtual void groupsChanged(const QStringList &groups)=0
This signal should be emitted whenever the entry&#39;s groups are changed.
Definition: iclentry.h:119
virtual void PurgeMessages(const QDateTime &before)=0
Purges messages before the given date.
Definition: iclentry.h:174
Definition: iclentry.h:164
Definition: iclentry.h:143
virtual QObject * GetQObject()=0
virtual void ShowInfo()=0
Requests the entry to show dialog with info about it.
virtual QObject * GetParentCLEntry() const
Definition: iclentry.h:204
Q_DECLARE_METATYPE(LeechCraft::Azoth::State)
virtual void statusChanged(const EntryStatus &st, const QString &variant)=0
This signal should be emitted whenever the status of a variant in this entry changes.
bool operator==(const EntryStatus &es1, const EntryStatus &es2)
Definition: iclentry.h:64
virtual void rawinfoChanged(const QString &)=0
This signal should be emitted whenever our copy of raw information is updated.
Definition: iclentry.h:169
Q_DECLARE_INTERFACE(LeechCraft::Azoth::IAccount,"org.Deviant.LeechCraft.Azoth.IAccount/1.0")
virtual QMap< QString, QVariant > GetClientInfo(const QString &variant) const =0
Returns the client information for the given variant.
virtual QObject * CreateMessage(IMessage::MessageType type, const QString &variant, const QString &body)=0
Creates the message of the given type to the given variant.
bool operator!=(const EntryStatus &es1, const EntryStatus &es2)
Definition: iclentry.h:70
virtual QString GetEntryID() const =0
Returns the ID of this entry.
virtual QString GetHumanReadableID() const
Returns the human-readable ID of this entry.
Definition: iclentry.h:283
virtual void gotMessage(QObject *msg)=0
This signal should be emitted whenever a new message is received.
virtual EntryType GetEntryType() const =0
Definition: iclentry.h:47
virtual void SetGroups(const QStringList &groups)=0
Sets the list of groups this item belongs to.
virtual void availableVariantsChanged(const QStringList &newVars)=0
This signal should be emitted whenever the list of available variants changes.
Represents a single entry in contact list.
Definition: iclentry.h:102
virtual void MarkMsgsRead()=0
Called whenever new messages are read.
Definition: iclentry.h:137
Definition: iclentry.h:151
virtual void entryGenerallyChanged()=0
This signal should be emitted when the entry changes.
Q_DECLARE_OPERATORS_FOR_FLAGS(IAccount::AccountFeatures)
virtual void SetChatPartState(ChatPartState state, const QString &variant)=0
Notifies about our chat participation state change.
Feature
Definition: iclentry.h:110
virtual EntryStatus GetStatus(const QString &variant=QString()) const =0
Returns the current status of a variant of the item.
virtual Features GetEntryFeatures() const =0
virtual QStringList Groups() const =0
Returns the list of human-readable names of the groups that this entry belongs to.
Definition: iclentry.h:124
virtual void avatarChanged(const QImage &)=0
This signal should be emitted whenever the avatar of this item is changed.
Definition: iclentry.h:160
virtual QList< QObject * > GetAllMessages() const =0
Returns all already sent or received messages.
virtual void nameChanged(const QString &name)=0
This signal should be emitted whenever the entry changes name.
State State_
Definition: iclentry.h:49
virtual void SetEntryName(const QString &name)=0
Sets the human-readable name of this entry.
virtual QImage GetAvatar() const =0
Returns the avatar of this item.
virtual QStringList Variants() const =0
Returns the list of destination variants.
QString StatusString_
Definition: iclentry.h:50
virtual QString GetEntryName() const =0
MessageType
Represents possible message types.
Definition: imessage.h:82
virtual void permsChanged()=0
This signal should be emitted if it&#39;s a MUC participant and his role/affiliation changes.
Definition: iclentry.h:147
Definition: iclentry.h:128
virtual void chatPartStateChanged(const ChatPartState &state, const QString &variant)=0
This signal should be emitted whenever the chat participation state of this entry changes...
virtual void ChatTabClosed()=0
Called by Azoth when the chat with the entry is closed.
EntryType
Definition: iclentry.h:156
EntryStatus()
Definition: iclentry.h:52
virtual ~ICLEntry()
Definition: iclentry.h:105
virtual QList< QAction * > GetActions() const =0
Returns the list of actions for the item.
virtual QObject * GetParentAccount() const =0