2014-06-25 04:11:11 +08:00
|
|
|
/*
|
|
|
|
Copyright (C) 2013 by Maxim Biro <nurupo.contributions@gmail.com>
|
|
|
|
|
|
|
|
This file is part of Tox Qt GUI.
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the COPYING file for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CORE_HPP
|
|
|
|
#define CORE_HPP
|
|
|
|
|
2014-06-26 04:43:28 +08:00
|
|
|
#include <cstdint>
|
2014-06-25 04:11:11 +08:00
|
|
|
#include <QObject>
|
2014-10-29 23:40:09 +08:00
|
|
|
#include <QMutex>
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-11-11 23:05:01 +08:00
|
|
|
#include <tox/tox.h>
|
|
|
|
|
2014-09-11 21:44:34 +08:00
|
|
|
#include "corestructs.h"
|
|
|
|
#include "coreav.h"
|
|
|
|
#include "coredefines.h"
|
2014-06-26 04:43:28 +08:00
|
|
|
|
2014-09-11 21:44:34 +08:00
|
|
|
template <typename T> class QList;
|
|
|
|
class Camera;
|
|
|
|
class QTimer;
|
|
|
|
class QString;
|
2014-09-21 18:30:10 +08:00
|
|
|
class CString;
|
2014-10-15 20:46:01 +08:00
|
|
|
class VideoSource;
|
2014-12-14 16:50:18 +08:00
|
|
|
#ifdef QTOX_FILTER_AUDIO
|
|
|
|
class AudioFilterer;
|
|
|
|
#endif
|
2014-06-27 21:16:39 +08:00
|
|
|
|
2014-06-25 04:11:11 +08:00
|
|
|
class Core : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-10-22 21:36:36 +08:00
|
|
|
enum PasswordType {ptMain = 0, ptHistory, ptCounter};
|
|
|
|
|
2014-10-09 13:30:33 +08:00
|
|
|
explicit Core(Camera* cam, QThread* coreThread, QString initialLoadPath);
|
2014-09-11 21:44:34 +08:00
|
|
|
static Core* getInstance(); ///< Returns the global widget's Core instance
|
2014-06-25 04:11:11 +08:00
|
|
|
~Core();
|
2014-07-17 06:43:30 +08:00
|
|
|
|
|
|
|
static const QString TOX_EXT;
|
2014-10-09 13:30:33 +08:00
|
|
|
static const QString CONFIG_FILE_NAME;
|
2014-10-09 16:07:26 +08:00
|
|
|
static QString sanitize(QString name);
|
2014-11-09 20:32:19 +08:00
|
|
|
static QList<CString> splitMessage(const QString &message);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-11-03 01:36:27 +08:00
|
|
|
QString getPeerName(const ToxID& id) const;
|
|
|
|
|
2014-10-27 07:31:51 +08:00
|
|
|
int getGroupNumberPeers(int groupId) const; ///< Return the number of peers in the group chat on success, or -1 on failure
|
|
|
|
QString getGroupPeerName(int groupId, int peerId) const; ///< Get the name of a peer of a group
|
2014-11-23 23:55:49 +08:00
|
|
|
ToxID getGroupPeerToxID(int groupId, int peerId) const; ///< Get the ToxID of a peer of a group
|
2014-10-27 07:31:51 +08:00
|
|
|
QList<QString> getGroupPeerNames(int groupId) const; ///< Get the names of the peers of a group
|
|
|
|
QString getFriendAddress(int friendNumber) const; ///< Get the full address if known, or Tox ID of a friend
|
|
|
|
QString getFriendUsername(int friendNumber) const; ///< Get the username of a friend
|
2014-11-10 03:23:43 +08:00
|
|
|
bool hasFriendWithAddress(const QString &addr) const; ///< Check if we have a friend by address
|
|
|
|
bool hasFriendWithPublicKey(const QString &pubkey) const; ///< Check if we have a friend by public key
|
2014-11-11 23:05:01 +08:00
|
|
|
int joinGroupchat(int32_t friendNumber, uint8_t type, const uint8_t* pubkey,uint16_t length) const; ///< Accept a groupchat invite
|
2014-10-27 07:31:51 +08:00
|
|
|
void quitGroupChat(int groupId) const; ///< Quit a groupchat
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-07-25 03:50:47 +08:00
|
|
|
void saveConfiguration();
|
|
|
|
void saveConfiguration(const QString& path);
|
2014-07-12 04:38:39 +08:00
|
|
|
|
2014-11-03 01:36:27 +08:00
|
|
|
QString getIDString() const; ///< Get the 12 first characters of our Tox ID
|
2014-07-27 16:27:15 +08:00
|
|
|
|
2014-11-03 01:36:27 +08:00
|
|
|
QString getUsername() const; ///< Returns our username, or an empty string on failure
|
|
|
|
QString getStatusMessage() const; ///< Returns our status message, or an empty string on failure
|
|
|
|
ToxID getSelfId() const; ///< Returns our Tox ID
|
2014-07-04 01:38:30 +08:00
|
|
|
|
2014-10-27 07:31:51 +08:00
|
|
|
VideoSource* getVideoSourceFromCall(int callNumber); ///< Get a call's video source
|
2014-07-12 20:10:24 +08:00
|
|
|
|
2014-10-27 07:31:51 +08:00
|
|
|
bool anyActiveCalls(); ///< true is any calls are currently active (note: a call about to start is not yet active)
|
2014-10-22 21:36:36 +08:00
|
|
|
bool isPasswordSet(PasswordType passtype);
|
2014-11-06 22:12:10 +08:00
|
|
|
bool isReady(); ///< Most of the API shouldn't be used until Core is ready, call start() first
|
2014-10-15 09:04:53 +08:00
|
|
|
|
2014-11-17 02:04:45 +08:00
|
|
|
void resetCallSources(); ///< Forces to regenerate each call's audio sources
|
2014-11-16 23:41:30 +08:00
|
|
|
|
2014-06-25 04:11:11 +08:00
|
|
|
public slots:
|
2014-10-27 07:31:51 +08:00
|
|
|
void start(); ///< Initializes the core, must be called before anything else
|
|
|
|
void process(); ///< Processes toxcore events and ensure we stay connected, called by its own timer
|
|
|
|
void bootstrapDht(); ///< Connects us to the Tox network
|
|
|
|
void switchConfiguration(const QString& profile); ///< Load a different profile and restart the core
|
2014-06-25 04:11:11 +08:00
|
|
|
|
|
|
|
void acceptFriendRequest(const QString& userId);
|
|
|
|
void requestFriendship(const QString& friendAddress, const QString& message);
|
2014-06-28 16:53:38 +08:00
|
|
|
void groupInviteFriend(int friendId, int groupId);
|
2014-11-11 23:05:01 +08:00
|
|
|
void createGroup(uint8_t type = TOX_GROUPCHAT_TYPE_AV);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-11-12 07:00:24 +08:00
|
|
|
void removeFriend(int friendId, bool fake = false);
|
|
|
|
void removeGroup(int groupId, bool fake = false);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-07-01 06:36:48 +08:00
|
|
|
void setStatus(Status status);
|
2014-06-27 08:08:33 +08:00
|
|
|
void setUsername(const QString& username);
|
|
|
|
void setStatusMessage(const QString& message);
|
2014-09-24 22:51:16 +08:00
|
|
|
void setAvatar(uint8_t format, const QByteArray& data);
|
2014-06-27 08:08:33 +08:00
|
|
|
|
2014-11-06 08:22:50 +08:00
|
|
|
int sendMessage(int friendId, const QString& message);
|
2014-06-26 04:43:28 +08:00
|
|
|
void sendGroupMessage(int groupId, const QString& message);
|
2014-11-01 21:00:43 +08:00
|
|
|
void sendGroupAction(int groupId, const QString& message);
|
2014-11-06 08:22:50 +08:00
|
|
|
void changeGroupTitle(int groupId, const QString& title);
|
|
|
|
int sendAction(int friendId, const QString& action);
|
2014-06-25 04:11:11 +08:00
|
|
|
void sendTyping(int friendId, bool typing);
|
2014-06-26 04:43:28 +08:00
|
|
|
|
2014-07-01 19:33:59 +08:00
|
|
|
void sendFile(int32_t friendId, QString Filename, QString FilePath, long long filesize);
|
2014-06-27 01:45:47 +08:00
|
|
|
void cancelFileSend(int friendId, int fileNum);
|
|
|
|
void cancelFileRecv(int friendId, int fileNum);
|
|
|
|
void rejectFileRecvRequest(int friendId, int fileNum);
|
2014-07-02 01:54:26 +08:00
|
|
|
void acceptFileRecvRequest(int friendId, int fileNum, QString path);
|
2014-06-27 01:45:47 +08:00
|
|
|
void pauseResumeFileSend(int friendId, int fileNum);
|
|
|
|
void pauseResumeFileRecv(int friendId, int fileNum);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-06-27 08:08:33 +08:00
|
|
|
void answerCall(int callId);
|
|
|
|
void hangupCall(int callId);
|
2014-06-30 05:38:48 +08:00
|
|
|
void startCall(int friendId, bool video=false);
|
2014-06-27 09:06:56 +08:00
|
|
|
void cancelCall(int callId, int friendId);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-08-19 23:20:20 +08:00
|
|
|
void micMuteToggle(int callId);
|
2014-10-28 20:50:30 +08:00
|
|
|
void volMuteToggle(int callId);
|
2014-08-19 23:20:20 +08:00
|
|
|
|
2014-11-16 00:10:04 +08:00
|
|
|
void setNospam(uint32_t nospam);
|
|
|
|
|
2014-11-15 03:31:23 +08:00
|
|
|
static void joinGroupCall(int groupId); ///< Starts a call in an existing AV groupchat. Call from the GUI thread.
|
|
|
|
static void leaveGroupCall(int groupId); ///< Will not leave the group, just stop the call. Call from the GUI thread.
|
2014-11-13 20:11:23 +08:00
|
|
|
static void disableGroupCallMic(int groupId);
|
|
|
|
static void disableGroupCallVol(int groupId);
|
|
|
|
static void enableGroupCallMic(int groupId);
|
|
|
|
static void enableGroupCallVol(int groupId);
|
2014-11-14 02:20:06 +08:00
|
|
|
static bool isGroupCallMicEnabled(int groupId);
|
|
|
|
static bool isGroupCallVolEnabled(int groupId);
|
2014-11-13 20:11:23 +08:00
|
|
|
|
2014-10-24 19:25:40 +08:00
|
|
|
void setPassword(QString& password, PasswordType passtype, uint8_t* salt = nullptr);
|
2014-10-22 21:36:36 +08:00
|
|
|
void clearPassword(PasswordType passtype);
|
|
|
|
QByteArray encryptData(const QByteArray& data, PasswordType passtype);
|
|
|
|
QByteArray decryptData(const QByteArray& data, PasswordType passtype);
|
2014-10-12 05:54:25 +08:00
|
|
|
|
2014-06-25 04:11:11 +08:00
|
|
|
signals:
|
|
|
|
void connected();
|
|
|
|
void disconnected();
|
2014-10-15 10:06:44 +08:00
|
|
|
void blockingClearContacts();
|
2014-10-24 19:25:40 +08:00
|
|
|
void blockingGetPassword(QString info, int passtype, uint8_t* salt = nullptr);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
|
|
|
void friendRequestReceived(const QString& userId, const QString& message);
|
2014-10-02 14:01:23 +08:00
|
|
|
void friendMessageReceived(int friendId, const QString& message, bool isAction);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
|
|
|
void friendAdded(int friendId, const QString& userId);
|
|
|
|
|
|
|
|
void friendStatusChanged(int friendId, Status status);
|
|
|
|
void friendStatusMessageChanged(int friendId, const QString& message);
|
|
|
|
void friendUsernameChanged(int friendId, const QString& username);
|
|
|
|
void friendTypingChanged(int friendId, bool isTyping);
|
2014-09-24 23:28:38 +08:00
|
|
|
void friendAvatarChanged(int friendId, const QPixmap& pic);
|
2014-09-27 03:23:20 +08:00
|
|
|
void friendAvatarRemoved(int friendId);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
|
|
|
void friendRemoved(int friendId);
|
|
|
|
|
|
|
|
void friendLastSeenChanged(int friendId, const QDateTime& dateTime);
|
|
|
|
|
2014-06-30 05:38:48 +08:00
|
|
|
void emptyGroupCreated(int groupnumber);
|
2014-11-13 07:13:11 +08:00
|
|
|
void groupInviteReceived(int friendnumber, uint8_t type, QByteArray publicKey);
|
2014-11-23 23:55:49 +08:00
|
|
|
void groupMessageReceived(int groupnumber, int peernumber, const QString& message, bool isAction);
|
2014-06-25 04:11:11 +08:00
|
|
|
void groupNamelistChanged(int groupnumber, int peernumber, uint8_t change);
|
2014-11-06 08:22:50 +08:00
|
|
|
void groupTitleChanged(int groupnumber, const QString& author, const QString& title);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
|
|
|
void usernameSet(const QString& username);
|
|
|
|
void statusMessageSet(const QString& message);
|
|
|
|
void statusSet(Status status);
|
2014-10-18 09:15:26 +08:00
|
|
|
void idSet(const QString& id);
|
2014-09-24 22:51:16 +08:00
|
|
|
void selfAvatarChanged(const QPixmap& pic);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
|
|
|
void messageSentResult(int friendId, const QString& message, int messageId);
|
2014-09-24 00:35:06 +08:00
|
|
|
void groupSentResult(int groupId, const QString& message, int result);
|
2014-11-06 08:22:50 +08:00
|
|
|
void actionSentResult(int friendId, const QString& action, int success);
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-11-01 22:19:11 +08:00
|
|
|
void receiptRecieved(int friedId, int receipt);
|
|
|
|
|
2014-11-10 03:23:43 +08:00
|
|
|
void failedToAddFriend(const QString& userId, const QString& errorInfo = QString());
|
2014-06-25 04:11:11 +08:00
|
|
|
void failedToRemoveFriend(int friendId);
|
|
|
|
void failedToSetUsername(const QString& username);
|
|
|
|
void failedToSetStatusMessage(const QString& message);
|
|
|
|
void failedToSetStatus(Status status);
|
|
|
|
void failedToSetTyping(bool typing);
|
|
|
|
|
|
|
|
void failedToStart();
|
2014-10-06 04:49:44 +08:00
|
|
|
void badProxy();
|
2014-06-25 04:11:11 +08:00
|
|
|
|
2014-06-27 01:45:47 +08:00
|
|
|
void fileSendStarted(ToxFile file);
|
|
|
|
void fileReceiveRequested(ToxFile file);
|
|
|
|
void fileTransferAccepted(ToxFile file);
|
|
|
|
void fileTransferCancelled(int FriendId, int FileNum, ToxFile::FileDirection direction);
|
|
|
|
void fileTransferFinished(ToxFile file);
|
2014-07-12 00:05:18 +08:00
|
|
|
void fileUploadFinished(const QString& path);
|
|
|
|
void fileDownloadFinished(const QString& path);
|
2014-06-27 01:45:47 +08:00
|
|
|
void fileTransferPaused(int FriendId, int FileNum, ToxFile::FileDirection direction);
|
2014-07-13 00:40:01 +08:00
|
|
|
void fileTransferInfo(int FriendId, int FileNum, int64_t Filesize, int64_t BytesSent, ToxFile::FileDirection direction);
|
2014-09-11 21:36:57 +08:00
|
|
|
void fileTransferRemotePausedUnpaused(ToxFile file, bool paused);
|
2014-09-30 00:14:19 +08:00
|
|
|
void fileTransferBrokenUnbroken(ToxFile file, bool broken);
|
2014-06-27 08:08:33 +08:00
|
|
|
|
2014-09-24 00:52:06 +08:00
|
|
|
void fileSendFailed(int FriendId, const QString& fname);
|
2014-06-27 08:08:33 +08:00
|
|
|
|
2014-06-30 10:39:43 +08:00
|
|
|
void avInvite(int friendId, int callIndex, bool video);
|
|
|
|
void avStart(int friendId, int callIndex, bool video);
|
2014-06-27 08:08:33 +08:00
|
|
|
void avCancel(int friendId, int callIndex);
|
|
|
|
void avEnd(int friendId, int callIndex);
|
2014-06-30 10:39:43 +08:00
|
|
|
void avRinging(int friendId, int callIndex, bool video);
|
|
|
|
void avStarting(int friendId, int callIndex, bool video);
|
2014-06-27 08:08:33 +08:00
|
|
|
void avEnding(int friendId, int callIndex);
|
2014-06-27 09:06:56 +08:00
|
|
|
void avRequestTimeout(int friendId, int callIndex);
|
2014-06-28 03:59:25 +08:00
|
|
|
void avPeerTimeout(int friendId, int callIndex);
|
2014-08-30 01:20:34 +08:00
|
|
|
void avMediaChange(int friendId, int callIndex, bool videoEnabled);
|
2014-10-25 17:29:25 +08:00
|
|
|
void avCallFailed(int friendId);
|
2014-11-02 19:47:42 +08:00
|
|
|
void avRejected(int friendId, int callIndex);
|
2014-06-27 06:42:45 +08:00
|
|
|
|
2014-07-12 20:10:24 +08:00
|
|
|
void videoFrameReceived(vpx_image* frame);
|
2014-06-30 10:39:43 +08:00
|
|
|
|
2014-06-27 06:42:45 +08:00
|
|
|
private:
|
|
|
|
static void onFriendRequest(Tox* tox, const uint8_t* cUserId, const uint8_t* cMessage, uint16_t cMessageSize, void* core);
|
2014-07-03 15:22:12 +08:00
|
|
|
static void onFriendMessage(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core);
|
|
|
|
static void onFriendNameChange(Tox* tox, int friendId, const uint8_t* cName, uint16_t cNameSize, void* core);
|
2014-06-27 06:42:45 +08:00
|
|
|
static void onFriendTypingChange(Tox* tox, int friendId, uint8_t isTyping, void* core);
|
2014-07-03 15:22:12 +08:00
|
|
|
static void onStatusMessageChanged(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core);
|
2014-06-27 06:42:45 +08:00
|
|
|
static void onUserStatusChanged(Tox* tox, int friendId, uint8_t userstatus, void* core);
|
|
|
|
static void onConnectionStatusChanged(Tox* tox, int friendId, uint8_t status, void* core);
|
2014-07-03 15:22:12 +08:00
|
|
|
static void onAction(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core);
|
2014-10-30 16:40:47 +08:00
|
|
|
static void onGroupAction(Tox* tox, int groupnumber, int peernumber, const uint8_t * action, uint16_t length, void* core);
|
2014-11-11 22:03:08 +08:00
|
|
|
static void onGroupInvite(Tox *tox, int friendnumber, uint8_t type, const uint8_t *data, uint16_t length,void *userdata);
|
2014-07-03 15:22:12 +08:00
|
|
|
static void onGroupMessage(Tox *tox, int groupnumber, int friendgroupnumber, const uint8_t * message, uint16_t length, void *userdata);
|
2014-06-27 06:42:45 +08:00
|
|
|
static void onGroupNamelistChange(Tox *tox, int groupnumber, int peernumber, uint8_t change, void *userdata);
|
2014-11-06 08:22:50 +08:00
|
|
|
static void onGroupTitleChange(Tox*, int groupnumber, int peernumber, const uint8_t* title, uint8_t len, void* _core);
|
2014-06-27 06:42:45 +08:00
|
|
|
static void onFileSendRequestCallback(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint64_t filesize,
|
2014-07-03 15:22:12 +08:00
|
|
|
const uint8_t *filename, uint16_t filename_length, void *userdata);
|
2014-06-27 06:42:45 +08:00
|
|
|
static void onFileControlCallback(Tox *tox, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber,
|
2014-07-03 15:22:12 +08:00
|
|
|
uint8_t control_type, const uint8_t *data, uint16_t length, void *core);
|
|
|
|
static void onFileDataCallback(Tox *tox, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *userdata);
|
2014-09-24 22:51:16 +08:00
|
|
|
static void onAvatarInfoCallback(Tox* tox, int32_t friendnumber, uint8_t format, uint8_t *hash, void *userdata);
|
|
|
|
static void onAvatarDataCallback(Tox* tox, int32_t friendnumber, uint8_t format, uint8_t *hash, uint8_t *data, uint32_t datalen, void *userdata);
|
2014-11-01 22:19:11 +08:00
|
|
|
static void onReadReceiptCallback(Tox *tox, int32_t friendnumber, uint32_t receipt, void *core);
|
2014-06-27 06:42:45 +08:00
|
|
|
|
2014-07-23 05:59:27 +08:00
|
|
|
static void onAvInvite(void* toxav, int32_t call_index, void* core);
|
|
|
|
static void onAvStart(void* toxav, int32_t call_index, void* core);
|
|
|
|
static void onAvCancel(void* toxav, int32_t call_index, void* core);
|
|
|
|
static void onAvReject(void* toxav, int32_t call_index, void* core);
|
|
|
|
static void onAvEnd(void* toxav, int32_t call_index, void* core);
|
|
|
|
static void onAvRinging(void* toxav, int32_t call_index, void* core);
|
|
|
|
static void onAvRequestTimeout(void* toxav, int32_t call_index, void* core);
|
|
|
|
static void onAvPeerTimeout(void* toxav, int32_t call_index, void* core);
|
2014-08-30 01:20:34 +08:00
|
|
|
static void onAvMediaChange(void *toxav, int32_t call_index, void* core);
|
2014-06-27 07:17:10 +08:00
|
|
|
|
2014-11-13 19:18:04 +08:00
|
|
|
static void sendGroupCallAudio(int groupId, ToxAv* toxav);
|
2014-11-11 23:05:01 +08:00
|
|
|
|
2014-06-30 05:38:48 +08:00
|
|
|
static void prepareCall(int friendId, int callId, ToxAv *toxav, bool videoEnabled);
|
2014-06-27 21:16:39 +08:00
|
|
|
static void cleanupCall(int callId);
|
2014-11-18 06:17:54 +08:00
|
|
|
static void playCallAudio(void *toxav, int32_t callId, const int16_t *data, uint16_t samples, void *user_data); // Callback
|
2014-07-09 15:55:25 +08:00
|
|
|
static void sendCallAudio(int callId, ToxAv* toxav);
|
2014-11-11 23:15:56 +08:00
|
|
|
static void playAudioBuffer(ALuint alSource, const int16_t *data, int samples, unsigned channels, int sampleRate);
|
2014-11-18 06:17:54 +08:00
|
|
|
static void playCallVideo(void *toxav, int32_t callId, const vpx_image_t* img, void *user_data);
|
2014-06-30 20:49:42 +08:00
|
|
|
void sendCallVideo(int callId);
|
2014-06-27 21:16:39 +08:00
|
|
|
|
2014-09-29 07:08:07 +08:00
|
|
|
bool checkConnection();
|
2014-06-27 06:42:45 +08:00
|
|
|
|
2014-10-09 09:25:26 +08:00
|
|
|
bool loadConfiguration(QString path); // Returns false for a critical error, true otherwise
|
|
|
|
void make_tox();
|
2014-06-27 06:42:45 +08:00
|
|
|
void loadFriends();
|
|
|
|
|
2014-08-28 21:46:11 +08:00
|
|
|
static void sendAllFileData(Core* core, ToxFile* file);
|
2014-06-27 06:42:45 +08:00
|
|
|
static void removeFileFromQueue(bool sendQueue, int friendId, int fileId);
|
|
|
|
|
|
|
|
void checkLastOnline(int friendId);
|
|
|
|
|
2014-07-12 00:05:18 +08:00
|
|
|
private slots:
|
|
|
|
void onFileTransferFinished(ToxFile file);
|
|
|
|
|
2014-06-27 06:42:45 +08:00
|
|
|
private:
|
|
|
|
Tox* tox;
|
|
|
|
ToxAv* toxav;
|
2014-10-09 13:30:33 +08:00
|
|
|
QTimer *toxTimer, *fileTimer; //, *saveTimer;
|
2014-06-30 20:49:42 +08:00
|
|
|
Camera* camera;
|
2014-10-09 13:30:33 +08:00
|
|
|
QString loadPath; // meaningless after start() is called
|
2014-06-27 06:42:45 +08:00
|
|
|
QList<DhtServer> dhtServerList;
|
|
|
|
int dhtServerId;
|
|
|
|
static QList<ToxFile> fileSendQueue, fileRecvQueue;
|
2014-11-17 02:04:45 +08:00
|
|
|
static ToxCall calls[TOXAV_MAX_CALLS];
|
2014-12-14 16:50:18 +08:00
|
|
|
#ifdef QTOX_FILTER_AUDIO
|
|
|
|
static AudioFilterer * filterer[TOXAV_MAX_CALLS];
|
|
|
|
#endif
|
2014-11-13 19:18:04 +08:00
|
|
|
static QHash<int, ToxGroupCall> groupCalls; // Maps group IDs to ToxGroupCalls
|
2014-11-09 20:32:19 +08:00
|
|
|
QMutex fileSendMutex, messageSendMutex;
|
2014-11-06 22:12:10 +08:00
|
|
|
bool ready;
|
2014-10-22 21:36:36 +08:00
|
|
|
|
2014-10-24 19:25:40 +08:00
|
|
|
uint8_t* pwsaltedkeys[PasswordType::ptCounter]; // use the pw's hash as the "pw"
|
2014-06-27 06:42:45 +08:00
|
|
|
|
2014-07-12 18:50:40 +08:00
|
|
|
static const int videobufsize;
|
|
|
|
static uint8_t* videobuf;
|
2014-08-30 20:40:41 +08:00
|
|
|
|
2014-11-20 05:26:04 +08:00
|
|
|
static QThread *coreThread;
|
|
|
|
|
|
|
|
friend class Audio; ///< Audio can access our calls directly to reduce latency
|
2014-06-25 04:11:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CORE_HPP
|
|
|
|
|