| 708 | } |
| 709 | |
| 710 | openmittsu::protocol::MessageId SimpleDatabase::storeSentGroupMessageFile(openmittsu::protocol::GroupId const& group, openmittsu::protocol::MessageTime const& timeCreated, bool isQueued, QByteArray const& file, QByteArray const& coverImage, QString const& mimeType, QString const& fileName, QString const& caption) { |
| 711 | if (!hasGroup(group)) { |
| 712 | throw openmittsu::exceptions::InternalErrorException() << "Could not save group file message, the given group " << group.toString() << " is unknown!"; |
| 713 | } |
| 714 | |
| 715 | QString uuid; |
| 716 | bool result = false; |
| 717 | do { |
| 718 | uuid = generateUuid(); |
| 719 | result = insertMediaItem(uuid, file, MediaFileType::TYPE_STANDARD) && insertMediaItem(uuid, coverImage, MediaFileType::TYPE_THUMBNAIL); |
| 720 | } while (!result); |
| 721 | return internal::DatabaseGroupMessage::insertGroupMessageFromUs(this, group, uuid, timeCreated, GroupMessageType::FILE, makeBodyForFile(file, mimeType, fileName, caption), isQueued, false, caption); |
| 722 | } |
| 723 | |
| 724 | openmittsu::protocol::MessageId SimpleDatabase::storeSentGroupMessageVideo(openmittsu::protocol::GroupId const& group, openmittsu::protocol::MessageTime const& timeCreated, bool isQueued, QByteArray const& video, QByteArray const& coverImage, quint16 lengthInSeconds) { |
| 725 | if (!hasGroup(group)) { |