Refactor naming
This commit is contained in:
parent
a9fd240bd3
commit
ad58ab9bdd
10 changed files with 66 additions and 62 deletions
src
14
src/cli.rs
14
src/cli.rs
|
@ -2,8 +2,8 @@ use clap::{Args, Parser, Subcommand};
|
|||
use telnet::Telnet;
|
||||
|
||||
use crate::parameter::{Parameter, ParameterList};
|
||||
use crate::response::channel::ResponseChannel;
|
||||
use crate::response::client::ResponseClient;
|
||||
use crate::models::Channel;
|
||||
use crate::models::Client;
|
||||
use crate::utils::SendTextMessageTarget;
|
||||
use crate::wrappers;
|
||||
|
||||
|
@ -87,14 +87,14 @@ impl FetchArgs {
|
|||
self.client.is_some()
|
||||
}
|
||||
|
||||
pub fn channel(&self, connection: &mut Telnet) -> Result<Option<ResponseChannel>, String> {
|
||||
pub fn channel(&self, connection: &mut Telnet) -> Result<Option<Channel>, String> {
|
||||
if let Some(channel) = &self.channel {
|
||||
wrappers::find_channel(connection, channel, self.strict_channel)
|
||||
} else {
|
||||
Err("No channel specified.".to_string())
|
||||
}
|
||||
}
|
||||
pub fn client(&self, connection: &mut Telnet) -> Result<Option<ResponseClient>, String> {
|
||||
pub fn client(&self, connection: &mut Telnet) -> Result<Option<Client>, String> {
|
||||
if let Some(client) = &self.client {
|
||||
wrappers::find_client(connection, client, self.strict_client)
|
||||
} else {
|
||||
|
@ -109,7 +109,7 @@ impl MessageArgs {
|
|||
Ok(SendTextMessageTarget::Server)
|
||||
} else if let Some(client) = &self.client {
|
||||
if let Some(client) = wrappers::find_client(connection, client, self.strict_client)? {
|
||||
return Ok(SendTextMessageTarget::Client(client.clid));
|
||||
return Ok(SendTextMessageTarget::Client(client));
|
||||
}
|
||||
return Err("Could not find client.".to_string());
|
||||
} else {
|
||||
|
@ -119,10 +119,10 @@ impl MessageArgs {
|
|||
}
|
||||
|
||||
impl MoveArgs {
|
||||
pub fn channel(&self, connection: &mut Telnet) -> Result<Option<ResponseChannel>, String> {
|
||||
pub fn channel(&self, connection: &mut Telnet) -> Result<Option<Channel>, String> {
|
||||
wrappers::find_channel(connection, &self.channel, self.strict_channel)
|
||||
}
|
||||
pub fn client(&self, connection: &mut Telnet) -> Result<Option<ResponseClient>, String> {
|
||||
pub fn client(&self, connection: &mut Telnet) -> Result<Option<Client>, String> {
|
||||
match &self.client {
|
||||
Some(client) => {
|
||||
wrappers::find_client(connection, client, self.strict_client)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue