diff --git a/core.cpp b/core.cpp index 0fcd09fc6..8f4d64551 100644 --- a/core.cpp +++ b/core.cpp @@ -137,12 +137,12 @@ void Core::onFriendRequest(Tox*/* tox*/, const uint8_t* cUserId, const uint8_t* emit static_cast(core)->friendRequestReceived(CUserId::toString(cUserId), CString::toString(cMessage, cMessageSize)); } -void Core::onFriendMessage(Tox*/* tox*/, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core) +void Core::onFriendMessage(Tox*/* tox*/, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core) { emit static_cast(core)->friendMessageReceived(friendId, CString::toString(cMessage, cMessageSize)); } -void Core::onFriendNameChange(Tox*/* tox*/, int friendId, uint8_t* cName, uint16_t cNameSize, void* core) +void Core::onFriendNameChange(Tox*/* tox*/, int friendId, const uint8_t* cName, uint16_t cNameSize, void* core) { emit static_cast(core)->friendUsernameChanged(friendId, CString::toString(cName, cNameSize)); } @@ -152,7 +152,7 @@ void Core::onFriendTypingChange(Tox*/* tox*/, int friendId, uint8_t isTyping, vo emit static_cast(core)->friendTypingChanged(friendId, isTyping ? true : false); } -void Core::onStatusMessageChanged(Tox*/* tox*/, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core) +void Core::onStatusMessageChanged(Tox*/* tox*/, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core) { emit static_cast(core)->friendStatusMessageChanged(friendId, CString::toString(cMessage, cMessageSize)); } @@ -186,18 +186,18 @@ void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status, } } -void Core::onAction(Tox*/* tox*/, int friendId, uint8_t *cMessage, uint16_t cMessageSize, void *core) +void Core::onAction(Tox*/* tox*/, int friendId, const uint8_t *cMessage, uint16_t cMessageSize, void *core) { emit static_cast(core)->actionReceived(friendId, CString::toString(cMessage, cMessageSize)); } -void Core::onGroupInvite(Tox*, int friendnumber, uint8_t *group_public_key, void *core) +void Core::onGroupInvite(Tox*, int friendnumber, const uint8_t *group_public_key, void *core) { qDebug() << QString("Core: Group invite by %1").arg(friendnumber); emit static_cast(core)->groupInviteReceived(friendnumber, group_public_key); } -void Core::onGroupMessage(Tox*, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *core) +void Core::onGroupMessage(Tox*, int groupnumber, int friendgroupnumber, const uint8_t * message, uint16_t length, void *core) { emit static_cast(core)->groupMessageReceived(groupnumber, friendgroupnumber, CString::toString(message, length)); } @@ -209,7 +209,7 @@ void Core::onGroupNamelistChange(Tox*, int groupnumber, int peernumber, uint8_t } void Core::onFileSendRequestCallback(Tox*, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, - uint8_t *filename, uint16_t filename_length, void *core) + const uint8_t *filename, uint16_t filename_length, void *core) { qDebug() << QString("Core: Received file request %1 with friend %2").arg(filenumber).arg(friendnumber); @@ -218,7 +218,7 @@ void Core::onFileSendRequestCallback(Tox*, int32_t friendnumber, uint8_t filenum emit static_cast(core)->fileReceiveRequested(fileRecvQueue.last()); } void Core::onFileControlCallback(Tox*, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber, - uint8_t control_type, uint8_t*, uint16_t, void *core) + uint8_t control_type, const uint8_t*, uint16_t, void *core) { ToxFile* file{nullptr}; if (receive_send == 1) @@ -287,7 +287,7 @@ void Core::onFileControlCallback(Tox*, int32_t friendnumber, uint8_t receive_sen } } -void Core::onFileDataCallback(Tox*, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *core) +void Core::onFileDataCallback(Tox*, int32_t friendnumber, uint8_t filenumber, const uint8_t *data, uint16_t length, void *core) { ToxFile* file{nullptr}; for (ToxFile& f : fileRecvQueue) @@ -793,7 +793,7 @@ QList Core::getGroupPeerNames(int groupId) const return names; } -int Core::joinGroupchat(int32_t friendnumber, uint8_t* friend_group_public_key) const +int Core::joinGroupchat(int32_t friendnumber, const uint8_t* friend_group_public_key) const { qDebug() << QString("Trying to join groupchat invite by friend %1").arg(friendnumber); return tox_join_groupchat(tox, friendnumber, friend_group_public_key); diff --git a/core.h b/core.h index 988787a48..fa3e5ec0c 100644 --- a/core.h +++ b/core.h @@ -115,7 +115,7 @@ public: int getGroupNumberPeers(int groupId) const; QString getGroupPeerName(int groupId, int peerId) const; QList getGroupPeerNames(int groupId) const; - int joinGroupchat(int32_t friendnumber, uint8_t* friend_group_public_key) const; + int joinGroupchat(int32_t friendnumber, const uint8_t* friend_group_public_key) const; void quitGroupChat(int groupId) const; void dispatchVideoFrame(vpx_image img) const; @@ -178,7 +178,7 @@ signals: void friendLastSeenChanged(int friendId, const QDateTime& dateTime); void emptyGroupCreated(int groupnumber); - void groupInviteReceived(int friendnumber, uint8_t *group_public_key); + void groupInviteReceived(int friendnumber, const uint8_t *group_public_key); void groupMessageReceived(int groupnumber, int friendgroupnumber, const QString& message); void groupNamelistChanged(int groupnumber, int peernumber, uint8_t change); @@ -222,21 +222,21 @@ signals: private: static void onFriendRequest(Tox* tox, const uint8_t* cUserId, const uint8_t* cMessage, uint16_t cMessageSize, void* core); - static void onFriendMessage(Tox* tox, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core); - static void onFriendNameChange(Tox* tox, int friendId, uint8_t* cName, uint16_t cNameSize, void* core); + 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); static void onFriendTypingChange(Tox* tox, int friendId, uint8_t isTyping, void* core); - static void onStatusMessageChanged(Tox* tox, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core); + static void onStatusMessageChanged(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core); static void onUserStatusChanged(Tox* tox, int friendId, uint8_t userstatus, void* core); static void onConnectionStatusChanged(Tox* tox, int friendId, uint8_t status, void* core); - static void onAction(Tox* tox, int friendId, uint8_t* cMessage, uint16_t cMessageSize, void* core); - static void onGroupInvite(Tox *tox, int friendnumber, uint8_t *group_public_key, void *userdata); - static void onGroupMessage(Tox *tox, int groupnumber, int friendgroupnumber, uint8_t * message, uint16_t length, void *userdata); + static void onAction(Tox* tox, int friendId, const uint8_t* cMessage, uint16_t cMessageSize, void* core); + static void onGroupInvite(Tox *tox, int friendnumber, const uint8_t *group_public_key, void *userdata); + static void onGroupMessage(Tox *tox, int groupnumber, int friendgroupnumber, const uint8_t * message, uint16_t length, void *userdata); static void onGroupNamelistChange(Tox *tox, int groupnumber, int peernumber, uint8_t change, void *userdata); static void onFileSendRequestCallback(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint64_t filesize, - uint8_t *filename, uint16_t filename_length, void *userdata); + const uint8_t *filename, uint16_t filename_length, void *userdata); static void onFileControlCallback(Tox *tox, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber, - uint8_t control_type, uint8_t *data, uint16_t length, void *core); - static void onFileDataCallback(Tox *tox, int32_t friendnumber, uint8_t filenumber, uint8_t *data, uint16_t length, void *userdata); + 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); static void onAvInvite(int32_t call_index, void* toxav); static void onAvStart(int32_t call_index, void* toxav); diff --git a/widget/widget.cpp b/widget/widget.cpp index cadb62128..fcad53dce 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -554,7 +554,7 @@ void Widget::copyFriendIdToClipboard(int friendId) } } -void Widget::onGroupInviteReceived(int32_t friendId, uint8_t* publicKey) +void Widget::onGroupInviteReceived(int32_t friendId, const uint8_t* publicKey) { int groupId = core->joinGroupchat(friendId, publicKey); if (groupId == -1) diff --git a/widget/widget.h b/widget/widget.h index 58997ff1b..edd2d73ba 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -81,7 +81,7 @@ private slots: void onFriendMessageReceived(int friendId, const QString& message); void onFriendRequestReceived(const QString& userId, const QString& message); void onEmptyGroupCreated(int groupId); - void onGroupInviteReceived(int32_t friendId, uint8_t *publicKey); + void onGroupInviteReceived(int32_t friendId, const uint8_t *publicKey); void onGroupMessageReceived(int groupnumber, int friendgroupnumber, const QString& message); void onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t change); void onGroupWidgetClicked(GroupWidget* widget);