Initial commit: split VNOX monorepo into VNOX-Server
Unified server binary (vnox-serverd) combining: - Gateway (TCP, auth, channels, sessions, SQLite) - Voice-node (UDP relay, Opus, jitter buffer) Standalone gateway (vnox-gateway) and voice-node (vnox-voice-node) preserved as sub-crates.
This commit is contained in:
commit
e751e0bf5b
94 changed files with 9771 additions and 0 deletions
37
gateway/src/handler/friends/decline.rs
Normal file
37
gateway/src/handler/friends/decline.rs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
use anyhow::Result;
|
||||
use tokio::net::TcpStream;
|
||||
|
||||
use crate::{
|
||||
domain::session,
|
||||
net::io,
|
||||
proto::{FriendDeclinePayload, PacketId, SessionCrypto, to_payload},
|
||||
};
|
||||
|
||||
pub async fn handle_friend_decline(
|
||||
stream: &mut TcpStream,
|
||||
seq: &mut u32,
|
||||
session_id: &str,
|
||||
payload: &[u8],
|
||||
crypto: &SessionCrypto,
|
||||
state: &crate::net::state::State,
|
||||
) -> Result<()> {
|
||||
let req: FriendDeclinePayload = serde_json::from_slice(payload)?;
|
||||
let sess = session::get(&state.sessions, session_id)
|
||||
.await
|
||||
.ok_or_else(|| anyhow::anyhow!("session not found"))?;
|
||||
|
||||
state
|
||||
.storage
|
||||
.decline_friend_request(&req.from_user_id, &sess.user_id)
|
||||
.await?;
|
||||
|
||||
io::send_encrypted(
|
||||
stream,
|
||||
PacketId::FriendDecline,
|
||||
seq,
|
||||
&to_payload(&serde_json::json!({"status": "DECLINED"})),
|
||||
crypto,
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue