mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 12:08:11 +00:00
Removed appData in ChatMessage
This commit is contained in:
parent
4957187dfb
commit
b764f9bb60
5 changed files with 27 additions and 12 deletions
|
|
@ -143,7 +143,6 @@ private:
|
|||
FileTransferChatMessageModifier fileTransferChatMessageModifier;
|
||||
|
||||
// Cache for returned values, used for compatibility with previous C API
|
||||
std::string appData;
|
||||
std::string fileTransferFilePath;
|
||||
ContentType cContentType;
|
||||
std::string cText;
|
||||
|
|
|
|||
|
|
@ -202,14 +202,22 @@ void ChatMessagePrivate::setFileTransferFilepath (const string &path) {
|
|||
}
|
||||
|
||||
const string &ChatMessagePrivate::getAppdata () const {
|
||||
return appData;
|
||||
for (const Content *c : contents) {
|
||||
if (c->getContentType().isFile()) {
|
||||
FileContent *fileContent = (FileContent *)c;
|
||||
return fileContent->getFilePath();
|
||||
}
|
||||
}
|
||||
return Utils::getEmptyConstRefObject<string>();
|
||||
}
|
||||
|
||||
void ChatMessagePrivate::setAppdata (const string &data) {
|
||||
appData = data;
|
||||
|
||||
// TODO: history.
|
||||
// linphone_chat_message_store_appdata(L_GET_C_BACK_PTR(this));
|
||||
for (const Content *c : contents) {
|
||||
if (c->getContentType().isFile()) {
|
||||
FileContent *fileContent = (FileContent *)c;
|
||||
return fileContent->setFilePath(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const string &ChatMessagePrivate::getExternalBodyUrl () const {
|
||||
|
|
|
|||
|
|
@ -49,12 +49,7 @@ ChatMessageModifier::Result FileTransferChatMessageModifier::encode (const share
|
|||
// For each FileContent, upload it and create a FileTransferContent
|
||||
for (Content *content : chatMessage->getContents()) {
|
||||
ContentType contentType = content->getContentType();
|
||||
//TODO Improve
|
||||
if (contentType != ContentType::FileTransfer && contentType != ContentType::PlainText &&
|
||||
contentType != ContentType::ExternalBody && contentType != ContentType::Imdn &&
|
||||
contentType != ContentType::ImIsComposing && contentType != ContentType::ResourceLists &&
|
||||
contentType != ContentType::Sdp && contentType != ContentType::ConferenceInfo &&
|
||||
contentType != ContentType::Cpim) {
|
||||
if (contentType.isFile()) {
|
||||
lInfo() << "Found content with type " << contentType.asString() << ", set it for file upload";
|
||||
FileContent *fileContent = (FileContent *)content;
|
||||
currentFileContentToTransfer = fileContent;
|
||||
|
|
|
|||
|
|
@ -154,6 +154,18 @@ bool ContentType::isValid () const {
|
|||
return !d->type.empty() && !d->subType.empty();
|
||||
}
|
||||
|
||||
bool ContentType::isFile() const {
|
||||
//TODO Improve
|
||||
if (*this != ContentType::FileTransfer && *this != ContentType::PlainText &&
|
||||
*this != ContentType::ExternalBody && *this != ContentType::Imdn &&
|
||||
*this != ContentType::ImIsComposing && *this != ContentType::ResourceLists &&
|
||||
*this != ContentType::Sdp && *this != ContentType::Cpim &&
|
||||
*this != ContentType::ConferenceInfo) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
string ContentType::asString () const {
|
||||
L_D();
|
||||
if (isValid()) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public:
|
|||
bool operator!= (const std::string &contentType) const = delete;
|
||||
|
||||
bool isValid () const;
|
||||
bool isFile () const;
|
||||
|
||||
const std::string &getType () const;
|
||||
bool setType (const std::string &type);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue