1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

read receipt infrastructure

This commit is contained in:
apprb 2014-11-01 23:19:11 +09:00
parent 8eb1377c5e
commit 694cd90ee4
No known key found for this signature in database
GPG Key ID: B001911B5B22FB9B
4 changed files with 20 additions and 0 deletions

View File

@ -268,6 +268,7 @@ void Core::start()
tox_callback_file_data(tox, onFileDataCallback, this);
tox_callback_avatar_info(tox, onAvatarInfoCallback, this);
tox_callback_avatar_data(tox, onAvatarDataCallback, this);
tox_callback_read_receipt(tox, onReadReceiptCallback, this);
toxav_register_callstate_callback(toxav, onAvInvite, av_OnInvite, this);
toxav_register_callstate_callback(toxav, onAvStart, av_OnStart, this);
@ -700,6 +701,11 @@ void Core::onAvatarDataCallback(Tox*, int32_t friendnumber, uint8_t,
}
}
void Core::onReadReceiptCallback(Tox*, int32_t friendnumber, uint32_t receipt, void *core)
{
emit static_cast<Core*>(core)->receiptRecieved(friendnumber, receipt);
}
void Core::acceptFriendRequest(const QString& userId)
{
int friendId = tox_add_friend_norequest(tox, CUserId(userId).data());

View File

@ -156,6 +156,8 @@ signals:
void groupSentResult(int groupId, const QString& message, int result);
void actionSentResult(int friendId, const QString& action, int success);
void receiptRecieved(int friedId, int receipt);
void failedToAddFriend(const QString& userId, const QString& errorInfo = QString());
void failedToRemoveFriend(int friendId);
void failedToSetUsername(const QString& username);
@ -215,6 +217,7 @@ private:
static void onFileDataCallback(Tox *tox, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *userdata);
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);
static void onReadReceiptCallback(Tox *tox, int32_t friendnumber, uint32_t receipt, void *core);
static void onAvInvite(void* toxav, int32_t call_index, void* core);
static void onAvStart(void* toxav, int32_t call_index, void* core);

View File

@ -213,6 +213,7 @@ void Widget::init()
connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged);
connect(core, &Core::friendRequestReceived, this, &Widget::onFriendRequestReceived);
connect(core, &Core::friendMessageReceived, this, &Widget::onFriendMessageReceived);
connect(core, &Core::receiptRecieved, this, &Widget::onReceiptRecieved);
connect(core, &Core::groupInviteReceived, this, &Widget::onGroupInviteReceived);
connect(core, &Core::groupMessageReceived, this, &Widget::onGroupMessageReceived);
connect(core, &Core::groupNamelistChanged, this, &Widget::onGroupNamelistChanged);
@ -761,6 +762,15 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message, bool
f->getFriendWidget()->updateStatusLight();
}
void Widget::onReceiptRecieved(int friendId, int receipt)
{
Friend* f = FriendList::findFriend(friendId);
if (!f)
return;
qDebug() << "Receipt Recieved" << friendId << "receipt" << receipt;
}
void Widget::newMessageAlert(GenericChatroomWidget* chat)
{
QApplication::alert(this);

View File

@ -109,6 +109,7 @@ private slots:
void onChatroomWidgetClicked(GenericChatroomWidget *);
void onFriendMessageReceived(int friendId, const QString& message, bool isAction);
void onFriendRequestReceived(const QString& userId, const QString& message);
void onReceiptRecieved(int friendId, int receipt);
void onEmptyGroupCreated(int groupId);
void onGroupInviteReceived(int32_t friendId, const uint8_t *publicKey,uint16_t length);
void onGroupMessageReceived(int groupnumber, const QString& message, const QString& author, bool isAction);