/** * @brief Accept a groupchat invite. * @param friendnumber Id of friend in friend list. * @param type Chat type (TEXT or AV). * @param friend_group_public_key Received via the `conference_invite` event. * @param length The size of @friend_group_public_key. * * @return Conference number on success, UINT32_MAX on failure. */ uint32_t Core::joinGroupchat(int32_t friendnumber, uint8_t type, const uint8_t* friend_group_public_key, uint16_t length) const { if (type == TOX_CONFERENCE_TYPE_TEXT) { qDebug() << QString("Trying to join text groupchat invite sent by friend %1").arg(friendnumber); TOX_ERR_CONFERENCE_JOIN error; uint32_t groupId = tox_conference_join(tox, friendnumber, friend_group_public_key, length, &error); if (parseConferenceJoinError(error)) return groupId; else return std::numeric_limits<uint32_t>::max(); } else if (type == TOX_CONFERENCE_TYPE_AV) { qDebug() << QString("Trying to join AV groupchat invite sent by friend %1").arg(friendnumber); return toxav_join_av_groupchat(tox, friendnumber, friend_group_public_key, length, CoreAV::groupCallCallback, const_cast<Core*>(this)); } else { qWarning() << "joinGroupchat: Unknown groupchat type "<<type; return std::numeric_limits<uint32_t>::max(); } }
/** * @brief Accept a groupchat invite. * @param friendId Id of friend in friend list. * @param type Chat type (TEXT or AV). * @param friendGroupPK Received via the `conference_invite` event. * @param length The size of @friend_group_public_key. * * @return Conference number on success, UINT32_MAX on failure. */ uint32_t Core::joinGroupchat(int32_t friendId, uint8_t type, const uint8_t* friendGroupPK, uint16_t length) const { switch (type) { case TOX_CONFERENCE_TYPE_TEXT: { qDebug() << QString("Trying to join text groupchat invite sent by friend %1").arg(friendId); TOX_ERR_CONFERENCE_JOIN error; uint32_t groupId = tox_conference_join(tox, friendId, friendGroupPK, length, &error); return parseConferenceJoinError(error) ? groupId : std::numeric_limits<uint32_t>::max(); } case TOX_CONFERENCE_TYPE_AV: { qDebug() << QString("Trying to join AV groupchat invite sent by friend %1").arg(friendId); return toxav_join_av_groupchat(tox, friendId, friendGroupPK, length, CoreAV::groupCallCallback, const_cast<Core*>(this)); } default: qWarning() << "joinGroupchat: Unknown groupchat type " << type; } return std::numeric_limits<uint32_t>::max(); }