2020-06-22 10:19:13 +00:00
|
|
|
//! # New conversation message
|
|
|
|
//!
|
|
|
|
//! @author Pierre Hubert
|
|
|
|
|
|
|
|
use crate::data::user::UserID;
|
2021-03-04 17:51:52 +00:00
|
|
|
use crate::data::conversation::ConvID;
|
|
|
|
use crate::data::conversation_message::{ConversationMessageFile, ConversationServerMessageType};
|
2020-06-22 10:19:13 +00:00
|
|
|
|
|
|
|
/// Information about a new conversation message
|
|
|
|
pub struct NewConversationMessage {
|
2021-03-04 17:51:52 +00:00
|
|
|
pub user_id: Option<UserID>,
|
|
|
|
pub conv_id: ConvID,
|
|
|
|
pub message: Option<String>,
|
|
|
|
pub file: Option<ConversationMessageFile>,
|
2021-03-07 14:44:52 +00:00
|
|
|
pub server_message: Option<ConversationServerMessageType>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl NewConversationMessage {
|
|
|
|
/// Create a new server message
|
|
|
|
pub fn new_server_message(conv_id: ConvID, message: ConversationServerMessageType) -> Self {
|
|
|
|
Self {
|
|
|
|
user_id: None,
|
|
|
|
conv_id,
|
|
|
|
message: None,
|
|
|
|
file: None,
|
|
|
|
server_message: Some(message),
|
|
|
|
}
|
|
|
|
}
|
2020-06-22 10:19:13 +00:00
|
|
|
}
|