use std::borrow::Cow;
use std::marker::PhantomData;
use std::mem;
use num_traits::{FromPrimitive, ToPrimitive};
use tsproto::packets::{Direction, Flags, InCommand, OutCommand, OutPacket,
PacketType};
pub trait InMessageTrait<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> where Self: Sized;
}
#[derive(Debug)]
pub struct InMessage {
cmd: InCommand,
msg: InMessages<'static>,
}
#[derive(Debug)]
pub enum InMessages<'a> {
ClientInit(InClientInit<'a>),
ClientInitIv(InClientInitIv<'a>),
PluginCommandRequest(InPluginCommandRequest<'a>),
BanAdd(InBanAdd<'a>),
BanClient(InBanClient<'a>),
BanDel(InBanDel<'a>),
BanDelAll(InBanDelAll<'a>),
BanListRequest(InBanListRequest<'a>),
BindingList(InBindingList<'a>),
ChannelAddPerm(InChannelAddPerm<'a>),
ChannelClientAddPerm(InChannelClientAddPerm<'a>),
ChannelClientDelPerm(InChannelClientDelPerm<'a>),
ChannelClientPermListRequest(InChannelClientPermListRequest<'a>),
ChannelCreate(InChannelCreate<'a>),
ChannelDelete(InChannelDelete<'a>),
ChannelDelPerm(InChannelDelPerm<'a>),
ChannelDescriptionRequest(InChannelDescriptionRequest<'a>),
ChannelEdit(InChannelEdit<'a>),
ChannelFindRequest(InChannelFindRequest<'a>),
ChannelGroupAdd(InChannelGroupAdd<'a>),
ChannelGroupAddPerm(InChannelGroupAddPerm<'a>),
ChannelGroupClientListRequest(InChannelGroupClientListRequest<'a>),
ChannelGroupCopy(InChannelGroupCopy<'a>),
ChannelGroupDel(InChannelGroupDel<'a>),
ChannelGroupDelPerm(InChannelGroupDelPerm<'a>),
ChannelGroupListRequest(InChannelGroupListRequest<'a>),
ChannelGroupPermListRequest(InChannelGroupPermListRequest<'a>),
ChannelGroupRename(InChannelGroupRename<'a>),
ChannelInfoRequest(InChannelInfoRequest<'a>),
ChannelListRequest(InChannelListRequest<'a>),
ChannelMove(InChannelMove<'a>),
ChannelPermListRequest(InChannelPermListRequest<'a>),
ChannelSubscribe(InChannelSubscribe<'a>),
ChannelSubscribeAll(InChannelSubscribeAll<'a>),
ChannelUnsubscribe(InChannelUnsubscribe<'a>),
ChannelUnsubscribeAll(InChannelUnsubscribeAll<'a>),
ClientAddPerm(InClientAddPerm<'a>),
ClientChatClose(InClientChatClose<'a>),
ClientConnectionInfoRequest(InClientConnectionInfoRequest<'a>),
ClientDbDelete(InClientDbDelete<'a>),
ClientDbEdit(InClientDbEdit<'a>),
ClientDbFindRequest(InClientDbFindRequest<'a>),
ClientDbInfoRequest(InClientDbInfoRequest<'a>),
ClientDbListRequest(InClientDbListRequest<'a>),
ClientDelPerm(InClientDelPerm<'a>),
ClientEdit(InClientEdit<'a>),
ClientFindRequest(InClientFindRequest<'a>),
ClientDbIdFromUidRequest(InClientDbIdFromUidRequest<'a>),
ClientIdsRequest(InClientIdsRequest<'a>),
ClientNameFromDbIdRequest(InClientNameFromDbIdRequest<'a>),
ClientNameFromUidRequest(InClientNameFromUidRequest<'a>),
ClientUidFromClidRequest(InClientUidFromClidRequest<'a>),
ClientVariablesRequest(InClientVariablesRequest<'a>),
ClientInfoRequest(InClientInfoRequest<'a>),
ClientKick(InClientKick<'a>),
ClientListRequest(InClientListRequest<'a>),
ClientMove(InClientMove<'a>),
ClientPermListRequest(InClientPermListRequest<'a>),
ClientPokeRequest(InClientPokeRequest<'a>),
ClientSetServerQueryLoginRequest(InClientSetServerQueryLoginRequest<'a>),
ClientUpdate(InClientUpdate<'a>),
ComplainAdd(InComplainAdd<'a>),
ComplainDel(InComplainDel<'a>),
ComplainDelAll(InComplainDelAll<'a>),
ComplainListRequest(InComplainListRequest<'a>),
CustomDelete(InCustomDelete<'a>),
CustomInfoRequest(InCustomInfoRequest<'a>),
CustomSearch(InCustomSearch<'a>),
CustomSet(InCustomSet<'a>),
FtCreateDir(InFtCreateDir<'a>),
FtDeleteFile(InFtDeleteFile<'a>),
FtFileInfoRequest(InFtFileInfoRequest<'a>),
FtFileListRequest(InFtFileListRequest<'a>),
FtInitDownload(InFtInitDownload<'a>),
FtInitUpload(InFtInitUpload<'a>),
FtList(InFtList<'a>),
FtRenameFile(InFtRenameFile<'a>),
FtStop(InFtStop<'a>),
GlobalMessage(InGlobalMessage<'a>),
HostInfoRequest(InHostInfoRequest<'a>),
InstanceEdit(InInstanceEdit<'a>),
InstanceInfo(InInstanceInfo<'a>),
LogAdd(InLogAdd<'a>),
Login(InLogin<'a>),
Logout(InLogout<'a>),
LogView(InLogView<'a>),
OfflineMessageAdd(InOfflineMessageAdd<'a>),
OfflineMessageDel(InOfflineMessageDel<'a>),
OfflineMessageGet(InOfflineMessageGet<'a>),
OfflineMessageListRequest(InOfflineMessageListRequest<'a>),
OfflineMessageUpdateFlag(InOfflineMessageUpdateFlag<'a>),
PermFindRequest(InPermFindRequest<'a>),
PermRequest(InPermRequest<'a>),
PermIdByNameRequest(InPermIdByNameRequest<'a>),
PermListRequest(InPermListRequest<'a>),
PermOverviewRequest(InPermOverviewRequest<'a>),
PermReset(InPermReset<'a>),
PrivilegeKeyAddRequest(InPrivilegeKeyAddRequest<'a>),
PrivilegeKeyDelete(InPrivilegeKeyDelete<'a>),
PrivilegeKeyListRequest(InPrivilegeKeyListRequest<'a>),
PrivilegeKeyUse(InPrivilegeKeyUse<'a>),
Quit(InQuit<'a>),
SendTextMessage(InSendTextMessage<'a>),
ServerCreate(InServerCreate<'a>),
ServerDelete(InServerDelete<'a>),
ServerEdit(InServerEdit<'a>),
ServerVariablesRequest(InServerVariablesRequest<'a>),
ServerGroupAdd(InServerGroupAdd<'a>),
ServerGroupAddClient(InServerGroupAddClient<'a>),
ServerGroupAddPerm(InServerGroupAddPerm<'a>),
ServerGroupAutoAddPerm(InServerGroupAutoAddPerm<'a>),
ServerGroupAutoDelPerm(InServerGroupAutoDelPerm<'a>),
ServerGroupClientListRequest(InServerGroupClientListRequest<'a>),
ServerGroupCopy(InServerGroupCopy<'a>),
ServerGroupDel(InServerGroupDel<'a>),
ServerGroupDelClient(InServerGroupDelClient<'a>),
ServerGroupDelPerm(InServerGroupDelPerm<'a>),
ServerGroupListRequest(InServerGroupListRequest<'a>),
ServerGroupPermListRequest(InServerGroupPermListRequest<'a>),
ServerGroupRename(InServerGroupRename<'a>),
ServerGroupsByClientIdRequest(InServerGroupsByClientIdRequest<'a>),
ServerIdGetByPort(InServerIdGetByPort<'a>),
ServerInfo(InServerInfo<'a>),
ServerList(InServerList<'a>),
ServerNotifyRegister(InServerNotifyRegister<'a>),
ServerNotifyUnregister(InServerNotifyUnregister<'a>),
ServerProcessStop(InServerProcessStop<'a>),
ServerConnectionInfoRequest(InServerConnectionInfoRequest<'a>),
ServerSnapshotCreate(InServerSnapshotCreate<'a>),
ServerSnapshotDeploy(InServerSnapshotDeploy<'a>),
ServerStart(InServerStart<'a>),
ServerStop(InServerStop<'a>),
ServerTempPasswordAdd(InServerTempPasswordAdd<'a>),
ServerTempPasswordDel(InServerTempPasswordDel<'a>),
ServerTempPasswordListRequest(InServerTempPasswordListRequest<'a>),
SetClientChannelGroup(InSetClientChannelGroup<'a>),
TokenAddRequest(InTokenAddRequest<'a>),
TokenDelete(InTokenDelete<'a>),
TokenListRequest(InTokenListRequest<'a>),
TokenUse(InTokenUse<'a>),
Use(InUse<'a>),
VersionRequest(InVersionRequest<'a>),
WhoAmIRequest(InWhoAmIRequest<'a>),
Disconnect(InDisconnect<'a>),
Other,
}
impl InMessage {
pub fn new(cmd: InCommand) -> Result<Self, (InCommand, ParseError)> {
let mut res = Self { cmd, msg: InMessages::Other };
{
let msg: InMessages = loop { match res.cmd.data().name {
"banadd" => { match InBanAdd::new(&res.cmd) {
Ok(msg) => break InMessages::BanAdd(msg),
Err(e) => return Err((res.cmd, e)),
}}
"banclient" => { match InBanClient::new(&res.cmd) {
Ok(msg) => break InMessages::BanClient(msg),
Err(e) => return Err((res.cmd, e)),
}}
"bandel" => { match InBanDel::new(&res.cmd) {
Ok(msg) => break InMessages::BanDel(msg),
Err(e) => return Err((res.cmd, e)),
}}
"bandelall" => { match InBanDelAll::new(&res.cmd) {
Ok(msg) => break InMessages::BanDelAll(msg),
Err(e) => return Err((res.cmd, e)),
}}
"banlist" => { match InBanListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::BanListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"bindinglist" => { match InBindingList::new(&res.cmd) {
Ok(msg) => break InMessages::BindingList(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channeladdperm" => { match InChannelAddPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelAddPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelclientaddperm" => { match InChannelClientAddPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelClientAddPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelclientdelperm" => { match InChannelClientDelPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelClientDelPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelclientpermlist" => { match InChannelClientPermListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelClientPermListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelcreate" => { match InChannelCreate::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelCreate(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channeldelete" => { match InChannelDelete::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelDelete(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channeldelperm" => { match InChannelDelPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelDelPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channeledit" => { match InChannelEdit::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelEdit(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelfind" => { match InChannelFindRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelFindRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgetdescription" => { match InChannelDescriptionRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelDescriptionRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgroupadd" => { match InChannelGroupAdd::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupAdd(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgroupaddperm" => { match InChannelGroupAddPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupAddPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgroupclientlist" => { match InChannelGroupClientListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupClientListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgroupcopy" => { match InChannelGroupCopy::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupCopy(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgroupdel" => { match InChannelGroupDel::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupDel(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgroupdelperm" => { match InChannelGroupDelPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupDelPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgrouplist" => { match InChannelGroupListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgrouppermlist" => { match InChannelGroupPermListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupPermListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelgrouprename" => { match InChannelGroupRename::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelGroupRename(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelinfo" => { match InChannelInfoRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelInfoRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channellist" => { match InChannelListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelmove" => { match InChannelMove::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelMove(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelpermlist" => { match InChannelPermListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelPermListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelsubscribe" => { match InChannelSubscribe::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelSubscribe(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelsubscribeall" => { match InChannelSubscribeAll::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelSubscribeAll(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelunsubscribe" => { match InChannelUnsubscribe::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelUnsubscribe(msg),
Err(e) => return Err((res.cmd, e)),
}}
"channelunsubscribeall" => { match InChannelUnsubscribeAll::new(&res.cmd) {
Ok(msg) => break InMessages::ChannelUnsubscribeAll(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientaddperm" => { match InClientAddPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ClientAddPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientchatclosed" => { match InClientChatClose::new(&res.cmd) {
Ok(msg) => break InMessages::ClientChatClose(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientdbdelete" => { match InClientDbDelete::new(&res.cmd) {
Ok(msg) => break InMessages::ClientDbDelete(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientdbedit" => { match InClientDbEdit::new(&res.cmd) {
Ok(msg) => break InMessages::ClientDbEdit(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientdbfind" => { match InClientDbFindRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientDbFindRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientdbinfo" => { match InClientDbInfoRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientDbInfoRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientdblist" => { match InClientDbListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientDbListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientdelperm" => { match InClientDelPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ClientDelPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientdisconnect" => { match InDisconnect::new(&res.cmd) {
Ok(msg) => break InMessages::Disconnect(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientedit" => { match InClientEdit::new(&res.cmd) {
Ok(msg) => break InMessages::ClientEdit(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientfind" => { match InClientFindRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientFindRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientgetdbidfromuid" => { match InClientDbIdFromUidRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientDbIdFromUidRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientgetids" => { match InClientIdsRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientIdsRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientgetnamefromdbid" => { match InClientNameFromDbIdRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientNameFromDbIdRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientgetnamefromuid" => { match InClientNameFromUidRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientNameFromUidRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientgetuidfromclid" => { match InClientUidFromClidRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientUidFromClidRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientgetvariables" => { match InClientVariablesRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientVariablesRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientinfo" => { match InClientInfoRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientInfoRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientinit" => { match InClientInit::new(&res.cmd) {
Ok(msg) => break InMessages::ClientInit(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientinitiv" => { match InClientInitIv::new(&res.cmd) {
Ok(msg) => break InMessages::ClientInitIv(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientkick" => { match InClientKick::new(&res.cmd) {
Ok(msg) => break InMessages::ClientKick(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientlist" => { match InClientListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientmove" => { match InClientMove::new(&res.cmd) {
Ok(msg) => break InMessages::ClientMove(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientpermlist" => { match InClientPermListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientPermListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientpoke" => { match InClientPokeRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientPokeRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientsetserverquerylogin" => { match InClientSetServerQueryLoginRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientSetServerQueryLoginRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"clientupdate" => { match InClientUpdate::new(&res.cmd) {
Ok(msg) => break InMessages::ClientUpdate(msg),
Err(e) => return Err((res.cmd, e)),
}}
"complainadd" => { match InComplainAdd::new(&res.cmd) {
Ok(msg) => break InMessages::ComplainAdd(msg),
Err(e) => return Err((res.cmd, e)),
}}
"complaindel" => { match InComplainDel::new(&res.cmd) {
Ok(msg) => break InMessages::ComplainDel(msg),
Err(e) => return Err((res.cmd, e)),
}}
"complaindelall" => { match InComplainDelAll::new(&res.cmd) {
Ok(msg) => break InMessages::ComplainDelAll(msg),
Err(e) => return Err((res.cmd, e)),
}}
"complainlist" => { match InComplainListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ComplainListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"customdelete" => { match InCustomDelete::new(&res.cmd) {
Ok(msg) => break InMessages::CustomDelete(msg),
Err(e) => return Err((res.cmd, e)),
}}
"custominfo" => { match InCustomInfoRequest::new(&res.cmd) {
Ok(msg) => break InMessages::CustomInfoRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"customsearch" => { match InCustomSearch::new(&res.cmd) {
Ok(msg) => break InMessages::CustomSearch(msg),
Err(e) => return Err((res.cmd, e)),
}}
"customset" => { match InCustomSet::new(&res.cmd) {
Ok(msg) => break InMessages::CustomSet(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftcreatedir" => { match InFtCreateDir::new(&res.cmd) {
Ok(msg) => break InMessages::FtCreateDir(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftdeletefile" => { match InFtDeleteFile::new(&res.cmd) {
Ok(msg) => break InMessages::FtDeleteFile(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftgetfileinfo" => { match InFtFileInfoRequest::new(&res.cmd) {
Ok(msg) => break InMessages::FtFileInfoRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftgetfilelist" => { match InFtFileListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::FtFileListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftinitdownload" => { match InFtInitDownload::new(&res.cmd) {
Ok(msg) => break InMessages::FtInitDownload(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftinitupload" => { match InFtInitUpload::new(&res.cmd) {
Ok(msg) => break InMessages::FtInitUpload(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftlist" => { match InFtList::new(&res.cmd) {
Ok(msg) => break InMessages::FtList(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftrenamefile" => { match InFtRenameFile::new(&res.cmd) {
Ok(msg) => break InMessages::FtRenameFile(msg),
Err(e) => return Err((res.cmd, e)),
}}
"ftstop" => { match InFtStop::new(&res.cmd) {
Ok(msg) => break InMessages::FtStop(msg),
Err(e) => return Err((res.cmd, e)),
}}
"getconnectioninfo" => { match InClientConnectionInfoRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ClientConnectionInfoRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"gm" => { match InGlobalMessage::new(&res.cmd) {
Ok(msg) => break InMessages::GlobalMessage(msg),
Err(e) => return Err((res.cmd, e)),
}}
"hostinfo" => { match InHostInfoRequest::new(&res.cmd) {
Ok(msg) => break InMessages::HostInfoRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"instanceedit" => { match InInstanceEdit::new(&res.cmd) {
Ok(msg) => break InMessages::InstanceEdit(msg),
Err(e) => return Err((res.cmd, e)),
}}
"instanceinfo" => { match InInstanceInfo::new(&res.cmd) {
Ok(msg) => break InMessages::InstanceInfo(msg),
Err(e) => return Err((res.cmd, e)),
}}
"logadd" => { match InLogAdd::new(&res.cmd) {
Ok(msg) => break InMessages::LogAdd(msg),
Err(e) => return Err((res.cmd, e)),
}}
"login" => { match InLogin::new(&res.cmd) {
Ok(msg) => break InMessages::Login(msg),
Err(e) => return Err((res.cmd, e)),
}}
"logout" => { match InLogout::new(&res.cmd) {
Ok(msg) => break InMessages::Logout(msg),
Err(e) => return Err((res.cmd, e)),
}}
"logview" => { match InLogView::new(&res.cmd) {
Ok(msg) => break InMessages::LogView(msg),
Err(e) => return Err((res.cmd, e)),
}}
"messageadd" => { match InOfflineMessageAdd::new(&res.cmd) {
Ok(msg) => break InMessages::OfflineMessageAdd(msg),
Err(e) => return Err((res.cmd, e)),
}}
"messagedel" => { match InOfflineMessageDel::new(&res.cmd) {
Ok(msg) => break InMessages::OfflineMessageDel(msg),
Err(e) => return Err((res.cmd, e)),
}}
"messageget" => { match InOfflineMessageGet::new(&res.cmd) {
Ok(msg) => break InMessages::OfflineMessageGet(msg),
Err(e) => return Err((res.cmd, e)),
}}
"messagelist" => { match InOfflineMessageListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::OfflineMessageListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"messageupdateflag" => { match InOfflineMessageUpdateFlag::new(&res.cmd) {
Ok(msg) => break InMessages::OfflineMessageUpdateFlag(msg),
Err(e) => return Err((res.cmd, e)),
}}
"permfind" => { match InPermFindRequest::new(&res.cmd) {
Ok(msg) => break InMessages::PermFindRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"permget" => { match InPermRequest::new(&res.cmd) {
Ok(msg) => break InMessages::PermRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"permidgetbyname" => { match InPermIdByNameRequest::new(&res.cmd) {
Ok(msg) => break InMessages::PermIdByNameRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"permissionlist" => { match InPermListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::PermListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"permoverview" => { match InPermOverviewRequest::new(&res.cmd) {
Ok(msg) => break InMessages::PermOverviewRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"permreset" => { match InPermReset::new(&res.cmd) {
Ok(msg) => break InMessages::PermReset(msg),
Err(e) => return Err((res.cmd, e)),
}}
"plugincmd" => { match InPluginCommandRequest::new(&res.cmd) {
Ok(msg) => break InMessages::PluginCommandRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"privilegekeyadd" => { match InPrivilegeKeyAddRequest::new(&res.cmd) {
Ok(msg) => break InMessages::PrivilegeKeyAddRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"privilegekeydelete" => { match InPrivilegeKeyDelete::new(&res.cmd) {
Ok(msg) => break InMessages::PrivilegeKeyDelete(msg),
Err(e) => return Err((res.cmd, e)),
}}
"privilegekeylist" => { match InPrivilegeKeyListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::PrivilegeKeyListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"privilegekeyuse" => { match InPrivilegeKeyUse::new(&res.cmd) {
Ok(msg) => break InMessages::PrivilegeKeyUse(msg),
Err(e) => return Err((res.cmd, e)),
}}
"quit" => { match InQuit::new(&res.cmd) {
Ok(msg) => break InMessages::Quit(msg),
Err(e) => return Err((res.cmd, e)),
}}
"sendtextmessage" => { match InSendTextMessage::new(&res.cmd) {
Ok(msg) => break InMessages::SendTextMessage(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servercreate" => { match InServerCreate::new(&res.cmd) {
Ok(msg) => break InMessages::ServerCreate(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serverdelete" => { match InServerDelete::new(&res.cmd) {
Ok(msg) => break InMessages::ServerDelete(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serveredit" => { match InServerEdit::new(&res.cmd) {
Ok(msg) => break InMessages::ServerEdit(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergetvariables" => { match InServerVariablesRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ServerVariablesRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupadd" => { match InServerGroupAdd::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupAdd(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupaddclient" => { match InServerGroupAddClient::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupAddClient(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupaddperm" => { match InServerGroupAddPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupAddPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupautoaddperm" => { match InServerGroupAutoAddPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupAutoAddPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupautodelperm" => { match InServerGroupAutoDelPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupAutoDelPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupclientlist" => { match InServerGroupClientListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupClientListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupcopy" => { match InServerGroupCopy::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupCopy(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupdel" => { match InServerGroupDel::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupDel(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupdelclient" => { match InServerGroupDelClient::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupDelClient(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupdelperm" => { match InServerGroupDelPerm::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupDelPerm(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergrouplist" => { match InServerGroupListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergrouppermlist" => { match InServerGroupPermListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupPermListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergrouprename" => { match InServerGroupRename::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupRename(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servergroupsbyclientid" => { match InServerGroupsByClientIdRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ServerGroupsByClientIdRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serveridgetbyport" => { match InServerIdGetByPort::new(&res.cmd) {
Ok(msg) => break InMessages::ServerIdGetByPort(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serverinfo" => { match InServerInfo::new(&res.cmd) {
Ok(msg) => break InMessages::ServerInfo(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serverlist" => { match InServerList::new(&res.cmd) {
Ok(msg) => break InMessages::ServerList(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servernotifyregister" => { match InServerNotifyRegister::new(&res.cmd) {
Ok(msg) => break InMessages::ServerNotifyRegister(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servernotifyunregister" => { match InServerNotifyUnregister::new(&res.cmd) {
Ok(msg) => break InMessages::ServerNotifyUnregister(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serverprocessstop" => { match InServerProcessStop::new(&res.cmd) {
Ok(msg) => break InMessages::ServerProcessStop(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serverrequestconnectioninfo" => { match InServerConnectionInfoRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ServerConnectionInfoRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serversnapshotcreate" => { match InServerSnapshotCreate::new(&res.cmd) {
Ok(msg) => break InMessages::ServerSnapshotCreate(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serversnapshotdeploy" => { match InServerSnapshotDeploy::new(&res.cmd) {
Ok(msg) => break InMessages::ServerSnapshotDeploy(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serverstart" => { match InServerStart::new(&res.cmd) {
Ok(msg) => break InMessages::ServerStart(msg),
Err(e) => return Err((res.cmd, e)),
}}
"serverstop" => { match InServerStop::new(&res.cmd) {
Ok(msg) => break InMessages::ServerStop(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servertemppasswordadd" => { match InServerTempPasswordAdd::new(&res.cmd) {
Ok(msg) => break InMessages::ServerTempPasswordAdd(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servertemppassworddel" => { match InServerTempPasswordDel::new(&res.cmd) {
Ok(msg) => break InMessages::ServerTempPasswordDel(msg),
Err(e) => return Err((res.cmd, e)),
}}
"servertemppasswordlist" => { match InServerTempPasswordListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::ServerTempPasswordListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"setclientchannelgroup" => { match InSetClientChannelGroup::new(&res.cmd) {
Ok(msg) => break InMessages::SetClientChannelGroup(msg),
Err(e) => return Err((res.cmd, e)),
}}
"tokenadd" => { match InTokenAddRequest::new(&res.cmd) {
Ok(msg) => break InMessages::TokenAddRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"tokendelete" => { match InTokenDelete::new(&res.cmd) {
Ok(msg) => break InMessages::TokenDelete(msg),
Err(e) => return Err((res.cmd, e)),
}}
"tokenlist" => { match InTokenListRequest::new(&res.cmd) {
Ok(msg) => break InMessages::TokenListRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"tokenuse" => { match InTokenUse::new(&res.cmd) {
Ok(msg) => break InMessages::TokenUse(msg),
Err(e) => return Err((res.cmd, e)),
}}
"use" => { match InUse::new(&res.cmd) {
Ok(msg) => break InMessages::Use(msg),
Err(e) => return Err((res.cmd, e)),
}}
"version" => { match InVersionRequest::new(&res.cmd) {
Ok(msg) => break InMessages::VersionRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
"whoami" => { match InWhoAmIRequest::new(&res.cmd) {
Ok(msg) => break InMessages::WhoAmIRequest(msg),
Err(e) => return Err((res.cmd, e)),
}}
s => {
let s = s.to_string();
return Err((res.cmd, ParseError::UnknownCommand(s)));
}
}};
res.msg = unsafe { mem::transmute(msg) };
}
Ok(res)
}
#[inline]
pub fn command(&self) -> &InCommand { &self.cmd }
#[inline]
pub fn msg(&self) -> &InMessages { &self.msg }
#[inline]
pub fn into_command(self) -> InCommand { self.cmd }
}
#[derive(Debug)]
pub struct InClientInit<'a> {
list: Vec<ClientInitPart<'a>>,
}
#[derive(Debug)]
pub struct ClientInitPart<'a> {
pub name: &'a str,
pub client_version: &'a str,
pub client_platform: &'a str,
pub input_hardware_enabled: bool,
pub output_hardware_enabled: bool,
pub default_channel: &'a str,
pub default_channel_password: &'a str,
pub password: &'a str,
pub metadata: &'a str,
pub client_version_sign: &'a str,
pub client_key_offset: u64,
pub phonetic_name: &'a str,
pub default_token: &'a str,
pub hardware_id: &'a str,
pub badges: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientInit<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientinit" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientInitPart {
name: {
let val = ccmd.0.get("client_nickname")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ClientInit", })?;
val },
client_version: {
let val = ccmd.0.get("client_version")
.ok_or(ParseError::ParameterNotFound { arg: "ClientVersion", name: "ClientInit", })?;
val },
client_platform: {
let val = ccmd.0.get("client_platform")
.ok_or(ParseError::ParameterNotFound { arg: "ClientPlatform", name: "ClientInit", })?;
val },
input_hardware_enabled: {
let val = ccmd.0.get("client_input_hardware")
.ok_or(ParseError::ParameterNotFound { arg: "InputHardwareEnabled", name: "ClientInit", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "InputHardwareEnabled",
value: val.to_string(),
})? }
},
output_hardware_enabled: {
let val = ccmd.0.get("client_output_hardware")
.ok_or(ParseError::ParameterNotFound { arg: "OutputHardwareEnabled", name: "ClientInit", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "OutputHardwareEnabled",
value: val.to_string(),
})? }
},
default_channel: {
let val = ccmd.0.get("client_default_channel")
.ok_or(ParseError::ParameterNotFound { arg: "DefaultChannel", name: "ClientInit", })?;
val },
default_channel_password: {
let val = ccmd.0.get("client_default_channel_password")
.ok_or(ParseError::ParameterNotFound { arg: "DefaultChannelPassword", name: "ClientInit", })?;
val },
password: {
let val = ccmd.0.get("client_server_password")
.ok_or(ParseError::ParameterNotFound { arg: "Password", name: "ClientInit", })?;
val },
metadata: {
let val = ccmd.0.get("client_meta_data")
.ok_or(ParseError::ParameterNotFound { arg: "Metadata", name: "ClientInit", })?;
val },
client_version_sign: {
let val = ccmd.0.get("client_version_sign")
.ok_or(ParseError::ParameterNotFound { arg: "ClientVersionSign", name: "ClientInit", })?;
val },
client_key_offset: {
let val = ccmd.0.get("client_key_offset")
.ok_or(ParseError::ParameterNotFound { arg: "ClientKeyOffset", name: "ClientInit", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientKeyOffset",
value: val.to_string(),
error: e,
})?
},
phonetic_name: {
let val = ccmd.0.get("client_nickname_phonetic")
.ok_or(ParseError::ParameterNotFound { arg: "PhoneticName", name: "ClientInit", })?;
val },
default_token: {
let val = ccmd.0.get("client_default_token")
.ok_or(ParseError::ParameterNotFound { arg: "DefaultToken", name: "ClientInit", })?;
val },
hardware_id: {
let val = ccmd.0.get("hwid")
.ok_or(ParseError::ParameterNotFound { arg: "HardwareId", name: "ClientInit", })?;
val },
badges: {
if let Some(val) = ccmd.0.get("client_badges") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InClientInit { list })
}
}
impl<'a> InClientInit<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientInitPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientInit<'a> {
type Item = &'a ClientInitPart<'a>;
type IntoIter = InMessageIterator<'a, ClientInitPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientInitIv<'a> {
list: Vec<ClientInitIvPart<'a>>,
}
#[derive(Debug)]
pub struct ClientInitIvPart<'a> {
pub alpha: &'a str,
pub omega: &'a str,
pub ip: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientInitIv<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientinitiv" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientInitIvPart {
alpha: {
let val = ccmd.0.get("alpha")
.ok_or(ParseError::ParameterNotFound { arg: "Alpha", name: "ClientInitIv", })?;
val },
omega: {
let val = ccmd.0.get("omega")
.ok_or(ParseError::ParameterNotFound { arg: "Omega", name: "ClientInitIv", })?;
val },
ip: {
let val = ccmd.0.get("ip")
.ok_or(ParseError::ParameterNotFound { arg: "Ip", name: "ClientInitIv", })?;
val },
phantom: PhantomData,
});
}
Ok(InClientInitIv { list })
}
}
impl<'a> InClientInitIv<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientInitIvPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientInitIv<'a> {
type Item = &'a ClientInitIvPart<'a>;
type IntoIter = InMessageIterator<'a, ClientInitIvPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPluginCommandRequest<'a> {
list: Vec<PluginCommandRequestPart<'a>>,
}
#[derive(Debug)]
pub struct PluginCommandRequestPart<'a> {
pub name: &'a str,
pub data: &'a str,
pub target: PluginTargetMode,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPluginCommandRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "plugincmd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(PluginCommandRequestPart {
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "PluginCommandRequest", })?;
val },
data: {
let val = ccmd.0.get("data")
.ok_or(ParseError::ParameterNotFound { arg: "Data", name: "PluginCommandRequest", })?;
val },
target: {
let val = ccmd.0.get("targetmode")
.ok_or(ParseError::ParameterNotFound { arg: "Target", name: "PluginCommandRequest", })?;
PluginTargetMode::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "Target",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "Target",
value: val.to_string(),
})?
},
phantom: PhantomData,
});
}
Ok(InPluginCommandRequest { list })
}
}
impl<'a> InPluginCommandRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PluginCommandRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPluginCommandRequest<'a> {
type Item = &'a PluginCommandRequestPart<'a>;
type IntoIter = InMessageIterator<'a, PluginCommandRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InBanAdd<'a> {
list: Vec<BanAddPart<'a>>,
}
#[derive(Debug)]
pub struct BanAddPart<'a> {
pub ip: Option<&'a str>,
pub name: Option<&'a str>,
pub uid: Option<UidRef<'a>>,
pub time: Option<Duration>,
pub ban_reason: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InBanAdd<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "banadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(BanAddPart {
ip: {
if let Some(val) = ccmd.0.get("ip") {
Some({ val })
} else { None } },
name: {
if let Some(val) = ccmd.0.get("name") {
Some({ val })
} else { None } },
uid: {
if let Some(val) = ccmd.0.get("uid") {
Some({ UidRef(val) })
} else { None } },
time: {
if let Some(val) = ccmd.0.get("time") {
Some({ let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "Time",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "Time",
value: val.to_string(),
})? }
})
} else { None } },
ban_reason: {
if let Some(val) = ccmd.0.get("banreason") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InBanAdd { list })
}
}
impl<'a> InBanAdd<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<BanAddPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InBanAdd<'a> {
type Item = &'a BanAddPart<'a>;
type IntoIter = InMessageIterator<'a, BanAddPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InBanClient<'a> {
list: Vec<BanClientPart<'a>>,
}
#[derive(Debug)]
pub struct BanClientPart<'a> {
pub client_id: ClientId,
pub time: Option<Duration>,
pub ban_reason: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InBanClient<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "banclient" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(BanClientPart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "BanClient", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
time: {
if let Some(val) = ccmd.0.get("time") {
Some({ let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "Time",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "Time",
value: val.to_string(),
})? }
})
} else { None } },
ban_reason: {
if let Some(val) = ccmd.0.get("banreason") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InBanClient { list })
}
}
impl<'a> InBanClient<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<BanClientPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InBanClient<'a> {
type Item = &'a BanClientPart<'a>;
type IntoIter = InMessageIterator<'a, BanClientPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InBanDel<'a> {
list: Vec<BanDelPart<'a>>,
}
#[derive(Debug)]
pub struct BanDelPart<'a> {
pub ban_id: u32,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InBanDel<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "bandel" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(BanDelPart {
ban_id: {
let val = ccmd.0.get("banid")
.ok_or(ParseError::ParameterNotFound { arg: "BanId", name: "BanDel", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "BanId",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InBanDel { list })
}
}
impl<'a> InBanDel<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<BanDelPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InBanDel<'a> {
type Item = &'a BanDelPart<'a>;
type IntoIter = InMessageIterator<'a, BanDelPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InBanDelAll<'a> {
list: Vec<BanDelAllPart<'a>>,
}
#[derive(Debug)]
pub struct BanDelAllPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InBanDelAll<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "bandelall" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(BanDelAllPart {
phantom: PhantomData,
});
}
Ok(InBanDelAll { list })
}
}
impl<'a> InBanDelAll<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<BanDelAllPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InBanDelAll<'a> {
type Item = &'a BanDelAllPart<'a>;
type IntoIter = InMessageIterator<'a, BanDelAllPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InBanListRequest<'a> {
list: Vec<BanListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct BanListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InBanListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "banlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(BanListRequestPart {
phantom: PhantomData,
});
}
Ok(InBanListRequest { list })
}
}
impl<'a> InBanListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<BanListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InBanListRequest<'a> {
type Item = &'a BanListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, BanListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InBindingList<'a> {
list: Vec<BindingListPart<'a>>,
}
#[derive(Debug)]
pub struct BindingListPart<'a> {
pub subsystem: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InBindingList<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "bindinglist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(BindingListPart {
subsystem: {
if let Some(val) = ccmd.0.get("subsystem") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InBindingList { list })
}
}
impl<'a> InBindingList<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<BindingListPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InBindingList<'a> {
type Item = &'a BindingListPart<'a>;
type IntoIter = InMessageIterator<'a, BindingListPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelAddPerm<'a> {
list: Vec<ChannelAddPermPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelAddPermPart<'a> {
pub channel_id: ChannelId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub permission_value: i32,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelAddPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channeladdperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelAddPermPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelAddPerm", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
permission_value: {
let val = ccmd.0.get("permvalue")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionValue", name: "ChannelAddPerm", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionValue",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InChannelAddPerm { list })
}
}
impl<'a> InChannelAddPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelAddPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelAddPerm<'a> {
type Item = &'a ChannelAddPermPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelAddPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelClientAddPerm<'a> {
list: Vec<ChannelClientAddPermPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelClientAddPermPart<'a> {
pub channel_id: ChannelId,
pub client_db_id: ClientDbId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub permission_value: i32,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelClientAddPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelclientaddperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelClientAddPermPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelClientAddPerm", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ChannelClientAddPerm", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
permission_value: {
let val = ccmd.0.get("permvalue")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionValue", name: "ChannelClientAddPerm", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionValue",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InChannelClientAddPerm { list })
}
}
impl<'a> InChannelClientAddPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelClientAddPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelClientAddPerm<'a> {
type Item = &'a ChannelClientAddPermPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelClientAddPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelClientDelPerm<'a> {
list: Vec<ChannelClientDelPermPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelClientDelPermPart<'a> {
pub channel_id: ChannelId,
pub client_db_id: ClientDbId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelClientDelPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelclientdelperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelClientDelPermPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelClientDelPerm", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ChannelClientDelPerm", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InChannelClientDelPerm { list })
}
}
impl<'a> InChannelClientDelPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelClientDelPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelClientDelPerm<'a> {
type Item = &'a ChannelClientDelPermPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelClientDelPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelClientPermListRequest<'a> {
list: Vec<ChannelClientPermListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelClientPermListRequestPart<'a> {
pub channel_id: ChannelId,
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelClientPermListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelclientpermlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelClientPermListRequestPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelClientPermListRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ChannelClientPermListRequest", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InChannelClientPermListRequest { list })
}
}
impl<'a> InChannelClientPermListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelClientPermListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelClientPermListRequest<'a> {
type Item = &'a ChannelClientPermListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelClientPermListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelCreate<'a> {
list: Vec<ChannelCreatePart<'a>>,
}
#[derive(Debug)]
pub struct ChannelCreatePart<'a> {
pub parent_id: Option<ChannelId>,
pub name: &'a str,
pub topic: Option<&'a str>,
pub description: Option<&'a str>,
pub password: Option<&'a str>,
pub codec: Option<Codec>,
pub codec_quality: Option<u8>,
pub max_clients: Option<i32>,
pub max_family_clients: Option<i32>,
pub order: Option<i32>,
pub has_password: Option<bool>,
pub is_unencrypted: Option<bool>,
pub delete_delay: Option<Duration>,
pub is_max_clients_unlimited: Option<bool>,
pub is_max_family_clients_unlimited: Option<bool>,
pub inherits_max_family_clients: Option<bool>,
pub phonetic_name: Option<&'a str>,
pub is_permanent: Option<bool>,
pub is_semi_permanent: Option<bool>,
pub is_default: Option<bool>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelCreate<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelcreate" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelCreatePart {
parent_id: {
if let Some(val) = ccmd.0.get("cpid") {
Some({ ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ParentId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
name: {
let val = ccmd.0.get("channel_name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ChannelCreate", })?;
val },
topic: {
if let Some(val) = ccmd.0.get("channel_topic") {
Some({ val })
} else { None } },
description: {
if let Some(val) = ccmd.0.get("channel_description") {
Some({ val })
} else { None } },
password: {
if let Some(val) = ccmd.0.get("channel_password") {
Some({ val })
} else { None } },
codec: {
if let Some(val) = ccmd.0.get("channel_codec") {
Some({ Codec::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "Codec",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "Codec",
value: val.to_string(),
})?
})
} else { None } },
codec_quality: {
if let Some(val) = ccmd.0.get("channel_codec_quality") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "CodecQuality",
value: val.to_string(),
error: e,
})?
})
} else { None } },
max_clients: {
if let Some(val) = ccmd.0.get("channel_maxclients") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "MaxClients",
value: val.to_string(),
error: e,
})?
})
} else { None } },
max_family_clients: {
if let Some(val) = ccmd.0.get("channel_maxfamilyclients") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "MaxFamilyClients",
value: val.to_string(),
error: e,
})?
})
} else { None } },
order: {
if let Some(val) = ccmd.0.get("channel_order") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "Order",
value: val.to_string(),
error: e,
})?
})
} else { None } },
has_password: {
if let Some(val) = ccmd.0.get("channel_flag_password") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "HasPassword",
value: val.to_string(),
})? }
})
} else { None } },
is_unencrypted: {
if let Some(val) = ccmd.0.get("channel_codec_is_unencrypted") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsUnencrypted",
value: val.to_string(),
})? }
})
} else { None } },
delete_delay: {
if let Some(val) = ccmd.0.get("channel_delete_delay") {
Some({ let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "DeleteDelay",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "DeleteDelay",
value: val.to_string(),
})? }
})
} else { None } },
is_max_clients_unlimited: {
if let Some(val) = ccmd.0.get("channel_flag_maxclients_unlimited") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsMaxClientsUnlimited",
value: val.to_string(),
})? }
})
} else { None } },
is_max_family_clients_unlimited: {
if let Some(val) = ccmd.0.get("channel_flag_maxfamilyclients_unlimited") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsMaxFamilyClientsUnlimited",
value: val.to_string(),
})? }
})
} else { None } },
inherits_max_family_clients: {
if let Some(val) = ccmd.0.get("channel_flag_maxfamilyclients_inherited") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "InheritsMaxFamilyClients",
value: val.to_string(),
})? }
})
} else { None } },
phonetic_name: {
if let Some(val) = ccmd.0.get("channel_name_phonetic") {
Some({ val })
} else { None } },
is_permanent: {
if let Some(val) = ccmd.0.get("channel_flag_permanent") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsPermanent",
value: val.to_string(),
})? }
})
} else { None } },
is_semi_permanent: {
if let Some(val) = ccmd.0.get("channel_flag_semi_permanent") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsSemiPermanent",
value: val.to_string(),
})? }
})
} else { None } },
is_default: {
if let Some(val) = ccmd.0.get("channel_flag_default") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsDefault",
value: val.to_string(),
})? }
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InChannelCreate { list })
}
}
impl<'a> InChannelCreate<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelCreatePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelCreate<'a> {
type Item = &'a ChannelCreatePart<'a>;
type IntoIter = InMessageIterator<'a, ChannelCreatePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelDelete<'a> {
list: Vec<ChannelDeletePart<'a>>,
}
#[derive(Debug)]
pub struct ChannelDeletePart<'a> {
pub channel_id: ChannelId,
pub force: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelDelete<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channeldelete" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelDeletePart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelDelete", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
force: {
let val = ccmd.0.get("force")
.ok_or(ParseError::ParameterNotFound { arg: "Force", name: "ChannelDelete", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "Force",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InChannelDelete { list })
}
}
impl<'a> InChannelDelete<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelDeletePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelDelete<'a> {
type Item = &'a ChannelDeletePart<'a>;
type IntoIter = InMessageIterator<'a, ChannelDeletePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelDelPerm<'a> {
list: Vec<ChannelDelPermPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelDelPermPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelDelPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channeldelperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ChannelDelPermPart {
phantom: PhantomData,
});
}
Ok(InChannelDelPerm { list })
}
}
impl<'a> InChannelDelPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelDelPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelDelPerm<'a> {
type Item = &'a ChannelDelPermPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelDelPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelDescriptionRequest<'a> {
list: Vec<ChannelDescriptionRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelDescriptionRequestPart<'a> {
pub channel_id: ChannelId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelDescriptionRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgetdescription" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelDescriptionRequestPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelDescriptionRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InChannelDescriptionRequest { list })
}
}
impl<'a> InChannelDescriptionRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelDescriptionRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelDescriptionRequest<'a> {
type Item = &'a ChannelDescriptionRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelDescriptionRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelEdit<'a> {
list: Vec<ChannelEditPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelEditPart<'a> {
pub channel_id: ChannelId,
pub order: Option<i32>,
pub name: Option<&'a str>,
pub topic: Option<&'a str>,
pub is_default: Option<bool>,
pub has_password: Option<bool>,
pub is_permanent: Option<bool>,
pub is_semi_permanent: Option<bool>,
pub codec: Option<Codec>,
pub codec_quality: Option<u8>,
pub needed_talk_power: Option<i32>,
pub icon_id: Option<IconHash>,
pub max_clients: Option<i32>,
pub max_family_clients: Option<i32>,
pub codec_latency_factor: Option<i32>,
pub is_unencrypted: Option<bool>,
pub delete_delay: Option<Duration>,
pub is_max_clients_unlimited: Option<bool>,
pub is_max_family_clients_unlimited: Option<bool>,
pub inherits_max_family_clients: Option<bool>,
pub phonetic_name: Option<&'a str>,
pub parent_id: Option<ChannelId>,
pub description: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelEdit<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channeledit" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelEditPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelEdit", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
order: {
if let Some(val) = ccmd.0.get("channel_order") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "Order",
value: val.to_string(),
error: e,
})?
})
} else { None } },
name: {
if let Some(val) = ccmd.0.get("channel_name") {
Some({ val })
} else { None } },
topic: {
if let Some(val) = ccmd.0.get("channel_topic") {
Some({ val })
} else { None } },
is_default: {
if let Some(val) = ccmd.0.get("channel_flag_default") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsDefault",
value: val.to_string(),
})? }
})
} else { None } },
has_password: {
if let Some(val) = ccmd.0.get("channel_flag_password") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "HasPassword",
value: val.to_string(),
})? }
})
} else { None } },
is_permanent: {
if let Some(val) = ccmd.0.get("channel_flag_permanent") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsPermanent",
value: val.to_string(),
})? }
})
} else { None } },
is_semi_permanent: {
if let Some(val) = ccmd.0.get("channel_flag_semi_permanent") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsSemiPermanent",
value: val.to_string(),
})? }
})
} else { None } },
codec: {
if let Some(val) = ccmd.0.get("channel_codec") {
Some({ Codec::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "Codec",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "Codec",
value: val.to_string(),
})?
})
} else { None } },
codec_quality: {
if let Some(val) = ccmd.0.get("channel_codec_quality") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "CodecQuality",
value: val.to_string(),
error: e,
})?
})
} else { None } },
needed_talk_power: {
if let Some(val) = ccmd.0.get("channel_needed_talk_power") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "NeededTalkPower",
value: val.to_string(),
error: e,
})?
})
} else { None } },
icon_id: {
if let Some(val) = ccmd.0.get("channel_icon_id") {
Some({ IconHash(if val.starts_with('-') {
val.parse::<i32>().map(|i| i as u32)
} else {
val.parse::<u64>().map(|i| i as u32)
}.map_err(|e| ParseError::ParseInt {
arg: "IconId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
max_clients: {
if let Some(val) = ccmd.0.get("channel_maxclients") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "MaxClients",
value: val.to_string(),
error: e,
})?
})
} else { None } },
max_family_clients: {
if let Some(val) = ccmd.0.get("channel_maxfamilyclients") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "MaxFamilyClients",
value: val.to_string(),
error: e,
})?
})
} else { None } },
codec_latency_factor: {
if let Some(val) = ccmd.0.get("channel_codec_latency_factor") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "CodecLatencyFactor",
value: val.to_string(),
error: e,
})?
})
} else { None } },
is_unencrypted: {
if let Some(val) = ccmd.0.get("channel_codec_is_unencrypted") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsUnencrypted",
value: val.to_string(),
})? }
})
} else { None } },
delete_delay: {
if let Some(val) = ccmd.0.get("channel_delete_delay") {
Some({ let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "DeleteDelay",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "DeleteDelay",
value: val.to_string(),
})? }
})
} else { None } },
is_max_clients_unlimited: {
if let Some(val) = ccmd.0.get("channel_flag_maxclients_unlimited") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsMaxClientsUnlimited",
value: val.to_string(),
})? }
})
} else { None } },
is_max_family_clients_unlimited: {
if let Some(val) = ccmd.0.get("channel_flag_maxfamilyclients_unlimited") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsMaxFamilyClientsUnlimited",
value: val.to_string(),
})? }
})
} else { None } },
inherits_max_family_clients: {
if let Some(val) = ccmd.0.get("channel_flag_maxfamilyclients_inherited") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "InheritsMaxFamilyClients",
value: val.to_string(),
})? }
})
} else { None } },
phonetic_name: {
if let Some(val) = ccmd.0.get("channel_name_phonetic") {
Some({ val })
} else { None } },
parent_id: {
if let Some(val) = ccmd.0.get("cpid") {
Some({ ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ParentId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
description: {
if let Some(val) = ccmd.0.get("channel_description") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InChannelEdit { list })
}
}
impl<'a> InChannelEdit<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelEditPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelEdit<'a> {
type Item = &'a ChannelEditPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelEditPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelFindRequest<'a> {
list: Vec<ChannelFindRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelFindRequestPart<'a> {
pub pattern: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelFindRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelfind" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelFindRequestPart {
pattern: {
let val = ccmd.0.get("pattern")
.ok_or(ParseError::ParameterNotFound { arg: "Pattern", name: "ChannelFindRequest", })?;
val },
phantom: PhantomData,
});
}
Ok(InChannelFindRequest { list })
}
}
impl<'a> InChannelFindRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelFindRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelFindRequest<'a> {
type Item = &'a ChannelFindRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelFindRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupAdd<'a> {
list: Vec<ChannelGroupAddPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupAddPart<'a> {
pub name: &'a str,
pub group_type: Option<GroupType>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupAdd<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgroupadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelGroupAddPart {
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ChannelGroupAdd", })?;
val },
group_type: {
if let Some(val) = ccmd.0.get("type") {
Some({ GroupType::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "GroupType",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "GroupType",
value: val.to_string(),
})?
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InChannelGroupAdd { list })
}
}
impl<'a> InChannelGroupAdd<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupAddPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupAdd<'a> {
type Item = &'a ChannelGroupAddPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupAddPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupAddPerm<'a> {
list: Vec<ChannelGroupAddPermPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupAddPermPart<'a> {
pub channel_group: ChannelGroupId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub permission_value: i32,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupAddPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgroupaddperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelGroupAddPermPart {
channel_group: {
let val = ccmd.0.get("cgid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelGroup", name: "ChannelGroupAddPerm", })?;
ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelGroup",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
permission_value: {
let val = ccmd.0.get("permvalue")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionValue", name: "ChannelGroupAddPerm", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionValue",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InChannelGroupAddPerm { list })
}
}
impl<'a> InChannelGroupAddPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupAddPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupAddPerm<'a> {
type Item = &'a ChannelGroupAddPermPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupAddPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupClientListRequest<'a> {
list: Vec<ChannelGroupClientListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupClientListRequestPart<'a> {
pub channel_id: Option<ChannelId>,
pub client_db_id: Option<ClientDbId>,
pub channel_group: Option<ChannelGroupId>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupClientListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgroupclientlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelGroupClientListRequestPart {
channel_id: {
if let Some(val) = ccmd.0.get("cid") {
Some({ ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
client_db_id: {
if let Some(val) = ccmd.0.get("cldbid") {
Some({ ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
channel_group: {
if let Some(val) = ccmd.0.get("cgid") {
Some({ ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelGroup",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InChannelGroupClientListRequest { list })
}
}
impl<'a> InChannelGroupClientListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupClientListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupClientListRequest<'a> {
type Item = &'a ChannelGroupClientListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupClientListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupCopy<'a> {
list: Vec<ChannelGroupCopyPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupCopyPart<'a> {
pub source_channel_group_id: ChannelGroupId,
pub target_channel_group_id: ChannelGroupId,
pub name: &'a str,
pub group_type: GroupType,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupCopy<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgroupcopy" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelGroupCopyPart {
source_channel_group_id: {
let val = ccmd.0.get("scgid")
.ok_or(ParseError::ParameterNotFound { arg: "SourceChannelGroupId", name: "ChannelGroupCopy", })?;
ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "SourceChannelGroupId",
value: val.to_string(),
error: e,
})?)
},
target_channel_group_id: {
let val = ccmd.0.get("tcgid")
.ok_or(ParseError::ParameterNotFound { arg: "TargetChannelGroupId", name: "ChannelGroupCopy", })?;
ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetChannelGroupId",
value: val.to_string(),
error: e,
})?)
},
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ChannelGroupCopy", })?;
val },
group_type: {
let val = ccmd.0.get("type")
.ok_or(ParseError::ParameterNotFound { arg: "GroupType", name: "ChannelGroupCopy", })?;
GroupType::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "GroupType",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "GroupType",
value: val.to_string(),
})?
},
phantom: PhantomData,
});
}
Ok(InChannelGroupCopy { list })
}
}
impl<'a> InChannelGroupCopy<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupCopyPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupCopy<'a> {
type Item = &'a ChannelGroupCopyPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupCopyPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupDel<'a> {
list: Vec<ChannelGroupDelPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupDelPart<'a> {
pub channel_group: ChannelGroupId,
pub force: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupDel<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgroupdel" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelGroupDelPart {
channel_group: {
let val = ccmd.0.get("cgid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelGroup", name: "ChannelGroupDel", })?;
ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelGroup",
value: val.to_string(),
error: e,
})?)
},
force: {
let val = ccmd.0.get("force")
.ok_or(ParseError::ParameterNotFound { arg: "Force", name: "ChannelGroupDel", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "Force",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InChannelGroupDel { list })
}
}
impl<'a> InChannelGroupDel<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupDelPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupDel<'a> {
type Item = &'a ChannelGroupDelPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupDelPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupDelPerm<'a> {
list: Vec<ChannelGroupDelPermPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupDelPermPart<'a> {
pub channel_group: ChannelGroupId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupDelPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgroupdelperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelGroupDelPermPart {
channel_group: {
let val = ccmd.0.get("cgid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelGroup", name: "ChannelGroupDelPerm", })?;
ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelGroup",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InChannelGroupDelPerm { list })
}
}
impl<'a> InChannelGroupDelPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupDelPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupDelPerm<'a> {
type Item = &'a ChannelGroupDelPermPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupDelPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupListRequest<'a> {
list: Vec<ChannelGroupListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgrouplist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ChannelGroupListRequestPart {
phantom: PhantomData,
});
}
Ok(InChannelGroupListRequest { list })
}
}
impl<'a> InChannelGroupListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupListRequest<'a> {
type Item = &'a ChannelGroupListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupPermListRequest<'a> {
list: Vec<ChannelGroupPermListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupPermListRequestPart<'a> {
pub channel_group: ChannelGroupId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupPermListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgrouppermlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelGroupPermListRequestPart {
channel_group: {
let val = ccmd.0.get("cgid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelGroup", name: "ChannelGroupPermListRequest", })?;
ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelGroup",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InChannelGroupPermListRequest { list })
}
}
impl<'a> InChannelGroupPermListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupPermListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupPermListRequest<'a> {
type Item = &'a ChannelGroupPermListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupPermListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelGroupRename<'a> {
list: Vec<ChannelGroupRenamePart<'a>>,
}
#[derive(Debug)]
pub struct ChannelGroupRenamePart<'a> {
pub channel_group: ChannelGroupId,
pub name: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelGroupRename<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelgrouprename" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelGroupRenamePart {
channel_group: {
let val = ccmd.0.get("cgid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelGroup", name: "ChannelGroupRename", })?;
ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelGroup",
value: val.to_string(),
error: e,
})?)
},
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ChannelGroupRename", })?;
val },
phantom: PhantomData,
});
}
Ok(InChannelGroupRename { list })
}
}
impl<'a> InChannelGroupRename<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelGroupRenamePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelGroupRename<'a> {
type Item = &'a ChannelGroupRenamePart<'a>;
type IntoIter = InMessageIterator<'a, ChannelGroupRenamePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelInfoRequest<'a> {
list: Vec<ChannelInfoRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelInfoRequestPart<'a> {
pub channel_id: ChannelId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelInfoRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelinfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelInfoRequestPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelInfoRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InChannelInfoRequest { list })
}
}
impl<'a> InChannelInfoRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelInfoRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelInfoRequest<'a> {
type Item = &'a ChannelInfoRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelInfoRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelListRequest<'a> {
list: Vec<ChannelListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channellist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ChannelListRequestPart {
phantom: PhantomData,
});
}
Ok(InChannelListRequest { list })
}
}
impl<'a> InChannelListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelListRequest<'a> {
type Item = &'a ChannelListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelMove<'a> {
list: Vec<ChannelMovePart<'a>>,
}
#[derive(Debug)]
pub struct ChannelMovePart<'a> {
pub channel_id: ChannelId,
pub parent_id: ChannelId,
pub order: Option<i32>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelMove<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelmove" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelMovePart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelMove", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
parent_id: {
let val = ccmd.0.get("cpid")
.ok_or(ParseError::ParameterNotFound { arg: "ParentId", name: "ChannelMove", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ParentId",
value: val.to_string(),
error: e,
})?)
},
order: {
if let Some(val) = ccmd.0.get("order") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "Order",
value: val.to_string(),
error: e,
})?
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InChannelMove { list })
}
}
impl<'a> InChannelMove<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelMovePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelMove<'a> {
type Item = &'a ChannelMovePart<'a>;
type IntoIter = InMessageIterator<'a, ChannelMovePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelPermListRequest<'a> {
list: Vec<ChannelPermListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelPermListRequestPart<'a> {
pub channel_id: ChannelId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelPermListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelpermlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelPermListRequestPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelPermListRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InChannelPermListRequest { list })
}
}
impl<'a> InChannelPermListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelPermListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelPermListRequest<'a> {
type Item = &'a ChannelPermListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelPermListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelSubscribe<'a> {
list: Vec<ChannelSubscribePart<'a>>,
}
#[derive(Debug)]
pub struct ChannelSubscribePart<'a> {
pub channel_id: ChannelId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelSubscribe<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelsubscribe" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelSubscribePart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelSubscribe", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InChannelSubscribe { list })
}
}
impl<'a> InChannelSubscribe<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelSubscribePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelSubscribe<'a> {
type Item = &'a ChannelSubscribePart<'a>;
type IntoIter = InMessageIterator<'a, ChannelSubscribePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelSubscribeAll<'a> {
list: Vec<ChannelSubscribeAllPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelSubscribeAllPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelSubscribeAll<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelsubscribeall" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ChannelSubscribeAllPart {
phantom: PhantomData,
});
}
Ok(InChannelSubscribeAll { list })
}
}
impl<'a> InChannelSubscribeAll<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelSubscribeAllPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelSubscribeAll<'a> {
type Item = &'a ChannelSubscribeAllPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelSubscribeAllPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelUnsubscribe<'a> {
list: Vec<ChannelUnsubscribePart<'a>>,
}
#[derive(Debug)]
pub struct ChannelUnsubscribePart<'a> {
pub channel_id: ChannelId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelUnsubscribe<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelunsubscribe" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ChannelUnsubscribePart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ChannelUnsubscribe", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InChannelUnsubscribe { list })
}
}
impl<'a> InChannelUnsubscribe<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelUnsubscribePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelUnsubscribe<'a> {
type Item = &'a ChannelUnsubscribePart<'a>;
type IntoIter = InMessageIterator<'a, ChannelUnsubscribePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InChannelUnsubscribeAll<'a> {
list: Vec<ChannelUnsubscribeAllPart<'a>>,
}
#[derive(Debug)]
pub struct ChannelUnsubscribeAllPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InChannelUnsubscribeAll<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "channelunsubscribeall" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ChannelUnsubscribeAllPart {
phantom: PhantomData,
});
}
Ok(InChannelUnsubscribeAll { list })
}
}
impl<'a> InChannelUnsubscribeAll<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ChannelUnsubscribeAllPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InChannelUnsubscribeAll<'a> {
type Item = &'a ChannelUnsubscribeAllPart<'a>;
type IntoIter = InMessageIterator<'a, ChannelUnsubscribeAllPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientAddPerm<'a> {
list: Vec<ClientAddPermPart<'a>>,
}
#[derive(Debug)]
pub struct ClientAddPermPart<'a> {
pub client_db_id: ClientDbId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub permission_value: i32,
pub permission_skip: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientAddPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientaddperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientAddPermPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ClientAddPerm", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
permission_value: {
let val = ccmd.0.get("permvalue")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionValue", name: "ClientAddPerm", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionValue",
value: val.to_string(),
error: e,
})?
},
permission_skip: {
let val = ccmd.0.get("permskip")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionSkip", name: "ClientAddPerm", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "PermissionSkip",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InClientAddPerm { list })
}
}
impl<'a> InClientAddPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientAddPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientAddPerm<'a> {
type Item = &'a ClientAddPermPart<'a>;
type IntoIter = InMessageIterator<'a, ClientAddPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientChatClose<'a> {
list: Vec<ClientChatClosePart<'a>>,
}
#[derive(Debug)]
pub struct ClientChatClosePart<'a> {
pub client_id: ClientId,
pub client_uid: UidRef<'a>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientChatClose<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientchatclosed" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientChatClosePart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientChatClose", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
client_uid: {
let val = ccmd.0.get("cluid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientUid", name: "ClientChatClose", })?;
UidRef(val) },
phantom: PhantomData,
});
}
Ok(InClientChatClose { list })
}
}
impl<'a> InClientChatClose<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientChatClosePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientChatClose<'a> {
type Item = &'a ClientChatClosePart<'a>;
type IntoIter = InMessageIterator<'a, ClientChatClosePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientConnectionInfoRequest<'a> {
list: Vec<ClientConnectionInfoRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientConnectionInfoRequestPart<'a> {
pub client_id: ClientId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientConnectionInfoRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "getconnectioninfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientConnectionInfoRequestPart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientConnectionInfoRequest", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientConnectionInfoRequest { list })
}
}
impl<'a> InClientConnectionInfoRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientConnectionInfoRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientConnectionInfoRequest<'a> {
type Item = &'a ClientConnectionInfoRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientConnectionInfoRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientDbDelete<'a> {
list: Vec<ClientDbDeletePart<'a>>,
}
#[derive(Debug)]
pub struct ClientDbDeletePart<'a> {
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientDbDelete<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientdbdelete" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientDbDeletePart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ClientDbDelete", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientDbDelete { list })
}
}
impl<'a> InClientDbDelete<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientDbDeletePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientDbDelete<'a> {
type Item = &'a ClientDbDeletePart<'a>;
type IntoIter = InMessageIterator<'a, ClientDbDeletePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientDbEdit<'a> {
list: Vec<ClientDbEditPart<'a>>,
}
#[derive(Debug)]
pub struct ClientDbEditPart<'a> {
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientDbEdit<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientdbedit" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientDbEditPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ClientDbEdit", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientDbEdit { list })
}
}
impl<'a> InClientDbEdit<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientDbEditPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientDbEdit<'a> {
type Item = &'a ClientDbEditPart<'a>;
type IntoIter = InMessageIterator<'a, ClientDbEditPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientDbFindRequest<'a> {
list: Vec<ClientDbFindRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientDbFindRequestPart<'a> {
pub pattern: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientDbFindRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientdbfind" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientDbFindRequestPart {
pattern: {
let val = ccmd.0.get("pattern")
.ok_or(ParseError::ParameterNotFound { arg: "Pattern", name: "ClientDbFindRequest", })?;
val },
phantom: PhantomData,
});
}
Ok(InClientDbFindRequest { list })
}
}
impl<'a> InClientDbFindRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientDbFindRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientDbFindRequest<'a> {
type Item = &'a ClientDbFindRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientDbFindRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientDbInfoRequest<'a> {
list: Vec<ClientDbInfoRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientDbInfoRequestPart<'a> {
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientDbInfoRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientdbinfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientDbInfoRequestPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ClientDbInfoRequest", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientDbInfoRequest { list })
}
}
impl<'a> InClientDbInfoRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientDbInfoRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientDbInfoRequest<'a> {
type Item = &'a ClientDbInfoRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientDbInfoRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientDbListRequest<'a> {
list: Vec<ClientDbListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientDbListRequestPart<'a> {
pub offset: Option<u32>,
pub limit: Option<u32>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientDbListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientdblist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientDbListRequestPart {
offset: {
if let Some(val) = ccmd.0.get("start") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "Offset",
value: val.to_string(),
error: e,
})?
})
} else { None } },
limit: {
if let Some(val) = ccmd.0.get("duration") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "Limit",
value: val.to_string(),
error: e,
})?
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InClientDbListRequest { list })
}
}
impl<'a> InClientDbListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientDbListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientDbListRequest<'a> {
type Item = &'a ClientDbListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientDbListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientDelPerm<'a> {
list: Vec<ClientDelPermPart<'a>>,
}
#[derive(Debug)]
pub struct ClientDelPermPart<'a> {
pub client_db_id: ClientDbId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientDelPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientdelperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientDelPermPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ClientDelPerm", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InClientDelPerm { list })
}
}
impl<'a> InClientDelPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientDelPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientDelPerm<'a> {
type Item = &'a ClientDelPermPart<'a>;
type IntoIter = InMessageIterator<'a, ClientDelPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientEdit<'a> {
list: Vec<ClientEditPart<'a>>,
}
#[derive(Debug)]
pub struct ClientEditPart<'a> {
pub client_id: ClientId,
pub description: Option<&'a str>,
pub talk_power_granted: Option<bool>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientEdit<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientedit" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientEditPart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientEdit", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
description: {
if let Some(val) = ccmd.0.get("client_description") {
Some({ val })
} else { None } },
talk_power_granted: {
if let Some(val) = ccmd.0.get("client_is_talker") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "TalkPowerGranted",
value: val.to_string(),
})? }
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InClientEdit { list })
}
}
impl<'a> InClientEdit<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientEditPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientEdit<'a> {
type Item = &'a ClientEditPart<'a>;
type IntoIter = InMessageIterator<'a, ClientEditPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientFindRequest<'a> {
list: Vec<ClientFindRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientFindRequestPart<'a> {
pub pattern: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientFindRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientfind" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientFindRequestPart {
pattern: {
let val = ccmd.0.get("pattern")
.ok_or(ParseError::ParameterNotFound { arg: "Pattern", name: "ClientFindRequest", })?;
val },
phantom: PhantomData,
});
}
Ok(InClientFindRequest { list })
}
}
impl<'a> InClientFindRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientFindRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientFindRequest<'a> {
type Item = &'a ClientFindRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientFindRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientDbIdFromUidRequest<'a> {
list: Vec<ClientDbIdFromUidRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientDbIdFromUidRequestPart<'a> {
pub client_uid: UidRef<'a>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientDbIdFromUidRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientgetdbidfromuid" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientDbIdFromUidRequestPart {
client_uid: {
let val = ccmd.0.get("cluid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientUid", name: "ClientDbIdFromUidRequest", })?;
UidRef(val) },
phantom: PhantomData,
});
}
Ok(InClientDbIdFromUidRequest { list })
}
}
impl<'a> InClientDbIdFromUidRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientDbIdFromUidRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientDbIdFromUidRequest<'a> {
type Item = &'a ClientDbIdFromUidRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientDbIdFromUidRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientIdsRequest<'a> {
list: Vec<ClientIdsRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientIdsRequestPart<'a> {
pub client_uid: UidRef<'a>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientIdsRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientgetids" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientIdsRequestPart {
client_uid: {
let val = ccmd.0.get("cluid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientUid", name: "ClientIdsRequest", })?;
UidRef(val) },
phantom: PhantomData,
});
}
Ok(InClientIdsRequest { list })
}
}
impl<'a> InClientIdsRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientIdsRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientIdsRequest<'a> {
type Item = &'a ClientIdsRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientIdsRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientNameFromDbIdRequest<'a> {
list: Vec<ClientNameFromDbIdRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientNameFromDbIdRequestPart<'a> {
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientNameFromDbIdRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientgetnamefromdbid" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientNameFromDbIdRequestPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ClientNameFromDbIdRequest", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientNameFromDbIdRequest { list })
}
}
impl<'a> InClientNameFromDbIdRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientNameFromDbIdRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientNameFromDbIdRequest<'a> {
type Item = &'a ClientNameFromDbIdRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientNameFromDbIdRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientNameFromUidRequest<'a> {
list: Vec<ClientNameFromUidRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientNameFromUidRequestPart<'a> {
pub client_uid: UidRef<'a>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientNameFromUidRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientgetnamefromuid" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientNameFromUidRequestPart {
client_uid: {
let val = ccmd.0.get("cluid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientUid", name: "ClientNameFromUidRequest", })?;
UidRef(val) },
phantom: PhantomData,
});
}
Ok(InClientNameFromUidRequest { list })
}
}
impl<'a> InClientNameFromUidRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientNameFromUidRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientNameFromUidRequest<'a> {
type Item = &'a ClientNameFromUidRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientNameFromUidRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientUidFromClidRequest<'a> {
list: Vec<ClientUidFromClidRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientUidFromClidRequestPart<'a> {
pub client_id: ClientId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientUidFromClidRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientgetuidfromclid" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientUidFromClidRequestPart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientUidFromClidRequest", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientUidFromClidRequest { list })
}
}
impl<'a> InClientUidFromClidRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientUidFromClidRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientUidFromClidRequest<'a> {
type Item = &'a ClientUidFromClidRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientUidFromClidRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientVariablesRequest<'a> {
list: Vec<ClientVariablesRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientVariablesRequestPart<'a> {
pub client_id: ClientId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientVariablesRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientgetvariables" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientVariablesRequestPart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientVariablesRequest", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientVariablesRequest { list })
}
}
impl<'a> InClientVariablesRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientVariablesRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientVariablesRequest<'a> {
type Item = &'a ClientVariablesRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientVariablesRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientInfoRequest<'a> {
list: Vec<ClientInfoRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientInfoRequestPart<'a> {
pub client_id: ClientId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientInfoRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientinfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientInfoRequestPart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientInfoRequest", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientInfoRequest { list })
}
}
impl<'a> InClientInfoRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientInfoRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientInfoRequest<'a> {
type Item = &'a ClientInfoRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientInfoRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientKick<'a> {
list: Vec<ClientKickPart<'a>>,
}
#[derive(Debug)]
pub struct ClientKickPart<'a> {
pub client_id: ClientId,
pub reason: Reason,
pub reason_message: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientKick<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientkick" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientKickPart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientKick", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
reason: {
let val = ccmd.0.get("reasonid")
.ok_or(ParseError::ParameterNotFound { arg: "Reason", name: "ClientKick", })?;
Reason::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "Reason",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "Reason",
value: val.to_string(),
})?
},
reason_message: {
if let Some(val) = ccmd.0.get("reasonmsg") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InClientKick { list })
}
}
impl<'a> InClientKick<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientKickPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientKick<'a> {
type Item = &'a ClientKickPart<'a>;
type IntoIter = InMessageIterator<'a, ClientKickPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientListRequest<'a> {
list: Vec<ClientListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ClientListRequestPart {
phantom: PhantomData,
});
}
Ok(InClientListRequest { list })
}
}
impl<'a> InClientListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientListRequest<'a> {
type Item = &'a ClientListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientMove<'a> {
list: Vec<ClientMovePart<'a>>,
}
#[derive(Debug)]
pub struct ClientMovePart<'a> {
pub client_id: ClientId,
pub channel_id: ChannelId,
pub channel_password: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientMove<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientmove" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientMovePart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientMove", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "ClientMove", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
channel_password: {
if let Some(val) = ccmd.0.get("cpw") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InClientMove { list })
}
}
impl<'a> InClientMove<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientMovePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientMove<'a> {
type Item = &'a ClientMovePart<'a>;
type IntoIter = InMessageIterator<'a, ClientMovePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientPermListRequest<'a> {
list: Vec<ClientPermListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientPermListRequestPart<'a> {
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientPermListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientpermlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientPermListRequestPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ClientPermListRequest", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InClientPermListRequest { list })
}
}
impl<'a> InClientPermListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientPermListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientPermListRequest<'a> {
type Item = &'a ClientPermListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientPermListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientPokeRequest<'a> {
list: Vec<ClientPokeRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientPokeRequestPart<'a> {
pub client_id: ClientId,
pub message: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientPokeRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientpoke" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientPokeRequestPart {
client_id: {
let val = ccmd.0.get("clid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientId", name: "ClientPokeRequest", })?;
ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientId",
value: val.to_string(),
error: e,
})?)
},
message: {
let val = ccmd.0.get("msg")
.ok_or(ParseError::ParameterNotFound { arg: "Message", name: "ClientPokeRequest", })?;
val },
phantom: PhantomData,
});
}
Ok(InClientPokeRequest { list })
}
}
impl<'a> InClientPokeRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientPokeRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientPokeRequest<'a> {
type Item = &'a ClientPokeRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientPokeRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientSetServerQueryLoginRequest<'a> {
list: Vec<ClientSetServerQueryLoginRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ClientSetServerQueryLoginRequestPart<'a> {
pub login_name: &'a str,
pub login_password: Option<&'a str>,
pub client_db_id: Option<ClientDbId>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientSetServerQueryLoginRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientsetserverquerylogin" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientSetServerQueryLoginRequestPart {
login_name: {
let val = ccmd.0.get("client_login_name")
.ok_or(ParseError::ParameterNotFound { arg: "LoginName", name: "ClientSetServerQueryLoginRequest", })?;
val },
login_password: {
if let Some(val) = ccmd.0.get("client_login_password") {
Some({ val })
} else { None } },
client_db_id: {
if let Some(val) = ccmd.0.get("cldbid") {
Some({ ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InClientSetServerQueryLoginRequest { list })
}
}
impl<'a> InClientSetServerQueryLoginRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientSetServerQueryLoginRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientSetServerQueryLoginRequest<'a> {
type Item = &'a ClientSetServerQueryLoginRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ClientSetServerQueryLoginRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InClientUpdate<'a> {
list: Vec<ClientUpdatePart<'a>>,
}
#[derive(Debug)]
pub struct ClientUpdatePart<'a> {
pub name: Option<&'a str>,
pub input_muted: Option<bool>,
pub output_muted: Option<bool>,
pub is_away: Option<bool>,
pub away_message: Option<&'a str>,
pub input_hardware_enabled: Option<bool>,
pub output_hardware_enabled: Option<bool>,
pub is_channel_commander: Option<bool>,
pub avatar_hash: Option<&'a str>,
pub phonetic_name: Option<&'a str>,
pub talk_power_request_time: Option<DateTime<Utc>>,
pub talk_power_request_message: Option<&'a str>,
pub is_recording: Option<bool>,
pub badges: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InClientUpdate<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientupdate" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ClientUpdatePart {
name: {
if let Some(val) = ccmd.0.get("client_nickname") {
Some({ val })
} else { None } },
input_muted: {
if let Some(val) = ccmd.0.get("client_input_muted") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "InputMuted",
value: val.to_string(),
})? }
})
} else { None } },
output_muted: {
if let Some(val) = ccmd.0.get("client_output_muted") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "OutputMuted",
value: val.to_string(),
})? }
})
} else { None } },
is_away: {
if let Some(val) = ccmd.0.get("client_away") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsAway",
value: val.to_string(),
})? }
})
} else { None } },
away_message: {
if let Some(val) = ccmd.0.get("client_away_message") {
Some({ val })
} else { None } },
input_hardware_enabled: {
if let Some(val) = ccmd.0.get("client_input_hardware") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "InputHardwareEnabled",
value: val.to_string(),
})? }
})
} else { None } },
output_hardware_enabled: {
if let Some(val) = ccmd.0.get("client_output_hardware") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "OutputHardwareEnabled",
value: val.to_string(),
})? }
})
} else { None } },
is_channel_commander: {
if let Some(val) = ccmd.0.get("client_is_channel_commander") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsChannelCommander",
value: val.to_string(),
})? }
})
} else { None } },
avatar_hash: {
if let Some(val) = ccmd.0.get("client_flag_avatar") {
Some({ val })
} else { None } },
phonetic_name: {
if let Some(val) = ccmd.0.get("client_nickname_phonetic") {
Some({ val })
} else { None } },
talk_power_request_time: {
if let Some(val) = ccmd.0.get("client_talk_request") {
Some({ DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp_opt(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TalkPowerRequestTime",
value: val.to_string(),
error: e,
})?, 0).ok_or(ParseError::InvalidValue {
arg: "TalkPowerRequestTime",
value: val.to_string(),
})?, Utc)
})
} else { None } },
talk_power_request_message: {
if let Some(val) = ccmd.0.get("client_talk_request_msg") {
Some({ val })
} else { None } },
is_recording: {
if let Some(val) = ccmd.0.get("client_is_recording") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsRecording",
value: val.to_string(),
})? }
})
} else { None } },
badges: {
if let Some(val) = ccmd.0.get("client_badges") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InClientUpdate { list })
}
}
impl<'a> InClientUpdate<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ClientUpdatePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InClientUpdate<'a> {
type Item = &'a ClientUpdatePart<'a>;
type IntoIter = InMessageIterator<'a, ClientUpdatePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InComplainAdd<'a> {
list: Vec<ComplainAddPart<'a>>,
}
#[derive(Debug)]
pub struct ComplainAddPart<'a> {
pub target_client_db_id: ClientDbId,
pub message: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InComplainAdd<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "complainadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ComplainAddPart {
target_client_db_id: {
let val = ccmd.0.get("tcldbid")
.ok_or(ParseError::ParameterNotFound { arg: "TargetClientDbId", name: "ComplainAdd", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetClientDbId",
value: val.to_string(),
error: e,
})?)
},
message: {
let val = ccmd.0.get("message")
.ok_or(ParseError::ParameterNotFound { arg: "Message", name: "ComplainAdd", })?;
val },
phantom: PhantomData,
});
}
Ok(InComplainAdd { list })
}
}
impl<'a> InComplainAdd<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ComplainAddPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InComplainAdd<'a> {
type Item = &'a ComplainAddPart<'a>;
type IntoIter = InMessageIterator<'a, ComplainAddPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InComplainDel<'a> {
list: Vec<ComplainDelPart<'a>>,
}
#[derive(Debug)]
pub struct ComplainDelPart<'a> {
pub target_client_db_id: ClientDbId,
pub from_client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InComplainDel<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "complaindel" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ComplainDelPart {
target_client_db_id: {
let val = ccmd.0.get("tcldbid")
.ok_or(ParseError::ParameterNotFound { arg: "TargetClientDbId", name: "ComplainDel", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetClientDbId",
value: val.to_string(),
error: e,
})?)
},
from_client_db_id: {
let val = ccmd.0.get("fcldbid")
.ok_or(ParseError::ParameterNotFound { arg: "FromClientDbId", name: "ComplainDel", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "FromClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InComplainDel { list })
}
}
impl<'a> InComplainDel<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ComplainDelPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InComplainDel<'a> {
type Item = &'a ComplainDelPart<'a>;
type IntoIter = InMessageIterator<'a, ComplainDelPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InComplainDelAll<'a> {
list: Vec<ComplainDelAllPart<'a>>,
}
#[derive(Debug)]
pub struct ComplainDelAllPart<'a> {
pub target_client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InComplainDelAll<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "complaindelall" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ComplainDelAllPart {
target_client_db_id: {
let val = ccmd.0.get("tcldbid")
.ok_or(ParseError::ParameterNotFound { arg: "TargetClientDbId", name: "ComplainDelAll", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InComplainDelAll { list })
}
}
impl<'a> InComplainDelAll<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ComplainDelAllPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InComplainDelAll<'a> {
type Item = &'a ComplainDelAllPart<'a>;
type IntoIter = InMessageIterator<'a, ComplainDelAllPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InComplainListRequest<'a> {
list: Vec<ComplainListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ComplainListRequestPart<'a> {
pub target_client_db_id: Option<ClientDbId>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InComplainListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "complainlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ComplainListRequestPart {
target_client_db_id: {
if let Some(val) = ccmd.0.get("tcldbid") {
Some({ ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetClientDbId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InComplainListRequest { list })
}
}
impl<'a> InComplainListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ComplainListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InComplainListRequest<'a> {
type Item = &'a ComplainListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ComplainListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InCustomDelete<'a> {
list: Vec<CustomDeletePart<'a>>,
}
#[derive(Debug)]
pub struct CustomDeletePart<'a> {
pub client_db_id: ClientDbId,
pub external_identity: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InCustomDelete<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "customdelete" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(CustomDeletePart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "CustomDelete", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
external_identity: {
let val = ccmd.0.get("ident")
.ok_or(ParseError::ParameterNotFound { arg: "ExternalIdentity", name: "CustomDelete", })?;
val },
phantom: PhantomData,
});
}
Ok(InCustomDelete { list })
}
}
impl<'a> InCustomDelete<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<CustomDeletePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InCustomDelete<'a> {
type Item = &'a CustomDeletePart<'a>;
type IntoIter = InMessageIterator<'a, CustomDeletePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InCustomInfoRequest<'a> {
list: Vec<CustomInfoRequestPart<'a>>,
}
#[derive(Debug)]
pub struct CustomInfoRequestPart<'a> {
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InCustomInfoRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "custominfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(CustomInfoRequestPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "CustomInfoRequest", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InCustomInfoRequest { list })
}
}
impl<'a> InCustomInfoRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<CustomInfoRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InCustomInfoRequest<'a> {
type Item = &'a CustomInfoRequestPart<'a>;
type IntoIter = InMessageIterator<'a, CustomInfoRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InCustomSearch<'a> {
list: Vec<CustomSearchPart<'a>>,
}
#[derive(Debug)]
pub struct CustomSearchPart<'a> {
pub external_identity: &'a str,
pub pattern: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InCustomSearch<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "customsearch" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(CustomSearchPart {
external_identity: {
let val = ccmd.0.get("ident")
.ok_or(ParseError::ParameterNotFound { arg: "ExternalIdentity", name: "CustomSearch", })?;
val },
pattern: {
let val = ccmd.0.get("pattern")
.ok_or(ParseError::ParameterNotFound { arg: "Pattern", name: "CustomSearch", })?;
val },
phantom: PhantomData,
});
}
Ok(InCustomSearch { list })
}
}
impl<'a> InCustomSearch<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<CustomSearchPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InCustomSearch<'a> {
type Item = &'a CustomSearchPart<'a>;
type IntoIter = InMessageIterator<'a, CustomSearchPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InCustomSet<'a> {
list: Vec<CustomSetPart<'a>>,
}
#[derive(Debug)]
pub struct CustomSetPart<'a> {
pub client_db_id: ClientDbId,
pub external_identity: &'a str,
pub value: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InCustomSet<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "customset" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(CustomSetPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "CustomSet", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
external_identity: {
let val = ccmd.0.get("ident")
.ok_or(ParseError::ParameterNotFound { arg: "ExternalIdentity", name: "CustomSet", })?;
val },
value: {
let val = ccmd.0.get("value")
.ok_or(ParseError::ParameterNotFound { arg: "Value", name: "CustomSet", })?;
val },
phantom: PhantomData,
});
}
Ok(InCustomSet { list })
}
}
impl<'a> InCustomSet<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<CustomSetPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InCustomSet<'a> {
type Item = &'a CustomSetPart<'a>;
type IntoIter = InMessageIterator<'a, CustomSetPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtCreateDir<'a> {
list: Vec<FtCreateDirPart<'a>>,
}
#[derive(Debug)]
pub struct FtCreateDirPart<'a> {
pub channel_id: ChannelId,
pub channel_password: &'a str,
pub directory_name: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtCreateDir<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftcreatedir" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(FtCreateDirPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "FtCreateDir", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
channel_password: {
let val = ccmd.0.get("cpw")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelPassword", name: "FtCreateDir", })?;
val },
directory_name: {
let val = ccmd.0.get("dirname")
.ok_or(ParseError::ParameterNotFound { arg: "DirectoryName", name: "FtCreateDir", })?;
val },
phantom: PhantomData,
});
}
Ok(InFtCreateDir { list })
}
}
impl<'a> InFtCreateDir<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtCreateDirPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtCreateDir<'a> {
type Item = &'a FtCreateDirPart<'a>;
type IntoIter = InMessageIterator<'a, FtCreateDirPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtDeleteFile<'a> {
list: Vec<FtDeleteFilePart<'a>>,
}
#[derive(Debug)]
pub struct FtDeleteFilePart<'a> {
pub channel_id: ChannelId,
pub channel_password: &'a str,
pub name: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtDeleteFile<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftdeletefile" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(FtDeleteFilePart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "FtDeleteFile", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
channel_password: {
let val = ccmd.0.get("cpw")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelPassword", name: "FtDeleteFile", })?;
val },
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "FtDeleteFile", })?;
val },
phantom: PhantomData,
});
}
Ok(InFtDeleteFile { list })
}
}
impl<'a> InFtDeleteFile<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtDeleteFilePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtDeleteFile<'a> {
type Item = &'a FtDeleteFilePart<'a>;
type IntoIter = InMessageIterator<'a, FtDeleteFilePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtFileInfoRequest<'a> {
list: Vec<FtFileInfoRequestPart<'a>>,
}
#[derive(Debug)]
pub struct FtFileInfoRequestPart<'a> {
pub channel_id: ChannelId,
pub channel_password: &'a str,
pub name: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtFileInfoRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftgetfileinfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(FtFileInfoRequestPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "FtFileInfoRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
channel_password: {
let val = ccmd.0.get("cpw")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelPassword", name: "FtFileInfoRequest", })?;
val },
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "FtFileInfoRequest", })?;
val },
phantom: PhantomData,
});
}
Ok(InFtFileInfoRequest { list })
}
}
impl<'a> InFtFileInfoRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtFileInfoRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtFileInfoRequest<'a> {
type Item = &'a FtFileInfoRequestPart<'a>;
type IntoIter = InMessageIterator<'a, FtFileInfoRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtFileListRequest<'a> {
list: Vec<FtFileListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct FtFileListRequestPart<'a> {
pub channel_id: ChannelId,
pub channel_password: &'a str,
pub path: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtFileListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftgetfilelist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(FtFileListRequestPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "FtFileListRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
channel_password: {
let val = ccmd.0.get("cpw")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelPassword", name: "FtFileListRequest", })?;
val },
path: {
let val = ccmd.0.get("path")
.ok_or(ParseError::ParameterNotFound { arg: "Path", name: "FtFileListRequest", })?;
val },
phantom: PhantomData,
});
}
Ok(InFtFileListRequest { list })
}
}
impl<'a> InFtFileListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtFileListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtFileListRequest<'a> {
type Item = &'a FtFileListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, FtFileListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtInitDownload<'a> {
list: Vec<FtInitDownloadPart<'a>>,
}
#[derive(Debug)]
pub struct FtInitDownloadPart<'a> {
pub client_file_transfer_id: u16,
pub name: &'a str,
pub channel_id: ChannelId,
pub channel_password: &'a str,
pub seek_posistion: i64,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtInitDownload<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftinitdownload" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(FtInitDownloadPart {
client_file_transfer_id: {
let val = ccmd.0.get("clientftfid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientFileTransferId", name: "FtInitDownload", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientFileTransferId",
value: val.to_string(),
error: e,
})?
},
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "FtInitDownload", })?;
val },
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "FtInitDownload", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
channel_password: {
let val = ccmd.0.get("cpw")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelPassword", name: "FtInitDownload", })?;
val },
seek_posistion: {
let val = ccmd.0.get("seekpos")
.ok_or(ParseError::ParameterNotFound { arg: "SeekPosistion", name: "FtInitDownload", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "SeekPosistion",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InFtInitDownload { list })
}
}
impl<'a> InFtInitDownload<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtInitDownloadPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtInitDownload<'a> {
type Item = &'a FtInitDownloadPart<'a>;
type IntoIter = InMessageIterator<'a, FtInitDownloadPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtInitUpload<'a> {
list: Vec<FtInitUploadPart<'a>>,
}
#[derive(Debug)]
pub struct FtInitUploadPart<'a> {
pub client_file_transfer_id: u16,
pub name: &'a str,
pub channel_id: ChannelId,
pub channel_password: &'a str,
pub size: i64,
pub overwrite: bool,
pub resume: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtInitUpload<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftinitupload" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(FtInitUploadPart {
client_file_transfer_id: {
let val = ccmd.0.get("clientftfid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientFileTransferId", name: "FtInitUpload", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientFileTransferId",
value: val.to_string(),
error: e,
})?
},
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "FtInitUpload", })?;
val },
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "FtInitUpload", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
channel_password: {
let val = ccmd.0.get("cpw")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelPassword", name: "FtInitUpload", })?;
val },
size: {
let val = ccmd.0.get("size")
.ok_or(ParseError::ParameterNotFound { arg: "Size", name: "FtInitUpload", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "Size",
value: val.to_string(),
error: e,
})?
},
overwrite: {
let val = ccmd.0.get("overwrite")
.ok_or(ParseError::ParameterNotFound { arg: "Overwrite", name: "FtInitUpload", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "Overwrite",
value: val.to_string(),
})? }
},
resume: {
let val = ccmd.0.get("resume")
.ok_or(ParseError::ParameterNotFound { arg: "Resume", name: "FtInitUpload", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "Resume",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InFtInitUpload { list })
}
}
impl<'a> InFtInitUpload<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtInitUploadPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtInitUpload<'a> {
type Item = &'a FtInitUploadPart<'a>;
type IntoIter = InMessageIterator<'a, FtInitUploadPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtList<'a> {
list: Vec<FtListPart<'a>>,
}
#[derive(Debug)]
pub struct FtListPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtList<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(FtListPart {
phantom: PhantomData,
});
}
Ok(InFtList { list })
}
}
impl<'a> InFtList<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtListPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtList<'a> {
type Item = &'a FtListPart<'a>;
type IntoIter = InMessageIterator<'a, FtListPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtRenameFile<'a> {
list: Vec<FtRenameFilePart<'a>>,
}
#[derive(Debug)]
pub struct FtRenameFilePart<'a> {
pub channel_id: ChannelId,
pub channel_password: &'a str,
pub target_channel_id: Option<ChannelId>,
pub target_channel_password: Option<&'a str>,
pub old_name: &'a str,
pub new_name: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtRenameFile<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftrenamefile" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(FtRenameFilePart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "FtRenameFile", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
channel_password: {
let val = ccmd.0.get("cpw")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelPassword", name: "FtRenameFile", })?;
val },
target_channel_id: {
if let Some(val) = ccmd.0.get("tcid") {
Some({ ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetChannelId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
target_channel_password: {
if let Some(val) = ccmd.0.get("tcpw") {
Some({ val })
} else { None } },
old_name: {
let val = ccmd.0.get("oldname")
.ok_or(ParseError::ParameterNotFound { arg: "OldName", name: "FtRenameFile", })?;
val },
new_name: {
let val = ccmd.0.get("newname")
.ok_or(ParseError::ParameterNotFound { arg: "NewName", name: "FtRenameFile", })?;
val },
phantom: PhantomData,
});
}
Ok(InFtRenameFile { list })
}
}
impl<'a> InFtRenameFile<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtRenameFilePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtRenameFile<'a> {
type Item = &'a FtRenameFilePart<'a>;
type IntoIter = InMessageIterator<'a, FtRenameFilePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InFtStop<'a> {
list: Vec<FtStopPart<'a>>,
}
#[derive(Debug)]
pub struct FtStopPart<'a> {
pub server_file_transfer_id: u16,
pub delete: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InFtStop<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "ftstop" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(FtStopPart {
server_file_transfer_id: {
let val = ccmd.0.get("serverftfid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerFileTransferId", name: "FtStop", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerFileTransferId",
value: val.to_string(),
error: e,
})?
},
delete: {
let val = ccmd.0.get("delete")
.ok_or(ParseError::ParameterNotFound { arg: "Delete", name: "FtStop", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "Delete",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InFtStop { list })
}
}
impl<'a> InFtStop<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<FtStopPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InFtStop<'a> {
type Item = &'a FtStopPart<'a>;
type IntoIter = InMessageIterator<'a, FtStopPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InGlobalMessage<'a> {
list: Vec<GlobalMessagePart<'a>>,
}
#[derive(Debug)]
pub struct GlobalMessagePart<'a> {
pub message: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InGlobalMessage<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "gm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(GlobalMessagePart {
message: {
let val = ccmd.0.get("msg")
.ok_or(ParseError::ParameterNotFound { arg: "Message", name: "GlobalMessage", })?;
val },
phantom: PhantomData,
});
}
Ok(InGlobalMessage { list })
}
}
impl<'a> InGlobalMessage<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<GlobalMessagePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InGlobalMessage<'a> {
type Item = &'a GlobalMessagePart<'a>;
type IntoIter = InMessageIterator<'a, GlobalMessagePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InHostInfoRequest<'a> {
list: Vec<HostInfoRequestPart<'a>>,
}
#[derive(Debug)]
pub struct HostInfoRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InHostInfoRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "hostinfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(HostInfoRequestPart {
phantom: PhantomData,
});
}
Ok(InHostInfoRequest { list })
}
}
impl<'a> InHostInfoRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<HostInfoRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InHostInfoRequest<'a> {
type Item = &'a HostInfoRequestPart<'a>;
type IntoIter = InMessageIterator<'a, HostInfoRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InInstanceEdit<'a> {
list: Vec<InstanceEditPart<'a>>,
}
#[derive(Debug)]
pub struct InstanceEditPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InInstanceEdit<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "instanceedit" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(InstanceEditPart {
phantom: PhantomData,
});
}
Ok(InInstanceEdit { list })
}
}
impl<'a> InInstanceEdit<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<InstanceEditPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InInstanceEdit<'a> {
type Item = &'a InstanceEditPart<'a>;
type IntoIter = InMessageIterator<'a, InstanceEditPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InInstanceInfo<'a> {
list: Vec<InstanceInfoPart<'a>>,
}
#[derive(Debug)]
pub struct InstanceInfoPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InInstanceInfo<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "instanceinfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(InstanceInfoPart {
phantom: PhantomData,
});
}
Ok(InInstanceInfo { list })
}
}
impl<'a> InInstanceInfo<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<InstanceInfoPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InInstanceInfo<'a> {
type Item = &'a InstanceInfoPart<'a>;
type IntoIter = InMessageIterator<'a, InstanceInfoPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InLogAdd<'a> {
list: Vec<LogAddPart<'a>>,
}
#[derive(Debug)]
pub struct LogAddPart<'a> {
pub log_level: LogLevel,
pub log_message: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InLogAdd<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "logadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(LogAddPart {
log_level: {
let val = ccmd.0.get("loglevel")
.ok_or(ParseError::ParameterNotFound { arg: "LogLevel", name: "LogAdd", })?;
LogLevel::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "LogLevel",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "LogLevel",
value: val.to_string(),
})?
},
log_message: {
let val = ccmd.0.get("logmsg")
.ok_or(ParseError::ParameterNotFound { arg: "LogMessage", name: "LogAdd", })?;
val },
phantom: PhantomData,
});
}
Ok(InLogAdd { list })
}
}
impl<'a> InLogAdd<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<LogAddPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InLogAdd<'a> {
type Item = &'a LogAddPart<'a>;
type IntoIter = InMessageIterator<'a, LogAddPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InLogin<'a> {
list: Vec<LoginPart<'a>>,
}
#[derive(Debug)]
pub struct LoginPart<'a> {
pub login_name: &'a str,
pub login_password: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InLogin<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "login" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(LoginPart {
login_name: {
let val = ccmd.0.get("client_login_name")
.ok_or(ParseError::ParameterNotFound { arg: "LoginName", name: "Login", })?;
val },
login_password: {
let val = ccmd.0.get("client_login_password")
.ok_or(ParseError::ParameterNotFound { arg: "LoginPassword", name: "Login", })?;
val },
phantom: PhantomData,
});
}
Ok(InLogin { list })
}
}
impl<'a> InLogin<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<LoginPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InLogin<'a> {
type Item = &'a LoginPart<'a>;
type IntoIter = InMessageIterator<'a, LoginPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InLogout<'a> {
list: Vec<LogoutPart<'a>>,
}
#[derive(Debug)]
pub struct LogoutPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InLogout<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "logout" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(LogoutPart {
phantom: PhantomData,
});
}
Ok(InLogout { list })
}
}
impl<'a> InLogout<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<LogoutPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InLogout<'a> {
type Item = &'a LogoutPart<'a>;
type IntoIter = InMessageIterator<'a, LogoutPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InLogView<'a> {
list: Vec<LogViewPart<'a>>,
}
#[derive(Debug)]
pub struct LogViewPart<'a> {
pub lines: Option<u32>,
pub reverse: Option<bool>,
pub instance_log: Option<bool>,
pub offset: Option<u64>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InLogView<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "logview" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(LogViewPart {
lines: {
if let Some(val) = ccmd.0.get("lines") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "Lines",
value: val.to_string(),
error: e,
})?
})
} else { None } },
reverse: {
if let Some(val) = ccmd.0.get("reverse") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "Reverse",
value: val.to_string(),
})? }
})
} else { None } },
instance_log: {
if let Some(val) = ccmd.0.get("instance") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "InstanceLog",
value: val.to_string(),
})? }
})
} else { None } },
offset: {
if let Some(val) = ccmd.0.get("begin_pos") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "Offset",
value: val.to_string(),
error: e,
})?
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InLogView { list })
}
}
impl<'a> InLogView<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<LogViewPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InLogView<'a> {
type Item = &'a LogViewPart<'a>;
type IntoIter = InMessageIterator<'a, LogViewPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InOfflineMessageAdd<'a> {
list: Vec<OfflineMessageAddPart<'a>>,
}
#[derive(Debug)]
pub struct OfflineMessageAddPart<'a> {
pub client_uid: UidRef<'a>,
pub subject: &'a str,
pub message: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InOfflineMessageAdd<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "messageadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(OfflineMessageAddPart {
client_uid: {
let val = ccmd.0.get("cluid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientUid", name: "OfflineMessageAdd", })?;
UidRef(val) },
subject: {
let val = ccmd.0.get("subject")
.ok_or(ParseError::ParameterNotFound { arg: "Subject", name: "OfflineMessageAdd", })?;
val },
message: {
let val = ccmd.0.get("message")
.ok_or(ParseError::ParameterNotFound { arg: "Message", name: "OfflineMessageAdd", })?;
val },
phantom: PhantomData,
});
}
Ok(InOfflineMessageAdd { list })
}
}
impl<'a> InOfflineMessageAdd<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<OfflineMessageAddPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InOfflineMessageAdd<'a> {
type Item = &'a OfflineMessageAddPart<'a>;
type IntoIter = InMessageIterator<'a, OfflineMessageAddPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InOfflineMessageDel<'a> {
list: Vec<OfflineMessageDelPart<'a>>,
}
#[derive(Debug)]
pub struct OfflineMessageDelPart<'a> {
pub message_id: u32,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InOfflineMessageDel<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "messagedel" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(OfflineMessageDelPart {
message_id: {
let val = ccmd.0.get("msgid")
.ok_or(ParseError::ParameterNotFound { arg: "MessageId", name: "OfflineMessageDel", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "MessageId",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InOfflineMessageDel { list })
}
}
impl<'a> InOfflineMessageDel<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<OfflineMessageDelPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InOfflineMessageDel<'a> {
type Item = &'a OfflineMessageDelPart<'a>;
type IntoIter = InMessageIterator<'a, OfflineMessageDelPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InOfflineMessageGet<'a> {
list: Vec<OfflineMessageGetPart<'a>>,
}
#[derive(Debug)]
pub struct OfflineMessageGetPart<'a> {
pub message_id: u32,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InOfflineMessageGet<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "messageget" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(OfflineMessageGetPart {
message_id: {
let val = ccmd.0.get("msgid")
.ok_or(ParseError::ParameterNotFound { arg: "MessageId", name: "OfflineMessageGet", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "MessageId",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InOfflineMessageGet { list })
}
}
impl<'a> InOfflineMessageGet<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<OfflineMessageGetPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InOfflineMessageGet<'a> {
type Item = &'a OfflineMessageGetPart<'a>;
type IntoIter = InMessageIterator<'a, OfflineMessageGetPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InOfflineMessageListRequest<'a> {
list: Vec<OfflineMessageListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct OfflineMessageListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InOfflineMessageListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "messagelist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(OfflineMessageListRequestPart {
phantom: PhantomData,
});
}
Ok(InOfflineMessageListRequest { list })
}
}
impl<'a> InOfflineMessageListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<OfflineMessageListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InOfflineMessageListRequest<'a> {
type Item = &'a OfflineMessageListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, OfflineMessageListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InOfflineMessageUpdateFlag<'a> {
list: Vec<OfflineMessageUpdateFlagPart<'a>>,
}
#[derive(Debug)]
pub struct OfflineMessageUpdateFlagPart<'a> {
pub message_id: u32,
pub is_read: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InOfflineMessageUpdateFlag<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "messageupdateflag" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(OfflineMessageUpdateFlagPart {
message_id: {
let val = ccmd.0.get("msgid")
.ok_or(ParseError::ParameterNotFound { arg: "MessageId", name: "OfflineMessageUpdateFlag", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "MessageId",
value: val.to_string(),
error: e,
})?
},
is_read: {
let val = ccmd.0.get("flag")
.ok_or(ParseError::ParameterNotFound { arg: "IsRead", name: "OfflineMessageUpdateFlag", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "IsRead",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InOfflineMessageUpdateFlag { list })
}
}
impl<'a> InOfflineMessageUpdateFlag<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<OfflineMessageUpdateFlagPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InOfflineMessageUpdateFlag<'a> {
type Item = &'a OfflineMessageUpdateFlagPart<'a>;
type IntoIter = InMessageIterator<'a, OfflineMessageUpdateFlagPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPermFindRequest<'a> {
list: Vec<PermFindRequestPart<'a>>,
}
#[derive(Debug)]
pub struct PermFindRequestPart<'a> {
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPermFindRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "permfind" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(PermFindRequestPart {
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InPermFindRequest { list })
}
}
impl<'a> InPermFindRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PermFindRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPermFindRequest<'a> {
type Item = &'a PermFindRequestPart<'a>;
type IntoIter = InMessageIterator<'a, PermFindRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPermRequest<'a> {
list: Vec<PermRequestPart<'a>>,
}
#[derive(Debug)]
pub struct PermRequestPart<'a> {
pub permission_id: Permission,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPermRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "permget" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(PermRequestPart {
permission_id: {
let val = ccmd.0.get("permid")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionId", name: "PermRequest", })?;
Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
},
phantom: PhantomData,
});
}
Ok(InPermRequest { list })
}
}
impl<'a> InPermRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PermRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPermRequest<'a> {
type Item = &'a PermRequestPart<'a>;
type IntoIter = InMessageIterator<'a, PermRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPermIdByNameRequest<'a> {
list: Vec<PermIdByNameRequestPart<'a>>,
}
#[derive(Debug)]
pub struct PermIdByNameRequestPart<'a> {
pub permission_name_id: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPermIdByNameRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "permidgetbyname" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(PermIdByNameRequestPart {
permission_name_id: {
let val = ccmd.0.get("permsid")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionNameId", name: "PermIdByNameRequest", })?;
val },
phantom: PhantomData,
});
}
Ok(InPermIdByNameRequest { list })
}
}
impl<'a> InPermIdByNameRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PermIdByNameRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPermIdByNameRequest<'a> {
type Item = &'a PermIdByNameRequestPart<'a>;
type IntoIter = InMessageIterator<'a, PermIdByNameRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPermListRequest<'a> {
list: Vec<PermListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct PermListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPermListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "permissionlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(PermListRequestPart {
phantom: PhantomData,
});
}
Ok(InPermListRequest { list })
}
}
impl<'a> InPermListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PermListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPermListRequest<'a> {
type Item = &'a PermListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, PermListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPermOverviewRequest<'a> {
list: Vec<PermOverviewRequestPart<'a>>,
}
#[derive(Debug)]
pub struct PermOverviewRequestPart<'a> {
pub channel_id: ChannelId,
pub client_db_id: ClientDbId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPermOverviewRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "permoverview" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(PermOverviewRequestPart {
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "PermOverviewRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "PermOverviewRequest", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InPermOverviewRequest { list })
}
}
impl<'a> InPermOverviewRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PermOverviewRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPermOverviewRequest<'a> {
type Item = &'a PermOverviewRequestPart<'a>;
type IntoIter = InMessageIterator<'a, PermOverviewRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPermReset<'a> {
list: Vec<PermResetPart<'a>>,
}
#[derive(Debug)]
pub struct PermResetPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPermReset<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "permreset" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(PermResetPart {
phantom: PhantomData,
});
}
Ok(InPermReset { list })
}
}
impl<'a> InPermReset<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PermResetPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPermReset<'a> {
type Item = &'a PermResetPart<'a>;
type IntoIter = InMessageIterator<'a, PermResetPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPrivilegeKeyAddRequest<'a> {
list: Vec<PrivilegeKeyAddRequestPart<'a>>,
}
#[derive(Debug)]
pub struct PrivilegeKeyAddRequestPart<'a> {
pub token_type: TokenType,
pub token_id1: u64,
pub token_id2: ChannelId,
pub token_description: Option<&'a str>,
pub token_custom_set: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPrivilegeKeyAddRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "privilegekeyadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(PrivilegeKeyAddRequestPart {
token_type: {
let val = ccmd.0.get("tokentype")
.ok_or(ParseError::ParameterNotFound { arg: "TokenType", name: "PrivilegeKeyAddRequest", })?;
TokenType::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TokenType",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "TokenType",
value: val.to_string(),
})?
},
token_id1: {
let val = ccmd.0.get("tokenid1")
.ok_or(ParseError::ParameterNotFound { arg: "TokenId1", name: "PrivilegeKeyAddRequest", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "TokenId1",
value: val.to_string(),
error: e,
})?
},
token_id2: {
let val = ccmd.0.get("tokenid2")
.ok_or(ParseError::ParameterNotFound { arg: "TokenId2", name: "PrivilegeKeyAddRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TokenId2",
value: val.to_string(),
error: e,
})?)
},
token_description: {
if let Some(val) = ccmd.0.get("tokendescription") {
Some({ val })
} else { None } },
token_custom_set: {
if let Some(val) = ccmd.0.get("tokencustomset") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InPrivilegeKeyAddRequest { list })
}
}
impl<'a> InPrivilegeKeyAddRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PrivilegeKeyAddRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPrivilegeKeyAddRequest<'a> {
type Item = &'a PrivilegeKeyAddRequestPart<'a>;
type IntoIter = InMessageIterator<'a, PrivilegeKeyAddRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPrivilegeKeyDelete<'a> {
list: Vec<PrivilegeKeyDeletePart<'a>>,
}
#[derive(Debug)]
pub struct PrivilegeKeyDeletePart<'a> {
pub token: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPrivilegeKeyDelete<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "privilegekeydelete" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(PrivilegeKeyDeletePart {
token: {
let val = ccmd.0.get("token")
.ok_or(ParseError::ParameterNotFound { arg: "Token", name: "PrivilegeKeyDelete", })?;
val },
phantom: PhantomData,
});
}
Ok(InPrivilegeKeyDelete { list })
}
}
impl<'a> InPrivilegeKeyDelete<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PrivilegeKeyDeletePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPrivilegeKeyDelete<'a> {
type Item = &'a PrivilegeKeyDeletePart<'a>;
type IntoIter = InMessageIterator<'a, PrivilegeKeyDeletePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPrivilegeKeyListRequest<'a> {
list: Vec<PrivilegeKeyListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct PrivilegeKeyListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPrivilegeKeyListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "privilegekeylist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(PrivilegeKeyListRequestPart {
phantom: PhantomData,
});
}
Ok(InPrivilegeKeyListRequest { list })
}
}
impl<'a> InPrivilegeKeyListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PrivilegeKeyListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPrivilegeKeyListRequest<'a> {
type Item = &'a PrivilegeKeyListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, PrivilegeKeyListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InPrivilegeKeyUse<'a> {
list: Vec<PrivilegeKeyUsePart<'a>>,
}
#[derive(Debug)]
pub struct PrivilegeKeyUsePart<'a> {
pub token: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InPrivilegeKeyUse<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "privilegekeyuse" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(PrivilegeKeyUsePart {
token: {
let val = ccmd.0.get("token")
.ok_or(ParseError::ParameterNotFound { arg: "Token", name: "PrivilegeKeyUse", })?;
val },
phantom: PhantomData,
});
}
Ok(InPrivilegeKeyUse { list })
}
}
impl<'a> InPrivilegeKeyUse<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<PrivilegeKeyUsePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InPrivilegeKeyUse<'a> {
type Item = &'a PrivilegeKeyUsePart<'a>;
type IntoIter = InMessageIterator<'a, PrivilegeKeyUsePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InQuit<'a> {
list: Vec<QuitPart<'a>>,
}
#[derive(Debug)]
pub struct QuitPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InQuit<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "quit" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(QuitPart {
phantom: PhantomData,
});
}
Ok(InQuit { list })
}
}
impl<'a> InQuit<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<QuitPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InQuit<'a> {
type Item = &'a QuitPart<'a>;
type IntoIter = InMessageIterator<'a, QuitPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InSendTextMessage<'a> {
list: Vec<SendTextMessagePart<'a>>,
}
#[derive(Debug)]
pub struct SendTextMessagePart<'a> {
pub target: TextMessageTargetMode,
pub target_client_id: Option<ClientId>,
pub message: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InSendTextMessage<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "sendtextmessage" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(SendTextMessagePart {
target: {
let val = ccmd.0.get("targetmode")
.ok_or(ParseError::ParameterNotFound { arg: "Target", name: "SendTextMessage", })?;
TextMessageTargetMode::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "Target",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "Target",
value: val.to_string(),
})?
},
target_client_id: {
if let Some(val) = ccmd.0.get("target") {
Some({ ClientId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetClientId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
message: {
let val = ccmd.0.get("msg")
.ok_or(ParseError::ParameterNotFound { arg: "Message", name: "SendTextMessage", })?;
val },
phantom: PhantomData,
});
}
Ok(InSendTextMessage { list })
}
}
impl<'a> InSendTextMessage<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<SendTextMessagePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InSendTextMessage<'a> {
type Item = &'a SendTextMessagePart<'a>;
type IntoIter = InMessageIterator<'a, SendTextMessagePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerCreate<'a> {
list: Vec<ServerCreatePart<'a>>,
}
#[derive(Debug)]
pub struct ServerCreatePart<'a> {
pub name: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerCreate<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servercreate" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerCreatePart {
name: {
let val = ccmd.0.get("virtualserver_name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ServerCreate", })?;
val },
phantom: PhantomData,
});
}
Ok(InServerCreate { list })
}
}
impl<'a> InServerCreate<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerCreatePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerCreate<'a> {
type Item = &'a ServerCreatePart<'a>;
type IntoIter = InMessageIterator<'a, ServerCreatePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerDelete<'a> {
list: Vec<ServerDeletePart<'a>>,
}
#[derive(Debug)]
pub struct ServerDeletePart<'a> {
pub server_id: u32,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerDelete<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serverdelete" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerDeletePart {
server_id: {
let val = ccmd.0.get("sid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerId", name: "ServerDelete", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerId",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InServerDelete { list })
}
}
impl<'a> InServerDelete<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerDeletePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerDelete<'a> {
type Item = &'a ServerDeletePart<'a>;
type IntoIter = InMessageIterator<'a, ServerDeletePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerEdit<'a> {
list: Vec<ServerEditPart<'a>>,
}
#[derive(Debug)]
pub struct ServerEditPart<'a> {
pub server_id: u32,
pub name: Option<&'a str>,
pub welcome_message: Option<&'a str>,
pub max_clients: Option<u16>,
pub server_password: Option<&'a str>,
pub hostmessage: Option<&'a str>,
pub hostmessage_mode: Option<HostMessageMode>,
pub hostbanner_url: Option<&'a str>,
pub hostbanner_gfx_url: Option<&'a str>,
pub hostbanner_gfx_interval: Option<Duration>,
pub hostbutton_tooltip: Option<&'a str>,
pub hostbutton_url: Option<&'a str>,
pub hostbutton_gfx_url: Option<&'a str>,
pub icon_id: Option<IconHash>,
pub reserved_slots: Option<u16>,
pub hostbanner_mode: Option<HostBannerMode>,
pub nickname: Option<&'a str>,
pub max_download_total_bandwidth: Option<u64>,
pub max_upload_total_bandwidth: Option<u64>,
pub download_quota: Option<u64>,
pub upload_quota: Option<u64>,
pub antiflood_points_tick_reduce: Option<u32>,
pub antiflood_points_to_command_block: Option<u32>,
pub antiflood_points_to_ip_block: Option<u32>,
pub codec_encryption_mode: Option<CodecEncryptionMode>,
pub identity_security_level: Option<u8>,
pub default_server_group: Option<ServerGroupId>,
pub default_channel_group: Option<ChannelGroupId>,
pub default_channel_admin_group: Option<ChannelGroupId>,
pub complain_autoban_count: Option<u32>,
pub complain_autoban_time: Option<Duration>,
pub complain_remove_time: Option<Duration>,
pub min_clients_in_channel_before_forced_silence: Option<u32>,
pub priority_speaker_dimm_modificator: Option<f32>,
pub phonetic_name: Option<&'a str>,
pub temp_channel_default_delete_delay: Option<Duration>,
pub weblist_enabled: Option<bool>,
pub log_client: Option<bool>,
pub log_query: Option<bool>,
pub log_channel: Option<bool>,
pub log_permissions: Option<bool>,
pub log_server: Option<bool>,
pub log_file_transfer: Option<bool>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerEdit<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serveredit" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerEditPart {
server_id: {
let val = ccmd.0.get("sid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerId", name: "ServerEdit", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerId",
value: val.to_string(),
error: e,
})?
},
name: {
if let Some(val) = ccmd.0.get("virtualserver_name") {
Some({ val })
} else { None } },
welcome_message: {
if let Some(val) = ccmd.0.get("virtualserver_welcomemessage") {
Some({ val })
} else { None } },
max_clients: {
if let Some(val) = ccmd.0.get("virtualserver_maxclients") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "MaxClients",
value: val.to_string(),
error: e,
})?
})
} else { None } },
server_password: {
if let Some(val) = ccmd.0.get("virtualserver_password") {
Some({ val })
} else { None } },
hostmessage: {
if let Some(val) = ccmd.0.get("virtualserver_hostmessage") {
Some({ val })
} else { None } },
hostmessage_mode: {
if let Some(val) = ccmd.0.get("virtualserver_hostmessage_mode") {
Some({ HostMessageMode::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "HostmessageMode",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "HostmessageMode",
value: val.to_string(),
})?
})
} else { None } },
hostbanner_url: {
if let Some(val) = ccmd.0.get("virtualserver_hostbanner_url") {
Some({ val })
} else { None } },
hostbanner_gfx_url: {
if let Some(val) = ccmd.0.get("virtualserver_hostbanner_gfx_url") {
Some({ val })
} else { None } },
hostbanner_gfx_interval: {
if let Some(val) = ccmd.0.get("virtualserver_hostbanner_gfx_interval") {
Some({ let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "HostbannerGfxInterval",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "HostbannerGfxInterval",
value: val.to_string(),
})? }
})
} else { None } },
hostbutton_tooltip: {
if let Some(val) = ccmd.0.get("virtualserver_hostbutton_tooltip") {
Some({ val })
} else { None } },
hostbutton_url: {
if let Some(val) = ccmd.0.get("virtualserver_hostbutton_url") {
Some({ val })
} else { None } },
hostbutton_gfx_url: {
if let Some(val) = ccmd.0.get("virtualserver_hostbutton_gfx_url") {
Some({ val })
} else { None } },
icon_id: {
if let Some(val) = ccmd.0.get("virtualserver_icon_id") {
Some({ IconHash(if val.starts_with('-') {
val.parse::<i32>().map(|i| i as u32)
} else {
val.parse::<u64>().map(|i| i as u32)
}.map_err(|e| ParseError::ParseInt {
arg: "IconId",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
reserved_slots: {
if let Some(val) = ccmd.0.get("virtualserver_reserved_slots") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "ReservedSlots",
value: val.to_string(),
error: e,
})?
})
} else { None } },
hostbanner_mode: {
if let Some(val) = ccmd.0.get("virtualserver_hostbanner_mode") {
Some({ HostBannerMode::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "HostbannerMode",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "HostbannerMode",
value: val.to_string(),
})?
})
} else { None } },
nickname: {
if let Some(val) = ccmd.0.get("virtualserver_nickname") {
Some({ val })
} else { None } },
max_download_total_bandwidth: {
if let Some(val) = ccmd.0.get("virtualserver_max_download_total_bandwidth") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "MaxDownloadTotalBandwidth",
value: val.to_string(),
error: e,
})?
})
} else { None } },
max_upload_total_bandwidth: {
if let Some(val) = ccmd.0.get("virtualserver_max_upload_total_bandwidth") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "MaxUploadTotalBandwidth",
value: val.to_string(),
error: e,
})?
})
} else { None } },
download_quota: {
if let Some(val) = ccmd.0.get("virtualserver_download_quota") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "DownloadQuota",
value: val.to_string(),
error: e,
})?
})
} else { None } },
upload_quota: {
if let Some(val) = ccmd.0.get("virtualserver_upload_quota") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "UploadQuota",
value: val.to_string(),
error: e,
})?
})
} else { None } },
antiflood_points_tick_reduce: {
if let Some(val) = ccmd.0.get("virtualserver_antiflood_points_tick_reduce") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "AntifloodPointsTickReduce",
value: val.to_string(),
error: e,
})?
})
} else { None } },
antiflood_points_to_command_block: {
if let Some(val) = ccmd.0.get("virtualserver_antiflood_points_needed_command_block") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "AntifloodPointsToCommandBlock",
value: val.to_string(),
error: e,
})?
})
} else { None } },
antiflood_points_to_ip_block: {
if let Some(val) = ccmd.0.get("virtualserver_antiflood_points_needed_ip_block") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "AntifloodPointsToIpBlock",
value: val.to_string(),
error: e,
})?
})
} else { None } },
codec_encryption_mode: {
if let Some(val) = ccmd.0.get("virtualserver_codec_encryption_mode") {
Some({ CodecEncryptionMode::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "CodecEncryptionMode",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "CodecEncryptionMode",
value: val.to_string(),
})?
})
} else { None } },
identity_security_level: {
if let Some(val) = ccmd.0.get("virtualserver_needed_identity_security_level") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "IdentitySecurityLevel",
value: val.to_string(),
error: e,
})?
})
} else { None } },
default_server_group: {
if let Some(val) = ccmd.0.get("virtualserver_default_server_group") {
Some({ ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "DefaultServerGroup",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
default_channel_group: {
if let Some(val) = ccmd.0.get("virtualserver_default_channel_group") {
Some({ ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "DefaultChannelGroup",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
default_channel_admin_group: {
if let Some(val) = ccmd.0.get("virtualserver_default_channel_admin_group") {
Some({ ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "DefaultChannelAdminGroup",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
complain_autoban_count: {
if let Some(val) = ccmd.0.get("virtualserver_complain_autoban_count") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "ComplainAutobanCount",
value: val.to_string(),
error: e,
})?
})
} else { None } },
complain_autoban_time: {
if let Some(val) = ccmd.0.get("virtualserver_complain_autoban_time") {
Some({ let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "ComplainAutobanTime",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "ComplainAutobanTime",
value: val.to_string(),
})? }
})
} else { None } },
complain_remove_time: {
if let Some(val) = ccmd.0.get("virtualserver_complain_remove_time") {
Some({ let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "ComplainRemoveTime",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "ComplainRemoveTime",
value: val.to_string(),
})? }
})
} else { None } },
min_clients_in_channel_before_forced_silence: {
if let Some(val) = ccmd.0.get("virtualserver_min_clients_in_channel_before_forced_silence") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "MinClientsInChannelBeforeForcedSilence",
value: val.to_string(),
error: e,
})?
})
} else { None } },
priority_speaker_dimm_modificator: {
if let Some(val) = ccmd.0.get("virtualserver_priority_speaker_dimm_modificator") {
Some({ val.parse().map_err(|e| ParseError::ParseFloat {
arg: "PrioritySpeakerDimmModificator",
value: val.to_string(),
error: e,
})?
})
} else { None } },
phonetic_name: {
if let Some(val) = ccmd.0.get("virtualserver_name_phonetic") {
Some({ val })
} else { None } },
temp_channel_default_delete_delay: {
if let Some(val) = ccmd.0.get("virtualserver_channel_temp_delete_delay_default") {
Some({ let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "TempChannelDefaultDeleteDelay",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "TempChannelDefaultDeleteDelay",
value: val.to_string(),
})? }
})
} else { None } },
weblist_enabled: {
if let Some(val) = ccmd.0.get("virtualserver_weblist_enabled") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "WeblistEnabled",
value: val.to_string(),
})? }
})
} else { None } },
log_client: {
if let Some(val) = ccmd.0.get("virtualserver_log_client") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "LogClient",
value: val.to_string(),
})? }
})
} else { None } },
log_query: {
if let Some(val) = ccmd.0.get("virtualserver_log_query") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "LogQuery",
value: val.to_string(),
})? }
})
} else { None } },
log_channel: {
if let Some(val) = ccmd.0.get("virtualserver_log_channel") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "LogChannel",
value: val.to_string(),
})? }
})
} else { None } },
log_permissions: {
if let Some(val) = ccmd.0.get("virtualserver_log_permissions") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "LogPermissions",
value: val.to_string(),
})? }
})
} else { None } },
log_server: {
if let Some(val) = ccmd.0.get("virtualserver_log_server") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "LogServer",
value: val.to_string(),
})? }
})
} else { None } },
log_file_transfer: {
if let Some(val) = ccmd.0.get("virtualserver_log_filetransfer") {
Some({ match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "LogFileTransfer",
value: val.to_string(),
})? }
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InServerEdit { list })
}
}
impl<'a> InServerEdit<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerEditPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerEdit<'a> {
type Item = &'a ServerEditPart<'a>;
type IntoIter = InMessageIterator<'a, ServerEditPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerVariablesRequest<'a> {
list: Vec<ServerVariablesRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ServerVariablesRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerVariablesRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergetvariables" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerVariablesRequestPart {
phantom: PhantomData,
});
}
Ok(InServerVariablesRequest { list })
}
}
impl<'a> InServerVariablesRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerVariablesRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerVariablesRequest<'a> {
type Item = &'a ServerVariablesRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ServerVariablesRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupAdd<'a> {
list: Vec<ServerGroupAddPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupAddPart<'a> {
pub name: &'a str,
pub group_type: Option<GroupType>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupAdd<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupAddPart {
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ServerGroupAdd", })?;
val },
group_type: {
if let Some(val) = ccmd.0.get("type") {
Some({ GroupType::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "GroupType",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "GroupType",
value: val.to_string(),
})?
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InServerGroupAdd { list })
}
}
impl<'a> InServerGroupAdd<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupAddPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupAdd<'a> {
type Item = &'a ServerGroupAddPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupAddPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupAddClient<'a> {
list: Vec<ServerGroupAddClientPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupAddClientPart<'a> {
pub server_group_id: ServerGroupId,
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupAddClient<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupaddclient" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupAddClientPart {
server_group_id: {
let val = ccmd.0.get("sgid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupId", name: "ServerGroupAddClient", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupId",
value: val.to_string(),
error: e,
})?)
},
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ServerGroupAddClient", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InServerGroupAddClient { list })
}
}
impl<'a> InServerGroupAddClient<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupAddClientPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupAddClient<'a> {
type Item = &'a ServerGroupAddClientPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupAddClientPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupAddPerm<'a> {
list: Vec<ServerGroupAddPermPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupAddPermPart<'a> {
pub server_group_id: ServerGroupId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub permission_value: i32,
pub permission_negated: bool,
pub permission_skip: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupAddPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupaddperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupAddPermPart {
server_group_id: {
let val = ccmd.0.get("sgid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupId", name: "ServerGroupAddPerm", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupId",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
permission_value: {
let val = ccmd.0.get("permvalue")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionValue", name: "ServerGroupAddPerm", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionValue",
value: val.to_string(),
error: e,
})?
},
permission_negated: {
let val = ccmd.0.get("permnegated")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionNegated", name: "ServerGroupAddPerm", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "PermissionNegated",
value: val.to_string(),
})? }
},
permission_skip: {
let val = ccmd.0.get("permskip")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionSkip", name: "ServerGroupAddPerm", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "PermissionSkip",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InServerGroupAddPerm { list })
}
}
impl<'a> InServerGroupAddPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupAddPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupAddPerm<'a> {
type Item = &'a ServerGroupAddPermPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupAddPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupAutoAddPerm<'a> {
list: Vec<ServerGroupAutoAddPermPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupAutoAddPermPart<'a> {
pub server_group_type: u32,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub permission_value: i32,
pub permission_negated: bool,
pub permission_skip: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupAutoAddPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupautoaddperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupAutoAddPermPart {
server_group_type: {
let val = ccmd.0.get("sgtype")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupType", name: "ServerGroupAutoAddPerm", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupType",
value: val.to_string(),
error: e,
})?
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
permission_value: {
let val = ccmd.0.get("permvalue")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionValue", name: "ServerGroupAutoAddPerm", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionValue",
value: val.to_string(),
error: e,
})?
},
permission_negated: {
let val = ccmd.0.get("permnegated")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionNegated", name: "ServerGroupAutoAddPerm", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "PermissionNegated",
value: val.to_string(),
})? }
},
permission_skip: {
let val = ccmd.0.get("permskip")
.ok_or(ParseError::ParameterNotFound { arg: "PermissionSkip", name: "ServerGroupAutoAddPerm", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "PermissionSkip",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InServerGroupAutoAddPerm { list })
}
}
impl<'a> InServerGroupAutoAddPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupAutoAddPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupAutoAddPerm<'a> {
type Item = &'a ServerGroupAutoAddPermPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupAutoAddPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupAutoDelPerm<'a> {
list: Vec<ServerGroupAutoDelPermPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupAutoDelPermPart<'a> {
pub server_group_type: u32,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupAutoDelPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupautodelperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupAutoDelPermPart {
server_group_type: {
let val = ccmd.0.get("sgtype")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupType", name: "ServerGroupAutoDelPerm", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupType",
value: val.to_string(),
error: e,
})?
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InServerGroupAutoDelPerm { list })
}
}
impl<'a> InServerGroupAutoDelPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupAutoDelPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupAutoDelPerm<'a> {
type Item = &'a ServerGroupAutoDelPermPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupAutoDelPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupClientListRequest<'a> {
list: Vec<ServerGroupClientListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupClientListRequestPart<'a> {
pub server_group_id: ServerGroupId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupClientListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupclientlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupClientListRequestPart {
server_group_id: {
let val = ccmd.0.get("sgid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupId", name: "ServerGroupClientListRequest", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InServerGroupClientListRequest { list })
}
}
impl<'a> InServerGroupClientListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupClientListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupClientListRequest<'a> {
type Item = &'a ServerGroupClientListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupClientListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupCopy<'a> {
list: Vec<ServerGroupCopyPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupCopyPart<'a> {
pub source_server_group_id: ServerGroupId,
pub target_server_group_id: ServerGroupId,
pub name: &'a str,
pub group_type: GroupType,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupCopy<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupcopy" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupCopyPart {
source_server_group_id: {
let val = ccmd.0.get("ssgid")
.ok_or(ParseError::ParameterNotFound { arg: "SourceServerGroupId", name: "ServerGroupCopy", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "SourceServerGroupId",
value: val.to_string(),
error: e,
})?)
},
target_server_group_id: {
let val = ccmd.0.get("tsgid")
.ok_or(ParseError::ParameterNotFound { arg: "TargetServerGroupId", name: "ServerGroupCopy", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetServerGroupId",
value: val.to_string(),
error: e,
})?)
},
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ServerGroupCopy", })?;
val },
group_type: {
let val = ccmd.0.get("type")
.ok_or(ParseError::ParameterNotFound { arg: "GroupType", name: "ServerGroupCopy", })?;
GroupType::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "GroupType",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "GroupType",
value: val.to_string(),
})?
},
phantom: PhantomData,
});
}
Ok(InServerGroupCopy { list })
}
}
impl<'a> InServerGroupCopy<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupCopyPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupCopy<'a> {
type Item = &'a ServerGroupCopyPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupCopyPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupDel<'a> {
list: Vec<ServerGroupDelPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupDelPart<'a> {
pub server_group_id: ServerGroupId,
pub force: bool,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupDel<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupdel" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupDelPart {
server_group_id: {
let val = ccmd.0.get("sgid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupId", name: "ServerGroupDel", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupId",
value: val.to_string(),
error: e,
})?)
},
force: {
let val = ccmd.0.get("force")
.ok_or(ParseError::ParameterNotFound { arg: "Force", name: "ServerGroupDel", })?;
match *val { "0" => false, "1" => true, _ => Err(ParseError::ParseBool {
arg: "Force",
value: val.to_string(),
})? }
},
phantom: PhantomData,
});
}
Ok(InServerGroupDel { list })
}
}
impl<'a> InServerGroupDel<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupDelPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupDel<'a> {
type Item = &'a ServerGroupDelPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupDelPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupDelClient<'a> {
list: Vec<ServerGroupDelClientPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupDelClientPart<'a> {
pub server_group_id: ServerGroupId,
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupDelClient<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupdelclient" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupDelClientPart {
server_group_id: {
let val = ccmd.0.get("sgid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupId", name: "ServerGroupDelClient", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupId",
value: val.to_string(),
error: e,
})?)
},
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ServerGroupDelClient", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InServerGroupDelClient { list })
}
}
impl<'a> InServerGroupDelClient<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupDelClientPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupDelClient<'a> {
type Item = &'a ServerGroupDelClientPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupDelClientPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupDelPerm<'a> {
list: Vec<ServerGroupDelPermPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupDelPermPart<'a> {
pub server_group_id: ServerGroupId,
pub permission_id: Option<Permission>,
pub permission_name_id: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupDelPerm<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupdelperm" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupDelPermPart {
server_group_id: {
let val = ccmd.0.get("sgid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupId", name: "ServerGroupDelPerm", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupId",
value: val.to_string(),
error: e,
})?)
},
permission_id: {
if let Some(val) = ccmd.0.get("permid") {
Some({ Permission::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "PermissionId",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "PermissionId",
value: val.to_string(),
})?
})
} else { None } },
permission_name_id: {
if let Some(val) = ccmd.0.get("permsid") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InServerGroupDelPerm { list })
}
}
impl<'a> InServerGroupDelPerm<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupDelPermPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupDelPerm<'a> {
type Item = &'a ServerGroupDelPermPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupDelPermPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupListRequest<'a> {
list: Vec<ServerGroupListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergrouplist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerGroupListRequestPart {
phantom: PhantomData,
});
}
Ok(InServerGroupListRequest { list })
}
}
impl<'a> InServerGroupListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupListRequest<'a> {
type Item = &'a ServerGroupListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupPermListRequest<'a> {
list: Vec<ServerGroupPermListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupPermListRequestPart<'a> {
pub server_group_id: ServerGroupId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupPermListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergrouppermlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupPermListRequestPart {
server_group_id: {
let val = ccmd.0.get("sgid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupId", name: "ServerGroupPermListRequest", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InServerGroupPermListRequest { list })
}
}
impl<'a> InServerGroupPermListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupPermListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupPermListRequest<'a> {
type Item = &'a ServerGroupPermListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupPermListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupRename<'a> {
list: Vec<ServerGroupRenamePart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupRenamePart<'a> {
pub server_group_id: ServerGroupId,
pub name: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupRename<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergrouprename" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupRenamePart {
server_group_id: {
let val = ccmd.0.get("sgid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerGroupId", name: "ServerGroupRename", })?;
ServerGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerGroupId",
value: val.to_string(),
error: e,
})?)
},
name: {
let val = ccmd.0.get("name")
.ok_or(ParseError::ParameterNotFound { arg: "Name", name: "ServerGroupRename", })?;
val },
phantom: PhantomData,
});
}
Ok(InServerGroupRename { list })
}
}
impl<'a> InServerGroupRename<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupRenamePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupRename<'a> {
type Item = &'a ServerGroupRenamePart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupRenamePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerGroupsByClientIdRequest<'a> {
list: Vec<ServerGroupsByClientIdRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ServerGroupsByClientIdRequestPart<'a> {
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerGroupsByClientIdRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servergroupsbyclientid" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerGroupsByClientIdRequestPart {
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "ServerGroupsByClientIdRequest", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InServerGroupsByClientIdRequest { list })
}
}
impl<'a> InServerGroupsByClientIdRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerGroupsByClientIdRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerGroupsByClientIdRequest<'a> {
type Item = &'a ServerGroupsByClientIdRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ServerGroupsByClientIdRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerIdGetByPort<'a> {
list: Vec<ServerIdGetByPortPart<'a>>,
}
#[derive(Debug)]
pub struct ServerIdGetByPortPart<'a> {
pub virtual_server_port: u16,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerIdGetByPort<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serveridgetbyport" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerIdGetByPortPart {
virtual_server_port: {
let val = ccmd.0.get("virtualserver_port")
.ok_or(ParseError::ParameterNotFound { arg: "VirtualServerPort", name: "ServerIdGetByPort", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "VirtualServerPort",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InServerIdGetByPort { list })
}
}
impl<'a> InServerIdGetByPort<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerIdGetByPortPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerIdGetByPort<'a> {
type Item = &'a ServerIdGetByPortPart<'a>;
type IntoIter = InMessageIterator<'a, ServerIdGetByPortPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerInfo<'a> {
list: Vec<ServerInfoPart<'a>>,
}
#[derive(Debug)]
pub struct ServerInfoPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerInfo<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serverinfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerInfoPart {
phantom: PhantomData,
});
}
Ok(InServerInfo { list })
}
}
impl<'a> InServerInfo<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerInfoPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerInfo<'a> {
type Item = &'a ServerInfoPart<'a>;
type IntoIter = InMessageIterator<'a, ServerInfoPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerList<'a> {
list: Vec<ServerListPart<'a>>,
}
#[derive(Debug)]
pub struct ServerListPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerList<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serverlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerListPart {
phantom: PhantomData,
});
}
Ok(InServerList { list })
}
}
impl<'a> InServerList<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerListPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerList<'a> {
type Item = &'a ServerListPart<'a>;
type IntoIter = InMessageIterator<'a, ServerListPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerNotifyRegister<'a> {
list: Vec<ServerNotifyRegisterPart<'a>>,
}
#[derive(Debug)]
pub struct ServerNotifyRegisterPart<'a> {
pub event_type: &'a str,
pub id: Option<ChannelId>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerNotifyRegister<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servernotifyregister" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerNotifyRegisterPart {
event_type: {
let val = ccmd.0.get("event")
.ok_or(ParseError::ParameterNotFound { arg: "EventType", name: "ServerNotifyRegister", })?;
val },
id: {
if let Some(val) = ccmd.0.get("id") {
Some({ ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "Id",
value: val.to_string(),
error: e,
})?)
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InServerNotifyRegister { list })
}
}
impl<'a> InServerNotifyRegister<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerNotifyRegisterPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerNotifyRegister<'a> {
type Item = &'a ServerNotifyRegisterPart<'a>;
type IntoIter = InMessageIterator<'a, ServerNotifyRegisterPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerNotifyUnregister<'a> {
list: Vec<ServerNotifyUnregisterPart<'a>>,
}
#[derive(Debug)]
pub struct ServerNotifyUnregisterPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerNotifyUnregister<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servernotifyunregister" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerNotifyUnregisterPart {
phantom: PhantomData,
});
}
Ok(InServerNotifyUnregister { list })
}
}
impl<'a> InServerNotifyUnregister<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerNotifyUnregisterPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerNotifyUnregister<'a> {
type Item = &'a ServerNotifyUnregisterPart<'a>;
type IntoIter = InMessageIterator<'a, ServerNotifyUnregisterPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerProcessStop<'a> {
list: Vec<ServerProcessStopPart<'a>>,
}
#[derive(Debug)]
pub struct ServerProcessStopPart<'a> {
pub reason_message: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerProcessStop<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serverprocessstop" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerProcessStopPart {
reason_message: {
if let Some(val) = ccmd.0.get("reasonmsg") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InServerProcessStop { list })
}
}
impl<'a> InServerProcessStop<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerProcessStopPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerProcessStop<'a> {
type Item = &'a ServerProcessStopPart<'a>;
type IntoIter = InMessageIterator<'a, ServerProcessStopPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerConnectionInfoRequest<'a> {
list: Vec<ServerConnectionInfoRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ServerConnectionInfoRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerConnectionInfoRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serverrequestconnectioninfo" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerConnectionInfoRequestPart {
phantom: PhantomData,
});
}
Ok(InServerConnectionInfoRequest { list })
}
}
impl<'a> InServerConnectionInfoRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerConnectionInfoRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerConnectionInfoRequest<'a> {
type Item = &'a ServerConnectionInfoRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ServerConnectionInfoRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerSnapshotCreate<'a> {
list: Vec<ServerSnapshotCreatePart<'a>>,
}
#[derive(Debug)]
pub struct ServerSnapshotCreatePart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerSnapshotCreate<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serversnapshotcreate" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerSnapshotCreatePart {
phantom: PhantomData,
});
}
Ok(InServerSnapshotCreate { list })
}
}
impl<'a> InServerSnapshotCreate<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerSnapshotCreatePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerSnapshotCreate<'a> {
type Item = &'a ServerSnapshotCreatePart<'a>;
type IntoIter = InMessageIterator<'a, ServerSnapshotCreatePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerSnapshotDeploy<'a> {
list: Vec<ServerSnapshotDeployPart<'a>>,
}
#[derive(Debug)]
pub struct ServerSnapshotDeployPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerSnapshotDeploy<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serversnapshotdeploy" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerSnapshotDeployPart {
phantom: PhantomData,
});
}
Ok(InServerSnapshotDeploy { list })
}
}
impl<'a> InServerSnapshotDeploy<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerSnapshotDeployPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerSnapshotDeploy<'a> {
type Item = &'a ServerSnapshotDeployPart<'a>;
type IntoIter = InMessageIterator<'a, ServerSnapshotDeployPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerStart<'a> {
list: Vec<ServerStartPart<'a>>,
}
#[derive(Debug)]
pub struct ServerStartPart<'a> {
pub server_id: u32,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerStart<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serverstart" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerStartPart {
server_id: {
let val = ccmd.0.get("sid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerId", name: "ServerStart", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerId",
value: val.to_string(),
error: e,
})?
},
phantom: PhantomData,
});
}
Ok(InServerStart { list })
}
}
impl<'a> InServerStart<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerStartPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerStart<'a> {
type Item = &'a ServerStartPart<'a>;
type IntoIter = InMessageIterator<'a, ServerStartPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerStop<'a> {
list: Vec<ServerStopPart<'a>>,
}
#[derive(Debug)]
pub struct ServerStopPart<'a> {
pub server_id: u32,
pub reason_message: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerStop<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "serverstop" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerStopPart {
server_id: {
let val = ccmd.0.get("sid")
.ok_or(ParseError::ParameterNotFound { arg: "ServerId", name: "ServerStop", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerId",
value: val.to_string(),
error: e,
})?
},
reason_message: {
if let Some(val) = ccmd.0.get("reasonmsg") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InServerStop { list })
}
}
impl<'a> InServerStop<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerStopPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerStop<'a> {
type Item = &'a ServerStopPart<'a>;
type IntoIter = InMessageIterator<'a, ServerStopPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerTempPasswordAdd<'a> {
list: Vec<ServerTempPasswordAddPart<'a>>,
}
#[derive(Debug)]
pub struct ServerTempPasswordAddPart<'a> {
pub password: &'a str,
pub description: &'a str,
pub duration: Duration,
pub target_channel_id: ChannelId,
pub target_channel_password: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerTempPasswordAdd<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servertemppasswordadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerTempPasswordAddPart {
password: {
let val = ccmd.0.get("pw")
.ok_or(ParseError::ParameterNotFound { arg: "Password", name: "ServerTempPasswordAdd", })?;
val },
description: {
let val = ccmd.0.get("desc")
.ok_or(ParseError::ParameterNotFound { arg: "Description", name: "ServerTempPasswordAdd", })?;
val },
duration: {
let val = ccmd.0.get("duration")
.ok_or(ParseError::ParameterNotFound { arg: "Duration", name: "ServerTempPasswordAdd", })?;
let val = val.parse::<i64>().map_err(|e| ParseError::ParseInt {
arg: "Duration",
value: val.to_string(),
error: e,
})?;
if let Some(_) = val.checked_mul(1000) { Duration::seconds(val) }
else { Err(ParseError::InvalidValue {
arg: "Duration",
value: val.to_string(),
})? }
},
target_channel_id: {
let val = ccmd.0.get("tcid")
.ok_or(ParseError::ParameterNotFound { arg: "TargetChannelId", name: "ServerTempPasswordAdd", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TargetChannelId",
value: val.to_string(),
error: e,
})?)
},
target_channel_password: {
let val = ccmd.0.get("tcpw")
.ok_or(ParseError::ParameterNotFound { arg: "TargetChannelPassword", name: "ServerTempPasswordAdd", })?;
val },
phantom: PhantomData,
});
}
Ok(InServerTempPasswordAdd { list })
}
}
impl<'a> InServerTempPasswordAdd<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerTempPasswordAddPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerTempPasswordAdd<'a> {
type Item = &'a ServerTempPasswordAddPart<'a>;
type IntoIter = InMessageIterator<'a, ServerTempPasswordAddPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerTempPasswordDel<'a> {
list: Vec<ServerTempPasswordDelPart<'a>>,
}
#[derive(Debug)]
pub struct ServerTempPasswordDelPart<'a> {
pub password: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerTempPasswordDel<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servertemppassworddel" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(ServerTempPasswordDelPart {
password: {
let val = ccmd.0.get("pw")
.ok_or(ParseError::ParameterNotFound { arg: "Password", name: "ServerTempPasswordDel", })?;
val },
phantom: PhantomData,
});
}
Ok(InServerTempPasswordDel { list })
}
}
impl<'a> InServerTempPasswordDel<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerTempPasswordDelPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerTempPasswordDel<'a> {
type Item = &'a ServerTempPasswordDelPart<'a>;
type IntoIter = InMessageIterator<'a, ServerTempPasswordDelPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InServerTempPasswordListRequest<'a> {
list: Vec<ServerTempPasswordListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct ServerTempPasswordListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InServerTempPasswordListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "servertemppasswordlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(ServerTempPasswordListRequestPart {
phantom: PhantomData,
});
}
Ok(InServerTempPasswordListRequest { list })
}
}
impl<'a> InServerTempPasswordListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<ServerTempPasswordListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InServerTempPasswordListRequest<'a> {
type Item = &'a ServerTempPasswordListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, ServerTempPasswordListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InSetClientChannelGroup<'a> {
list: Vec<SetClientChannelGroupPart<'a>>,
}
#[derive(Debug)]
pub struct SetClientChannelGroupPart<'a> {
pub channel_group: ChannelGroupId,
pub channel_id: ChannelId,
pub client_db_id: ClientDbId,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InSetClientChannelGroup<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "setclientchannelgroup" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(SetClientChannelGroupPart {
channel_group: {
let val = ccmd.0.get("cgid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelGroup", name: "SetClientChannelGroup", })?;
ChannelGroupId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelGroup",
value: val.to_string(),
error: e,
})?)
},
channel_id: {
let val = ccmd.0.get("cid")
.ok_or(ParseError::ParameterNotFound { arg: "ChannelId", name: "SetClientChannelGroup", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ChannelId",
value: val.to_string(),
error: e,
})?)
},
client_db_id: {
let val = ccmd.0.get("cldbid")
.ok_or(ParseError::ParameterNotFound { arg: "ClientDbId", name: "SetClientChannelGroup", })?;
ClientDbId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "ClientDbId",
value: val.to_string(),
error: e,
})?)
},
phantom: PhantomData,
});
}
Ok(InSetClientChannelGroup { list })
}
}
impl<'a> InSetClientChannelGroup<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<SetClientChannelGroupPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InSetClientChannelGroup<'a> {
type Item = &'a SetClientChannelGroupPart<'a>;
type IntoIter = InMessageIterator<'a, SetClientChannelGroupPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InTokenAddRequest<'a> {
list: Vec<TokenAddRequestPart<'a>>,
}
#[derive(Debug)]
pub struct TokenAddRequestPart<'a> {
pub token_type: TokenType,
pub token_id1: u64,
pub token_id2: ChannelId,
pub token_description: Option<&'a str>,
pub token_custom_set: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InTokenAddRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "tokenadd" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(TokenAddRequestPart {
token_type: {
let val = ccmd.0.get("tokentype")
.ok_or(ParseError::ParameterNotFound { arg: "TokenType", name: "TokenAddRequest", })?;
TokenType::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TokenType",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "TokenType",
value: val.to_string(),
})?
},
token_id1: {
let val = ccmd.0.get("tokenid1")
.ok_or(ParseError::ParameterNotFound { arg: "TokenId1", name: "TokenAddRequest", })?;
val.parse().map_err(|e| ParseError::ParseInt {
arg: "TokenId1",
value: val.to_string(),
error: e,
})?
},
token_id2: {
let val = ccmd.0.get("tokenid2")
.ok_or(ParseError::ParameterNotFound { arg: "TokenId2", name: "TokenAddRequest", })?;
ChannelId(val.parse().map_err(|e| ParseError::ParseInt {
arg: "TokenId2",
value: val.to_string(),
error: e,
})?)
},
token_description: {
if let Some(val) = ccmd.0.get("tokendescription") {
Some({ val })
} else { None } },
token_custom_set: {
if let Some(val) = ccmd.0.get("tokencustomset") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InTokenAddRequest { list })
}
}
impl<'a> InTokenAddRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<TokenAddRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InTokenAddRequest<'a> {
type Item = &'a TokenAddRequestPart<'a>;
type IntoIter = InMessageIterator<'a, TokenAddRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InTokenDelete<'a> {
list: Vec<TokenDeletePart<'a>>,
}
#[derive(Debug)]
pub struct TokenDeletePart<'a> {
pub token: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InTokenDelete<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "tokendelete" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(TokenDeletePart {
token: {
let val = ccmd.0.get("token")
.ok_or(ParseError::ParameterNotFound { arg: "Token", name: "TokenDelete", })?;
val },
phantom: PhantomData,
});
}
Ok(InTokenDelete { list })
}
}
impl<'a> InTokenDelete<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<TokenDeletePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InTokenDelete<'a> {
type Item = &'a TokenDeletePart<'a>;
type IntoIter = InMessageIterator<'a, TokenDeletePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InTokenListRequest<'a> {
list: Vec<TokenListRequestPart<'a>>,
}
#[derive(Debug)]
pub struct TokenListRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InTokenListRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "tokenlist" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(TokenListRequestPart {
phantom: PhantomData,
});
}
Ok(InTokenListRequest { list })
}
}
impl<'a> InTokenListRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<TokenListRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InTokenListRequest<'a> {
type Item = &'a TokenListRequestPart<'a>;
type IntoIter = InMessageIterator<'a, TokenListRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InTokenUse<'a> {
list: Vec<TokenUsePart<'a>>,
}
#[derive(Debug)]
pub struct TokenUsePart<'a> {
pub token: &'a str,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InTokenUse<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "tokenuse" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(TokenUsePart {
token: {
let val = ccmd.0.get("token")
.ok_or(ParseError::ParameterNotFound { arg: "Token", name: "TokenUse", })?;
val },
phantom: PhantomData,
});
}
Ok(InTokenUse { list })
}
}
impl<'a> InTokenUse<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<TokenUsePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InTokenUse<'a> {
type Item = &'a TokenUsePart<'a>;
type IntoIter = InMessageIterator<'a, TokenUsePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InUse<'a> {
list: Vec<UsePart<'a>>,
}
#[derive(Debug)]
pub struct UsePart<'a> {
pub server_id: Option<u32>,
pub port: Option<u16>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InUse<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "use" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(UsePart {
server_id: {
if let Some(val) = ccmd.0.get("sid") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "ServerId",
value: val.to_string(),
error: e,
})?
})
} else { None } },
port: {
if let Some(val) = ccmd.0.get("port") {
Some({ val.parse().map_err(|e| ParseError::ParseInt {
arg: "Port",
value: val.to_string(),
error: e,
})?
})
} else { None } },
phantom: PhantomData,
});
}
Ok(InUse { list })
}
}
impl<'a> InUse<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<UsePart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InUse<'a> {
type Item = &'a UsePart<'a>;
type IntoIter = InMessageIterator<'a, UsePart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InVersionRequest<'a> {
list: Vec<VersionRequestPart<'a>>,
}
#[derive(Debug)]
pub struct VersionRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InVersionRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "version" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(VersionRequestPart {
phantom: PhantomData,
});
}
Ok(InVersionRequest { list })
}
}
impl<'a> InVersionRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<VersionRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InVersionRequest<'a> {
type Item = &'a VersionRequestPart<'a>;
type IntoIter = InMessageIterator<'a, VersionRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InWhoAmIRequest<'a> {
list: Vec<WhoAmIRequestPart<'a>>,
}
#[derive(Debug)]
pub struct WhoAmIRequestPart<'a> {
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InWhoAmIRequest<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "whoami" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for _ in cmd.iter() {
list.push(WhoAmIRequestPart {
phantom: PhantomData,
});
}
Ok(InWhoAmIRequest { list })
}
}
impl<'a> InWhoAmIRequest<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<WhoAmIRequestPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InWhoAmIRequest<'a> {
type Item = &'a WhoAmIRequestPart<'a>;
type IntoIter = InMessageIterator<'a, WhoAmIRequestPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
#[derive(Debug)]
pub struct InDisconnect<'a> {
list: Vec<DisconnectPart<'a>>,
}
#[derive(Debug)]
pub struct DisconnectPart<'a> {
pub reason: Option<Reason>,
pub reason_message: Option<&'a str>,
pub phantom: PhantomData<&'a ()>,
}
impl<'a> InMessageTrait<'a> for InDisconnect<'a> {
fn new(cmd: &'a InCommand) -> Result<Self, ParseError> {
let data = cmd.data();
if data.name != "clientdisconnect" {
return Err(ParseError::WrongCommand(data.name.to_string()));
}
if cmd.newprotocol() { return Err(ParseError::WrongNewprotocol(cmd.newprotocol())); }
if cmd.packet_type() != PacketType::Command { return Err(ParseError::WrongPacketType(cmd.packet_type())); }
if cmd.direction() == Direction::S2C { return Err(ParseError::WrongDirection(cmd.direction())); }
let mut list = Vec::new();
for ccmd in cmd.iter() {
list.push(DisconnectPart {
reason: {
if let Some(val) = ccmd.0.get("reasonid") {
Some({ Reason::from_u32(val.parse().map_err(|e| ParseError::ParseInt {
arg: "Reason",
value: val.to_string(),
error: e,
})?).ok_or(ParseError::InvalidValue {
arg: "Reason",
value: val.to_string(),
})?
})
} else { None } },
reason_message: {
if let Some(val) = ccmd.0.get("reasonmsg") {
Some({ val })
} else { None } },
phantom: PhantomData,
});
}
Ok(InDisconnect { list })
}
}
impl<'a> InDisconnect<'a> {
#[inline]
pub fn iter(&self) -> InMessageIterator<DisconnectPart> { self.into_iter() }
}
impl<'a> IntoIterator for &'a InDisconnect<'a> {
type Item = &'a DisconnectPart<'a>;
type IntoIter = InMessageIterator<'a, DisconnectPart<'a>>;
#[inline]
fn into_iter(self) -> Self::IntoIter { InMessageIterator(&self.list, 0) }
}
pub struct InMessageIterator<'a, T>(&'a [T], usize);
impl<'a, T> Iterator for InMessageIterator<'a, T> {
type Item = &'a T;
fn next(&mut self) -> Option<Self::Item> {
let i = self.1;
self.1 += 1;
self.0.get(i)
}
}
pub struct OutClientInitMessage;
impl OutClientInitMessage {
pub fn new<'a, I: Iterator<Item=ClientInitPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("client_nickname", Cow::Borrowed(p.name)));
res.push(("client_version", Cow::Borrowed(p.client_version)));
res.push(("client_platform", Cow::Borrowed(p.client_platform)));
res.push(("client_input_hardware", Cow::Borrowed(if p.input_hardware_enabled { "1" } else { "0" })));
res.push(("client_output_hardware", Cow::Borrowed(if p.output_hardware_enabled { "1" } else { "0" })));
res.push(("client_default_channel", Cow::Borrowed(p.default_channel)));
res.push(("client_default_channel_password", Cow::Borrowed(p.default_channel_password)));
res.push(("client_server_password", Cow::Borrowed(p.password)));
res.push(("client_meta_data", Cow::Borrowed(p.metadata)));
res.push(("client_version_sign", Cow::Borrowed(p.client_version_sign)));
res.push(("client_key_offset", Cow::Owned(p.client_key_offset.to_string())));
res.push(("client_nickname_phonetic", Cow::Borrowed(p.phonetic_name)));
res.push(("client_default_token", Cow::Borrowed(p.default_token)));
res.push(("hwid", Cow::Borrowed(p.hardware_id)));
if let Some(val) = p.badges { res.push(("client_badges", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientinit", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientInitIvMessage;
impl OutClientInitIvMessage {
pub fn new<'a, I: Iterator<Item=ClientInitIvPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("alpha", Cow::Borrowed(p.alpha)));
res.push(("omega", Cow::Borrowed(p.omega)));
res.push(("ip", Cow::Borrowed(p.ip)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientinitiv", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPluginCommandRequestMessage;
impl OutPluginCommandRequestMessage {
pub fn new<'a, I: Iterator<Item=PluginCommandRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("name", Cow::Borrowed(p.name)));
res.push(("data", Cow::Borrowed(p.data)));
res.push(("targetmode", Cow::Owned(p.target.to_u32().unwrap().to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"plugincmd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutBanAddMessage;
impl OutBanAddMessage {
pub fn new<'a, I: Iterator<Item=BanAddPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.ip { res.push(("ip", Cow::Borrowed(val))); }
if let Some(val) = p.name { res.push(("name", Cow::Borrowed(val))); }
if let Some(val) = p.uid { res.push(("uid", Cow::Borrowed(val.0))); }
if let Some(val) = p.time { res.push(("time", Cow::Owned(val.num_seconds().to_string()))); }
if let Some(val) = p.ban_reason { res.push(("banreason", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"banadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutBanClientMessage;
impl OutBanClientMessage {
pub fn new<'a, I: Iterator<Item=BanClientPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
if let Some(val) = p.time { res.push(("time", Cow::Owned(val.num_seconds().to_string()))); }
if let Some(val) = p.ban_reason { res.push(("banreason", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"banclient", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutBanDelMessage;
impl OutBanDelMessage {
pub fn new<'a, I: Iterator<Item=BanDelPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("banid", Cow::Owned(p.ban_id.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"bandel", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutBanDelAllMessage;
impl OutBanDelAllMessage {
pub fn new<'a, I: Iterator<Item=BanDelAllPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"bandelall", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutBanListRequestMessage;
impl OutBanListRequestMessage {
pub fn new<'a, I: Iterator<Item=BanListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"banlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutBindingListMessage;
impl OutBindingListMessage {
pub fn new<'a, I: Iterator<Item=BindingListPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.subsystem { res.push(("subsystem", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"bindinglist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelAddPermMessage;
impl OutChannelAddPermMessage {
pub fn new<'a, I: Iterator<Item=ChannelAddPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.push(("permvalue", Cow::Owned(p.permission_value.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channeladdperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelClientAddPermMessage;
impl OutChannelClientAddPermMessage {
pub fn new<'a, I: Iterator<Item=ChannelClientAddPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.push(("permvalue", Cow::Owned(p.permission_value.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelclientaddperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelClientDelPermMessage;
impl OutChannelClientDelPermMessage {
pub fn new<'a, I: Iterator<Item=ChannelClientDelPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelclientdelperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelClientPermListRequestMessage;
impl OutChannelClientPermListRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelClientPermListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelclientpermlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelCreateMessage;
impl OutChannelCreateMessage {
pub fn new<'a, I: Iterator<Item=ChannelCreatePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.parent_id { res.push(("cpid", Cow::Owned(val.0.to_string()))); }
res.push(("channel_name", Cow::Borrowed(p.name)));
if let Some(val) = p.topic { res.push(("channel_topic", Cow::Borrowed(val))); }
if let Some(val) = p.description { res.push(("channel_description", Cow::Borrowed(val))); }
if let Some(val) = p.password { res.push(("channel_password", Cow::Borrowed(val))); }
if let Some(val) = p.codec { res.push(("channel_codec", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.codec_quality { res.push(("channel_codec_quality", Cow::Owned(val.to_string()))); }
if let Some(val) = p.max_clients { res.push(("channel_maxclients", Cow::Owned(val.to_string()))); }
if let Some(val) = p.max_family_clients { res.push(("channel_maxfamilyclients", Cow::Owned(val.to_string()))); }
if let Some(val) = p.order { res.push(("channel_order", Cow::Owned(val.to_string()))); }
if let Some(val) = p.has_password { res.push(("channel_flag_password", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_unencrypted { res.push(("channel_codec_is_unencrypted", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.delete_delay { res.push(("channel_delete_delay", Cow::Owned(val.num_seconds().to_string()))); }
if let Some(val) = p.is_max_clients_unlimited { res.push(("channel_flag_maxclients_unlimited", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_max_family_clients_unlimited { res.push(("channel_flag_maxfamilyclients_unlimited", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.inherits_max_family_clients { res.push(("channel_flag_maxfamilyclients_inherited", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.phonetic_name { res.push(("channel_name_phonetic", Cow::Borrowed(val))); }
if let Some(val) = p.is_permanent { res.push(("channel_flag_permanent", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_semi_permanent { res.push(("channel_flag_semi_permanent", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_default { res.push(("channel_flag_default", Cow::Borrowed(if val { "1" } else { "0" }))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelcreate", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelDeleteMessage;
impl OutChannelDeleteMessage {
pub fn new<'a, I: Iterator<Item=ChannelDeletePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("force", Cow::Borrowed(if p.force { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channeldelete", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelDelPermMessage;
impl OutChannelDelPermMessage {
pub fn new<'a, I: Iterator<Item=ChannelDelPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channeldelperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelDescriptionRequestMessage;
impl OutChannelDescriptionRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelDescriptionRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgetdescription", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelEditMessage;
impl OutChannelEditMessage {
pub fn new<'a, I: Iterator<Item=ChannelEditPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
if let Some(val) = p.order { res.push(("channel_order", Cow::Owned(val.to_string()))); }
if let Some(val) = p.name { res.push(("channel_name", Cow::Borrowed(val))); }
if let Some(val) = p.topic { res.push(("channel_topic", Cow::Borrowed(val))); }
if let Some(val) = p.is_default { res.push(("channel_flag_default", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.has_password { res.push(("channel_flag_password", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_permanent { res.push(("channel_flag_permanent", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_semi_permanent { res.push(("channel_flag_semi_permanent", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.codec { res.push(("channel_codec", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.codec_quality { res.push(("channel_codec_quality", Cow::Owned(val.to_string()))); }
if let Some(val) = p.needed_talk_power { res.push(("channel_needed_talk_power", Cow::Owned(val.to_string()))); }
if let Some(val) = p.icon_id { res.push(("channel_icon_id", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.max_clients { res.push(("channel_maxclients", Cow::Owned(val.to_string()))); }
if let Some(val) = p.max_family_clients { res.push(("channel_maxfamilyclients", Cow::Owned(val.to_string()))); }
if let Some(val) = p.codec_latency_factor { res.push(("channel_codec_latency_factor", Cow::Owned(val.to_string()))); }
if let Some(val) = p.is_unencrypted { res.push(("channel_codec_is_unencrypted", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.delete_delay { res.push(("channel_delete_delay", Cow::Owned(val.num_seconds().to_string()))); }
if let Some(val) = p.is_max_clients_unlimited { res.push(("channel_flag_maxclients_unlimited", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_max_family_clients_unlimited { res.push(("channel_flag_maxfamilyclients_unlimited", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.inherits_max_family_clients { res.push(("channel_flag_maxfamilyclients_inherited", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.phonetic_name { res.push(("channel_name_phonetic", Cow::Borrowed(val))); }
if let Some(val) = p.parent_id { res.push(("cpid", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.description { res.push(("channel_description", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channeledit", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelFindRequestMessage;
impl OutChannelFindRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelFindRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("pattern", Cow::Borrowed(p.pattern)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelfind", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupAddMessage;
impl OutChannelGroupAddMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupAddPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("name", Cow::Borrowed(p.name)));
if let Some(val) = p.group_type { res.push(("type", Cow::Owned(val.to_u32().unwrap().to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgroupadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupAddPermMessage;
impl OutChannelGroupAddPermMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupAddPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cgid", Cow::Owned(p.channel_group.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.push(("permvalue", Cow::Owned(p.permission_value.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgroupaddperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupClientListRequestMessage;
impl OutChannelGroupClientListRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupClientListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.channel_id { res.push(("cid", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.client_db_id { res.push(("cldbid", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.channel_group { res.push(("cgid", Cow::Owned(val.0.to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgroupclientlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupCopyMessage;
impl OutChannelGroupCopyMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupCopyPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("scgid", Cow::Owned(p.source_channel_group_id.0.to_string())));
res.push(("tcgid", Cow::Owned(p.target_channel_group_id.0.to_string())));
res.push(("name", Cow::Borrowed(p.name)));
res.push(("type", Cow::Owned(p.group_type.to_u32().unwrap().to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgroupcopy", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupDelMessage;
impl OutChannelGroupDelMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupDelPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cgid", Cow::Owned(p.channel_group.0.to_string())));
res.push(("force", Cow::Borrowed(if p.force { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgroupdel", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupDelPermMessage;
impl OutChannelGroupDelPermMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupDelPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cgid", Cow::Owned(p.channel_group.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgroupdelperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupListRequestMessage;
impl OutChannelGroupListRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgrouplist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupPermListRequestMessage;
impl OutChannelGroupPermListRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupPermListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cgid", Cow::Owned(p.channel_group.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgrouppermlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelGroupRenameMessage;
impl OutChannelGroupRenameMessage {
pub fn new<'a, I: Iterator<Item=ChannelGroupRenamePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cgid", Cow::Owned(p.channel_group.0.to_string())));
res.push(("name", Cow::Borrowed(p.name)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelgrouprename", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelInfoRequestMessage;
impl OutChannelInfoRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelInfoRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelinfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelListRequestMessage;
impl OutChannelListRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channellist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelMoveMessage;
impl OutChannelMoveMessage {
pub fn new<'a, I: Iterator<Item=ChannelMovePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cpid", Cow::Owned(p.parent_id.0.to_string())));
if let Some(val) = p.order { res.push(("order", Cow::Owned(val.to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelmove", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelPermListRequestMessage;
impl OutChannelPermListRequestMessage {
pub fn new<'a, I: Iterator<Item=ChannelPermListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelpermlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelSubscribeMessage;
impl OutChannelSubscribeMessage {
pub fn new<'a, I: Iterator<Item=ChannelSubscribePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelsubscribe", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelSubscribeAllMessage;
impl OutChannelSubscribeAllMessage {
pub fn new<'a, I: Iterator<Item=ChannelSubscribeAllPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelsubscribeall", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelUnsubscribeMessage;
impl OutChannelUnsubscribeMessage {
pub fn new<'a, I: Iterator<Item=ChannelUnsubscribePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelunsubscribe", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutChannelUnsubscribeAllMessage;
impl OutChannelUnsubscribeAllMessage {
pub fn new<'a, I: Iterator<Item=ChannelUnsubscribeAllPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"channelunsubscribeall", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientAddPermMessage;
impl OutClientAddPermMessage {
pub fn new<'a, I: Iterator<Item=ClientAddPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.push(("permvalue", Cow::Owned(p.permission_value.to_string())));
res.push(("permskip", Cow::Borrowed(if p.permission_skip { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientaddperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientChatCloseMessage;
impl OutClientChatCloseMessage {
pub fn new<'a, I: Iterator<Item=ClientChatClosePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
res.push(("cluid", Cow::Borrowed(p.client_uid.0)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientchatclosed", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientConnectionInfoRequestMessage;
impl OutClientConnectionInfoRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientConnectionInfoRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"getconnectioninfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientDbDeleteMessage;
impl OutClientDbDeleteMessage {
pub fn new<'a, I: Iterator<Item=ClientDbDeletePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientdbdelete", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientDbEditMessage;
impl OutClientDbEditMessage {
pub fn new<'a, I: Iterator<Item=ClientDbEditPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientdbedit", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientDbFindRequestMessage;
impl OutClientDbFindRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientDbFindRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("pattern", Cow::Borrowed(p.pattern)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientdbfind", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientDbInfoRequestMessage;
impl OutClientDbInfoRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientDbInfoRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientdbinfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientDbListRequestMessage;
impl OutClientDbListRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientDbListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.offset { res.push(("start", Cow::Owned(val.to_string()))); }
if let Some(val) = p.limit { res.push(("duration", Cow::Owned(val.to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientdblist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientDelPermMessage;
impl OutClientDelPermMessage {
pub fn new<'a, I: Iterator<Item=ClientDelPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientdelperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientEditMessage;
impl OutClientEditMessage {
pub fn new<'a, I: Iterator<Item=ClientEditPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
if let Some(val) = p.description { res.push(("client_description", Cow::Borrowed(val))); }
if let Some(val) = p.talk_power_granted { res.push(("client_is_talker", Cow::Borrowed(if val { "1" } else { "0" }))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientedit", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientFindRequestMessage;
impl OutClientFindRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientFindRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("pattern", Cow::Borrowed(p.pattern)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientfind", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientDbIdFromUidRequestMessage;
impl OutClientDbIdFromUidRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientDbIdFromUidRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cluid", Cow::Borrowed(p.client_uid.0)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientgetdbidfromuid", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientIdsRequestMessage;
impl OutClientIdsRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientIdsRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cluid", Cow::Borrowed(p.client_uid.0)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientgetids", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientNameFromDbIdRequestMessage;
impl OutClientNameFromDbIdRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientNameFromDbIdRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientgetnamefromdbid", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientNameFromUidRequestMessage;
impl OutClientNameFromUidRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientNameFromUidRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cluid", Cow::Borrowed(p.client_uid.0)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientgetnamefromuid", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientUidFromClidRequestMessage;
impl OutClientUidFromClidRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientUidFromClidRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientgetuidfromclid", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientVariablesRequestMessage;
impl OutClientVariablesRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientVariablesRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientgetvariables", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientInfoRequestMessage;
impl OutClientInfoRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientInfoRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientinfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientKickMessage;
impl OutClientKickMessage {
pub fn new<'a, I: Iterator<Item=ClientKickPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
res.push(("reasonid", Cow::Owned(p.reason.to_u32().unwrap().to_string())));
if let Some(val) = p.reason_message { res.push(("reasonmsg", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientkick", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientListRequestMessage;
impl OutClientListRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientMoveMessage;
impl OutClientMoveMessage {
pub fn new<'a, I: Iterator<Item=ClientMovePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
if let Some(val) = p.channel_password { res.push(("cpw", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientmove", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientPermListRequestMessage;
impl OutClientPermListRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientPermListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientpermlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientPokeRequestMessage;
impl OutClientPokeRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientPokeRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clid", Cow::Owned(p.client_id.0.to_string())));
res.push(("msg", Cow::Borrowed(p.message)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientpoke", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientSetServerQueryLoginRequestMessage;
impl OutClientSetServerQueryLoginRequestMessage {
pub fn new<'a, I: Iterator<Item=ClientSetServerQueryLoginRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("client_login_name", Cow::Borrowed(p.login_name)));
if let Some(val) = p.login_password { res.push(("client_login_password", Cow::Borrowed(val))); }
if let Some(val) = p.client_db_id { res.push(("cldbid", Cow::Owned(val.0.to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientsetserverquerylogin", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutClientUpdateMessage;
impl OutClientUpdateMessage {
pub fn new<'a, I: Iterator<Item=ClientUpdatePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.name { res.push(("client_nickname", Cow::Borrowed(val))); }
if let Some(val) = p.input_muted { res.push(("client_input_muted", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.output_muted { res.push(("client_output_muted", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_away { res.push(("client_away", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.away_message { res.push(("client_away_message", Cow::Borrowed(val))); }
if let Some(val) = p.input_hardware_enabled { res.push(("client_input_hardware", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.output_hardware_enabled { res.push(("client_output_hardware", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.is_channel_commander { res.push(("client_is_channel_commander", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.avatar_hash { res.push(("client_flag_avatar", Cow::Borrowed(val))); }
if let Some(val) = p.phonetic_name { res.push(("client_nickname_phonetic", Cow::Borrowed(val))); }
if let Some(val) = p.talk_power_request_time { res.push(("client_talk_request", Cow::Owned(val.timestamp().to_string()))); }
if let Some(val) = p.talk_power_request_message { res.push(("client_talk_request_msg", Cow::Borrowed(val))); }
if let Some(val) = p.is_recording { res.push(("client_is_recording", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.badges { res.push(("client_badges", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientupdate", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutComplainAddMessage;
impl OutComplainAddMessage {
pub fn new<'a, I: Iterator<Item=ComplainAddPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("tcldbid", Cow::Owned(p.target_client_db_id.0.to_string())));
res.push(("message", Cow::Borrowed(p.message)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"complainadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutComplainDelMessage;
impl OutComplainDelMessage {
pub fn new<'a, I: Iterator<Item=ComplainDelPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("tcldbid", Cow::Owned(p.target_client_db_id.0.to_string())));
res.push(("fcldbid", Cow::Owned(p.from_client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"complaindel", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutComplainDelAllMessage;
impl OutComplainDelAllMessage {
pub fn new<'a, I: Iterator<Item=ComplainDelAllPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("tcldbid", Cow::Owned(p.target_client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"complaindelall", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutComplainListRequestMessage;
impl OutComplainListRequestMessage {
pub fn new<'a, I: Iterator<Item=ComplainListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.target_client_db_id { res.push(("tcldbid", Cow::Owned(val.0.to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"complainlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutCustomDeleteMessage;
impl OutCustomDeleteMessage {
pub fn new<'a, I: Iterator<Item=CustomDeletePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.push(("ident", Cow::Borrowed(p.external_identity)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"customdelete", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutCustomInfoRequestMessage;
impl OutCustomInfoRequestMessage {
pub fn new<'a, I: Iterator<Item=CustomInfoRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"custominfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutCustomSearchMessage;
impl OutCustomSearchMessage {
pub fn new<'a, I: Iterator<Item=CustomSearchPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("ident", Cow::Borrowed(p.external_identity)));
res.push(("pattern", Cow::Borrowed(p.pattern)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"customsearch", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutCustomSetMessage;
impl OutCustomSetMessage {
pub fn new<'a, I: Iterator<Item=CustomSetPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.push(("ident", Cow::Borrowed(p.external_identity)));
res.push(("value", Cow::Borrowed(p.value)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"customset", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtCreateDirMessage;
impl OutFtCreateDirMessage {
pub fn new<'a, I: Iterator<Item=FtCreateDirPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cpw", Cow::Borrowed(p.channel_password)));
res.push(("dirname", Cow::Borrowed(p.directory_name)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftcreatedir", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtDeleteFileMessage;
impl OutFtDeleteFileMessage {
pub fn new<'a, I: Iterator<Item=FtDeleteFilePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cpw", Cow::Borrowed(p.channel_password)));
res.push(("name", Cow::Borrowed(p.name)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftdeletefile", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtFileInfoRequestMessage;
impl OutFtFileInfoRequestMessage {
pub fn new<'a, I: Iterator<Item=FtFileInfoRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cpw", Cow::Borrowed(p.channel_password)));
res.push(("name", Cow::Borrowed(p.name)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftgetfileinfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtFileListRequestMessage;
impl OutFtFileListRequestMessage {
pub fn new<'a, I: Iterator<Item=FtFileListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cpw", Cow::Borrowed(p.channel_password)));
res.push(("path", Cow::Borrowed(p.path)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftgetfilelist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtInitDownloadMessage;
impl OutFtInitDownloadMessage {
pub fn new<'a, I: Iterator<Item=FtInitDownloadPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clientftfid", Cow::Owned(p.client_file_transfer_id.to_string())));
res.push(("name", Cow::Borrowed(p.name)));
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cpw", Cow::Borrowed(p.channel_password)));
res.push(("seekpos", Cow::Owned(p.seek_posistion.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftinitdownload", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtInitUploadMessage;
impl OutFtInitUploadMessage {
pub fn new<'a, I: Iterator<Item=FtInitUploadPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("clientftfid", Cow::Owned(p.client_file_transfer_id.to_string())));
res.push(("name", Cow::Borrowed(p.name)));
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cpw", Cow::Borrowed(p.channel_password)));
res.push(("size", Cow::Owned(p.size.to_string())));
res.push(("overwrite", Cow::Borrowed(if p.overwrite { "1" } else { "0" })));
res.push(("resume", Cow::Borrowed(if p.resume { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftinitupload", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtListMessage;
impl OutFtListMessage {
pub fn new<'a, I: Iterator<Item=FtListPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtRenameFileMessage;
impl OutFtRenameFileMessage {
pub fn new<'a, I: Iterator<Item=FtRenameFilePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cpw", Cow::Borrowed(p.channel_password)));
if let Some(val) = p.target_channel_id { res.push(("tcid", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.target_channel_password { res.push(("tcpw", Cow::Borrowed(val))); }
res.push(("oldname", Cow::Borrowed(p.old_name)));
res.push(("newname", Cow::Borrowed(p.new_name)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftrenamefile", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutFtStopMessage;
impl OutFtStopMessage {
pub fn new<'a, I: Iterator<Item=FtStopPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("serverftfid", Cow::Owned(p.server_file_transfer_id.to_string())));
res.push(("delete", Cow::Borrowed(if p.delete { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"ftstop", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutGlobalMessageMessage;
impl OutGlobalMessageMessage {
pub fn new<'a, I: Iterator<Item=GlobalMessagePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("msg", Cow::Borrowed(p.message)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"gm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutHostInfoRequestMessage;
impl OutHostInfoRequestMessage {
pub fn new<'a, I: Iterator<Item=HostInfoRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"hostinfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutInstanceEditMessage;
impl OutInstanceEditMessage {
pub fn new<'a, I: Iterator<Item=InstanceEditPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"instanceedit", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutInstanceInfoMessage;
impl OutInstanceInfoMessage {
pub fn new<'a, I: Iterator<Item=InstanceInfoPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"instanceinfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutLogAddMessage;
impl OutLogAddMessage {
pub fn new<'a, I: Iterator<Item=LogAddPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("loglevel", Cow::Owned(p.log_level.to_u32().unwrap().to_string())));
res.push(("logmsg", Cow::Borrowed(p.log_message)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"logadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutLoginMessage;
impl OutLoginMessage {
pub fn new<'a, I: Iterator<Item=LoginPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("client_login_name", Cow::Borrowed(p.login_name)));
res.push(("client_login_password", Cow::Borrowed(p.login_password)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"login", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutLogoutMessage;
impl OutLogoutMessage {
pub fn new<'a, I: Iterator<Item=LogoutPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"logout", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutLogViewMessage;
impl OutLogViewMessage {
pub fn new<'a, I: Iterator<Item=LogViewPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.lines { res.push(("lines", Cow::Owned(val.to_string()))); }
if let Some(val) = p.reverse { res.push(("reverse", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.instance_log { res.push(("instance", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.offset { res.push(("begin_pos", Cow::Owned(val.to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"logview", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutOfflineMessageAddMessage;
impl OutOfflineMessageAddMessage {
pub fn new<'a, I: Iterator<Item=OfflineMessageAddPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cluid", Cow::Borrowed(p.client_uid.0)));
res.push(("subject", Cow::Borrowed(p.subject)));
res.push(("message", Cow::Borrowed(p.message)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"messageadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutOfflineMessageDelMessage;
impl OutOfflineMessageDelMessage {
pub fn new<'a, I: Iterator<Item=OfflineMessageDelPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("msgid", Cow::Owned(p.message_id.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"messagedel", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutOfflineMessageGetMessage;
impl OutOfflineMessageGetMessage {
pub fn new<'a, I: Iterator<Item=OfflineMessageGetPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("msgid", Cow::Owned(p.message_id.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"messageget", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutOfflineMessageListRequestMessage;
impl OutOfflineMessageListRequestMessage {
pub fn new<'a, I: Iterator<Item=OfflineMessageListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"messagelist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutOfflineMessageUpdateFlagMessage;
impl OutOfflineMessageUpdateFlagMessage {
pub fn new<'a, I: Iterator<Item=OfflineMessageUpdateFlagPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("msgid", Cow::Owned(p.message_id.to_string())));
res.push(("flag", Cow::Borrowed(if p.is_read { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"messageupdateflag", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPermFindRequestMessage;
impl OutPermFindRequestMessage {
pub fn new<'a, I: Iterator<Item=PermFindRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"permfind", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPermRequestMessage;
impl OutPermRequestMessage {
pub fn new<'a, I: Iterator<Item=PermRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("permid", Cow::Owned(p.permission_id.to_u32().unwrap().to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"permget", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPermIdByNameRequestMessage;
impl OutPermIdByNameRequestMessage {
pub fn new<'a, I: Iterator<Item=PermIdByNameRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("permsid", Cow::Borrowed(p.permission_name_id)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"permidgetbyname", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPermListRequestMessage;
impl OutPermListRequestMessage {
pub fn new<'a, I: Iterator<Item=PermListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"permissionlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPermOverviewRequestMessage;
impl OutPermOverviewRequestMessage {
pub fn new<'a, I: Iterator<Item=PermOverviewRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"permoverview", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPermResetMessage;
impl OutPermResetMessage {
pub fn new<'a, I: Iterator<Item=PermResetPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"permreset", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPrivilegeKeyAddRequestMessage;
impl OutPrivilegeKeyAddRequestMessage {
pub fn new<'a, I: Iterator<Item=PrivilegeKeyAddRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("tokentype", Cow::Owned(p.token_type.to_u32().unwrap().to_string())));
res.push(("tokenid1", Cow::Owned(p.token_id1.to_string())));
res.push(("tokenid2", Cow::Owned(p.token_id2.0.to_string())));
if let Some(val) = p.token_description { res.push(("tokendescription", Cow::Borrowed(val))); }
if let Some(val) = p.token_custom_set { res.push(("tokencustomset", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"privilegekeyadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPrivilegeKeyDeleteMessage;
impl OutPrivilegeKeyDeleteMessage {
pub fn new<'a, I: Iterator<Item=PrivilegeKeyDeletePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("token", Cow::Borrowed(p.token)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"privilegekeydelete", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPrivilegeKeyListRequestMessage;
impl OutPrivilegeKeyListRequestMessage {
pub fn new<'a, I: Iterator<Item=PrivilegeKeyListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"privilegekeylist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutPrivilegeKeyUseMessage;
impl OutPrivilegeKeyUseMessage {
pub fn new<'a, I: Iterator<Item=PrivilegeKeyUsePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("token", Cow::Borrowed(p.token)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"privilegekeyuse", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutQuitMessage;
impl OutQuitMessage {
pub fn new<'a, I: Iterator<Item=QuitPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"quit", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutSendTextMessageMessage;
impl OutSendTextMessageMessage {
pub fn new<'a, I: Iterator<Item=SendTextMessagePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("targetmode", Cow::Owned(p.target.to_u32().unwrap().to_string())));
if let Some(val) = p.target_client_id { res.push(("target", Cow::Owned(val.0.to_string()))); }
res.push(("msg", Cow::Borrowed(p.message)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"sendtextmessage", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerCreateMessage;
impl OutServerCreateMessage {
pub fn new<'a, I: Iterator<Item=ServerCreatePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("virtualserver_name", Cow::Borrowed(p.name)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servercreate", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerDeleteMessage;
impl OutServerDeleteMessage {
pub fn new<'a, I: Iterator<Item=ServerDeletePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sid", Cow::Owned(p.server_id.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serverdelete", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerEditMessage;
impl OutServerEditMessage {
pub fn new<'a, I: Iterator<Item=ServerEditPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sid", Cow::Owned(p.server_id.to_string())));
if let Some(val) = p.name { res.push(("virtualserver_name", Cow::Borrowed(val))); }
if let Some(val) = p.welcome_message { res.push(("virtualserver_welcomemessage", Cow::Borrowed(val))); }
if let Some(val) = p.max_clients { res.push(("virtualserver_maxclients", Cow::Owned(val.to_string()))); }
if let Some(val) = p.server_password { res.push(("virtualserver_password", Cow::Borrowed(val))); }
if let Some(val) = p.hostmessage { res.push(("virtualserver_hostmessage", Cow::Borrowed(val))); }
if let Some(val) = p.hostmessage_mode { res.push(("virtualserver_hostmessage_mode", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.hostbanner_url { res.push(("virtualserver_hostbanner_url", Cow::Borrowed(val))); }
if let Some(val) = p.hostbanner_gfx_url { res.push(("virtualserver_hostbanner_gfx_url", Cow::Borrowed(val))); }
if let Some(val) = p.hostbanner_gfx_interval { res.push(("virtualserver_hostbanner_gfx_interval", Cow::Owned(val.num_seconds().to_string()))); }
if let Some(val) = p.hostbutton_tooltip { res.push(("virtualserver_hostbutton_tooltip", Cow::Borrowed(val))); }
if let Some(val) = p.hostbutton_url { res.push(("virtualserver_hostbutton_url", Cow::Borrowed(val))); }
if let Some(val) = p.hostbutton_gfx_url { res.push(("virtualserver_hostbutton_gfx_url", Cow::Borrowed(val))); }
if let Some(val) = p.icon_id { res.push(("virtualserver_icon_id", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.reserved_slots { res.push(("virtualserver_reserved_slots", Cow::Owned(val.to_string()))); }
if let Some(val) = p.hostbanner_mode { res.push(("virtualserver_hostbanner_mode", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.nickname { res.push(("virtualserver_nickname", Cow::Borrowed(val))); }
if let Some(val) = p.max_download_total_bandwidth { res.push(("virtualserver_max_download_total_bandwidth", Cow::Owned(val.to_string()))); }
if let Some(val) = p.max_upload_total_bandwidth { res.push(("virtualserver_max_upload_total_bandwidth", Cow::Owned(val.to_string()))); }
if let Some(val) = p.download_quota { res.push(("virtualserver_download_quota", Cow::Owned(val.to_string()))); }
if let Some(val) = p.upload_quota { res.push(("virtualserver_upload_quota", Cow::Owned(val.to_string()))); }
if let Some(val) = p.antiflood_points_tick_reduce { res.push(("virtualserver_antiflood_points_tick_reduce", Cow::Owned(val.to_string()))); }
if let Some(val) = p.antiflood_points_to_command_block { res.push(("virtualserver_antiflood_points_needed_command_block", Cow::Owned(val.to_string()))); }
if let Some(val) = p.antiflood_points_to_ip_block { res.push(("virtualserver_antiflood_points_needed_ip_block", Cow::Owned(val.to_string()))); }
if let Some(val) = p.codec_encryption_mode { res.push(("virtualserver_codec_encryption_mode", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.identity_security_level { res.push(("virtualserver_needed_identity_security_level", Cow::Owned(val.to_string()))); }
if let Some(val) = p.default_server_group { res.push(("virtualserver_default_server_group", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.default_channel_group { res.push(("virtualserver_default_channel_group", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.default_channel_admin_group { res.push(("virtualserver_default_channel_admin_group", Cow::Owned(val.0.to_string()))); }
if let Some(val) = p.complain_autoban_count { res.push(("virtualserver_complain_autoban_count", Cow::Owned(val.to_string()))); }
if let Some(val) = p.complain_autoban_time { res.push(("virtualserver_complain_autoban_time", Cow::Owned(val.num_seconds().to_string()))); }
if let Some(val) = p.complain_remove_time { res.push(("virtualserver_complain_remove_time", Cow::Owned(val.num_seconds().to_string()))); }
if let Some(val) = p.min_clients_in_channel_before_forced_silence { res.push(("virtualserver_min_clients_in_channel_before_forced_silence", Cow::Owned(val.to_string()))); }
if let Some(val) = p.priority_speaker_dimm_modificator { res.push(("virtualserver_priority_speaker_dimm_modificator", Cow::Owned(val.to_string()))); }
if let Some(val) = p.phonetic_name { res.push(("virtualserver_name_phonetic", Cow::Borrowed(val))); }
if let Some(val) = p.temp_channel_default_delete_delay { res.push(("virtualserver_channel_temp_delete_delay_default", Cow::Owned(val.num_seconds().to_string()))); }
if let Some(val) = p.weblist_enabled { res.push(("virtualserver_weblist_enabled", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.log_client { res.push(("virtualserver_log_client", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.log_query { res.push(("virtualserver_log_query", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.log_channel { res.push(("virtualserver_log_channel", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.log_permissions { res.push(("virtualserver_log_permissions", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.log_server { res.push(("virtualserver_log_server", Cow::Borrowed(if val { "1" } else { "0" }))); }
if let Some(val) = p.log_file_transfer { res.push(("virtualserver_log_filetransfer", Cow::Borrowed(if val { "1" } else { "0" }))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serveredit", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerVariablesRequestMessage;
impl OutServerVariablesRequestMessage {
pub fn new<'a, I: Iterator<Item=ServerVariablesRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergetvariables", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupAddMessage;
impl OutServerGroupAddMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupAddPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("name", Cow::Borrowed(p.name)));
if let Some(val) = p.group_type { res.push(("type", Cow::Owned(val.to_u32().unwrap().to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupAddClientMessage;
impl OutServerGroupAddClientMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupAddClientPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgid", Cow::Owned(p.server_group_id.0.to_string())));
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupaddclient", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupAddPermMessage;
impl OutServerGroupAddPermMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupAddPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgid", Cow::Owned(p.server_group_id.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.push(("permvalue", Cow::Owned(p.permission_value.to_string())));
res.push(("permnegated", Cow::Borrowed(if p.permission_negated { "1" } else { "0" })));
res.push(("permskip", Cow::Borrowed(if p.permission_skip { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupaddperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupAutoAddPermMessage;
impl OutServerGroupAutoAddPermMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupAutoAddPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgtype", Cow::Owned(p.server_group_type.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.push(("permvalue", Cow::Owned(p.permission_value.to_string())));
res.push(("permnegated", Cow::Borrowed(if p.permission_negated { "1" } else { "0" })));
res.push(("permskip", Cow::Borrowed(if p.permission_skip { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupautoaddperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupAutoDelPermMessage;
impl OutServerGroupAutoDelPermMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupAutoDelPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgtype", Cow::Owned(p.server_group_type.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupautodelperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupClientListRequestMessage;
impl OutServerGroupClientListRequestMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupClientListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgid", Cow::Owned(p.server_group_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupclientlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupCopyMessage;
impl OutServerGroupCopyMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupCopyPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("ssgid", Cow::Owned(p.source_server_group_id.0.to_string())));
res.push(("tsgid", Cow::Owned(p.target_server_group_id.0.to_string())));
res.push(("name", Cow::Borrowed(p.name)));
res.push(("type", Cow::Owned(p.group_type.to_u32().unwrap().to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupcopy", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupDelMessage;
impl OutServerGroupDelMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupDelPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgid", Cow::Owned(p.server_group_id.0.to_string())));
res.push(("force", Cow::Borrowed(if p.force { "1" } else { "0" })));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupdel", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupDelClientMessage;
impl OutServerGroupDelClientMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupDelClientPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgid", Cow::Owned(p.server_group_id.0.to_string())));
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupdelclient", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupDelPermMessage;
impl OutServerGroupDelPermMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupDelPermPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgid", Cow::Owned(p.server_group_id.0.to_string())));
if let Some(val) = p.permission_id { res.push(("permid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.permission_name_id { res.push(("permsid", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupdelperm", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupListRequestMessage;
impl OutServerGroupListRequestMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergrouplist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupPermListRequestMessage;
impl OutServerGroupPermListRequestMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupPermListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgid", Cow::Owned(p.server_group_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergrouppermlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupRenameMessage;
impl OutServerGroupRenameMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupRenamePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sgid", Cow::Owned(p.server_group_id.0.to_string())));
res.push(("name", Cow::Borrowed(p.name)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergrouprename", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerGroupsByClientIdRequestMessage;
impl OutServerGroupsByClientIdRequestMessage {
pub fn new<'a, I: Iterator<Item=ServerGroupsByClientIdRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servergroupsbyclientid", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerIdGetByPortMessage;
impl OutServerIdGetByPortMessage {
pub fn new<'a, I: Iterator<Item=ServerIdGetByPortPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("virtualserver_port", Cow::Owned(p.virtual_server_port.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serveridgetbyport", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerInfoMessage;
impl OutServerInfoMessage {
pub fn new<'a, I: Iterator<Item=ServerInfoPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serverinfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerListMessage;
impl OutServerListMessage {
pub fn new<'a, I: Iterator<Item=ServerListPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serverlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerNotifyRegisterMessage;
impl OutServerNotifyRegisterMessage {
pub fn new<'a, I: Iterator<Item=ServerNotifyRegisterPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("event", Cow::Borrowed(p.event_type)));
if let Some(val) = p.id { res.push(("id", Cow::Owned(val.0.to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servernotifyregister", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerNotifyUnregisterMessage;
impl OutServerNotifyUnregisterMessage {
pub fn new<'a, I: Iterator<Item=ServerNotifyUnregisterPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servernotifyunregister", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerProcessStopMessage;
impl OutServerProcessStopMessage {
pub fn new<'a, I: Iterator<Item=ServerProcessStopPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.reason_message { res.push(("reasonmsg", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serverprocessstop", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerConnectionInfoRequestMessage;
impl OutServerConnectionInfoRequestMessage {
pub fn new<'a, I: Iterator<Item=ServerConnectionInfoRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serverrequestconnectioninfo", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerSnapshotCreateMessage;
impl OutServerSnapshotCreateMessage {
pub fn new<'a, I: Iterator<Item=ServerSnapshotCreatePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serversnapshotcreate", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerSnapshotDeployMessage;
impl OutServerSnapshotDeployMessage {
pub fn new<'a, I: Iterator<Item=ServerSnapshotDeployPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serversnapshotdeploy", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerStartMessage;
impl OutServerStartMessage {
pub fn new<'a, I: Iterator<Item=ServerStartPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sid", Cow::Owned(p.server_id.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serverstart", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerStopMessage;
impl OutServerStopMessage {
pub fn new<'a, I: Iterator<Item=ServerStopPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("sid", Cow::Owned(p.server_id.to_string())));
if let Some(val) = p.reason_message { res.push(("reasonmsg", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"serverstop", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerTempPasswordAddMessage;
impl OutServerTempPasswordAddMessage {
pub fn new<'a, I: Iterator<Item=ServerTempPasswordAddPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("pw", Cow::Borrowed(p.password)));
res.push(("desc", Cow::Borrowed(p.description)));
res.push(("duration", Cow::Owned(p.duration.num_seconds().to_string())));
res.push(("tcid", Cow::Owned(p.target_channel_id.0.to_string())));
res.push(("tcpw", Cow::Borrowed(p.target_channel_password)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servertemppasswordadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerTempPasswordDelMessage;
impl OutServerTempPasswordDelMessage {
pub fn new<'a, I: Iterator<Item=ServerTempPasswordDelPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("pw", Cow::Borrowed(p.password)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servertemppassworddel", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutServerTempPasswordListRequestMessage;
impl OutServerTempPasswordListRequestMessage {
pub fn new<'a, I: Iterator<Item=ServerTempPasswordListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"servertemppasswordlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutSetClientChannelGroupMessage;
impl OutSetClientChannelGroupMessage {
pub fn new<'a, I: Iterator<Item=SetClientChannelGroupPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("cgid", Cow::Owned(p.channel_group.0.to_string())));
res.push(("cid", Cow::Owned(p.channel_id.0.to_string())));
res.push(("cldbid", Cow::Owned(p.client_db_id.0.to_string())));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"setclientchannelgroup", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutTokenAddRequestMessage;
impl OutTokenAddRequestMessage {
pub fn new<'a, I: Iterator<Item=TokenAddRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("tokentype", Cow::Owned(p.token_type.to_u32().unwrap().to_string())));
res.push(("tokenid1", Cow::Owned(p.token_id1.to_string())));
res.push(("tokenid2", Cow::Owned(p.token_id2.0.to_string())));
if let Some(val) = p.token_description { res.push(("tokendescription", Cow::Borrowed(val))); }
if let Some(val) = p.token_custom_set { res.push(("tokencustomset", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"tokenadd", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutTokenDeleteMessage;
impl OutTokenDeleteMessage {
pub fn new<'a, I: Iterator<Item=TokenDeletePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("token", Cow::Borrowed(p.token)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"tokendelete", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutTokenListRequestMessage;
impl OutTokenListRequestMessage {
pub fn new<'a, I: Iterator<Item=TokenListRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"tokenlist", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutTokenUseMessage;
impl OutTokenUseMessage {
pub fn new<'a, I: Iterator<Item=TokenUsePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
res.push(("token", Cow::Borrowed(p.token)));
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"tokenuse", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutUseMessage;
impl OutUseMessage {
pub fn new<'a, I: Iterator<Item=UsePart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.server_id { res.push(("sid", Cow::Owned(val.to_string()))); }
if let Some(val) = p.port { res.push(("port", Cow::Owned(val.to_string()))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"use", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutVersionRequestMessage;
impl OutVersionRequestMessage {
pub fn new<'a, I: Iterator<Item=VersionRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"version", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutWhoAmIRequestMessage;
impl OutWhoAmIRequestMessage {
pub fn new<'a, I: Iterator<Item=WhoAmIRequestPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|_| { std::iter::empty() });
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"whoami", static_args, list_args, packet.data_mut());
packet
}
}
pub struct OutDisconnectMessage;
impl OutDisconnectMessage {
pub fn new<'a, I: Iterator<Item=DisconnectPart<'a>>>(list: I) -> OutPacket {
let mut packet = OutPacket::new_with_dir(Direction::C2S,
Flags::empty(), PacketType::Command);
let static_args = std::iter::empty();
let list_args = list.map(|p| {
let mut res = Vec::new();
if let Some(val) = p.reason { res.push(("reasonid", Cow::Owned(val.to_u32().unwrap().to_string()))); }
if let Some(val) = p.reason_message { res.push(("reasonmsg", Cow::Borrowed(val))); }
res.into_iter()
});
OutCommand::new_into::<&'static str, Cow<str>, &'static str, Cow<str>, _, _, _>(
"clientdisconnect", static_args, list_args, packet.data_mut());
packet
}
}