1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 08:25:16 +00:00

Can send new messages

This commit is contained in:
2020-06-22 12:19:13 +02:00
parent e915e4b7d0
commit 0a21531cb4
6 changed files with 109 additions and 7 deletions

View File

@ -16,6 +16,7 @@ use crate::data::config::conf;
use crate::data::error::{ExecError, ResultBoxError};
use crate::data::user::UserID;
use crate::helpers::{account_helper, api_helper, conversations_helper, user_helper};
use crate::utils::string_utils::remove_html_nodes;
use crate::utils::user_data_utils::{generate_new_user_data_file_name, prepare_file_creation, user_data_path};
use crate::utils::virtual_directories_utils::check_virtual_directory;
@ -423,6 +424,11 @@ impl HttpRequestHandler {
Ok(dir)
}
/// Get a string included in the request, with HTML codes removed
pub fn post_string_without_html(&mut self, name: &str, min_length: usize, required: bool) -> ResultBoxError<String> {
Ok(remove_html_nodes(self.post_string_opt(name, min_length, required)?.as_str()))
}
/// Get & return the ID of the conversation included in the POST request
pub fn post_conv_id(&mut self, name: &str) -> ResultBoxError<u64> {
let conv_id = self.post_u64(name)?;

View File

@ -9,4 +9,5 @@ pub mod user_token;
pub mod custom_emoji;
pub mod new_conversation;
pub mod conversation;
pub mod conversation_message;
pub mod conversation_message;
pub mod new_conversation_message;

View File

@ -0,0 +1,13 @@
//! # New conversation message
//!
//! @author Pierre Hubert
use crate::data::user::UserID;
/// Information about a new conversation message
pub struct NewConversationMessage {
pub user_id: UserID,
pub conv_id: u64,
pub message: String,
pub image_path: Option<String>
}