diff options
| author | Max Audron <audron@cocaine.farm> | 2025-02-23 17:44:12 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-02-23 17:44:12 +0100 |
| commit | b168e9489b33191168f940146e9fc3439f753e79 (patch) | |
| tree | 5c3ff43506df2fe60542c7b55533d38a4090b31f /src/session/mod.rs | |
| parent | move network config to it's own file and impl it's sync (diff) | |
add syncables for IrcUser
Diffstat (limited to '')
| -rw-r--r-- | src/session/mod.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/session/mod.rs b/src/session/mod.rs index f98cd04..be78a05 100644 --- a/src/session/mod.rs +++ b/src/session/mod.rs @@ -118,7 +118,25 @@ pub trait SessionManager { warn!("Could not find Network {:?}", network_id) } } - Class::IrcUser => (), + Class::IrcUser => { + let mut object_name = msg.object_name.split('/'); + let network_id: i32 = object_name.next().unwrap().parse().unwrap(); + let user = object_name.next().unwrap(); + + debug!("Syncing IrcUser {} in Network {:?}", user, network_id); + + if let Some(network) = self.network(network_id) { + if let Some(user) = network.irc_users.get_mut(user) { + user.sync(msg); + // TODO we probably need to deal with the quit here? + // and remove the user from the network + } else { + warn!("Could not find IrcUser {} in Network {:?}", user, network_id) + } + } else { + warn!("Could not find Network {:?}", network_id) + } + } Class::Unknown => (), } } |
