![]() |
LeechCraft Azoth 0.6.70-18808-g3467692359
Modular multiprotocol IM plugin for LeechCraft
|
Represents a single entry in contact list. More...
#include "iclentry.h"
Public Types | |
| enum | Feature { FPermanentEntry = 0b00000000 , FSessionEntry = 0b00000001 , FMaskLongetivity = 0b00000011 , FSupportsRenames = 0b00000100 , FSupportsAuth = 0b00001000 , FSupportsGrouping = 0b00010000 , FSelfContact = 0b00100000 } |
| enum class | EntryType : std::uint8_t { Chat , MUC , PrivateChat , UnauthEntry } |
Public Member Functions | |
| Emitters::CLEntry & | GetCLEntryEmitter () |
| virtual QObject * | GetQObject ()=0 |
| virtual IAccount * | GetParentAccount () const =0 |
| virtual ICLEntry * | GetParentCLEntry () const |
| QObject * | GetParentCLEntryObject () const |
| virtual Features | GetEntryFeatures () const =0 |
| virtual EntryType | GetEntryType () const =0 |
| virtual QString | GetEntryName () const =0 |
| virtual void | SetEntryName (const QString &name)=0 |
| Sets the human-readable name of this entry. | |
| QString | GetEntryID () const |
| QString | GetHumanReadableID () const |
| virtual std::optional< EntryPersistentId > | GetPersistentID () const =0 |
| Returns the global persistent ID of this entry. | |
| std::optional< GlobalPersistentId > | GetGlobalPersistentID () const |
| virtual EntryConventionalId | GetConventionalID () const =0 |
| Returns the conventional human-readable ID of this entry. | |
| GlobalConventionalId | GetGlobalConventionalID () const |
| EntryStrongestId | GetStrongestID () const |
| GlobalStrongestId | GetGlobalStrongestID () const |
| virtual QString | GetHumanReadableAddress () const |
| virtual QStringList | Groups () const =0 |
| Returns the list of human-readable names of the groups that this entry belongs to. | |
| virtual void | SetGroups (const QStringList &groups)=0 |
| Sets the list of groups this item belongs to. | |
| virtual QStringList | Variants () const =0 |
| Returns the list of destination variants. | |
| virtual void | SendMessage (const OutgoingMessage &message)=0 |
| Sends the message described by message. | |
| virtual QList< IMessage * > | GetAllMessages () const =0 |
| Returns all already sent or received messages. | |
| virtual void | PurgeMessages (const QDateTime &before)=0 |
| Purges messages before the given date. | |
| virtual void | SetChatPartState (ChatPartState state, const QString &variant)=0 |
| Notifies about our chat participation state change. | |
| virtual EntryStatus | GetStatus (const QString &variant=QString()) const =0 |
| Returns the current status of a variant of the item. | |
| virtual void | ShowInfo ()=0 |
| Requests the entry to show dialog with info about it. | |
| virtual QList< QAction * > | GetActions () const =0 |
| Returns the list of actions for the item. | |
| virtual QMap< QString, QVariant > | GetClientInfo (const QString &variant) const =0 |
| Returns the client information for the given variant. | |
| virtual void | MarkMsgsRead ()=0 |
| Called whenever new messages are read. | |
| virtual void | ChatTabClosed ()=0 |
| Called by Azoth when the chat with the entry is closed. | |
Protected Member Functions | |
| virtual | ~ICLEntry ()=default |
Protected Attributes | |
| Emitters::CLEntry | Emitter_ |
Represents a single entry in contact list.
Everything that should go to the contact list should implement this interface: plain contacts, metacontacts, transports to other accounts in protocols like XMPP, and such.
In some protocol an entry can have several destinations, like resources in XMPP protocol. In this case, GetVariants() should return the up-to-date list of variants that this entry may have as destinations.
This interface provides only more or less basic functionality. Advanced features, like drawing attention and such, are in IAdvancedCLEntry.
If the CL entry can have an avatar, it makes sense to implement the IHaveAvatars interface.
Definition at line 48 of file iclentry.h.
|
strong |
| Enumerator | |
|---|---|
| Chat | A standard one-to-one chat. |
| MUC | A multi-user chatroom. |
| PrivateChat | A chat room member. |
| UnauthEntry | An unauthorized user that has requested authorization. |
Definition at line 73 of file iclentry.h.
Represents the features that may be supported by a contant list entry.
| Enumerator | |
|---|---|
| FPermanentEntry | The entry is permanent: it belongs to some kind of roster list. |
| FSessionEntry | The entry is transient, like a chat room participant or a temporary contact. |
| FMaskLongetivity | Mask for FPermanentEntry and FSessionEntry. |
| FSupportsRenames | The entry supports renaming, so SetEntryName() makes sense. |
| FSupportsAuth | The entry supports auth manipulations and implements IAuthable. |
| FSupportsGrouping | The entry supports moving between different groups via SetGroups(). |
| FSelfContact | The entry represents ourselves, like the self-contact in XMPP. |
Definition at line 60 of file iclentry.h.
|
protectedvirtualdefault |
|
pure virtual |
Called by Azoth when the chat with the entry is closed.
|
pure virtual |
Returns the list of actions for the item.
The list is showed, for example, when user calls the context menu on the item, or such. You may want to place actions like "Info", etc, in this list.
Returns all already sent or received messages.
Returns the list of all messages sent or received during the session.
If the entry represents a MUC, all the messages in the returned list should have "IN" direction.
|
inline |
Definition at line 55 of file iclentry.h.
References Emitter_.
|
pure virtual |
Returns the client information for the given variant.
The returned map should have the following keys:
| [in] | variant | Variant for which to return the client info. |
|
pure virtual |
Returns the conventional human-readable ID of this entry.
Unlike GetPersistentID(), the conventional ID is not guaranteed to be stable throughout the lifetime of the entry, and it may change over time (in which case the parent account's Emitters::Account::conventionalIdChanged() will be emitted for this entry). The canonical example is an entry in an anonymous chat room, where the conventional ID depends on the nick.
If it makes sense for the protocol, the conventional ID is also the ID normally used by humans to exchange contacts (like JID in XMPP, or phone number in SIP).
Referenced by GetGlobalConventionalID(), GetHumanReadableAddress(), GetHumanReadableID(), and GetStrongestID().
|
pure virtual |
Returns the OR-ed combination of Feature flags that describes the features supported by this contact list entry.
|
inline |
Definition at line 152 of file iclentry.h.
References GetGlobalStrongestID(), and LC::Azoth::StrongestId< Id >::ToString().
|
pure virtual |
Returns the human-readable name of this entry.
|
pure virtual |
Returns the type of this entry.
|
inline |
Definition at line 209 of file iclentry.h.
References LC::Azoth::IAccount::GetAccountID(), GetConventionalID(), and GetParentAccount().
Referenced by GetGlobalStrongestID().
|
inline |
Definition at line 183 of file iclentry.h.
References LC::Azoth::IAccount::GetAccountID(), GetParentAccount(), and GetPersistentID().
Referenced by GetGlobalStrongestID().
|
inline |
Definition at line 221 of file iclentry.h.
References GetGlobalConventionalID(), and GetGlobalPersistentID().
Referenced by GetEntryID().
|
inlinevirtual |
Definition at line 228 of file iclentry.h.
References GetConventionalID(), and LC::Azoth::EntryId< IdKind >::ToString().
|
inline |
Definition at line 158 of file iclentry.h.
References GetConventionalID(), and LC::Azoth::EntryId< IdKind >::ToString().
|
pure virtual |
Returns the pointer to the parent account that this entry belongs to.
Referenced by GetGlobalConventionalID(), and GetGlobalPersistentID().
|
inlinevirtual |
Returns the pointer to the parent CL entry, if any.
This currently only makes sense for private chat entries, thus private chat entries (those that are of type ETPrivateChat) should return their parent room CL entry (of type ETMUC).
If parent CL entry is not applicable, NULL should be returned.
The default implementation returns NULL.
Definition at line 108 of file iclentry.h.
Referenced by GetParentCLEntryObject().
|
inline |
Definition at line 113 of file iclentry.h.
References GetParentCLEntry().
|
pure virtual |
Returns the global persistent ID of this entry.
The persistent ID:
Not all contexts support persistent IDs, hence the return value is wrapped in std::optional. A good example is anonymous chat rooms, where the persistent ID is not available, and the conventional ID depends on the nick.
Referenced by GetGlobalPersistentID(), and GetStrongestID().
|
pure virtual |
Returns the entry as a QObject.
|
pure virtual |
Returns the current status of a variant of the item.
Since different variants may have different status, this function should return the proper status for the given variant. If no such variant exists, an empty status structure should be returned.
| [in] | variant | The variant to return status for or null string for most important variant. |
|
inline |
Definition at line 214 of file iclentry.h.
References GetConventionalID(), and GetPersistentID().
|
pure virtual |
Returns the list of human-readable names of the groups that this entry belongs to.
|
pure virtual |
Called whenever new messages are read.
This function is called by Azoth Core whenever any unread messages that could be present in this entry are read. For example, this may happen when user opens the chat tab with this entry.
Please note that this function is always called, even when there are no messages at all, for example.
|
pure virtual |
Purges messages before the given date.
This function should purge all the messages before the given date. After the call, the corresponding messages should not appear in the result of GetAllMessages() function. It's also suggested to remove them from any internal memory storage to conserve memory.
If before is an invalid date, this function should purge all messages.
| [in] | before | The date before which messages should be purged. |
|
pure virtual |
Sends the message described by message.
|
pure virtual |
Notifies about our chat participation state change.
If variant is a null string, a variant with the highest priority should be used.
| [in] | state | Our new chat participation state. |
| [in] | variant | Target variant. |
|
pure virtual |
Sets the human-readable name of this entry.
The name is expected to be updated on the server immediately.
| [in] | name | The new human-readable name of this entry. |
|
pure virtual |
Sets the list of groups this item belongs to.
If updating the list of groups is not applicable, this function should do nothing.
| [in] | groups | The new list of groups. |
|
pure virtual |
Requests the entry to show dialog with info about it.
|
pure virtual |
Returns the list of destination variants.
For example, for an entry representing a contact in XMPP protocol variants would be the list of resources for the contact.
Strings in the list should not be null, though they may be empty. There should be no duplicates in returned list.
The strings in the returned list should be sorted in descending order according to importance. For example, for XMPP protocol, the first variant should be the resource with the highest priority.
|
protected |
Definition at line 51 of file iclentry.h.
Referenced by GetCLEntryEmitter().