mirror of
https://github.com/MeexReay/sRAC.git
synced 2025-06-24 10:32:58 +03:00
respect message_limit
This commit is contained in:
parent
2b4d1a4e27
commit
ff3e779962
13
src/logic.rs
13
src/logic.rs
@ -71,6 +71,9 @@ pub fn on_send_message(
|
|||||||
message: Vec<u8>,
|
message: Vec<u8>,
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
if !ctx.args.auth_only {
|
if !ctx.args.auth_only {
|
||||||
|
let mut message = message;
|
||||||
|
message.truncate(ctx.args.message_limit);
|
||||||
|
|
||||||
add_message(
|
add_message(
|
||||||
&mut message.clone(),
|
&mut message.clone(),
|
||||||
ctx.clone(),
|
ctx.clone(),
|
||||||
@ -90,12 +93,22 @@ pub fn on_send_auth_message(
|
|||||||
) -> Result<Option<u8>, Box<dyn Error>> {
|
) -> Result<Option<u8>, Box<dyn Error>> {
|
||||||
if let Some(acc) = ctx.get_account(name) {
|
if let Some(acc) = ctx.get_account(name) {
|
||||||
if acc.check_password(password) {
|
if acc.check_password(password) {
|
||||||
|
let mut name = name.to_string();
|
||||||
|
name.truncate(256); // FIXME: softcode this
|
||||||
|
|
||||||
|
let mut password = password.to_string();
|
||||||
|
password.truncate(256); // FIXME: softcode this
|
||||||
|
|
||||||
|
let mut text = text.to_string();
|
||||||
|
text.truncate(ctx.args.message_limit);
|
||||||
|
|
||||||
add_message(
|
add_message(
|
||||||
&mut text.as_bytes().to_vec(),
|
&mut text.as_bytes().to_vec(),
|
||||||
ctx.clone(),
|
ctx.clone(),
|
||||||
None,
|
None,
|
||||||
ctx.args.sanitize,
|
ctx.args.sanitize,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
Ok(None)
|
Ok(None)
|
||||||
} else {
|
} else {
|
||||||
Ok(Some(0x02))
|
Ok(Some(0x02))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user