Channel_loadMessageBlock

This commit is contained in:
2025-12-08 05:23:24 +05:00
parent 6d1f450f32
commit 88c2f8aa51
14 changed files with 149 additions and 89 deletions

View File

@@ -17,9 +17,7 @@ declare_RequestHandler(Login)
if(conn->authorized){
try_void(sendErrorMessage(log_ctx, conn, res_head,
LogSeverity_Warn,
STR("is authorized in already")
));
LogSeverity_Warn, STR("is authorized in already") ));
Return RESULT_VOID;
}
@@ -29,9 +27,7 @@ declare_RequestHandler(Login)
if(name_error_str.data){
Defer(str_destroy(name_error_str));
try_void(sendErrorMessage(log_ctx, conn, res_head,
LogSeverity_Warn,
name_error_str
));
LogSeverity_Warn, name_error_str));
Return RESULT_VOID;
}
@@ -46,11 +42,8 @@ declare_RequestHandler(Login)
// try get id from name cache
u64* id_ptr = HashMap_tryGetPtr(&srv->users.name_id_map, username_str);
if(id_ptr == NULL){
try_void(sendErrorMessage_f(log_ctx, conn, res_head,
LogSeverity_Warn,
"Username '%s' is not registered",
username_str.data
));
try_void(sendErrorMessage(log_ctx, conn, res_head,
LogSeverity_Warn, STR("Username is not registered") ));
Return RESULT_VOID;
}
u64 user_id = *id_ptr;
@@ -62,9 +55,7 @@ declare_RequestHandler(Login)
// validate token hash
if(memcmp(req.token, u->token, sizeof(req.token)) != 0){
try_void(sendErrorMessage(log_ctx, conn, res_head,
LogSeverity_Warn,
STR("wrong password")
));
LogSeverity_Warn, STR("wrong password") ));
Return RESULT_VOID;
}