Improved plugin modularity and protocol
This commit is contained in:
+10
-7
@@ -178,13 +178,10 @@ impl Server {
|
||||
loop {
|
||||
let req = client.read()?;
|
||||
if let Some(r) = &req {
|
||||
for p in self.plugins.lock().unwrap().iter_mut() {
|
||||
p.send(LoaderMessage::Request {
|
||||
user_id: client.get_uuid().unwrap_or_default(),
|
||||
msg: r.clone(),
|
||||
});
|
||||
}
|
||||
|
||||
self.send_plugin_message(&LoaderMessage::Request {
|
||||
user_id: client.get_uuid().unwrap_or_default(),
|
||||
msg: r.clone(),
|
||||
});
|
||||
self.wrap_err(&client, self.call_request(r, &client))?;
|
||||
}
|
||||
}
|
||||
@@ -206,4 +203,10 @@ impl Server {
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
pub fn send_plugin_message(&self, msg: &LoaderMessage) {
|
||||
for p in self.plugins.lock().unwrap().iter_mut() {
|
||||
p.send(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user