use lemmy_utils::{
location_info,
rate_limit::RateLimit,
- APIError,
+ ApiError,
CommunityId,
ConnectionId,
- IPAddr,
+ IpAddr,
LemmyError,
PostId,
UserId,
}
pub struct SessionInfo {
- pub addr: Recipient<WSMessage>,
- pub ip: IPAddr,
+ pub addr: Recipient<WsMessage>,
+ pub ip: IpAddr,
}
/// `ChatServer` is an actor. It maintains list of connection client session.
fn sendit(&self, message: &str, id: ConnectionId) {
if let Some(info) = self.sessions.get(&id) {
- let _ = info.addr.do_send(WSMessage(message.to_owned()));
+ let _ = info.addr.do_send(WsMessage(message.to_owned()));
}
}
) -> impl Future<Output = Result<String, LemmyError>> {
let rate_limiter = self.rate_limiter.clone();
- let ip: IPAddr = match self.sessions.get(&msg.id) {
+ let ip: IpAddr = match self.sessions.get(&msg.id) {
Some(info) => info.ip.to_owned(),
None => "blank_ip".to_string(),
};
async move {
let json: Value = serde_json::from_str(&msg.msg)?;
let data = &json["data"].to_string();
- let op = &json["op"].as_str().ok_or(APIError {
+ let op = &json["op"].as_str().ok_or(ApiError {
message: "Unknown op type".to_string(),
})?;