qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
|
Go to the documentation of this file.
33 #include "util/strongtype.h"
34 #include "util/compatiblerecursivemutex.h"
59 class Core :
public QObject,
112 QPair<QByteArray, QByteArray>
getKeypair()
const;
114 void sendFile(uint32_t friendId, QString filename, QString filePath,
long long filesize);
124 int createGroup(uint8_t type = TOX_CONFERENCE_TYPE_AV);
138 void sendTyping(uint32_t friendId,
bool typing);
169 void fileAvatarOfferReceived(uint32_t friendId, uint32_t fileId,
const QByteArray& avatarHash, uint64_t filesize);
188 void groupTitleChanged(
int groupnumber,
const QString& author,
const QString& title);
192 void actionSentResult(uint32_t friendId,
const QString& action,
int success);
201 static void onFriendRequest(Tox*
tox,
const uint8_t* cUserId,
const uint8_t* cMessage,
202 size_t cMessageSize,
void* core);
204 const uint8_t* cMessage,
size_t cMessageSize,
void* core);
206 size_t cNameSize,
void* core);
209 size_t cMessageSize,
void* core);
214 static void onGroupInvite(Tox*
tox, uint32_t friendId, Tox_Conference_Type type,
215 const uint8_t* cookie,
size_t length,
void* vCore);
216 static void onGroupMessage(Tox*
tox, uint32_t groupId, uint32_t peerId, Tox_Message_Type type,
217 const uint8_t* cMessage,
size_t length,
void* vCore);
220 size_t length,
void* core);
222 const uint8_t* cTitle,
size_t length,
void* vCore);
225 const uint8_t* data,
size_t length,
void* core);
261 #define CORE_DISCONNECT_TOLERANCE 30
263 using ToxPtr = std::unique_ptr<Tox, ToxDeleter>;
266 std::unique_ptr<CoreFile>
file;
268 std::unique_ptr<CoreExt>
ext;
void groupTitleChanged(int groupnumber, const QString &author, const QString &title)
void setNospam(uint32_t nospam)
Sets the NoSpam value to prevent friend request spam.
void failedToSetTyping(bool typing)
QString getFriendUsername(uint32_t friendNumber) const
Get the username of a friend.
void sendFile(uint32_t friendId, QString filename, QString filePath, long long filesize)
void actionSentResult(uint32_t friendId, const QString &action, int success)
static void onFriendRequest(Tox *tox, const uint8_t *cUserId, const uint8_t *cMessage, size_t cMessageSize, void *core)
void failedToRemoveFriend(uint32_t friendId)
std::unique_ptr< Tox, ToxDeleter > ToxPtr
void statusSet(Status::Status status)
bool sendMessageWithType(uint32_t friendId, const QString &message, Tox_Message_Type type, ReceiptNum &receipt)
void fileAvatarOfferReceived(uint32_t friendId, uint32_t fileId, const QByteArray &avatarHash, uint64_t filesize)
void start()
Starts toxcore and it's event loop, can be called from any thread.
void friendAvatarRemoved(const ToxPk &friendPk)
bool sendAction(uint32_t friendId, const QString &action, ReceiptNum &receipt) override
void acceptFriendRequest(const ToxPk &friendPk)
QString getFriendRequestErrorMessage(const ToxId &friendId, const QString &message) const
Checks that sending friendship request is correct and returns error message accordingly.
QString getGroupPeerName(int groupId, int peerId) const override
Get the name of a peer of a group.
CompatibleRecursiveMutex coreLoopLock
ToxPk getSelfPublicKey() const override
Gets self public key.
void failedToSetStatusMessage(const QString &message)
void friendRequestReceived(const ToxPk &friendPk, const QString &message)
Handles all qTox internal paths.
static void onConnectionStatusChanged(Tox *tox, uint32_t friendId, Tox_Connection status, void *vCore)
static void registerCallbacks(Tox *tox)
Registers all toxcore callbacks.
This class contains information needed to create a group invite.
void friendStatusMessageChanged(uint32_t friendId, const QString &message)
void failedToSetUsername(const QString &username)
std::unique_ptr< Core > ToxCorePtr
std::unique_ptr< CoreExt > ext
void makeTox(QByteArray savedata, ICoreSettings *s)
static const QString TOX_EXT
void operator()(Tox *tox)
void groupJoined(int groupnumber, GroupId groupId)
void failedToSetStatus(Status::Status status)
void friendMessageReceived(uint32_t friendId, const QString &message, bool isAction)
void failedToAddFriend(const ToxPk &friendPk, const QString &errorInfo=QString())
CoreFile * getCoreFile() const
static void onReadReceiptCallback(Tox *tox, uint32_t friendId, uint32_t receipt, void *core)
static void onGroupTitleChange(Tox *tox, uint32_t groupId, uint32_t peerId, const uint8_t *cTitle, size_t length, void *vCore)
static void onFriendNameChange(Tox *tox, uint32_t friendId, const uint8_t *cName, size_t cNameSize, void *core)
std::unique_ptr< QThread > coreThread
void groupPeerAudioPlaying(int groupnumber, ToxPk peerPk)
void friendAvatarChanged(const ToxPk &friendPk, const QByteArray &pic)
static void onGroupPeerNameChange(Tox *, uint32_t groupId, uint32_t peerId, const uint8_t *name, size_t length, void *core)
const CoreAV * getAv() const
std::unique_ptr< CoreFile > file
void friendLastSeenChanged(uint32_t friendId, const QDateTime &dateTime)
const ICoreSettings & settings
static void onFriendMessage(Tox *tox, uint32_t friendId, Tox_Message_Type type, const uint8_t *cMessage, size_t cMessageSize, void *core)
void changeGroupTitle(int groupId, const QString &title)
void friendAdded(uint32_t friendId, const ToxPk &friendPk)
void groupMessageReceived(int groupnumber, int peernumber, const QString &message, bool isAction)
void groupNamelistChanged(int groupnumber, int peernumber, uint8_t change)
bool isFriendOnline(uint32_t friendId) const
Checks if a friend is online. Unknown friends are considered offline.
void receiptRecieved(int friedId, ReceiptNum receipt)
ToxId getSelfId() const override
Returns our Tox ID.
QString getUsername() const override
Returns our username, or an empty string on failure.
void emptyGroupCreated(int groupnumber, const GroupId groupId, const QString &title=QString())
void sendGroupMessageWithType(int groupId, const QString &message, Tox_Message_Type type)
ToxPk getGroupPeerPk(int groupId, int peerId) const override
Get the public key of a peer of a group.
uint64_t getMaxMessageSize() const
QByteArray getToxSaveData()
Returns the unencrypted tox save data.
This class represents a Tox Public Key, which is a part of Tox ID.
GroupId getGroupPersistentId(uint32_t groupNumber) const override
const IBootstrapListGenerator & bootstrapListGenerator
void sendGroupAction(int groupId, const QString &message) override
QStringList getGroupPeerNames(int groupId) const override
Get the names of the peers of a group.
ToxPk getFriendPublicKey(uint32_t friendNumber) const
Get the public key part of the ToxID only.
static void onGroupInvite(Tox *tox, uint32_t friendId, Tox_Conference_Type type, const uint8_t *cookie, size_t length, void *vCore)
CompatibleRecursiveMutex & getCoreLoopLock() const
void sendGroupMessage(int groupId, const QString &message) override
void process()
Processes toxcore events and ensure we stay connected, called by its own timer.
void usernameSet(const QString &username)
void requestFriendship(const ToxId &friendAddress, const QString &message)
void setStatus(Status::Status status)
This class represents a Tox ID.
void groupPeerlistChanged(int groupnumber)
void removeGroup(int groupId)
static void onFriendTypingChange(Tox *tox, uint32_t friendId, bool isTyping, void *core)
This class represents a long term persistent group identifier.
static void onUserStatusChanged(Tox *tox, uint32_t friendId, Tox_User_Status userstatus, void *core)
uint32_t getGroupNumberPeers(int groupId) const override
Get number of peers in the conference.
void statusMessageSet(const QString &message)
void setUsername(const QString &username)
static void onGroupMessage(Tox *tox, uint32_t groupId, uint32_t peerId, Tox_Message_Type type, const uint8_t *cMessage, size_t length, void *vCore)
void checkLastOnline(uint32_t friendId)
void quitGroupChat(int groupId) const
int createGroup(uint8_t type=TOX_CONFERENCE_TYPE_AV)
bool sendMessage(uint32_t friendId, const QString &message, ReceiptNum &receipt) override
void idSet(const ToxId &id)
Core(QThread *coreThread, IBootstrapListGenerator &_bootstrapNodes, const ICoreSettings &settings)
const CoreExt * getExt() const
QPair< QByteArray, QByteArray > getKeypair() const
Returns our public and private keys.
void friendTypingChanged(uint32_t friendId, bool isTyping)
static void onStatusMessageChanged(Tox *tox, uint32_t friendId, const uint8_t *cMessage, size_t cMessageSize, void *core)
QString getPeerName(const ToxPk &id) const
NamedType< uint32_t, struct ReceiptNumTag, Orderable > ReceiptNum
Status::Status getStatus() const
Returns our user status.
static ToxCorePtr makeToxCore(const QByteArray &savedata, const ICoreSettings &settings, IBootstrapListGenerator &bootstrapNodes, ToxCoreErrors *err=nullptr)
Factory method for the Core object.
void setAv(CoreAV *coreAv)
static void onGroupPeerListChange(Tox *, uint32_t groupId, void *core)
#define CORE_DISCONNECT_TOLERANCE
bool getGroupAvEnabled(int groupId) const override
Check, that group has audio or video stream.
void setStatusMessage(const QString &message)
void friendStatusChanged(uint32_t friendId, Status::Status status)
void requestSent(const ToxPk &friendPk, const QString &message)
uint32_t joinGroupchat(const GroupInvite &inviteInfo)
Accept a groupchat invite.
void groupSentFailed(int groupId)
void removeFriend(uint32_t friendId)
QString getStatusMessage() const
Returns our status message, or an empty string on failure.
void bootstrapDht()
Connects us to the Tox network.
void friendUsernameChanged(uint32_t friendId, const QString &username)
Manages the file transfer service of toxcore.
void groupInviteReceived(const GroupInvite &inviteInfo)
QVector< uint32_t > getFriendList() const
Returns the list of friendIds in our friendlist, an empty list on error.
void friendRemoved(uint32_t friendId)
void groupPeerNameChanged(int groupnumber, const ToxPk &peerPk, const QString &newName)
void groupInviteFriend(uint32_t friendId, int groupId)
void sendTyping(uint32_t friendId, bool typing)
bool hasFriendWithPublicKey(const ToxPk &publicKey) const
Checks if we have a friend by public key.
static void onLosslessPacket(Tox *tox, uint32_t friendId, const uint8_t *data, size_t length, void *core)
Handling of custom lossless packets received by toxcore. Currently only used to forward toxext packet...