LeechCraft Azoth 0.6.70-18808-g3467692359
Modular multiprotocol IM plugin for LeechCraft
Loading...
Searching...
No Matches
itransfermanager.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 <variant>
12#include <QObject>
13#include <QString>
14#include <util/sll/trackingpointer.h>
15#include "iclentry.h"
16
17namespace LC::Azoth::Emitters
18{
19 class TransferJob;
20 class TransferManager;
21}
22
23namespace LC::Azoth
24{
25 namespace Transfers
26 {
27 enum class Phase : std::uint8_t
28 {
32 };
33
41
42 struct Error
43 {
45 QString Message_ {};
46
47 bool operator== (const Error&) const = default;
48 };
49 }
50
51 using TransferState = std::variant<
54 >;
55
56 inline bool IsTerminal (const TransferState& state)
57 {
58 return std::holds_alternative<Transfers::Error> (state) || state == TransferState { Transfers::Phase::Finished };
59 }
60
65 {
66 public:
67 virtual ~ITransferJob () = default;
68
69 virtual Emitters::TransferJob& GetTransferJobEmitter () = 0;
70
75 virtual void Abort () = 0;
76 };
77
78 class ITransferManager;
79
81 {
83 uint64_t JobId_;
84
85 Util::TrackingPointer<ICLEntry> Entry_;
86
87 QString Name_;
88 qsizetype Size_;
89
90 QString Description_ {};
91
92 bool operator== (const IncomingOffer& other) const = default;
93 };
94
99 {
100 public:
101 virtual ~ITransferManager () = default;
102
103 virtual Emitters::TransferManager& GetTransferManagerEmitter () = 0;
104
118 virtual bool IsAvailable () const = 0;
119
120 virtual ITransferJob* Accept (const IncomingOffer& offer, const QString& savePath) = 0;
121
122 virtual void Decline (const IncomingOffer&) = 0;
123
147 const QString& variant,
148 const QString& path,
149 const QString& comment) = 0;
150 };
151}
152
153Q_DECLARE_INTERFACE (LC::Azoth::ITransferJob, "org.Deviant.LeechCraft.Azoth.ITransferJob/1.0")
154Q_DECLARE_INTERFACE (LC::Azoth::ITransferManager, "org.Deviant.LeechCraft.Azoth.ITransferManager/1.0")
Represents a single entry in contact list.
Definition iclentry.h:49
This interface must be implemented by objects representing file transfer jobs.
virtual Emitters::TransferJob & GetTransferJobEmitter()=0
virtual void Abort()=0
Aborts a transfer.
virtual ~ITransferJob()=default
This interface must be implemented by transfer managers returned from IAccount::GetTransferManager().
virtual void Decline(const IncomingOffer &)=0
virtual ~ITransferManager()=default
virtual Emitters::TransferManager & GetTransferManagerEmitter()=0
virtual ITransferJob * SendFile(ICLEntry &entry, const QString &variant, const QString &path, const QString &comment)=0
Requests a file transfer with the remote party.
virtual bool IsAvailable() const =0
Returns whether the transfer manager is available.
virtual ITransferJob * Accept(const IncomingOffer &offer, const QString &savePath)=0
std::variant< Transfers::Phase, Transfers::Error > TransferState
bool IsTerminal(const TransferState &state)
bool operator==(const IncomingOffer &other) const =default
ITransferManager * Manager_
Util::TrackingPointer< ICLEntry > Entry_
bool operator==(const Error &) const =default