pub type ConnectionId = usize;
pub type PostId = i32;
pub type CommunityId = i32;
-pub type UserId = i32;
+pub type LocalUserId = i32;
pub type IpAddr = String;
#[macro_export]
ConnectionId,
IpAddr,
LemmyError,
+ LocalUserId,
PostId,
- UserId,
};
use rand::rngs::ThreadRng;
use reqwest::Client;
/// A map from user id to its connection ID for joined users. Remember a user can have multiple
/// sessions (IE clients)
- pub(super) user_rooms: HashMap<UserId, HashSet<ConnectionId>>,
+ pub(super) user_rooms: HashMap<LocalUserId, HashSet<ConnectionId>>,
pub(super) rng: ThreadRng,
Ok(())
}
- pub fn join_user_room(&mut self, user_id: UserId, id: ConnectionId) -> Result<(), LemmyError> {
+ pub fn join_user_room(
+ &mut self,
+ user_id: LocalUserId,
+ id: ConnectionId,
+ ) -> Result<(), LemmyError> {
// remove session from all rooms
for sessions in self.user_rooms.values_mut() {
sessions.remove(&id);
&self,
op: &UserOperation,
response: &Response,
- recipient_id: UserId,
+ recipient_id: LocalUserId,
websocket_id: Option<ConnectionId>,
) -> Result<(), LemmyError>
where
use crate::UserOperation;
use actix::{prelude::*, Recipient};
use lemmy_api_structs::{comment::CommentResponse, post::PostResponse};
-use lemmy_utils::{CommunityId, ConnectionId, IpAddr, PostId, UserId};
+use lemmy_utils::{CommunityId, ConnectionId, IpAddr, LocalUserId, PostId};
use serde::{Deserialize, Serialize};
/// Chat server sends this messages to session
pub struct SendUserRoomMessage<Response> {
pub op: UserOperation,
pub response: Response,
- pub recipient_id: UserId,
+ pub recipient_id: LocalUserId,
pub websocket_id: Option<ConnectionId>,
}
#[derive(Message)]
#[rtype(result = "()")]
pub struct JoinUserRoom {
- pub local_user_id: UserId,
+ pub local_user_id: LocalUserId,
pub id: ConnectionId,
}