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:
loki5512344 2026-07-09 11:52:56 +02:00
commit e751e0bf5b
94 changed files with 9771 additions and 0 deletions

View 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(())
}