1 ####################################################################
2 # Perl interface to CommuniGate Pro CLI.
6 # Original location: <http://www.communigate.com/CGPerl/>
7 # Revision history: <http://www.communigate.com/CGPerl/History.html>
9 # See <http://www.communigate.com/CommuniGatePro/CLI.html> for the related info.
11 # Mail your comments and error reports to <support@stalker.com>
13 ############################## Commands:
20 # setStringsTranslateMode
25 ############################## Accounts commands
32 # GetAccountEffectiveSettings
33 # UpdateAccountSettings
36 # VerifyAccountPassword
39 # [Get|Set]AccountTelnums
40 # [Get|Set]AccountRules
41 # [Get|Set]Account[Mail|Signal]Rules
42 # UpdateAccount[Mail|Signal]Rule
43 # [Get|Set]Account[RPOPs|SIPs];
48 # [Get|Set|Update]AccountPrefs
49 # GetAccountEffectivePrefs
54 ############################## Group Commands
62 ############################## Forwarder Commands
70 ############################## Named Tasks
71 # List[Domain|Account]NamedTasks
72 # [Create|Rename|Delete]NamedTask
73 # [Get|Update]NamedTask
76 ############################## Domain commands
79 # [Get|Update|Set]DomainSettings
80 # GetDomainEffectiveSettings
81 # [Create|Rename|Delete]Domain
82 # [Suspend|Resume]Domain
84 # CreateDirectoryDomain
85 # [Get|Set]DomainRules
86 # [Get|Set]DomainAliases
88 # [Insert|Delete]DirectoryRecords
89 # [Get|Set][Server|Cluster]TrustedCerts
91 # [Get|Set]DirectoryIntegration
92 # [Get|Set]ClusterDirectoryIntegration
95 # [Get|Update|Set]DomainDefaults
96 # [Get|Update|Set]ClusterDomainDefaults
97 # [Get|Update|Set]AllAccountsDefaults *
98 # [Get|Update|Set]ServerAccountsDefaults
101 # [Get|Update|Set]AccountDefaults
102 # [Get|Update|Set]ClusterAccountDefaults
103 # [Get|Set|Update]AccountDefaultPrefs
104 # [Get|Set|Update][Server|Cluster]AccountPrefs
105 # [Get|Update|Set]AccountTemplate
107 ############################## Mailbox Administration
109 # [Create|Rename|Delete]Mailbox
110 # [Rename|Delete]Mailboxes
112 # [Get|Set]MailboxACL
116 # [Get|Set]AccountSubscription *
117 # [Get|Set]MailboxSubscription
118 # [Get|Set]MailboxAliases
120 ############################## Alerts Administration
121 # Get[Domain|Account|Server|Cluster]Alerts
122 # Set[Domain|Account|Server|Cluster]Alerts
123 # Post[Domain|Account|Server|Cluster]Alert
124 # Remove[Domain|Account|Server|Cluster]Alert
126 ############################## Personal Web Site Administration
134 # [Read|Write|Rename|Delete]StorageFile
137 # [Read|Update]StorageFileAttr
138 # [Get|Set]FileSubscription
140 ############################## Lists commands
144 # [Create|Rename|Delete|Get|Update]List
151 ############################## Web Skins Administration
152 # ListDomainSkins( [domainName] )
153 # CreateDomainSkin(domainName,skinName)
154 # RenameDomainSkin(domainName,oldSkinName,newSkinName)
155 # DeleteDomainSkin(domainName,skinName)
156 # ListDomainSkinFiles(domainName,skinName)
157 # ReadDomainSkinFile(domainName,skinName,fileName)
158 # StoreDomainSkinFile(domainName,skinName,fileName,base64data)
159 # DeleteDomainSkinFile(domainName,skinName,fileName)
162 # CreateServerSkin(skinName)
163 # RenameServerSkin(oldSkinName,newSkinName)
164 # DeleteServerSkin(skinName)
165 # ListServerSkinFiles(skinName)
166 # ReadServerSkinFile(skinName,fileName)
167 # StoreServerSkinFile(skinName,fileName,base64data)
168 # DeleteServerSkinFile(skinName,fileName)
171 # CreateClusterSkin(skinName)
172 # RenameClusterSkin(oldSkinName,newSkinName)
173 # DeleteClusterSkin(skinName)
174 # ListClusterSkinFiles(skinName)
175 # ReadClusterSkinFile(skinName,fileName)
176 # StoreClusterSkinFile(skinName,fileName,base64data)
177 # DeleteClusterSkinFile(skinName,fileName)
179 ############################## Web Interface Tuning
180 # [List|Get|Put|Delete]WebUserInterface
183 ############################## Web Interface Integration
184 # [Create|Get|Kill|Find]WebUserSession
189 ############################## Real-Time Application Administration
190 # Create[Domain|Server|Cluster]PBX
191 # List[Domain|Server|Cluster]PBXFiles
192 # [Read|Store|Delete][Domain|Server|Cluster]PBXFile
194 ############################## Real-Time Application Control
200 ############################## Account Services
201 # RemoveAccountSubset
205 ############################## Server commands
206 # [Get|Update|Set]Module
207 # [Get|Set][Queue|Signal|Session|Cluster|MediaServer]Settings
209 # [Get|Set]BlacklistedIPs
211 # [Get|Set]WhiteHoleIPs
212 # [Get|Set]Protection
216 # [Get|Set]ClusterLANIPs
217 # [Get|Set]ClusterBlacklistedIPs
218 # [Get|Set]ClusterClientIPs
219 # [Get|Set]ClusterWhiteHoleIPs
220 # [Get|Set]ClusterProtection
221 # [Get|Set]ClusterNetwork
224 # [Get|Set][Server|Cluster]Rules
225 # [Get|Set][Server|Cluster][Mail|Signal]Rules
226 ## Update[Server|Cluster][Mail|Signal]Rule
229 # [Get|Set]RouterTable
230 # [Get|Set]RouterSettings
231 # [Get|Set]ClusterRouterTable
232 # [Get|Set][Server|Cluster]Intercept
236 ############################## Monitoring commands
237 # GetSNMPElement-GetStateElement
241 ############################## Statistics commands
242 # [Get|Reset]AccountStat
243 # [Get|Reset]DomainStat
245 ############################## Miscellaneous commands
249 # GetMessageQueueInfo
250 # GetCurrentController
252 # [Get|Set]TempBlacklistedIPs
253 # List[Domain|Server|Cluster]Telnums
255 ##############################################################
262 # You may need to change this to "use IO::Socket::INET;" if you have INET.pm
265 # You may need to install this module.
266 # See <http://search.cpan.org/search?module=Digest::MD5>
269 use vars qw($VERSION);
273 $CGP::SECURE_LOGIN = 1;
274 $CGP::WEBUSER_LOGIN = 0;
275 $CGP::TIMEOUT = 60*5-5; # 5 minutes timeout
277 $CGP::ERR_STRING = "No error";
279 $CGP::CLI_CODE_OK = 200;
280 $CGP::CLI_CODE_OK_INLINE = 201;
282 $CGP::CLI_CODE_PASSWORD = 300;
283 $CGP::CLI_CODE_UNKNOW_USER = 500;
284 $CGP::CLI_CODE_GEN_ERR = 501;
285 $CGP::CLI_CODE_STRANGE = 10000;
292 $this->{isConnected}=0;
294 delete $this->{theSocket} if(exists($this->{theSocket}));
296 $this->{theSocket} = new IO::Socket::INET( %{$this->{connParams}} );
298 unless(defined $this->{theSocket} && $this->{theSocket}) {
299 $CGP::ERR_STRING="Can't open connection to CGPro Server";
302 $this->{theSocket}->autoflush(1);
304 unless($this->_parseResponse()) {
305 $CGP::ERR_STRING="Can't read CGPro Server prompt";
309 if($this->{isSecureLogin} && $this->{errMsg} =~ /(\<.*\@.*\>)/) {
310 my $md5=Digest::MD5->new;
312 $md5->add($1.$this->{password});
313 $this->send('APOP '.$this->{login}.' '.$md5->hexdigest);
314 $this->_parseResponse();
316 $CGP::ERR_STRING="Can't create MD5 object";
317 close($this->{theSocket});
320 } elsif($this->{isWebUserLogin}) {
321 $this->send('AUTH WEBUSER '.$this->{login}.' '.$this->{password});
322 $this->_parseResponse();
325 $this->send('USER '.$this->{login});
326 $this->_parseResponse();
327 unless( $this->{errCode} == $CGP::CLI_CODE_PASSWORD) {
328 $CGP::ERR_STRING="Unexpected answer: ".$this->{errCode};
329 close($this->{theSocket});
332 $this->send('PASS '.$this->{password});
333 $this->_parseResponse();
336 unless($this->isSuccess) {
337 $CGP::ERR_STRING=$this->{errMsg};
338 close($this->{theSocket});
341 $this->send('INLINE');
342 $this->_parseResponse();
343 $this->setStringsTranslateMode(0);
344 $this->{isConnected}=1;
350 my ($class, $params) = @_;
353 $this->{login} = delete $params->{'login'};
354 $this->{password} = delete $params->{'password'};
356 $this->{isSecureLogin} = delete $params->{'SecureLogin'};
357 $this->{isWebUserLogin} = delete $params->{'WebUserLogin'};
360 $this->{isSecureLogin} = $CGP::SECURE_LOGIN unless defined $this->{isSecureLogin};
361 $this->{isWebUserLogin} = $CGP::WEBUSER_LOGIN unless defined $this->{isWebUserLogin};
364 croak 'You must pass login parameter to CGP::CLI::new'
365 unless defined $this->{login};
366 croak 'You must pass password parameter to CGP::CLI::new'
367 unless defined $this->{password};
369 croak 'SecureLogin and WebUserLogin are mutually exclusive'
370 if($this->{isSecureLogin} && $this->{isWebUserLogin});
374 $this->{connParams}=$params;
376 if(!(defined $params->{'connectNow'}) || $params->{'connectNow'}) {
377 unless($this->connect()) {
386 $this->Logout() if($this->{isConnected});
391 return $this->{errCode};
396 return $this->{errMsg};
401 return $this->{'currentCGateCommand'};
406 return ($this->{errCode} == $CGP::CLI_CODE_OK || $this->{errCode} == $CGP::CLI_CODE_OK_INLINE);
410 my ($this, $debugFlag) = @_;
411 $this->{'debug'} = $debugFlag;
414 sub setStringsTranslateMode {
415 my ($this, $onFlag) = @_;
416 $this->{'translateStrings'} = $onFlag;
422 $this->_parseResponse();
423 $this->{isConnected}=0;
427 my ($this, $newPassword) = @_;
428 croak 'usage CGP::CLI->NewPassword($newPassword)'
429 unless defined $newPassword;
430 $this->send('NEWPASS '.$newPassword);
431 $this->_parseResponse();
435 my ($this, $command) = @_;
436 croak 'usage CGP::CLI->SendCommand($commandString)'
437 unless defined $command;
438 $this->send($command);
439 $this->_parseResponse();
442 sub GetResponseData {
444 $this->parseWords($this->getWords);
448 ####################################################################
451 sub ListDomainObjects {
452 my ($this, $domainName,$limit,$filter,$what,$cookie) = @_;
453 croak 'usage CGP::CLI->ListDomainObjects($domainName,$limit[,$filter][,$what][,$cookie])'
454 unless defined $domainName && defined $limit;
455 my $line = "ListDomainObjects $domainName";
456 $line .= ' FILTER '.$this->printWords($filter) if defined $filter;
458 $line .= " $what" if $what;
459 $line .= " COOKIE ".$this->printWords($cookie) if defined $cookie;
461 return undef unless $this->_parseResponse();
462 $this->parseWords($this->getWords);
467 my ($this, $domainName) = @_;
468 my $line = 'ListAccounts';
469 $line .= ' '.$domainName if $domainName;
471 return undef unless $this->_parseResponse();
472 $this->parseWords($this->getWords);
475 sub ListDomainTelnums {
476 my ($this, $domainName,$limit,$filter) = @_;
477 croak 'usage CGP::CLI->ListDomainTelnums($domainName,$limit[,$filter])'
478 unless defined $domainName && defined $limit;
479 my $line = "ListDomainTelnums $domainName";
480 $line .= ' FILTER '.$this->printWords($filter) if defined $filter;
483 return undef unless $this->_parseResponse();
484 $this->parseWords($this->getWords);
493 croak 'usage CGP::CLI->CreateAccount(accountName => \'newAccountName\',
494 accountType => \'accountType\',
495 externalFlag => \'externalFlag\',
496 settings => $settings)'
497 unless exists $params{accountName};
498 my $line = 'CreateAccount '.$params{accountName};
499 $line .= ' ' . $params{accountType} if exists $params{accountType};
500 $line .= ' ' . 'external' if exists $params{externalFlag};
501 $line .= ' ' . $this->printWords($params{settings}) if exists $params{settings};
504 $this->_parseResponse();
508 my ($this, $oldAccountName, $newAccountName) = @_;
509 croak 'usage CGP::CLI->RenameAccount($oldAccountName, $newAccountName)'
510 unless defined $oldAccountName && defined $newAccountName;
511 $this->send('RenameAccount '.$oldAccountName.' into '.$newAccountName);
512 $this->_parseResponse();
516 my ($this, $accountName) = @_;
517 croak 'usage CGP::CLI->DeleteAccount($accountName)'
518 unless defined $accountName;
519 $this->send('DeleteAccount '.$accountName);
520 $this->_parseResponse();
523 my ($this, $accountName,$type) = @_;
524 croak 'usage CGP::CLI->SetAccountType($accountName,$type)'
525 unless (defined $accountName && defined $type);
526 $this->send('SetAccountType '.$accountName.' '.$type);
527 $this->_parseResponse();
530 sub GetAccountSettings {
531 my ($this, $accountName) = @_;
532 croak 'usage CGP::CLI->GetAccountSettings($accountName)'
533 unless defined $accountName;
534 $this->send('GetAccountSettings '.$accountName);
535 return undef unless $this->_parseResponse();
536 $this->parseWords($this->getWords);
540 GetAccountSettings(@_);
543 sub GetAccountEffectiveSettings {
544 my ($this, $accountName) = @_;
545 croak 'usage CGP::CLI->GetAccountEffectiveSettings($accountName)'
546 unless defined $accountName;
547 $this->send('GetAccountEffectiveSettings '.$accountName);
548 return undef unless $this->_parseResponse();
549 $this->parseWords($this->getWords);
552 sub UpdateAccountSettings {
553 my ($this, $accountName, $params) = @_;
554 croak 'usage CGP::CLI->UpdateAccountSettings($accountName, \%settings)'
555 unless defined $accountName;
556 $this->send('UpdateAccountSettings '.$accountName.' '.$this->printWords($params));
557 $this->_parseResponse();
561 UpdateAccountSettings(@_);
564 sub SetAccountSettings {
565 my ($this, $accountName, $params) = @_;
566 croak 'usage CGP::CLI->SetAccountSettings($accountName, \%settings)'
567 unless defined $accountName;
568 $this->send('SetAccountSettings '.$accountName.' '.$this->printWords($params));
569 $this->_parseResponse();
573 SetAccountSettings(@_);
576 sub SetAccountPassword {
577 my ($this, $accountName, $newPass,$check) = @_;
578 croak 'usage CGP::CLI->SetAccountPassword($accountName, $newPassword,$check)'
579 unless defined $accountName && defined $newPass;
580 my $line = 'SetAccountPassword '.$accountName.' PASSWORD '.$this->printWords($newPass);
581 $line .= ' CHECK' if($check);
583 $this->_parseResponse();
586 sub VerifyAccountPassword {
587 my ($this, $accountName, $pass) = @_;
588 croak 'usage CGP::CLI->VerifyAccountPassword($accountName, $password)'
589 unless defined $accountName && defined $pass;
590 $this->send('VerifyAccountPassword '.$accountName.' PASSWORD '.$this->printWords($pass));
591 $this->_parseResponse();
595 sub GetAccountAliases {
596 my ($this, $accountName) = @_;
597 croak 'usage CGP::CLI->GetAccountAliases($accountName)'
598 unless defined $accountName;
599 $this->send('GetAccountAliases '.$accountName);
600 return undef unless $this->_parseResponse();
601 $this->parseWords($this->getWords);
604 sub SetAccountAliases {
605 my ($this, $accountName, $aliases) = @_;
606 croak 'usage CGP::CLI->SetAccountAliases($accountName, \@aliases)'
607 unless defined $accountName && defined $aliases;
608 $this->send('SetAccountAliases '.$accountName.' '.$this->printWords($aliases));
609 $this->_parseResponse();
612 sub GetAccountTelnums {
613 my ($this, $accountName) = @_;
614 croak 'usage CGP::CLI->GetAccountTelnums($accountName)'
615 unless defined $accountName;
616 $this->send('GetAccountTelnums '.$accountName);
617 return undef unless $this->_parseResponse();
618 $this->parseWords($this->getWords);
621 sub SetAccountTelnums {
622 my ($this, $accountName, $aliases) = @_;
623 croak 'usage CGP::CLI->SetAccountTelnums($accountName, \@telnums)'
624 unless defined $accountName && defined $aliases;
625 $this->send('SetAccountTelnums '.$accountName.' '.$this->printWords($aliases));
626 $this->_parseResponse();
630 sub GetAccountRules {
631 my ($this, $accountName) = @_;
632 croak 'usage CGP::CLI->GetAccountRules($accountName)'
633 unless defined $accountName;
634 $this->send('GetAccountRules '.$accountName);
635 return undef unless $this->_parseResponse();
636 $this->parseWords($this->getWords);
639 sub SetAccountRules {
640 my ($this, $accountName, $rules) = @_;
641 croak 'usage CGP::CLI->SetAccountRules($accountName, \@rules)'
642 unless defined $accountName && defined $rules;
643 $this->send('SetAccountRules '.$accountName.' '.$this->printWords($rules));
644 $this->_parseResponse();
647 sub GetAccountMailRules {
648 my ($this, $accountName) = @_;
649 croak 'usage CGP::CLI->GetAccountMailRules($accountName)'
650 unless defined $accountName;
651 $this->send('GetAccountMailRules '.$accountName);
652 return undef unless $this->_parseResponse();
653 $this->parseWords($this->getWords);
656 sub SetAccountMailRules {
657 my ($this, $accountName, $rules) = @_;
658 croak 'usage CGP::CLI->SetAccountMailRules($accountName, \@rules)'
659 unless defined $accountName && defined $rules;
660 $this->send('SetAccountMailRules '.$accountName.' '.$this->printWords($rules));
661 $this->_parseResponse();
663 sub UpdateAccountMailRule {
664 my ($this, $accountName, $rule) = @_;
665 croak 'usage CGP::CLI->UpdateAccountMailRule($accountName, \@rule)'
666 unless defined $accountName && defined $rule;
667 $this->send('UpdateAccountMailRule '.$accountName.' '.$this->printWords($rule));
668 $this->_parseResponse();
671 sub GetAccountSignalRules {
672 my ($this, $accountName) = @_;
673 croak 'usage CGP::CLI->GetAccountSignalRules($accountName)'
674 unless defined $accountName;
675 $this->send('GetAccountSignalRules '.$accountName);
676 return undef unless $this->_parseResponse();
677 $this->parseWords($this->getWords);
680 sub SetAccountSignalRules {
681 my ($this, $accountName, $rules) = @_;
682 croak 'usage CGP::CLI->SetAccountSignalRules($accountName, \@rules)'
683 unless defined $accountName && defined $rules;
684 $this->send('SetAccountSignalRules '.$accountName.' '.$this->printWords($rules));
685 $this->_parseResponse();
687 sub UpdateAccountSignalRule {
688 my ($this, $accountName, $rule) = @_;
689 croak 'usage CGP::CLI->UpdateAccountSignalRule($accountName, \@rule)'
690 unless defined $accountName && defined $rule;
691 $this->send('UpdateAccountSignalRule '.$accountName.' '.$this->printWords($rule));
692 $this->_parseResponse();
695 sub GetAccountRPOPs {
696 my ($this, $accountName) = @_;
697 croak 'usage CGP::CLI->GetAccountRPOPs($accountName)'
698 unless defined $accountName;
699 $this->send('GetAccountRPOPs '.$accountName);
700 return undef unless $this->_parseResponse();
701 $this->parseWords($this->getWords);
704 sub SetAccountRPOPs {
705 my ($this, $accountName, $newRecords) = @_;
706 croak 'usage CGP::CLI->SetAccountRPOPs($accountName, \@newRecords)'
707 unless defined $accountName && defined $newRecords;
708 $this->send('SetAccountRPOPs '.$accountName.' '.$this->printWords($newRecords));
709 $this->_parseResponse();
712 sub GetAccountRSIPs {
713 my ($this, $accountName) = @_;
714 croak 'usage CGP::CLI->GetAccountRSIPs($accountName)'
715 unless defined $accountName;
716 $this->send('GetAccountRSIPs '.$accountName);
717 return undef unless $this->_parseResponse();
718 $this->parseWords($this->getWords);
721 sub SetAccountRSIPs {
722 my ($this, $accountName, $newRecords) = @_;
723 croak 'usage CGP::CLI->SetAccountRPSIs($accountName, \@newRecords)'
724 unless defined $accountName && defined $newRecords;
725 $this->send('SetAccountRSIPs '.$accountName.' '.$this->printWords($newRecords));
726 $this->_parseResponse();
730 my ($this, $accountName) = @_;
731 croak 'usage CGP::CLI->GetAccountRPOP($accountName)'
732 unless defined $accountName;
733 $this->send('GetAccountRPOP '.$accountName);
734 return undef unless $this->_parseResponse();
735 $this->parseWords($this->getWords);
739 my ($this, $accountName, $newRecords) = @_;
740 croak 'usage CGP::CLI->SetAccountRPOP($accountName, \@newRecords)'
741 unless defined $accountName && defined $newRecords;
742 $this->send('SetAccountRPOP '.$accountName.' '.$this->printWords($newRecords));
743 $this->_parseResponse();
746 sub GetAccountRights {
747 my ($this, $account) = @_;
748 croak 'usage CGP::CLI->GetAccountRights($account)'
749 unless defined $account;
750 $this->send('GetAccountRights '.$account);
751 return undef unless $this->_parseResponse();
752 $this->parseWords($this->getWords);
755 sub SetAccountRights {
756 my ($this, $account, $list) = @_;
757 croak 'usage CGP::CLI->SetAccountRigthts($acount, \@list)'
758 unless defined $account && defined $list;
759 my $line = 'SetAccountRights '.$account.' '.$this->printWords($list);
762 $this->_parseResponse();
766 my ($this, $account, $key) = @_;
767 croak 'usage CGP::CLI->GetAccountInfo($account[,$key | ($key1,...)])'
768 unless defined $account;
769 my $line='GetAccountInfo '.$account;
771 if(ref($key) eq 'ARRAY') {
772 $line.=' '.$this->printWords($key);
774 $line.=' Key '.$this->printWords($key);
778 return undef unless $this->_parseResponse();
779 $this->parseWords($this->getWords);
783 my ($this, $account) = @_;
784 croak 'usage CGP::CLI->GetWebUser($account)'
785 unless defined $account;
786 $this->send('GetWebUser '.$account);
787 return undef unless $this->_parseResponse();
788 $this->parseWords($this->getWords);
792 sub GetAccountPrefs {
793 my ($this, $account) = @_;
794 croak 'usage CGP::CLI->GetAccountPrefs($account)'
795 unless defined $account;
796 $this->send('GetAccountPrefs '.$account);
797 return undef unless $this->_parseResponse();
798 $this->parseWords($this->getWords);
802 my ($this, $account, $settings) = @_;
803 croak 'usage CGP::CLI->SetWebUser($acount, \%settings)'
804 unless defined $account && defined $settings;
805 my $line = 'SetWebUser '.$account.' '.$this->printWords($settings);
808 $this->_parseResponse();
811 sub SetAccountPrefs {
812 my ($this, $account, $settings) = @_;
813 croak 'usage CGP::CLI->SetAccountPrefs($acount, \%settings)'
814 unless defined $account && defined $settings;
815 my $line = 'SetAccountPrefs '.$account.' '.$this->printWords($settings);
818 $this->_parseResponse();
820 sub UpdateAccountPrefs {
821 my ($this, $account, $settings) = @_;
822 croak 'usage CGP::CLI->UpdateAccountPrefs($acount, \%settings)'
823 unless defined $account && defined $settings;
824 my $line = 'UpdateAccountPrefs '.$account.' '.$this->printWords($settings);
827 $this->_parseResponse();
831 sub GetEffectiveWebUser {
832 my ($this, $account) = @_;
833 croak 'usage CGP::CLI->GetEffectiveWebUser($account)'
834 unless defined $account;
835 $this->send('GetEffectiveWebUser '.$account);
836 return undef unless $this->_parseResponse();
837 $this->parseWords($this->getWords);
840 sub GetAccountEffectivePrefs {
841 my ($this, $account) = @_;
842 croak 'usage CGP::CLI->GetAccountEffectivePrefs($account)'
843 unless defined $account;
844 $this->send('GetAccountEffectivePrefs '.$account);
845 return undef unless $this->_parseResponse();
846 $this->parseWords($this->getWords);
850 sub KillAccountSessions {
851 my ($this, $account) = @_;
852 croak 'usage CGP::CLI->KillAccountSessions($account)'
853 unless defined $account;
854 $this->send('KillAccountSessions '.$account);
855 $this->_parseResponse();
859 my ($this, $account,$authAccountName) = @_;
860 croak 'usage CGP::CLI->GetAccountACL($accountName [,authAccountName])'
861 unless defined $account;
863 my $line = 'GetAccountACL '.$account;
864 $line .= ' AUTH '.$authAccountName if($authAccountName);
866 return undef unless $this->_parseResponse();
867 $this->parseWords($this->getWords);
871 my ($this, $account, $newACL,$authAccountName) = @_;
872 croak 'usage CGP::CLI->SetAccountACL($acountACL, \%newACL [,$authAccountName])'
873 unless defined $account && defined $newACL;
874 my $line = 'SetAccountACL '.$account;
875 $line .= ' AUTH '.$authAccountName if($authAccountName);
876 $line.=' '.$this->printWords($newACL);
878 $this->_parseResponse();
881 sub GetAccountACLRights {
882 my ($this, $account,$authAccountName) = @_;
883 croak 'usage CGP::CLI->GetAccountACLRights($accountName ,authAccountName)'
884 unless (defined $account && defined $authAccountName);
886 my $line = 'GetAccountACLRights '.$account.' AUTH '.$authAccountName ;
888 return undef unless $this->_parseResponse();
889 $this->parseWords($this->getWords);
891 sub GetAccountPresence {
892 my ($this, $account) = @_;
893 croak 'usage CGP::CLI->GetAccountPresence($accountName)'
894 unless (defined $account);
896 my $line = 'GetAccountPresence '.$account;
898 return undef unless $this->_parseResponse();
899 $this->parseWords($this->getWords);
901 #################################################################
902 # Group managent commands
905 my ($this, $domainName) = @_;
906 my $line = 'ListGroups';
907 $line .= ' '.$domainName if $domainName;
909 return undef unless $this->_parseResponse();
910 $this->parseWords($this->getWords);
914 my ($this, $groupName, $params) = @_;
915 croak 'usage CGP::CLI->CreateGroup($groupName[, \%params])'
916 unless defined $groupName;
917 my $line = 'CreateGroup '.$groupName;
918 $line .= ' '.$this->printWords($params) if $params;
920 $this->_parseResponse();
924 my ($this, $oldGroupName, $newGroupName) = @_;
925 croak 'usage CGP::CLI->RenameGroup($oldGroupName, $newGroupName)'
926 unless defined $oldGroupName && defined $newGroupName;
927 $this->send('RenameGroup '.$oldGroupName.' into '.$newGroupName);
928 $this->_parseResponse();
932 my ($this, $groupName) = @_;
933 croak 'usage CGP::CLI->DeleteGroup($groupName)'
934 unless defined $groupName;
935 $this->send('DeleteGroup '.$groupName);
936 $this->_parseResponse();
940 my ($this, $groupName) = @_;
941 croak 'usage CGP::CLI->GetGroup($groupName)'
942 unless defined $groupName;
943 $this->send('GetGroup '.$groupName);
944 return undef unless $this->_parseResponse();
945 $this->parseWords($this->getWords);
949 my ($this, $groupName, $params) = @_;
950 croak 'usage CGP::CLI->SetGroup($groupName, \%settings)'
951 unless defined $groupName && defined $params;
952 $this->send('SetGroup '.$groupName.' '.$this->printWords($params));
953 $this->_parseResponse();
957 #################################################################
958 # Forwarder managent commands
961 my ($this, $domainName) = @_;
962 my $line = 'ListForwarders';
963 $line .= ' ' .$domainName if $domainName;
965 return undef unless $this->_parseResponse();
966 $this->parseWords($this->getWords);
969 sub CreateForwarder {
970 my ($this, $forwarderName, $address) = @_;
971 croak 'usage CGP::CLI->CreateForwarder($forwarderName, $address)'
972 unless defined $forwarderName && defined $address;
973 $this->send('CreateForwarder '.$forwarderName.' TO '.$this->printWords($address));
974 $this->_parseResponse();
976 sub RenameForwarder {
977 my ($this, $forwarderName, $newName) = @_;
978 croak 'usage CGP::CLI->RenameForwarder($forwarderName, $newName)'
979 unless defined $forwarderName && defined $newName;
980 $this->send('RenameForwarder '.$forwarderName.' into '.$newName);
981 $this->_parseResponse();
984 sub DeleteForwarder {
985 my ($this, $forwarderName) = @_;
986 croak 'usage CGP::CLI->DeleteForwarder($forwarderName)'
987 unless defined $forwarderName;
988 $this->send('DeleteForwarder '.$forwarderName);
989 $this->_parseResponse();
993 my ($this, $forwarderName) = @_;
994 croak 'usage CGP::CLI->GetForwarder($forwarderName)'
995 unless defined $forwarderName;
996 $this->send('GetForwarder '.$forwarderName);
997 return undef unless $this->_parseResponse();
998 $this->parseWords($this->getWords);
1000 sub FindForwarders {
1001 my ($this, $domain,$forwarderAddress) = @_;
1002 croak 'usage CGP::CLI->FindForwarders($domainName,$forwarderAddress)'
1003 unless (defined $domain && defined $forwarderAddress);
1004 $this->send('FindForwarders '.$domain.' TO '.$this->printWords($forwarderAddress));
1005 return undef unless $this->_parseResponse();
1006 $this->parseWords($this->getWords);
1009 #################################################################
1010 # Named Tasks managent commands
1012 sub ListDomainNamedTasks {
1013 my ($this, $domainName) = @_;
1014 my $line = 'ListDomainNamedTasks';
1015 $line .= ' ' .$domainName if $domainName;
1017 return undef unless $this->_parseResponse();
1018 $this->parseWords($this->getWords);
1020 sub ListAccountNamedTasks {
1021 my ($this, $accountName) = @_;
1022 croak 'usage CGP::CLI->ListAccountNamedTasks($account)'
1023 unless defined $accountName;
1024 $this->send('ListAccountNamedTasks '.$accountName);
1025 return undef unless $this->_parseResponse();
1026 $this->parseWords($this->getWords);
1029 sub CreateNamedTask {
1030 my ($this, $taskName, $account) = @_;
1031 croak 'usage CGP::CLI->CreateNamedTask($taskName, $accountName)'
1032 unless defined $taskName && defined $account;
1033 $this->send('CreateNamedTask '.$taskName.' FOR '.$account);
1034 $this->_parseResponse();
1036 sub RenameNamedTask {
1037 my ($this, $taskName, $newName) = @_;
1038 croak 'usage CGP::CLI->RenameNamedTask($taskName, $newName)'
1039 unless defined $taskName && defined $newName;
1040 $this->send('RenameNamedTask '.$taskName.' into '.$newName);
1041 $this->_parseResponse();
1044 sub DeleteNamedTask {
1045 my ($this, $taskName) = @_;
1046 croak 'usage CGP::CLI->DeleteNamedTask($taskName)'
1047 unless defined $taskName;
1048 $this->send('DeleteNamedTask '.$taskName);
1049 $this->_parseResponse();
1053 my ($this, $taskName) = @_;
1054 croak 'usage CGP::CLI->GetNamedTask($taskName)'
1055 unless defined $taskName;
1056 $this->send('GetNamedTask '.$taskName);
1057 return undef unless $this->_parseResponse();
1058 $this->parseWords($this->getWords);
1061 sub UpdateNamedTask {
1062 my ($this, $taskName, $settings) = @_;
1063 croak 'usage CGP::CLI->UpdateNamedTask($taskName, \%settings)'
1064 unless defined $taskName && defined $settings;
1065 my $line = 'UpdateNamedTask '.$taskName.' '.$this->printWords($settings);
1067 $this->_parseResponse();
1070 #################################################################
1071 # Domain managent commands
1075 $this->send('ListDomains');
1076 return undef unless $this->_parseResponse();
1077 $this->parseWords($this->getWords);
1080 sub MainDomainName {
1082 $this->send('MainDomainName');
1083 return undef unless $this->_parseResponse();
1084 $this->parseWords($this->getWords);
1087 sub GetDomainSettings {
1088 my ($this, $domainName) = @_;
1090 my $line = 'GetDomainSettings';
1091 $line .= ' '.$domainName if($domainName);
1094 return undef unless $this->_parseResponse();
1095 $this->parseWords($this->getWords);
1099 GetDomainSettings(@_);
1102 sub GetDomainEffectiveSettings {
1103 my ($this, $domainName) = @_;
1104 my $line = 'GetDomainEffectiveSettings';
1105 $line .= ' '.$domainName if($domainName);
1107 return undef unless $this->_parseResponse();
1108 $this->parseWords($this->getWords);
1111 sub UpdateDomainSettings {
1115 croak 'usage CGP::CLI->UpdateDomainSettings(domain => \'domainName\',settings => {settings})'
1116 unless exists $params{settings};
1118 my $line = 'UpdateDomainSettings';
1119 $line .= ' '.$params{domain} if exists $params{domain};
1120 $this->send($line.' '.$this->printWords($params{settings}));
1121 $this->_parseResponse();
1125 UpdateDomainSettings(@_);
1128 sub SetDomainSettings {
1132 croak 'usage CGP::CLI->SetDomainSettings(domain => \'domainName\',settings => {settings})'
1133 unless exists $params{settings};
1135 my $line = 'SetDomainSettings';
1136 $line .= ' '.$params{domain} if exists $params{domain};
1137 $this->send($line.' '.$this->printWords($params{settings}));
1138 $this->_parseResponse();
1142 SetDomainSettings(@_);
1147 my ($this, $domainName, $params) = @_;
1148 croak 'usage CGP::CLI->CreateDomain($domainName[, \%params])'
1149 unless defined $domainName;
1150 my $line = 'CreateDomain '.$domainName;
1151 $line .= ' '.$this->printWords($params) if $params;
1153 $this->_parseResponse();
1157 my ($this, $oldDomainName, $newDomainName) = @_;
1158 croak 'usage CGP::CLI->RenameDomain($oldDomainName, $newDomainName)'
1159 unless defined $oldDomainName && defined $newDomainName;
1160 $this->send('RenameDomain '.$oldDomainName.' into '.$newDomainName );
1161 $this->_parseResponse();
1165 my ($this, $domainName, $force) = @_;
1166 croak 'usage CGP::CLI->DeleteDomain($domainName[, $force])'
1167 unless defined $domainName;
1168 my $line = 'DeleteDomain '.$domainName;
1169 $line .= ' force' if $force;
1171 $this->_parseResponse();
1175 my ($this, $domainName) = @_;
1176 croak 'usage CGP::CLI->SuspendDomain($domainName)'
1177 unless defined $domainName;
1178 $this->send('SuspendDomain '.$domainName);
1179 $this->_parseResponse();
1182 my ($this, $domainName) = @_;
1183 croak 'usage CGP::CLI->ResumeDomain($domainName)'
1184 unless defined $domainName;
1185 $this->send('ResumeDomain '.$domainName);
1186 $this->_parseResponse();
1189 sub CreateSharedDomain {
1190 my ($this, $domainName, $params) = @_;
1191 croak 'usage CGP::CLI->CreateSharedDomain($domainName[, \%params])'
1192 unless defined $domainName;
1193 my $line = 'CreateSharedDomain '.$domainName;
1194 $line .= ' '.$this->printWords($params) if $params;
1196 $this->_parseResponse();
1199 sub CreateDirectoryDomain {
1200 my ($this, $domainName, $params) = @_;
1201 croak 'usage CGP::CLI->CreateDirectoryDomain($domainName[, \%params])'
1202 unless defined $domainName;
1203 my $line = 'CreateDirectoryDomain '.$domainName;
1204 $line .= ' '.$this->printWords($params) if $params;
1206 $this->_parseResponse();
1209 sub ReloadDirectoryDomains {
1211 $this->send('ReloadDirectoryDomains');
1212 $this->_parseResponse();
1215 sub GetDomainRules {
1216 my ($this, $domainName) = @_;
1217 croak 'usage CGP::CLI->GetDomainRules($domainName)'
1218 unless defined $domainName;
1219 $this->send('GetDomainRules '.$domainName);
1220 return undef unless $this->_parseResponse();
1221 $this->parseWords($this->getWords);
1224 sub SetDomainRules {
1225 my ($this, $domainName, $rules) = @_;
1226 croak 'usage CGP::CLI->SetDomainRules($domainName, \@rules)'
1227 unless defined $domainName && defined $rules;
1228 $this->send('SetDomainRules '.$domainName.' '.$this->printWords($rules));
1229 $this->_parseResponse();
1232 sub GetDomainMailRules {
1233 my ($this, $domainName) = @_;
1234 croak 'usage CGP::CLI->GetDomainMailRules($domainName)'
1235 unless defined $domainName;
1236 $this->send('GetDomainMailRules '.$domainName);
1237 return undef unless $this->_parseResponse();
1238 $this->parseWords($this->getWords);
1241 sub SetDomainMailRules {
1242 my ($this, $domainName, $rules) = @_;
1243 croak 'usage CGP::CLI->SetDomainMailRules($domainName, \@rules)'
1244 unless defined $domainName && defined $rules;
1245 $this->send('SetDomainMailRules '.$domainName.' '.$this->printWords($rules));
1246 $this->_parseResponse();
1249 #sub UpdateDomainMailRule {
1250 # my ($this, $domainName, $rule) = @_;
1251 # croak 'usage CGP::CLI->UpdateDomainMailRules($domainName, \@rule)'
1252 # unless defined $domainName && defined $rule;
1253 # $this->send('UpdateDomainMailRule '.$domainName.' '.$this->printWords($rule));
1254 # $this->_parseResponse();
1256 sub GetDomainSignalRules {
1257 my ($this, $domainName) = @_;
1258 croak 'usage CGP::CLI->GetDomainSignalRules($domainName)'
1259 unless defined $domainName;
1260 $this->send('GetDomainSignalRules '.$domainName);
1261 return undef unless $this->_parseResponse();
1262 $this->parseWords($this->getWords);
1265 sub SetDomainSignalRules {
1266 my ($this, $domainName, $rules) = @_;
1267 croak 'usage CGP::CLI->SetDomainSignalRules($domainName, \@rules)'
1268 unless defined $domainName && defined $rules;
1269 $this->send('SetDomainSignalRules '.$domainName.' '.$this->printWords($rules));
1270 $this->_parseResponse();
1273 #sub UpdateDomainSignalRule {
1274 # my ($this, $domainName, $rule) = @_;
1275 # croak 'usage CGP::CLI->UpdateDomainSignalRules($domainName, \@rule)'
1276 # unless defined $domainName && defined $rule;
1277 # $this->send('UpdateDomainSignalRule '.$domainName.' '.$this->printWords($rule));
1278 # $this->_parseResponse();
1282 sub GetDomainAliases {
1283 my ($this, $domain) = @_;
1285 my $line = 'GetDomainAliases';
1286 $line .= ' '.$domain if $domain;
1288 return undef unless $this->_parseResponse();
1289 $this->parseWords($this->getWords);
1293 sub SetDomainAliases {
1294 my ($this, $domain, $aliases) = @_;
1295 croak 'usage CGP::CLI->SetDomainAliases($domainName, \@aliases)'
1296 unless defined $domain && defined $aliases;
1297 $this->send('SetDomainAliases '.$domain.' '.$this->printWords($aliases));
1298 $this->_parseResponse();
1301 sub ListAdminDomains {
1302 my ($this, $domain) = @_;
1303 my $line = 'ListAdminDomains';
1304 $line .= ' '.$domain if $domain;
1306 return undef unless $this->_parseResponse();
1307 $this->parseWords($this->getWords);
1310 sub InsertDirectoryRecords {
1311 my ($this, $domain) = @_;
1312 my $line = 'InsertDirectoryRecords';
1313 $line .= ' '.$domain if $domain;
1315 $this->_parseResponse();
1317 sub DeleteDirectoryRecords {
1318 my ($this, $domain) = @_;
1319 my $line = 'DeleteDirectoryRecords';
1320 $line .= ' '.$domain if $domain;
1322 $this->_parseResponse();
1325 sub GetServerTrustedCerts {
1327 $this->send('GetServerTrustedCerts');
1328 return undef unless $this->_parseResponse();
1329 $this->parseWords($this->getWords);
1332 sub SetServerTrustedCerts {
1333 my ( $this, $certs ) = @_;
1334 croak 'usage CGP::CLI->SetServerTrustedCerts(\@certs)'
1335 unless defined $certs;
1336 $this->send('SetServerTrustedCerts '.$this->printWords($certs));
1337 $this->_parseResponse();
1340 sub GetClusterTrustedCerts {
1342 $this->send('GetClusterTrustedCerts');
1343 return undef unless $this->_parseResponse();
1344 $this->parseWords($this->getWords);
1347 sub SetClusterTrustedCerts {
1348 my ( $this, $certs ) = @_;
1349 croak 'usage CGP::CLI->SetClusterTrustedCerts(\@certs)'
1350 unless defined $certs;
1351 $this->send('SetClusterTrustedCerts '.$this->printWords($certs));
1352 $this->_parseResponse();
1356 sub GetDirectoryIntegration {
1358 $this->send('GetDirectoryIntegration');
1359 return undef unless $this->_parseResponse();
1360 $this->parseWords($this->getWords);
1363 sub SetDirectoryIntegration {
1364 my ( $this, $dict ) = @_;
1365 croak 'usage CGP::CLI->SetDirectoryIntegration(\%settings)'
1366 unless defined $dict;
1368 $this->send('SetDirectoryIntegration '.$this->printWords($dict));
1369 $this->_parseResponse();
1372 sub GetClusterDirectoryIntegration {
1374 $this->send('GetClusterDirectoryIntegration');
1375 return undef unless $this->_parseResponse();
1376 $this->parseWords($this->getWords);
1379 sub SetClusterDirectoryIntegration {
1380 my ( $this, $dict ) = @_;
1381 croak 'usage CGP::CLI->SetClusterDirectoryIntegration(\%settings)'
1382 unless defined $dict;
1384 $this->send('SetClusterDirectoryIntegration '.$this->printWords($dict));
1385 $this->_parseResponse();
1389 sub GetDomainDefaults {
1391 $this->send('GetDomainDefaults');
1392 return undef unless $this->_parseResponse();
1393 $this->parseWords($this->getWords);
1396 sub UpdateDomainDefaults {
1397 my ( $this, $dict ) = @_;
1398 croak 'usage CGP::CLI->UpdateDomainDefaults(\%settings)'
1399 unless defined $dict;
1401 $this->send('UpdateDomainDefaults '.$this->printWords($dict));
1402 $this->_parseResponse();
1405 sub SetDomainDefaults {
1406 my ( $this, $dict ) = @_;
1407 croak 'usage CGP::CLI->SetDomainDefaults(\%settings)'
1408 unless defined $dict;
1409 $this->send('SetDomainDefaults '.$this->printWords($dict));
1410 $this->_parseResponse();
1413 sub GetClusterDomainDefaults {
1415 $this->send('GetClusterDomainDefaults');
1416 return undef unless $this->_parseResponse();
1417 $this->parseWords($this->getWords);
1420 sub UpdateClusterDomainDefaults {
1421 my ( $this, $dict ) = @_;
1422 $this->send('UpdateClusterDomainDefaults '.$this->printWords($dict));
1423 $this->_parseResponse();
1426 sub SetClusterDomainDefaults {
1427 my ( $this, $dict ) = @_;
1428 $this->send('SetClusterDomainDefaults '.$this->printWords($dict));
1429 $this->_parseResponse();
1433 sub GetAllAccountsDefaults {
1435 $this->send('GetAllAccountsDefaults');
1436 return undef unless $this->_parseResponse();
1437 $this->parseWords($this->getWords);
1440 sub UpdateAllAccountsDefaults {
1441 my ( $this, $dict ) = @_;
1442 $this->send('UpdateAllAccountsDefaults '.$this->printWords($dict));
1443 $this->_parseResponse();
1446 sub SetAllAccountsDefaults {
1447 my ( $this, $dict ) = @_;
1448 $this->send('SetAllAccountsDefaults '.$this->printWords($dict));
1449 $this->_parseResponse();
1452 sub GetServerAccountDefaults {
1454 $this->send('GetServerAccountDefaults');
1455 return undef unless $this->_parseResponse();
1456 $this->parseWords($this->getWords);
1459 sub UpdateServerAccountDefaults {
1460 my ( $this, $dict ) = @_;
1461 $this->send('UpdateServerAccountDefaults '.$this->printWords($dict));
1462 $this->_parseResponse();
1465 sub SetServerAccountDefaults {
1466 my ( $this, $dict ) = @_;
1467 $this->send('SetServerAccountDefaults '.$this->printWords($dict));
1468 $this->_parseResponse();
1471 sub GetClusterAccountDefaults {
1473 $this->send('GetClusterAccountDefaults');
1474 return undef unless $this->_parseResponse();
1475 $this->parseWords($this->getWords);
1478 sub UpdateClusterAccountDefaults {
1479 my ( $this, $dict ) = @_;
1480 $this->send('UpdateClusterAccountDefaults '.$this->printWords($dict));
1481 $this->_parseResponse();
1484 sub SetClusterAccountDefaults {
1485 my ( $this, $dict ) = @_;
1486 $this->send('SetClusterAccountDefaults '.$this->printWords($dict));
1487 $this->_parseResponse();
1490 sub GetServerWebUserDefaults {
1492 $this->send('GetServerWebUserDefaults');
1493 return undef unless $this->_parseResponse();
1494 $this->parseWords($this->getWords);
1496 sub GetServerAccountPrefs {
1498 $this->send('GetServerAccountPrefs');
1499 return undef unless $this->_parseResponse();
1500 $this->parseWords($this->getWords);
1503 sub SetServerWebUserDefaults {
1504 my ( $this, $dict ) = @_;
1505 $this->send('SetServerWebUserDefaults '.$this->printWords($dict));
1506 $this->_parseResponse();
1508 sub SetServerAccountPrefs {
1509 my ( $this, $dict ) = @_;
1510 $this->send('SetServerAccountPrefs '.$this->printWords($dict));
1511 $this->_parseResponse();
1513 sub UpdateServerAccountPrefs {
1514 my ( $this, $dict ) = @_;
1515 $this->send('UpdateServerAccountPrefs '.$this->printWords($dict));
1516 $this->_parseResponse();
1519 sub GetClusterWebUserDefaults {
1521 $this->send('GetClusterWebUserDefaults');
1522 return undef unless $this->_parseResponse();
1523 $this->parseWords($this->getWords);
1525 sub GetClusterAccountPrefs {
1527 $this->send('GetClusterAccountPrefs');
1528 return undef unless $this->_parseResponse();
1529 $this->parseWords($this->getWords);
1531 sub SetClusterWebUserDefaults {
1532 my ( $this, $dict ) = @_;
1533 $this->send('SetClusterWebUserDefaults '.$this->printWords($dict));
1534 $this->_parseResponse();
1536 sub SetClusterAccountPrefs {
1537 my ( $this, $dict ) = @_;
1538 $this->send('SetClusterAccountPrefs '.$this->printWords($dict));
1539 $this->_parseResponse();
1541 sub UpdateClusterAccountPrefs {
1542 my ( $this, $dict ) = @_;
1543 $this->send('UpdateClusterAccountPrefs '.$this->printWords($dict));
1544 $this->_parseResponse();
1547 sub GetDomainLocation {
1548 my ( $this, $account ) = @_;
1549 $this->send('GetDomainLocation '.$account);
1550 return undef unless $this->_parseResponse();
1551 $this->parseWords($this->getWords);
1554 sub GetAccountLocation {
1555 my ( $this, $account ) = @_;
1556 $this->send('GetAccountLocation '.$account);
1557 return undef unless $this->_parseResponse();
1558 $this->parseWords($this->getWords);
1561 sub ListServerTelnums {
1562 my ($this, $limit,$filter) = @_;
1563 croak 'usage CGP::CLI->ListServerTelnums($limit[,$filter])'
1564 unless defined $limit;
1565 my $line = "ListServerTelnums";
1566 $line .= ' FILTER '.$this->printWords($filter) if defined $filter;
1569 return undef unless $this->_parseResponse();
1570 $this->parseWords($this->getWords);
1573 sub ListClusterTelnums {
1574 my ($this, $limit,$filter) = @_;
1575 croak 'usage CGP::CLI->ListClusterTelnums($limit[,$filter])'
1576 unless defined $limit;
1577 my $line = "ListClusterTelnums";
1578 $line .= ' FILTER '.$this->printWords($filter) if defined $filter;
1581 return undef unless $this->_parseResponse();
1582 $this->parseWords($this->getWords);
1586 sub GetAccountDefaults {
1587 my ($this, $domain) = @_;
1589 my $line = 'GetAccountDefaults';
1590 $line .= ' '.$domain if($domain);
1592 return undef unless $this->_parseResponse();
1593 $this->parseWords($this->getWords);
1596 sub UpdateAccountDefaults {
1600 croak 'usage CGP::CLI->UpdateAccountDefaults(domain => \'domainName\',settings => {settings})'
1601 unless exists $params{settings};
1603 my $line = 'UpdateAccountDefaults';
1604 $line .= ' '.$params{domain} if exists $params{domain};
1606 $this->send($line . ' ' . $this->printWords($params{settings}));
1607 $this->_parseResponse();
1610 sub SetAccountDefaults {
1614 croak 'usage CGP::CLI->SetAccountDefaults(domain => \'domainName\',settings => {settings})'
1615 unless exists $params{settings};
1617 my $line = 'SetAccountDefaults';
1618 $line .= ' '.$params{domain} if exists $params{domain};
1620 $this->send($line . ' ' . $this->printWords($params{settings}));
1621 $this->_parseResponse();
1624 sub GetWebUserDefaults {
1625 my ($this, $domain) = @_;
1627 my $line = 'GetWebUserDefaults';
1628 $line .= ' '.$domain if($domain);
1631 return undef unless $this->_parseResponse();
1632 $this->parseWords($this->getWords);
1635 sub GetAccountDefaultPrefs {
1636 my ($this, $domain) = @_;
1638 my $line = 'GetAccountDefaultPrefs';
1639 $line .= ' '.$domain if($domain);
1642 return undef unless $this->_parseResponse();
1643 $this->parseWords($this->getWords);
1646 sub SetWebUserDefaults {
1647 my ($this) = shift;;
1649 croak 'usage CGP::CLI->SetWebUserDefaults(domain => \'domainName\',settings => {settings})'
1650 unless exists $params{settings};
1652 my $line = 'SetWebUserDefaults';
1653 $line .= ' ' .$params{domain} if exists $params{domain};
1655 $this->send($line . ' ' . $this->printWords($params{settings}));
1656 $this->_parseResponse();
1658 sub SetAccountDefaultPrefs {
1659 my ($this) = shift;;
1661 croak 'usage CGP::CLI->SetAccountDefaultPrefs(domain => \'domainName\',settings => {settings})'
1662 unless exists $params{settings};
1664 my $line = 'SetAccountDefaultPrefs';
1665 $line .= ' ' .$params{domain} if exists $params{domain};
1667 $this->send($line . ' ' . $this->printWords($params{settings}));
1668 $this->_parseResponse();
1671 sub UpdateWebUserDefaults {
1672 my ($this) = shift;;
1674 croak 'usage CGP::CLI->UpdateWebUserDefaults(domain => \'domainName\',settings => {settings})'
1675 unless exists $params{settings};
1677 my $line = 'UpdateWebUserDefaults';
1678 $line .= ' ' .$params{domain} if exists $params{domain};
1680 $this->send($line . ' ' . $this->printWords($params{settings}));
1681 $this->_parseResponse();
1683 sub UpdateAccountDefaultPrefs {
1684 my ($this) = shift;;
1686 croak 'usage CGP::CLI->UpdateAccountDefaultPrefs(domain => \'domainName\',settings => {settings})'
1687 unless exists $params{settings};
1689 my $line = 'UpdateAccountDefaultPrefs';
1690 $line .= ' ' .$params{domain} if exists $params{domain};
1692 $this->send($line . ' ' . $this->printWords($params{settings}));
1693 $this->_parseResponse();
1696 sub GetAccountTemplate {
1697 my ($this, $domain) = @_;
1699 my $line = 'GetAccountTemplate';
1700 $line .= ' '.$domain if($domain);
1703 return undef unless $this->_parseResponse();
1704 $this->parseWords($this->getWords);
1707 sub UpdateAccountTemplate {
1708 my ($this) = shift;;
1711 croak 'usage CGP::CLI->UpdateAccountTemplate(domain => \'domainName\',settings => {settings})'
1712 unless exists $params{settings};
1714 my $line = 'UpdateAccountTemplate';
1715 $line .= ' '.$params{domain} if exists $params{domain};
1717 $this->send($line.' '.$this->printWords($params{settings}));
1718 $this->_parseResponse();
1721 sub SetAccountTemplate {
1722 my ($this) = shift;;
1725 croak 'usage CGP::CLI->SetAccountTemplate(domain => \'domainName\',settings => {settings})'
1726 unless exists $params{settings};
1728 my $line = 'SetAccountTemplate';
1729 $line .= ' '.$params{domain} if exists $params{domain};
1731 $this->send($line.' '.$this->printWords($params{settings}));
1732 $this->_parseResponse();
1735 #################################################################
1736 # Mailbox managent commands
1739 my ($this) = shift;;
1742 croak 'usage CGP::CLI->ListMailboxes(accountName => \'account\',filter => \'*\',authAccountName => \'extAccount\')'
1743 unless exists $params{accountName};
1745 my $line = 'ListMailboxes '.$params{accountName};
1746 $line .= ' FILTER '.$this->printWords($params{filter}) if exists $params{filter};
1747 $line .= ' AUTH '.$params{authAccountName} if exists $params{authAccountName};
1750 return undef unless $this->_parseResponse();
1751 $this->parseWords($this->getWords);
1755 my ($this,$accountName,$mailboxName,$authAccountName,$class) = @_;
1758 croak 'usage CGP::CLI->CreateMailbox(accountName,mailboxName,[authAccountName],[class])'
1759 unless (defined $accountName && defined $mailboxName);
1761 my $line = 'CREATEMAILBOX '.$accountName;
1762 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1763 $line .= ' AUTH '.$authAccountName if($authAccountName);
1764 $line .= ' CLASS '.$class if($class);
1767 $this->_parseResponse();
1771 my ($this,$accountName,$oldMailboxName,$newMailboxName,$authAccountName) = @_;
1773 croak 'usage CGP::CLI->RenameMailbox(accountName,oldMailboxName,newMailboxName[,authAccountName])'
1774 unless (defined $accountName && defined $oldMailboxName && defined $newMailboxName);
1776 my $line = 'RENAMEMAILBOX '.$accountName;
1777 $line .= ' MAILBOX '.$this->printWords($oldMailboxName);
1778 $line .= ' INTO '.$this->printWords($newMailboxName);
1779 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1782 $this->_parseResponse();
1785 sub RenameMailboxes {
1786 my ($this,$accountName,$oldMailboxName,$newMailboxName,$authAccountName) = @_;
1788 croak 'usage CGP::CLI->RenameMailboxes(accountName,oldMailboxName,newMailboxName[,authAccountName])'
1789 unless (defined $accountName && defined $oldMailboxName && defined $newMailboxName);
1791 my $line = 'RENAMEMAILBOX '.$accountName;
1792 $line .= ' MAILBOXES '.$this->printWords($oldMailboxName);
1793 $line .= ' INTO '.$this->printWords($newMailboxName);
1794 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1797 $this->_parseResponse();
1801 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1803 croak 'usage CGP::CLI->DeleteMailbox(accountName,mailboxName[,authAccountName])'
1804 unless (defined $accountName && defined $mailboxName);
1806 my $line = 'DELETEMAILBOX '.$accountName;
1807 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1808 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1811 $this->_parseResponse();
1814 sub DeleteMailboxes {
1815 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1817 croak 'usage CGP::CLI->DeleteMailboxes(accountName,mailboxName[,authAccountName])'
1818 unless (defined $accountName && defined $mailboxName);
1820 my $line = 'DELETEMAILBOX '.$accountName;
1821 $line .= ' MAILBOXES '.$this->printWords($mailboxName);
1822 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1825 $this->_parseResponse();
1828 sub GetMailboxInfo {
1829 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1831 croak 'usage CGP::CLI->GetMailboxInfo(accountName,mailboxName[,authAccountName])'
1832 unless (defined $accountName && defined $mailboxName);
1834 my $line = 'GETMAILBOXINFO '.$accountName;
1835 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1836 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1839 return undef unless $this->_parseResponse();
1840 $this->parseWords($this->getWords);
1844 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1846 croak 'usage CGP::CLI->GetMailboxACL(accountName,mailboxName[,authAccountName])'
1847 unless (defined $accountName && defined $mailboxName);
1849 my $line = 'GETMAILBOXACL '.$accountName;
1850 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1851 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1854 return undef unless $this->_parseResponse();
1855 $this->parseWords($this->getWords);
1859 my ($this,$accountName,$mailboxName,$newACL,$authAccountName) = @_;
1861 croak 'usage CGP::CLI->SetMailboxACL(accountName,mailboxName,\@newACL[,authAccountName])'
1862 unless (defined $accountName && defined $mailboxName && defined $newACL);
1864 my $line = 'SETMAILBOXACL '.$accountName;
1865 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1866 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1868 $this->send($line.' '.$this->printWords($newACL));
1869 $this->_parseResponse();
1873 sub GetMailboxRights {
1874 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1876 croak 'usage CGP::CLI->GetMailboxRights(accountName,mailboxName,authAccountName)'
1877 unless (defined $accountName && defined $mailboxName && defined $authAccountName);
1879 my $line = 'GETMAILBOXRIGHTS '.$accountName;
1880 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1881 $line .= ' AUTH '.$authAccountName;
1884 return undef unless $this->_parseResponse();
1885 $this->parseWords($this->getWords);
1888 sub SetMailboxClass {
1889 my ($this,$accountName,$mailboxName,$class,$authAccountName) = @_;
1891 croak 'usage CGP::CLI->SetMailboxClass(accountName,mailboxName,class [,authAccountName])'
1892 unless (defined $accountName && defined $mailboxName && defined $class);
1894 my $line = 'SetMailboxClass '.$accountName;
1895 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1896 $line .= ' AUTH '.$authAccountName if(defined $authAccountName);
1897 $line .= ' CLASS '.$class;
1900 return undef unless $this->_parseResponse();
1904 sub GetAccountSubscription {
1905 my ($this,$accountName) = @_;
1906 croak 'usage CGP::CLI->GetAccountSubscription(accountName)'
1907 unless defined $accountName;
1909 $this->send('GetAccountSubscription '.$accountName);
1910 return undef unless $this->_parseResponse();
1911 $this->parseWords($this->getWords);
1914 sub SetAccountSubscription {
1915 my ($this,$accountName,$newSubscription) = @_;
1916 croak 'usage CGP::CLI->SetAccountSubscription(accountName,\%newSubscription)'
1917 unless (defined $accountName && defined $newSubscription);
1919 $this->send('SetAccountSubscription '.$accountName.' '.$this->printWords($newSubscription));
1920 $this->_parseResponse();
1923 sub GetMailboxSubscription {
1924 my ($this,$accountName) = @_;
1925 croak 'usage CGP::CLI->GetMailboxSubscription(accountName)'
1926 unless defined $accountName;
1928 $this->send('GetMailboxSubscription '.$accountName);
1929 return undef unless $this->_parseResponse();
1930 $this->parseWords($this->getWords);
1933 sub SetMailboxSubscription {
1934 my ($this,$accountName,$newSubscription) = @_;
1935 croak 'usage CGP::CLI->SetMailboxSubscription(accountName,\%newSubscription)'
1936 unless (defined $accountName && defined $newSubscription);
1938 $this->send('SetMailboxSubscription '.$accountName.' '.$this->printWords($newSubscription));
1939 $this->_parseResponse();
1942 sub GetMailboxAliases {
1943 my ($this,$accountName) = @_;
1944 croak 'usage CGP::CLI->GetMailboxAliases(accountName)'
1945 unless defined $accountName;
1947 $this->send('GetMailboxAliases '.$accountName);
1948 return undef unless $this->_parseResponse();
1949 $this->parseWords($this->getWords);
1952 sub SetMailboxAliases {
1953 my ($this,$accountName,$newAliases) = @_;
1954 croak 'usage CGP::CLI->SetMailboxAliases(accountName,\%newAliases)'
1955 unless (defined $accountName && defined $newAliases);
1957 $this->send('SetMailboxAliases '.$accountName.' '.$this->printWords($newAliases));
1958 $this->_parseResponse();
1962 #################################################################
1963 # Alerts Administration
1965 sub GetDomainAlerts {
1966 my ($this, $domain) = @_;
1968 my $line = 'GetDomainAlerts';
1969 $line .= ' '.$domain if $domain;
1971 return undef unless $this->_parseResponse();
1972 $this->parseWords($this->getWords);
1975 sub SetDomainAlerts {
1976 my ($this, $domain, $alerts) = @_;
1977 croak 'usage CGP::CLI->SetDomainAlerts($domainName, \@alerts)'
1978 unless defined $domain && defined $alerts;
1979 $this->send('SetDomainAlerts '.$domain.' '.$this->printWords($alerts));
1980 $this->_parseResponse();
1983 sub PostDomainAlert {
1984 my ($this, $domain, $alert) = @_;
1985 croak 'usage CGP::CLI->PostDomainAlert($domainName, $alertString)'
1986 unless defined $domain && defined $alert;
1987 $this->send('PostDomainAlert '.$domain.' ALERT '.$this->printWords($alert));
1988 $this->_parseResponse();
1991 sub RemoveDomainAlert {
1992 my ($this, $domain, $timeStamp) = @_;
1993 croak 'usage CGP::CLI->RemoveDomainAlert($domainName, $timeStamp)'
1994 unless defined $domain && defined $timeStamp;
1995 $this->send('RemoveDomainAlert '.$domain.' ALERT '.$timeStamp);
1996 $this->_parseResponse();
1999 sub GetAccountAlerts {
2000 my ($this, $account) = @_;
2001 $this->send('GetAccountAlerts '.$account);
2002 return undef unless $this->_parseResponse();
2003 $this->parseWords($this->getWords);
2006 sub SetAccountAlerts {
2007 my ($this, $account, $alerts) = @_;
2008 croak 'usage CGP::CLI->SetAccountAlerts($account, \@alerts)'
2009 unless defined $account && defined $alerts;
2010 $this->send('SetAccountAlerts '.$account.' '.$this->printWords($alerts));
2011 $this->_parseResponse();
2014 sub PostAccountAlert {
2015 my ($this, $account, $alert) = @_;
2016 croak 'usage CGP::CLI->PostAccountAlert($account, $alertString)'
2017 unless defined $account && defined $alert;
2018 $this->send('PostAccountAlert '.$account.' ALERT '.$this->printWords($alert));
2019 $this->_parseResponse();
2022 sub RemoveAccountAlert {
2023 my ($this, $account, $timeStamp) = @_;
2024 croak 'usage CGP::CLI->RemoveAccountAlert($account, $timeStamp)'
2025 unless defined $account && defined $timeStamp;
2026 $this->send('RemoveAccountAlert '.$account.' ALERT '.$timeStamp);
2027 $this->_parseResponse();
2031 sub GetServerAlerts {
2033 $this->send('GetServerAlerts');
2034 return undef unless $this->_parseResponse();
2035 $this->parseWords($this->getWords);
2038 sub SetServerAlerts {
2039 my ($this, $alerts) = @_;
2040 croak 'usage CGP::CLI->SetServerAlerts(\@alerts)'
2041 unless defined $alerts;
2042 $this->send('SetServerAlerts '.$this->printWords($alerts));
2043 $this->_parseResponse();
2046 sub PostServerAlert {
2047 my ($this, $alert) = @_;
2048 croak 'usage CGP::CLI->PostServerAlert($alertString)'
2049 unless defined $alert;
2050 $this->send('PostServerAlert '.$this->printWords($alert));
2051 $this->_parseResponse();
2054 sub RemoveServerAlert {
2055 my ($this, $timeStamp) = @_;
2056 croak 'usage CGP::CLI->RemoveServerAlert($timeStamp)'
2057 unless defined $timeStamp;
2058 $this->send('RemoveServerAlert '.$timeStamp);
2059 $this->_parseResponse();
2062 sub GetClusterAlerts {
2064 $this->send('GetClusterAlerts');
2065 return undef unless $this->_parseResponse();
2066 $this->parseWords($this->getWords);
2069 sub SetClusterAlerts {
2070 my ($this, $alerts) = @_;
2071 croak 'usage CGP::CLI->SetClusterAlerts(\@alerts)'
2072 unless defined $alerts;
2073 $this->send('SetClusterAlerts '.$this->printWords($alerts));
2074 $this->_parseResponse();
2077 sub PostClusterAlert {
2078 my ($this, $alert) = @_;
2079 croak 'usage CGP::CLI->PostClusterAlert($alertString)'
2080 unless defined $alert;
2081 $this->send('PostClusterAlert '.$this->printWords($alert));
2082 $this->_parseResponse();
2085 sub RemoveClusterAlert {
2086 my ($this, $timeStamp) = @_;
2087 croak 'usage CGP::CLI->RemoveClusterAlert($timeStamp)'
2088 unless defined $timeStamp;
2089 $this->send('RemoveClusterAlert '.$timeStamp);
2090 $this->_parseResponse();
2093 #################################################################
2094 # Personal Web Site Administration
2097 my ($this,$accountName,$fileName,$position,$sliceSize) = @_;
2099 croak 'usage CGP::CLI->GetWebFile(accountName,fileName[,position,sliceSize])'
2100 unless (defined $accountName && defined $fileName);
2101 my $line='GetWebFile '.$accountName.' FILE '.$this->printWords($fileName);
2102 $line .= ' OFFSET '. $position if(defined $position && $position!=0);
2103 $line .= ' SIZE '. $sliceSize if(defined $sliceSize);
2106 return undef unless $this->_parseResponse;
2107 $this->parseWords($this->getWords);
2111 my ($this,$accountName,$fileName,$data,$position) = @_;
2113 croak 'usage CGP::CLI->PutWebFile(accountName,fileName,data [,position])'
2114 unless (defined $accountName && defined $fileName && defined $data);
2115 my $line='PutWebFile '.$accountName.' FILE '.$this->printWords($fileName);
2116 $line .= ' OFFSET '. $position if(defined $position && $position!=0);
2117 if($data=~/\[.*\]$/) {
2118 $line .= ' DATA '.$data;
2120 $line .= ' DATA ['.$data.']';
2123 $this->_parseResponse;
2127 my ($this,$accountName,$oldFileName,$newFileName) = @_;
2129 croak 'usage CGP::CLI->RenameWebFile(accountName,oldFileName,newFileName)'
2130 unless (defined $accountName && defined $oldFileName && defined $newFileName);
2131 $this->send('RenameWebFile '.$accountName.' FILE '.$this->printWords($oldFileName).' INTO '.$this->printWords($newFileName));
2132 $this->_parseResponse;
2136 my ($this,$accountName,$fileName) = @_;
2138 croak 'usage CGP::CLI->DeleteWebFile(accountName,fileName)'
2139 unless (defined $accountName && defined $fileName);
2140 $this->send('DeleteWebFile '.$accountName.' FILE '.$this->printWords($fileName));
2141 $this->_parseResponse;
2145 my ($this,$accountName,$filePath) = @_;
2147 croak 'usage CGP::CLI->ListWebFiles(accountName [,filePath])'
2148 unless defined $accountName;
2149 my $line = 'ListWebFiles '.$accountName;
2150 $line .= ' PATH '.$this->printWords($filePath) if $filePath;
2152 return undef unless $this->_parseResponse;
2153 $this->parseWords($this->getWords);
2156 sub GetWebFilesInfo {
2157 my ($this,$accountName) = @_;
2159 croak 'usage CGP::CLI->InfoWebFiles(accountName)'
2160 unless defined $accountName;
2161 $this->send('GetWebFilesInfo '.$accountName);
2162 return undef unless $this->_parseResponse;
2163 $this->parseWords($this->getWords);
2166 #################################################################
2167 # File Storage Administration
2169 sub ReadStorageFile {
2170 my ($this,$accountName,$fileName,$position,$sliceSize,$authAccountName) = @_;
2172 croak 'usage CGP::CLI->ReadStorageFile(accountName,fileName[,position,sliceSize[,authAccountName]])'
2173 unless (defined $accountName && defined $fileName);
2174 my $line='ReadStorageFile '.$accountName.' FILE '.$this->printWords($fileName);
2175 $line .= ' OFFSET '. $position if(defined $position && $position!=0);
2176 $line .= ' SIZE '. $sliceSize if(defined $sliceSize);
2177 $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
2180 return undef unless $this->_parseResponse;
2181 $this->parseWords($this->getWords);
2184 sub WriteStorageFile {
2185 my ($this,$accountName,$fileName,$data,$position,$authAccountName) = @_;
2187 croak 'usage CGP::CLI->WriteStorageFile(accountName,fileName,data [,position[,authAccountName]])'
2188 unless (defined $accountName && defined $fileName && defined $data);
2189 my $line='WriteStorageFile '.$accountName.' FILE '.$this->printWords($fileName);
2190 $line .= ' OFFSET '. $position if(defined $position && $position!=0);
2191 if($data=~/\[.*\]$/) {
2192 $line .= ' DATA '.$data;
2194 $line .= ' DATA ['.$data.']';
2196 $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
2198 $this->_parseResponse;
2201 sub RenameStorageFile {
2202 my ($this,$accountName,$oldFileName,$newFileName,$authAccountName) = @_;
2204 croak 'usage CGP::CLI->RenameStorageFile(accountName,oldFileName,newFileName[,authAccountName])'
2205 unless (defined $accountName && defined $oldFileName && defined $newFileName);
2206 my $line='RenameStorageFile '.$accountName.' FILE '.$this->printWords($oldFileName).' INTO '.$this->printWords($newFileName);
2207 $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
2209 $this->_parseResponse;
2212 sub DeleteStorageFile {
2213 my ($this,$accountName,$fileName,$authAccountName) = @_;
2215 croak 'usage CGP::CLI->DeleteStorageFile(accountName,fileName[,authAccountName])'
2216 unless (defined $accountName && defined $fileName);
2217 my $line='DeleteStorageFile '.$accountName.' FILE '.$this->printWords($fileName);
2218 $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
2220 $this->_parseResponse;
2223 sub ListStorageFiles {
2224 my ($this,$accountName,$filePath,$authAccountName) = @_;
2226 croak 'usage CGP::CLI->ListStorageFiles(accountName [,filePath[,authAccountName]])'
2227 unless defined $accountName;
2228 my $line = 'ListStorageFiles '.$accountName;
2229 $line .= ' PATH '.$this->printWords($filePath) if $filePath;
2230 $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
2232 return undef unless $this->_parseResponse;
2233 $this->parseWords($this->getWords);
2236 sub GetStorageFileInfo {
2237 my ($this,$accountName,$filePath,$authAccountName) = @_;
2239 croak 'usage CGP::CLI->GetStorageFileInfo(accountName[,filePath[,authAccountName])'
2240 unless defined $accountName;
2241 my $line='GetStorageFileInfo '.$accountName;
2242 $line .= ' PATH '.$this->printWords($filePath) if $filePath;
2243 $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
2246 return undef unless $this->_parseResponse;
2247 $this->parseWords($this->getWords);
2250 sub ReadStorageFileAttr {
2251 my ($this,$accountName,$fileName,$atributes,$authAccountName) = @_;
2253 croak 'usage CGP::CLI->ReadStorageFileAttr(accountName,fileName[,attributes[,authAccountName]])'
2254 unless (defined $accountName && defined $fileName);
2255 my $line='ReadStorageFileAttr '.$accountName.' FILE '.$this->printWords($fileName);
2256 $line .= $atributes if(defined $atributes);
2257 $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
2260 return undef unless $this->_parseResponse;
2261 $this->parseWords($this->getWords);
2264 sub UpdateStorageFileAttr {
2265 my ($this,$accountName,$fileName,$attributes,$authAccountName) = @_;
2267 croak 'usage CGP::CLI->UpdateStorageFileAttr(accountName,fileName,attributes[,authAccountName])'
2268 unless (defined $accountName && defined $fileName && defined $attributes);
2269 my $line='UpdateStorageFileAttr '.$accountName.' FILE '.$this->printWords($fileName).' '.$attributes;
2270 $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
2272 $this->_parseResponse;
2275 sub GetFileSubscription {
2276 my ($this, $accountName) = @_;
2277 croak 'usage CGP::CLI->GetFileSubscription($accountName)'
2278 unless defined $accountName;
2279 $this->send('GetFileSubscription '.$accountName);
2280 return undef unless $this->_parseResponse();
2281 $this->parseWords($this->getWords);
2284 sub SetFileSubscription {
2285 my ($this, $accountName, $newSubscription) = @_;
2286 croak 'usage CGP::CLI->SetFileSubscription($accountName, \@newSubscription)'
2287 unless defined $accountName && defined $newSubscription;
2288 $this->send('SetFileSubscription '.$accountName.' '.$this->printWords($newSubscription));
2289 $this->_parseResponse();
2293 #################################################################
2294 # List management commands
2297 my ( $this, $domain ) = @_;
2298 my $line = 'LISTLISTS';
2299 $line .= ' '.$domain if $domain;
2301 return undef unless $this->_parseResponse;
2302 $this->parseWords($this->getWords);
2305 sub GetDomainLists {
2306 my ( $this, $domain ) = @_;
2307 my $line = 'GetDomainLists';
2308 $line .= ' '.$domain if $domain;
2310 return undef unless $this->_parseResponse;
2311 $this->parseWords($this->getWords);
2314 sub GetAccountLists {
2315 my ( $this, $accountName ) = @_;
2316 croak 'usage CGP::CLI->GetAccoountLists($accountName)'
2317 unless defined $accountName;
2319 $this->send('GetAccountLists '.$accountName);
2320 return undef unless $this->_parseResponse;
2321 $this->parseWords($this->getWords);
2325 my ($this, $listName, $accountName) = @_;
2326 croak 'usage CGP::CLI->CreateList($listName, $accountName)'
2327 unless defined $listName && defined $accountName;
2328 $this->send('CREATELIST '.$listName.' for '.$accountName);
2329 $this->_parseResponse();
2333 my ($this, $oldListName, $newListName) = @_;
2334 croak 'usage CGP::CLI->RenameList($oldListName, $newListName)'
2335 unless defined $oldListName && defined $newListName;
2336 $this->send('RENAMELIST '.$oldListName.' into '.$newListName);
2337 $this->_parseResponse();
2341 my ( $this, $listName ) = @_;
2342 croak 'usage CGP::CLI->DeleteList($listName)'
2343 unless defined $listName;
2345 $this->send('DELETELIST '.$listName);
2346 $this->_parseResponse();
2350 my ( $this, $listName ) = @_;
2351 croak 'usage CGP::CLI->GetList($listName)'
2352 unless defined $listName;
2354 $this->send('GETLIST '.$listName);
2355 return undef unless $this->_parseResponse();
2356 $this->parseWords($this->getWords);
2360 my ( $this, $listName, $dict ) = @_;
2361 croak 'usage CGP::CLI->UpdateList($listName,\%params)'
2362 unless defined $listName && defined $dict;
2364 $this->send('UPDATELIST '.$listName.' '.$this->printWords($dict) );
2365 $this->_parseResponse();
2369 my ( $this, $listName, $command, $subscriber, @options ) = @_;
2370 croak 'usage CGP::CLI->List($listName, $command, $subscriber, @options)'
2371 unless defined $listName && defined $command && defined $subscriber;
2373 $this->send('LIST '.$listName.' '.$command.' '.join(' ',@options).' '.$subscriber);
2374 $this->_parseResponse();
2377 sub ListSubscribers {
2378 my ( $this, $listName,$filter,$limit ) = @_;
2379 croak 'usage CGP::CLI->ListSubscribers($listName [,$filter[,$limit]])'
2380 unless defined $listName;
2382 my $line = 'ListSubscribers '.$listName;
2383 $line .= ' FILTER '. ($filter eq '' ? '""' : $this->printWords($filter)) if($filter || $limit);
2384 $line .= " $limit" if($limit);
2386 $this->send($line );
2387 return undef unless $this->_parseResponse();
2388 $this->parseWords($this->getWords);
2391 sub GetSubscriberInfo {
2392 my ( $this, $listName,$address ) = @_;
2393 croak 'usage CGP::CLI->GetSubscriberInfo($listName ,$subscriberAddress)'
2394 unless defined $listName && defined $address;
2395 $this->send('GetSubscriberInfo '.$listName.' NAME '.$address);
2396 return undef unless $this->_parseResponse();
2397 $this->parseWords($this->getWords);
2400 sub SetPostingMode {
2401 my ($this, $listName, $address, $mode) = @_;
2402 croak 'usage CGP::CLI->SetPostingMode($listName,$subscriberAddress,$mode)'
2403 unless defined $listName && defined $address && defined $mode;
2404 $this->send('SetPostingMode '.$listName.' FOR '.$address.' '.$mode);
2405 $this->_parseResponse();
2409 my ($this, $listName, $address, $fatal) = @_;
2410 croak 'usage CGP::CLI->ProcessBounce($listName,$subscriberAddress,"fatal")'
2411 unless defined $listName && defined $address;
2412 my $line = 'ProcessBounce '.$listName;
2413 $line .= ' FATAL' if($fatal);
2414 $this->send($line. ' FOR '.$address);
2415 $this->_parseResponse();
2418 #############################################
2419 # Web Skins Administration
2421 sub ListDomainSkins {
2422 my ($this, $domainName) = @_;
2423 my $line = 'ListDomainSkins';
2424 $line .= ' '.$domainName if($domainName);
2426 return undef unless $this->_parseResponse();
2427 $this->parseWords($this->getWords);
2430 sub CreateDomainSkin {
2431 my ( $this, $domain, $skin ) = @_;
2432 croak 'usage CGP::CLI->CreateDomainSkin($domainName,$skinName)'
2433 unless defined $domain && defined $skin;
2435 $this->send('CreateDomainSkin '.$domain.' SKIN '.$this->printWords($skin));
2436 $this->_parseResponse();
2439 sub RenameDomainSkin {
2440 my ( $this, $domain, $skin, $newName ) = @_;
2441 croak 'usage CGP::CLI->RenameDomainSkin($domainName,$oldSkinName,$newSkinName)'
2442 unless defined $domain && defined $skin && defined $newName;
2444 $this->send('RenameDomainSkin '.$domain.' SKIN '.$this->printWords($skin).' INTO '.$this->printWords($newName));
2445 $this->_parseResponse();
2448 sub DeleteDomainSkin {
2449 my ( $this, $domain, $skin ) = @_;
2450 croak 'usage CGP::CLI->DeleteDomainSkin($domainName,$skinName)'
2451 unless defined $domain && defined $skin;
2453 $this->send('DeleteDomainSkin '.$domain.' SKIN '.$this->printWords($skin));
2454 $this->_parseResponse();
2457 sub ListDomainSkinFiles {
2458 my ( $this, $domain, $skin ) = @_;
2459 croak 'usage CGP::CLI->ListDomainSkinFiles($domainName,$skinName)'
2460 unless defined $domain && defined $skin;
2462 $this->send('ListDomainSkinFiles '.$domain.' SKIN '.$this->printWords($skin));
2463 return undef unless $this->_parseResponse();
2464 $this->parseWords($this->getWords);
2467 sub ReadDomainSkinFile {
2468 my ( $this, $domain, $skin, $fileName ) = @_;
2469 croak 'usage CGP::CLI->ReadDomainSkinFile($domainName,$skinName,$fileName)'
2470 unless defined $domain && defined $skin && defined $fileName;
2472 $this->send('ReadDomainSkinFile '.$domain.' SKIN '.$this->printWords($skin).' FILE '.$this->printWords($fileName));
2473 return undef unless $this->_parseResponse();
2474 $this->parseWords($this->getWords);
2477 sub StoreDomainSkinFile {
2478 my ( $this, $domain, $skin, $fileName,$base64data ) = @_;
2479 croak 'usage CGP::CLI->StoreDomainSkinFile($domainName,$skinName,$fileName,$base64data)'
2480 unless defined $domain && defined $skin && defined $fileName && defined $base64data;
2481 $this->send('StoreDomainSkinFile '.$domain.' SKIN '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DATA ['.$base64data.']');
2482 $this->_parseResponse();
2485 sub DeleteDomainSkinFile {
2486 my ( $this, $domain, $skin, $fileName ) = @_;
2487 croak 'usage CGP::CLI->DeleteDomainSkinFile($domainName,$skinName,$fileName)'
2488 unless defined $domain && defined $skin && defined $fileName;
2490 $this->send('StoreDomainSkinFile '.$domain.' SKIN '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DELETE');
2491 $this->_parseResponse();
2495 sub ListServerSkins {
2497 $this->send('ListServerSkins');
2498 return undef unless $this->_parseResponse();
2499 $this->parseWords($this->getWords);
2502 sub CreateServerSkin {
2503 my ( $this, $skin ) = @_;
2504 croak 'usage CGP::CLI->CreateServerSkin($skinName)'
2505 unless defined $skin;
2507 $this->send('CreateServerSkin '.$this->printWords($skin));
2508 $this->_parseResponse();
2511 sub RenameServerSkin {
2512 my ( $this, $skin, $newName ) = @_;
2513 croak 'usage CGP::CLI->RenameServerSkin($oldSkinName,$newSkinName)'
2514 unless defined $skin && defined $newName;
2516 $this->send('RenameServerSkin '.$this->printWords($skin).' INTO '.$this->printWords($newName));
2517 $this->_parseResponse();
2520 sub DeleteServerSkin {
2521 my ( $this, $skin ) = @_;
2522 croak 'usage CGP::CLI->DeleteServerSkin($skinName)'
2523 unless defined $skin;
2525 $this->send('DeleteServerSkin '.$this->printWords($skin));
2526 $this->_parseResponse();
2529 sub ListServerSkinFiles {
2530 my ( $this, $skin ) = @_;
2531 croak 'usage CGP::CLI->ListServerSkinFiles($skinName)'
2532 unless defined $skin;
2534 $this->send('ListServerSkinFiles '.$this->printWords($skin));
2535 return undef unless $this->_parseResponse();
2536 $this->parseWords($this->getWords);
2539 sub ReadServerSkinFile {
2540 my ( $this, $skin, $fileName ) = @_;
2541 croak 'usage CGP::CLI->ReadServerSkinFile($skinName,$fileName)'
2542 unless defined $skin && defined $fileName;
2544 $this->send('ReadServerSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName));
2545 return undef unless $this->_parseResponse();
2546 $this->parseWords($this->getWords);
2549 sub StoreServerSkinFile {
2550 my ( $this, $skin, $fileName,$data ) = @_;
2551 croak 'usage CGP::CLI->StoreServerSkinFile($skinName,$fileName,$base64data)'
2552 unless defined $skin && defined $fileName && defined $data;
2554 $this->send('StoreServerSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DATA ['.$data.']');
2555 $this->_parseResponse();
2558 sub DeleteServerSkinFile {
2559 my ( $this, $skin, $fileName ) = @_;
2560 croak 'usage CGP::CLI->DeleteServerSkinFile($skinName,$fileName)'
2561 unless defined $skin && defined $fileName;
2563 $this->send('StoreServerSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DELETE');
2564 $this->_parseResponse();
2568 sub ListClusterSkins {
2570 $this->send('ListClusterSkins');
2571 return undef unless $this->_parseResponse();
2572 $this->parseWords($this->getWords);
2575 sub CreateClusterSkin {
2576 my ( $this, $skin ) = @_;
2577 croak 'usage CGP::CLI->CreateClusterSkin($skinName)'
2578 unless defined $skin;
2580 $this->send('CreateClusterSkin '.$this->printWords($skin));
2581 $this->_parseResponse();
2584 sub RenameClusterSkin {
2585 my ( $this, $skin, $newName ) = @_;
2586 croak 'usage CGP::CLI->RenameClusterSkin($oldSkinName,$newSkinName)'
2587 unless defined $skin && defined $newName;
2589 $this->send('RenameClusterSkin '.$this->printWords($skin).' INTO '.$this->printWords($newName));
2590 $this->_parseResponse();
2593 sub DeleteClusterSkin {
2594 my ( $this, $skin ) = @_;
2595 croak 'usage CGP::CLI->DeleteClusterSkin($skinName)'
2596 unless defined $skin;
2598 $this->send('DeleteClusterSkin '.$this->printWords($skin));
2599 $this->_parseResponse();
2602 sub ListClusterSkinFiles {
2603 my ( $this, $skin ) = @_;
2604 croak 'usage CGP::CLI->ListClusterSkinFiles($skinName)'
2605 unless defined $skin;
2607 $this->send('ListClusterSkinFiles '.$this->printWords($skin));
2608 return undef unless $this->_parseResponse();
2609 $this->parseWords($this->getWords);
2612 sub ReadClusterSkinFile {
2613 my ( $this, $skin, $fileName ) = @_;
2614 croak 'usage CGP::CLI->ReadClusterSkinFile($skinName,$fileName)'
2615 unless defined $skin && defined $fileName;
2617 $this->send('ReadClusterSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName));
2618 return undef unless $this->_parseResponse();
2619 $this->parseWords($this->getWords);
2622 sub StoreClusterSkinFile {
2623 my ( $this, $skin, $fileName,$data ) = @_;
2624 croak 'usage CGP::CLI->StoreClusterSkinFile($skinName,$fileName,$base64data)'
2625 unless defined $skin && defined $fileName && defined $data;
2627 $this->send('StoreClusterSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DATA ['.$data.']');
2628 $this->_parseResponse();
2631 sub DeleteClusterSkinFile {
2632 my ( $this, $skin, $fileName ) = @_;
2633 croak 'usage CGP::CLI->DeleteClusterSkinFile($skinName,$fileName)'
2634 unless defined $skin && defined $fileName;
2636 $this->send('StoreClusterSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DELETE');
2637 $this->_parseResponse();
2640 #############################################
2641 # Web Interface Tuning
2643 sub ListWebUserInterface {
2644 my ($this, $domainName, $path) = @_;
2646 my $line = 'ListWebUserInterface';
2647 $line .= ' '.$domainName if($domainName);
2648 $line .= ' PATH '.$this->printWords($path) if($path);
2651 return undef unless $this->_parseResponse();
2652 $this->parseWords($this->getWords);
2655 sub GetWebUserInterface {
2656 my ($this, $domainName, $path) = @_;
2657 croak 'usage CGP::CLI->GetWebUserInterface($domainName, $fileName)'
2658 unless defined $domainName && defined $path;
2660 my $line = 'GetWebUserInterface '.$domainName.' FILE '.$this->printWords($path);
2662 return undef unless $this->_parseResponse();
2663 $this->parseWords($this->getWords);
2666 sub PutWebUserInterface {
2667 my ($this, $domainName, $path, $data) = @_;
2668 croak 'usage CGP::CLI->PutWebUserInterface($domainName, $fileName, $base64data)'
2669 unless defined $domainName && defined $path && defined $data;
2671 my $line = 'PutWebUserInterface '.$domainName;
2672 $line .= ' FILE '.$this->printWords($path).' DATA ['.$data.']';
2674 $this->_parseResponse();
2677 sub DeleteWebUserInterface {
2678 my ($this, $domainName, $path) = @_;
2679 croak 'usage CGP::CLI->DeleteWebUserInterface($domainName, $fileName)'
2680 unless defined $domainName && defined $path;
2682 my $line = 'DeleteWebUserInterface ';
2683 $line .= ' '.$domainName if($domainName);
2684 $line .= ' FILE '.$this->printWords($path) if($path);
2687 $this->_parseResponse();
2690 sub ClearWebUserCache {
2691 my ($this, $domainName) = @_;
2693 my $line = 'ClearWebUserCache';
2694 $line .= ' '.$domainName if($domainName);
2697 $this->_parseResponse();
2700 #############################################
2701 # Web Interface Integration
2703 sub CreateWebUserSession {
2704 my ($this, $accountName, $ipAddress, $wml,$skin,$origAddress) = @_;
2705 croak 'usage CGP::CLI->CreateWebUserSession($accountName, $IP_Address[, "WML"[,"mySkin"]][,$origAddress )'
2706 unless defined $accountName && defined $ipAddress;
2707 my $line='CreateWebUserSession '.$accountName.' ADDRESS '.$ipAddress;
2708 $line .= " FOR $origAddress" if($origAddress);
2709 $line .= " $wml" if($wml);
2710 $line .= " SKIN $skin" if($skin);
2713 return undef unless $this->_parseResponse();
2714 $this->parseWords($this->getWords);
2717 sub CreateXIMSSSession {
2718 my ($this, $accountName, $ipAddress,$origAddress) = @_;
2719 croak 'usage CGP::CLI->CreateXIMSSSession($accountName, $IP_Address,[$origAddress] )'
2720 unless defined $accountName && defined $ipAddress;
2721 my $line='CreateXIMSSSession '.$accountName.' ADDRESS '.$ipAddress;
2722 $line .= " FOR $origAddress" if($origAddress);
2724 return undef unless $this->_parseResponse();
2725 $this->parseWords($this->getWords);
2728 sub FindWebUserSession {
2729 my ($this, $accountName,$address) = @_;
2730 croak 'usage CGP::CLI->FindWebUserSession($accountName [,$address])' unless defined $accountName;
2732 my $line='FindWebUserSession '.$accountName;
2733 $line .= ' ADDRESS '.$address if($address);
2736 return undef unless $this->_parseResponse();
2737 $this->parseWords($this->getWords);
2740 sub GetWebUserSession {
2741 my ($this, $sessionID,$domain) = @_;
2742 croak 'usage CGP::CLI->GetWebUserSession($sessionID [,$domain])' unless defined $sessionID;
2744 my $line='GetWebUserSession '.$sessionID;
2745 $line .= ' DOMAIN '.$domain if($domain);
2748 return undef unless $this->_parseResponse();
2749 $this->parseWords($this->getWords);
2752 sub FindAccountSession {
2753 my ($this, $accountName,$address,$proxiedAddress,$protocol,$transport,$client) = @_;
2754 croak 'usage CGP::CLI->FindAccountSession($accountName [,$address,$proxiedAddress,$protocol,$transport,$client])' unless defined $accountName;
2756 my $line='FindAccountSession '.$accountName;
2757 $line .= ' ADDRESS '.$address if($address);
2758 $line .= ' FOR '.$proxiedAddress if($proxiedAddress);
2759 $line .= ' PROTOCOL '.$protocol if($protocol);
2760 $line .= ' TRANSPORT '.$transport if($transport);
2761 $line .= ' CLIENT '.$client if($client);
2763 return undef unless $this->_parseResponse();
2764 $this->parseWords($this->getWords);
2768 my ($this, $sessionID,$domain) = @_;
2769 croak 'usage CGP::CLI->GetSession($sessionID [,$domain])' unless defined $sessionID;
2771 my $line='GetSession '.$sessionID;
2772 $line .= ' DOMAIN '.$domain if($domain);
2775 return undef unless $this->_parseResponse();
2776 $this->parseWords($this->getWords);
2781 sub KillWebUserSession {
2782 my ($this, $sessionID,$domain) = @_;
2783 croak 'usage CGP::CLI->KillWebUserSession($sessionID [,$domain])' unless defined $sessionID;
2784 my $line='KillWebUserSession '.$sessionID;
2785 $line .= ' DOMAIN '.$domain if($domain);
2788 $this->_parseResponse();
2791 my ($this, $sessionID,$domain) = @_;
2792 croak 'usage CGP::CLI->KillSession($sessionID [,$domain])' unless defined $sessionID;
2793 my $line='KillSession '.$sessionID;
2794 $line .= ' DOMAIN '.$domain if($domain);
2797 $this->_parseResponse();
2800 #############################################
2801 # Real-Time Application Administration
2803 sub CreateDomainPBX {
2804 my ( $this, $domain, $language ) = @_;
2805 croak 'usage CGP::CLI->CreateDomainPBX($domainName,$language)'
2806 unless defined $domain;
2807 my $line = 'CreateDomainPBX '.$domain;
2808 $line .= ' FILE '.$this->printWords($language) if($language);
2811 $this->_parseResponse();
2813 sub DeleteDomainPBX {
2814 my ( $this, $domain, $language ) = @_;
2815 croak 'usage CGP::CLI->Deleref($ret)teDomainPBX($domainName,$language)'
2816 unless defined $domain && defined $language;
2817 my $line = 'DeleteDomainPBX '.$domain . ' FILE '.$this->printWords($language);
2820 $this->_parseResponse();
2823 sub ListDomainPBXFiles {
2824 my ($this, $domain,$language) = @_;
2825 croak 'usage CGP::CLI->ListDomainPBXFiles($domainName,$language)'
2826 unless defined $domain;
2827 my $line = 'ListDomainPBXFiles '.$domain;
2828 $line .= ' FILE '.$this->printWords($language) if($language);
2830 return undef unless $this->_parseResponse();
2831 $this->parseWords($this->getWords);
2834 sub ReadDomainPBXFile {
2835 my ( $this, $domain, $fileName ) = @_;
2836 croak 'usage CGP::CLI->ReadDomainPBXFile($domainName,$fileName)'
2837 unless defined $domain && defined $fileName;
2839 $this->send('ReadDomainPBXFile '.$domain.' FILE '.$this->printWords($fileName));
2840 return undef unless $this->_parseResponse();
2841 $this->parseWords($this->getWords);
2844 sub StoreDomainPBXFile {
2845 my ( $this, $domain, $fileName,$base64data ) = @_;
2846 croak 'usage CGP::CLI->StoreDomainPBXFile($domainName,$fileName,$base64data)'
2847 unless defined $domain && defined $fileName && defined $base64data;
2848 $base64data='['.$base64data.']' unless($base64data=~/^\[.*\]$/);
2849 $this->send('StoreDomainPBXFile '.$domain.' FILE '.$this->printWords($fileName).' DATA '.$base64data);
2850 $this->_parseResponse();
2853 sub DeleteDomainPBXFile {
2854 my ( $this, $domain, $fileName ) = @_;
2855 croak 'usage CGP::CLI->DeleteDomainPBXFile($domainName,$fileName)'
2856 unless defined $domain && defined $fileName;
2858 $this->send('StoreDomainPBXFile '.$domain.' FILE '.$this->printWords($fileName).' DELETE');
2859 $this->_parseResponse();
2864 sub CreateServerPBX {
2865 my ( $this, $language ) = @_;
2866 croak 'usage CGP::CLI->CreateServerPBX($language)'
2867 unless defined $language;
2868 my $line = 'CreateServerPBX '.$this->printWords($language);
2870 $this->_parseResponse();
2872 sub DeleteServerPBX {
2873 my ( $this, $language ) = @_;
2874 croak 'usage CGP::CLI->DeleteServerPBX($language)'
2875 unless defined $language;
2876 my $line = 'DeleteServerPBX ' .$this->printWords($language);
2878 $this->_parseResponse();
2881 sub ListServerPBXFiles {
2882 my ($this,$language) = @_;
2884 my $line = 'ListServerPBXFiles ';
2885 $line .= $this->printWords($language) if($language);
2887 return undef unless $this->_parseResponse();
2888 $this->parseWords($this->getWords);
2891 sub ReadServerPBXFile {
2892 my ( $this, $fileName ) = @_;
2893 croak 'usage CGP::CLI->ReadServerPBXFile($fileName)'
2894 unless defined $fileName;
2896 $this->send('ReadServerPBXFile '.$this->printWords($fileName));
2897 return undef unless $this->_parseResponse();
2898 $this->parseWords($this->getWords);
2901 sub StoreServerPBXFile {
2902 my ( $this, $fileName,$base64data ) = @_;
2903 croak 'usage CGP::CLI->StoreServerPBXFile($fileName,$base64data)'
2904 unless defined $fileName && defined $base64data;
2905 $base64data='['.$base64data.']' unless($base64data=~/^\[.*\]$/);
2906 $this->send('StoreServerPBXFile ' .$this->printWords($fileName).' DATA '.$base64data);
2907 $this->_parseResponse();
2910 sub DeleteServerPBXFile {
2911 my ( $this, $fileName ) = @_;
2912 croak 'usage CGP::CLI->DeleteServerPBXFile($fileName)'
2913 unless defined $fileName;
2915 $this->send('StoreServerPBXFile '.$this->printWords($fileName).' DELETE');
2916 $this->_parseResponse();
2921 sub CreateClusterPBX {
2922 my ( $this, $language ) = @_;
2923 croak 'usage CGP::CLI->CreateClusterPBX($language)'
2924 unless defined $language;
2925 my $line = 'CreateClusterPBX ' .$this->printWords($language);
2927 $this->_parseResponse();
2929 sub DeleteClusterPBX {
2930 my ( $this, $language ) = @_;
2931 croak 'usage CGP::CLI->DeleteClusterPBX($language)'
2932 unless defined $language;
2933 my $line = 'DeleteClusterPBX ' .$this->printWords($language);
2935 $this->_parseResponse();
2938 sub ListClusterPBXFiles {
2939 my ($this,$language) = @_;
2941 my $line = 'ListClusterPBXFiles ';
2942 $line .= $this->printWords($language) if($language);
2944 return undef unless $this->_parseResponse();
2945 $this->parseWords($this->getWords);
2948 sub ReadClusterPBXFile {
2949 my ( $this, $fileName ) = @_;
2950 croak 'usage CGP::CLI->ReadClusterPBXFile($fileName)'
2951 unless defined $fileName;
2953 $this->send('ReadClusterPBXFile '.$this->printWords($fileName));
2954 return undef unless $this->_parseResponse();
2955 $this->parseWords($this->getWords);
2958 sub StoreClusterPBXFile {
2959 my ( $this, $fileName,$base64data ) = @_;
2960 croak 'usage CGP::CLI->StoreClusterPBXFile($fileName,$base64data)'
2961 unless defined $fileName && defined $base64data;
2962 $base64data='['.$base64data.']' unless($base64data=~/^\[.*\]$/);
2963 $this->send('StoreClusterPBXFile ' .$this->printWords($fileName).' DATA '.$base64data);
2964 $this->_parseResponse();
2967 sub DeleteClusterPBXFile {
2968 my ( $this, $fileName ) = @_;
2969 croak 'usage CGP::CLI->DeleteClusterPBXFile($fileName)'
2970 unless defined $fileName;
2972 $this->send('StoreClusterPBXFile '.$this->printWords($fileName).' DELETE');
2973 $this->_parseResponse();
2976 #############################################
2977 # Real-Time Application Control
2980 my ($this, $account,$program,$entry,$param) = @_;
2981 croak 'usage CGP::CLI->StartPBXTask($account,$program[,$entryName,$param])'
2982 unless (defined $account && defined $program);
2983 my $line = "StartPBXTask $account PROGRAM $program";
2984 $line .= ' ENTRY '.$entry if($entry);
2985 $line .= ' PARAM '.$param if($param);
2987 return undef unless $this->_parseResponse();
2988 $this->parseWords($this->getWords);
2992 my ($this, $taskID,$eventName,$param) = @_;
2993 croak 'usage CGP::CLI->SendTaskEvent($taskID,$eventName[,$param])'
2994 unless (defined $taskID && defined $eventName);
2995 my $line = "SendTaskEvent $taskID EVENT ".$this->printWords($eventName);
2996 $line .= ' PARAM '.$param if($param);
2998 return undef unless $this->_parseResponse();
2999 $this->parseWords($this->getWords);
3002 my ($this, $taskID) = @_;
3003 croak 'usage CGP::CLI->KillNode($taskID)'
3004 unless (defined $taskID);
3005 my $line = "KillNode $taskID";
3007 $this->_parseResponse();
3010 sub ReadNodeStatus {
3011 my ($this, $taskID) = @_;
3012 croak 'usage CGP::CLI->ReadNodeStatus($taskID)'
3013 unless (defined $taskID);
3014 my $line = "ReadNodeStatus $taskID";
3016 return undef unless $this->_parseResponse();
3017 $this->parseWords($this->getWords);
3020 #############################################
3023 sub RemoveAccountSubset {
3024 my ($this, $account, $subset) = @_;
3025 croak 'usage CGP::CLI->RemoveAccountSubset($account,$subset)'
3026 unless defined $account && defined $subset;
3027 $this->send('RemoveAccountSubset '.$account.' SUBSET '.$this->printWords($subset));
3028 return undef unless $this->_parseResponse();
3032 my ($this, $account, $params) = @_;
3033 croak 'usage CGP::CLI->Roster($account,\%params)'
3034 unless defined $account && defined $params;
3035 $this->send('Roster '.$account.' '.$this->printWords($params));
3036 return undef unless $this->_parseResponse();
3037 $this->parseWords($this->getWords);
3041 my ($this, $account, $params) = @_;
3042 croak 'usage CGP::CLI->Balance($account,\%params)'
3043 unless defined $account && defined $params;
3044 $this->send('Balance '.$account.' '.$this->printWords($params));
3045 return undef unless $this->_parseResponse();
3046 $this->parseWords($this->getWords);
3049 #############################################
3053 my ( $this, $moduleName ) = @_;
3054 $this->send('GetModule '.$moduleName);
3055 return undef unless $this->_parseResponse();
3056 $this->parseWords($this->getWords);
3060 my ( $this, $moduleName, $newSettings ) = @_;
3061 croak 'usage CGP::CLI->UpdateModule($moduleName, \%newSettings)'
3062 unless defined $moduleName && defined $newSettings;
3063 $this->send ('UpdateModule '.$moduleName.' '.$this->printWords($newSettings) );
3064 $this->_parseResponse();
3068 my ( $this, $moduleName, $newSettings ) = @_;
3069 croak 'usage CGP::CLI->SetModule($moduleName, \%newSettings)'
3070 unless defined $moduleName && defined $newSettings;
3071 $this->send ('SetModule '.$moduleName.' '.$this->printWords($newSettings) );
3072 $this->_parseResponse();
3075 sub GetQueueSettings {
3077 $this->send('GetQueueSettings');
3078 return undef unless $this->_parseResponse();
3079 $this->parseWords($this->getWords);
3081 sub SetQueueSettings {
3082 my ( $this, $newSettings ) = @_;
3083 croak 'usage CGP::CLI->SetQueueSettings(\%newSettings)'
3084 unless defined $newSettings;
3085 $this->send ('SetQueueSettings '.$this->printWords($newSettings) );
3086 $this->_parseResponse();
3089 sub GetSignalSettings {
3091 $this->send('GetSignalSettings');
3092 return undef unless $this->_parseResponse();
3093 $this->parseWords($this->getWords);
3095 sub SetSignalSettings {
3096 my ( $this, $newSettings ) = @_;
3097 croak 'usage CGP::CLI->SetSignalSettings(\%newSettings)'
3098 unless defined $newSettings;
3099 $this->send ('SetSignalSettings '.$this->printWords($newSettings) );
3100 $this->_parseResponse();
3102 sub GetMediaServerSettings {
3104 $this->send('GetMediaServerSettings');
3105 return undef unless $this->_parseResponse();
3106 $this->parseWords($this->getWords);
3108 sub SetMediaServerSettings {
3109 my ( $this, $newSettings ) = @_;
3110 croak 'usage CGP::CLI->SetMediaServerSettings(\%newSettings)'
3111 unless defined $newSettings;
3112 $this->send ('SetMediaServerSettings '.$this->printWords($newSettings) );
3113 $this->_parseResponse();
3116 sub GetSessionSettings {
3118 $this->send('GetSessionSettings');
3119 return undef unless $this->_parseResponse();
3120 $this->parseWords($this->getWords);
3122 sub SetSessionSettings {
3123 my ( $this, $newSettings ) = @_;
3124 croak 'usage CGP::CLI->SetSessionSettings(\%newSettings)'
3125 unless defined $newSettings;
3126 $this->send ('SetSessionSettings '.$this->printWords($newSettings) );
3127 $this->_parseResponse();
3131 sub GetClusterSettings {
3133 $this->send('GetClusterSettings');
3134 return undef unless $this->_parseResponse();
3135 $this->parseWords($this->getWords);
3137 sub SetClusterSettings {
3138 my ( $this, $newSettings ) = @_;
3139 croak 'usage CGP::CLI->SetClusterSettings(\%newSettings)'
3140 unless defined $newSettings;
3141 $this->send ('SetClusterSettings '.$this->printWords($newSettings) );
3142 $this->_parseResponse();
3148 $this->send('GetLANIPs');
3149 return undef unless $this->_parseResponse();
3150 $this->parseWords($this->getWords);
3153 sub GetBlacklistedIPs {
3155 $this->send('GetBlacklistedIPs');
3156 return undef unless $this->_parseResponse();
3157 $this->parseWords($this->getWords);
3162 $this->send('GetClientIPs');
3163 return undef unless $this->_parseResponse();
3164 $this->parseWords($this->getWords);
3167 sub GetWhiteHoleIPs {
3169 $this->send('GetWhiteHoleIPs');
3170 return undef unless $this->_parseResponse();
3171 $this->parseWords($this->getWords);
3175 $this->send('GetNATedIPs');
3176 return undef unless $this->_parseResponse();
3177 $this->parseWords($this->getWords);
3181 $this->send('GetDebugIPs');
3182 return undef unless $this->_parseResponse();
3183 $this->parseWords($this->getWords);
3187 $this->send('GetDeniedIPs');
3188 return undef unless $this->_parseResponse();
3189 $this->parseWords($this->getWords);
3194 $this->send('GetProtection');
3195 return undef unless $this->_parseResponse();
3196 $this->parseWords($this->getWords);
3200 $this->send('GetNetwork');
3201 return undef unless $this->_parseResponse();
3202 $this->parseWords($this->getWords);
3207 $this->send('GetBanned');
3208 return undef unless $this->_parseResponse();
3209 $this->parseWords($this->getWords);
3213 my ( $this, $addresses ) = @_;
3214 croak 'usage CGP::CLI->SetLANIPs("10.0.0.1\e192.168.0.1")'
3215 unless defined $addresses;
3216 $this->send ('SetLANIPs '.$this->printWords($addresses));
3217 $this->_parseResponse();
3221 sub SetBlacklistedIPs {
3222 my ( $this, $addresses ) = @_;
3223 croak 'usage CGP::CLI->SetBlacklistedIPs("11.22.33.44\e55.66.77.88")'
3224 unless defined $addresses;
3225 $this->send ('SetBlacklistedIPs '.$this->printWords($addresses));
3226 $this->_parseResponse();
3230 my ( $this, $addresses ) = @_;
3231 croak 'usage CGP::CLI->SetClientIPs("11.22.33.44\e55.66.77.88")'
3232 unless defined $addresses;
3233 $this->send ('SetClientIPs '.$this->printWords($addresses));
3234 $this->_parseResponse();
3237 sub SetWhiteHoleIPs {
3238 my ( $this, $addresses ) = @_;
3239 croak 'usage CGP::CLI->SetWhiteHoleIPs("11.22.33.44\e55.66.77.88")'
3240 unless defined $addresses;
3241 $this->send ('SetWhiteHoleIPs '.$this->printWords($addresses));
3242 $this->_parseResponse();
3245 my ( $this, $addresses ) = @_;
3246 croak 'usage CGP::CLI->SetNATedIPs("192.168.0.1\e10.0.0.1")'
3247 unless defined $addresses;
3248 $this->send ('SetNATedIPs '.$this->printWords($addresses));
3249 $this->_parseResponse();
3252 my ( $this, $addresses ) = @_;
3253 croak 'usage CGP::CLI->SetDebugIPs("11.22.33.44\e55.66.77.88")'
3254 unless defined $addresses;
3255 $this->send ('SetDebugIPs '.$this->printWords($addresses));
3256 $this->_parseResponse();
3259 my ( $this, $addresses ) = @_;
3260 croak 'usage CGP::CLI->SetDeniedIPs("11.22.33.44\e55.66.77.88")'
3261 unless defined $addresses;
3262 $this->send ('SetDeniedIPs '.$this->printWords($addresses));
3263 $this->_parseResponse();
3267 my ( $this, $settings ) = @_;
3268 croak 'usage CGP::CLI->SetProtection(\%settings)'
3269 unless defined $settings;
3270 $this->send ('SetProtection '.$this->printWords($settings));
3271 $this->_parseResponse();
3274 my ( $this, $settings ) = @_;
3275 croak 'usage CGP::CLI->SetNetwork(\%settings)'
3276 unless defined $settings;
3277 $this->send ('SetNetwork '.$this->printWords($settings));
3278 $this->_parseResponse();
3282 my ( $this, $settings ) = @_;
3283 croak 'usage CGP::CLI->SetBanned(\%settings)'
3284 unless defined $settings;
3285 $this->send ('SetBanned '.$this->printWords($settings));
3286 $this->_parseResponse();
3289 sub GetClusterLANIPs {
3291 $this->send('GetClusterLANIPs');
3292 return undef unless $this->_parseResponse();
3293 $this->parseWords($this->getWords);
3296 sub GetClusterBlacklistedIPs {
3298 $this->send('GetClusterBlacklistedIPs');
3299 return undef unless $this->_parseResponse();
3300 $this->parseWords($this->getWords);
3303 sub GetClusterClientIPs {
3305 $this->send('GetClusterClientIPs');
3306 return undef unless $this->_parseResponse();
3307 $this->parseWords($this->getWords);
3310 sub GetClusterWhiteHoleIPs {
3312 $this->send('GetClusterWhiteHoleIPs');
3313 return undef unless $this->_parseResponse();
3314 $this->parseWords($this->getWords);
3316 sub GetClusterNATedIPs {
3318 $this->send('GetClusterNATedIPs');
3319 return undef unless $this->_parseResponse();
3320 $this->parseWords($this->getWords);
3322 sub GetClusterDebugIPs {
3324 $this->send('GetClusterDebugIPs');
3325 return undef unless $this->_parseResponse();
3326 $this->parseWords($this->getWords);
3328 sub GetClusterDeniedIPs {
3330 $this->send('GetClusterDeniedIPs');
3331 return undef unless $this->_parseResponse();
3332 $this->parseWords($this->getWords);
3335 sub GetClusterProtection {
3337 $this->send('GetClusterProtection');
3338 return undef unless $this->_parseResponse();
3339 $this->parseWords($this->getWords);
3341 sub GetClusterNetwork {
3343 $this->send('GetClusterNetwork');
3344 return undef unless $this->_parseResponse();
3345 $this->parseWords($this->getWords);
3347 sub GetClusterBanned {
3349 $this->send('GetClusterBanned');
3350 return undef unless $this->_parseResponse();
3351 $this->parseWords($this->getWords);
3354 sub SetClusterLANIPs {
3355 my ( $this, $addresses ) = @_;
3356 croak 'usage CGP::CLI->SetClusterLANIPs("10.0.0.1\e192.168.0.1")'
3357 unless defined $addresses;
3358 $this->send ('SetClusterLANIPs '.$this->printWords($addresses));
3359 $this->_parseResponse();
3362 sub SetClusterBlacklistedIPs {
3363 my ( $this, $addresses ) = @_;
3364 croak 'usage CGP::CLI->SetClusterBlacklistedIPs("11.22.33.44\e55.66.77.88")'
3365 unless defined $addresses;
3366 $this->send ('SetClusterBlacklistedIPs '.$this->printWords($addresses));
3367 $this->_parseResponse();
3370 sub SetClusterClientIPs {
3371 my ( $this, $addresses ) = @_;
3372 croak 'usage CGP::CLI->SetClusterClientIPs("11.22.33.44\e55.66.77.88")'
3373 unless defined $addresses;
3374 $this->send ('SetClusterClientIPs '.$this->printWords($addresses));
3375 $this->_parseResponse();
3378 sub SetClusterWhiteHoleIPs {
3379 my ( $this, $addresses ) = @_;
3380 croak 'usage CGP::CLI->SetClusterWhiteHoleIPs("11.22.33.44\e55.66.77.88")'
3381 unless defined $addresses;
3382 $this->send ('SetClusterWhiteHoleIPs '.$this->printWords($addresses));
3383 $this->_parseResponse();
3385 sub SetClusterNATedIPs {
3386 my ( $this, $addresses ) = @_;
3387 croak 'usage CGP::CLI->SetClusterNATedIPs("192.168.0.1\e10.0.0.1")'
3388 unless defined $addresses;
3389 $this->send ('SetClusterNATedIPs '.$this->printWords($addresses));
3390 $this->_parseResponse();
3392 sub SetClusterDebugIPs {
3393 my ( $this, $addresses ) = @_;
3394 croak 'usage CGP::CLI->SetClusterDebugIPs("11.22.33.44\e55.66.77.88")'
3395 unless defined $addresses;
3396 $this->send ('SetClusterDebugIPs '.$this->printWords($addresses));
3397 $this->_parseResponse();
3399 sub SetClusterDeniedIPs {
3400 my ( $this, $addresses ) = @_;
3401 croak 'usage CGP::CLI->SetClusterDeniedIPs("11.22.33.44\e55.66.77.88")'
3402 unless defined $addresses;
3403 $this->send ('SetClusterDeniedIPs '.$this->printWords($addresses));
3404 $this->_parseResponse();
3407 sub SetClusterProtection {
3408 my ( $this, $settings ) = @_;
3409 croak 'usage CGP::CLI->SetClusterProtection(\%settings)'
3410 unless defined $settings;
3411 $this->send ('SetClusterProtection '.$this->printWords($settings));
3412 $this->_parseResponse();
3414 sub SetClusterNetwork {
3415 my ( $this, $settings ) = @_;
3416 croak 'usage CGP::CLI->SetClusterNetwork(\%settings)'
3417 unless defined $settings;
3418 $this->send ('SetClusterNetwork '.$this->printWords($settings));
3419 $this->_parseResponse();
3422 sub GetServerRules {
3424 $this->send('GetServerRules');
3425 return undef unless $this->_parseResponse();
3426 $this->parseWords($this->getWords);
3429 sub SetServerRules {
3430 my ($this, $rules) = @_;
3431 croak 'usage CGP::CLI->SetServerRules(\@rules)'
3432 unless defined $rules;
3433 $this->send('SetServerRules '.$this->printWords($rules));
3434 $this->_parseResponse();
3438 sub GetClusterRules {
3440 $this->send('GetClusterRules');
3441 return undef unless $this->_parseResponse();
3442 $this->parseWords($this->getWords);
3445 sub SetClusterRules {
3446 my ($this, $rules) = @_;
3447 croak 'usage CGP::CLI->SetClusterRules(\@rules)'
3448 unless defined $rules;
3449 $this->send('SetClusterRules '.$this->printWords($rules));
3450 $this->_parseResponse();
3453 sub GetServerMailRules {
3455 $this->send('GetServerMailRules');
3456 return undef unless $this->_parseResponse();
3457 $this->parseWords($this->getWords);
3460 sub SetServerMailRules {
3461 my ($this, $rules) = @_;
3462 croak 'usage CGP::CLI->SetServerMailRules(\@rules)'
3463 unless defined $rules;
3464 $this->send('SetServerMailRules '.$this->printWords($rules));
3465 $this->_parseResponse();
3468 #sub UpdateServerMailRule {
3469 # my ($this, $rule) = @_;
3470 # croak 'usage CGP::CLI->UpdateServerMailRules(\@rule)'
3471 # unless defined $rule;
3472 # $this->send('UpdateServerMailRule '.$this->printWords($rule));
3473 # $this->_parseResponse();
3476 sub GetServerSignalRules {
3478 $this->send('GetServerSignalRules');
3479 return undef unless $this->_parseResponse();
3480 $this->parseWords($this->getWords);
3483 sub SetServerSignalRules {
3484 my ($this, $rules) = @_;
3485 croak 'usage CGP::CLI->SetServerSignalRules(\@rules)'
3486 unless defined $rules;
3487 $this->send('SetServerSignalRules '.$this->printWords($rules));
3488 $this->_parseResponse();
3491 #sub UpdateServerSignalRule {
3492 # my ($this, $rule) = @_;
3493 # croak 'usage CGP::CLI->UpdateServerSignalRule(\@rule)'
3494 # unless defined $rule;
3495 # $this->send('UpdateServerSignalRule '.$this->printWords($rule));
3496 # $this->_parseResponse();
3499 sub GetClusterMailRules {
3501 $this->send('GetClusterMailRules');
3502 return undef unless $this->_parseResponse();
3503 $this->parseWords($this->getWords);
3506 sub SetClusterMailRules {
3507 my ($this, $rules) = @_;
3508 croak 'usage CGP::CLI->SetClusterMailRules(\@rules)'
3509 unless defined $rules;
3510 $this->send('SetClusterMailRules '.$this->printWords($rules));
3511 $this->_parseResponse();
3514 #sub UpdateClusterMailRule {
3515 # my ($this, $rule) = @_;
3516 # croak 'usage CGP::CLI->UpdateClusterMailRule(\@rule)'
3517 # unless defined $rule;
3518 # $this->send('UpdateClusterMailRule '.$this->printWords($rule));
3519 # $this->_parseResponse();
3522 sub GetClusterSignalRules {
3524 $this->send('GetClusterSignalRules');
3525 return undef unless $this->_parseResponse();
3526 $this->parseWords($this->getWords);
3529 sub SetClusterSignalRules {
3530 my ($this, $rules) = @_;
3531 croak 'usage CGP::CLI->SetClusterSignalRules(\@rules)'
3532 unless defined $rules;
3533 $this->send('SetClusterSignalRules '.$this->printWords($rules));
3534 $this->_parseResponse();
3537 #sub UpdateClusterSignalRule {
3538 # my ($this, $rule) = @_;
3539 # croak 'usage CGP::CLI->UpdateClusterSignalRule(\@rule)'
3540 # unless defined $rule;
3541 # $this->send('UpdateClusterSignalRule '.$this->printWords($rule));
3542 # $this->_parseResponse();
3549 $this->send('RefreshOSData');
3550 $this->_parseResponse();
3553 sub GetRouterTable {
3555 $this->send('GetRouterTable');
3556 return undef unless $this->_parseResponse();
3557 $this->parseWords($this->getWords);
3560 sub SetRouterTable {
3561 my ($this, $table) = @_;
3562 croak 'usage CGP::CLI->GetRouterTable("<addr1>=addr1\@domain.com\\e<addr2>=addr2\@domain.com\\e")'
3563 unless defined $table;
3564 $this->send('SetRouterTable '.$this->printWords($table));
3565 $this->_parseResponse();
3568 sub GetRouterSettings {
3570 $this->send('GetRouterSettings');
3571 return undef unless $this->_parseResponse();
3572 $this->parseWords($this->getWords);
3575 sub SetRouterSettings {
3576 my ($this, $settings) = @_;
3577 croak 'usage CGP::CLI->SetRouterSettings(\@settings)'
3578 unless defined $settings;
3579 $this->send('SetRouterSettings '.$this->printWords($settings));
3580 $this->_parseResponse();
3584 sub GetClusterRouterTable {
3586 $this->send('GetClusterRouterTable');
3587 return undef unless $this->_parseResponse();
3588 $this->parseWords($this->getWords);
3591 sub SetClusterRouterTable {
3592 my ($this, $table) = @_;
3593 croak 'usage CGP::CLI->SetClusterRouterTable("<addr1>=addr1\@domain.com\\e<addr2>=addr2\@domain.com\\e")'
3594 unless defined $table;
3595 $this->send('SetClusterRouterTable '.$this->printWords($table));
3596 $this->_parseResponse();
3600 sub GetServerIntercept {
3602 $this->send('GetServerIntercept');
3603 return undef unless $this->_parseResponse();
3604 $this->parseWords($this->getWords);
3606 sub SetServerIntercept {
3607 my ( $this, $settings ) = @_;
3608 croak 'usage CGP::CLI->SetServerIntercept(\%settings)'
3609 unless defined $settings;
3610 $this->send ('SetServerIntercept '.$this->printWords($settings));
3611 $this->_parseResponse();
3614 sub GetClusterIntercept {
3616 $this->send('GetClusterIntercept');
3617 return undef unless $this->_parseResponse();
3618 $this->parseWords($this->getWords);
3620 sub SetClusterIntercept {
3621 my ( $this, $settings ) = @_;
3622 croak 'usage CGP::CLI->SetClusterIntercept(\%settings)'
3623 unless defined $settings;
3624 $this->send ('SetClusterIntercept '.$this->printWords($settings));
3625 $this->_parseResponse();
3630 my ($this, $address, $mail) = @_;
3631 croak 'usage CGP::CLI->Route(address[,"mail"])'
3632 unless defined $address;
3633 my $line='Route '.$address;
3634 $line .= ' mail' if($mail);
3636 return undef unless $this->_parseResponse();
3637 $this->parseWords($this->getWords);
3640 #############################################
3641 # Monitoring commands
3643 sub GetSNMPElement {
3644 my ($this, $element) = @_;
3645 $this->send('GetSNMPElement '.$element);
3646 return undef unless $this->_parseResponse();
3647 $this->parseWords($this->getWords);
3649 sub GetStatElement {
3650 my ($this, $element) = @_;
3651 $this->send('GetStatElement '.$element);
3652 return undef unless $this->_parseResponse();
3653 $this->parseWords($this->getWords);
3655 sub GetNextStatName {
3656 my ($this, $element) = @_;
3657 $this->send('GetNextStatName '.$element);
3658 return undef unless $this->_parseResponse();
3659 $this->parseWords($this->getWords);
3663 my ($this, $dialogID) = @_;
3664 $this->send('GetDialogInfo '.$dialogID);
3665 return undef unless $this->_parseResponse();
3666 $this->parseWords($this->getWords);
3671 $this->send('SHUTDOWN');
3672 $this->_parseResponse();
3675 #############################################
3676 # Statistics commands
3678 sub GetAccountStat {
3679 my ($this, $account, $key) = @_;
3680 croak 'usage CGP::CLI->GetAccountStat($account[,$key])'
3681 unless defined $account;
3682 my $line = 'GetAccountStat '.$account;
3683 $line .= ' Key '.$key if $key;
3685 return undef unless $this->_parseResponse();
3686 $this->parseWords($this->getWords);
3689 sub ResetAccountStat {
3690 my ($this, $account, $key) = @_;
3691 croak 'usage CGP::CLI->ResetAccountStat($account[,$key])'
3692 unless defined $account;
3693 my $line = 'ResetAccountStat '.$account;
3694 $line .= ' Key '.$key if $key;
3696 $this->_parseResponse();
3700 my ($this, $domain, $key) = @_;
3701 croak 'usage CGP::CLI->GetDomainStat($domain[,$key])'
3702 unless defined $domain;
3703 my $line = 'GetDomainStat '.$domain;
3704 $line .= ' Key '.$key if $key;
3706 return undef unless $this->_parseResponse();
3707 $this->parseWords($this->getWords);
3710 sub ResetDomainStat {
3711 my ($this, $domain, $key) = @_;
3712 croak 'usage CGP::CLI->ResetDomainStat($domain[,$key])'
3713 unless defined $domain;
3714 my $line = 'ResetDomainStat '.$domain;
3715 $line .= ' Key '.$key if $key;
3717 $this->_parseResponse();
3720 #############################################
3721 # Directory Administration commands
3723 sub ListDirectoryUnits {
3724 my ($this, $shared) = @_;
3725 my $line = 'ListDirectoryUnits';
3726 $line .= ' SHARED' if $shared;
3728 $this->_parseResponse();
3731 sub CreateDirectoryUnit {
3732 my ($this, $unitName,$mountPoint,$shared,$remote) = @_;
3733 croak 'usage CGP::CLI->CreateDirectoryUnit($unitName,$mountPoint,[$shared,[$remote]])'
3734 unless defined $unitName && defined $mountPoint;
3735 my $line = 'CreateDirectoryUnit '.$unitName;
3736 $line .= ' SHARED' if $shared;
3737 $line .= ' REMOTE' if $remote;
3738 $line .= ' '.$mountPoint;
3740 $this->_parseResponse();
3743 sub RelocateDirectoryUnit {
3744 my ($this, $unitName,$newMountPoint,$shared) = @_;
3745 croak 'usage CGP::CLI->RelocateDirectoryUnit($unitName,$newMountPoint,[$shared])'
3746 unless defined $unitName && defined $newMountPoint;
3747 my $line = 'RelocateDirectoryUnit '.$unitName;
3748 $line .= ' SHARED' if $shared;
3749 $line .= ' '.$newMountPoint;
3752 sub DeleteDirectoryUnit {
3753 my ($this, $unitName,$shared) = @_;
3754 croak 'usage CGP::CLI->DeleteDirectoryUnit($unitName,[$shared])'
3755 unless defined $unitName;
3756 my $line = 'DeleteDirectoryUnit '.$unitName;
3757 $line .= ' SHARED' if $shared;
3759 $this->_parseResponse();
3762 sub GetDirectoryUnit {
3763 my ($this, $unitName,$shared) = @_;
3764 croak 'usage CGP::CLI->GetDirectoryUnit($unitName,[$shared])'
3765 unless defined $unitName;
3766 my $line = 'GetDirectoryUnit '.$unitName;
3767 $line .= ' SHARED' if $shared;
3769 return undef unless $this->_parseResponse();
3770 $this->parseWords($this->getWords);
3773 sub SetDirectoryUnit {
3774 my ($this, $unitName,$newSettings,$shared) = @_;
3775 croak 'usage CGP::CLI->SetDirectoryUnit($unitName,$newSettings,[$shared])'
3776 unless defined $unitName && defined $newSettings;
3777 my $line = 'SetDirectoryUnit '.$unitName;
3778 $line .= ' SHARED' if $shared;
3779 $line .= ' '.$this->printWords($newSettings);
3781 $this->_parseResponse();
3784 sub GetDirectoryAccessRights {
3785 my ($this, $shared) = @_;
3786 my $line = 'GetDirectoryAccessRights';
3787 $line .= ' SHARED' if $shared;
3789 return undef unless $this->_parseResponse();
3790 $this->parseWords($this->getWords);
3793 sub SetDirectoryAccessRights {
3794 my ($this, $unitName,$newRights,$shared) = @_;
3795 croak 'usage CGP::CLI->SetDirectoryAccessRights($newRights,[$shared])'
3796 unless defined $newRights;
3797 my $line = 'SetDirectoryAccessRights';
3798 $line .= ' SHARED' if $shared;
3799 $line .= ' '.$this->printWords($newRights);
3801 $this->_parseResponse();
3804 #############################################
3805 # Miscellaneous commands
3808 my ($this, $level, $msg) = @_;
3809 croak 'usage CGP::CLI->WriteLog($level,$message)'
3810 unless defined $level && defined $msg;
3811 $this->send('WriteLog '.$level.' '.$this->printWords($msg));
3812 $this->_parseResponse();
3814 sub ReleaseSMTPQueue {
3815 my ($this, $queue) = @_;
3816 croak 'usage CGP::CLI->ReleaseSMTPQueue($queueName)'
3817 unless defined $queue;
3818 $this->send('ReleaseSMTPQueue '.$this->printWords($queue));
3819 $this->_parseResponse();
3821 sub RejectQueueMessage {
3822 my ($this, $msg, $text) = @_;
3823 croak 'usage CGP::CLI->RejectQueueMessage($msgID [,$errorText])'
3824 unless defined $msg;
3825 my $line = 'RejectQueueMessage '.$msg;
3826 $line .= " ".$this->printWords($text) if $text;
3828 $this->_parseResponse();
3830 sub GetMessageQueueInfo {
3831 my ($this, $moduleName, $queueName) = @_;
3832 croak 'usage CGP::CLI->GetMessageQueueInfo($moduleName,$queueName)'
3833 unless (defined $moduleName && defined $queueName);
3834 my $line = 'GetMessageQueueInfo '.$moduleName.' QUEUE '.$this->printWords($queueName);
3836 return undef unless $this->_parseResponse();
3837 $this->parseWords($this->getWords);
3840 sub GetCurrentController {
3842 $this->send('GetCurrentController');
3843 return undef unless $this->_parseResponse();
3844 $this->parseWords($this->getWords);
3846 sub GetTempClientIPs {
3848 $this->send('GetTempClientIPs');
3849 return undef unless $this->_parseResponse();
3850 $this->parseWords($this->getWords);
3852 sub GetTempBlacklistedIPs {
3854 $this->send('GetTempBlacklistedIPs');
3855 return undef unless $this->_parseResponse();
3856 $this->parseWords($this->getWords);
3858 sub SetTempBlacklistedIPs {
3859 my ( $this, $addresses ) = @_;
3860 croak 'usage CGP::CLI->SetTempBlacklistedIPs("111.11.1.1\e222.2.2.2")'
3861 unless defined $addresses;
3862 $this->send ('SetTempBlacklistedIPs '.$this->printWords($addresses));
3863 $this->_parseResponse();
3867 #########################################################################
3868 #########################################################################
3869 ## Internal routines
3871 sub _setStrangeError
3873 my ($this, $line, $code) = @_;
3876 $this->{errCode} = $code;
3880 $this->{errCode} = $CGP::CLI_CODE_STRANGE;
3882 $this->{errMsg} = $line;
3890 my $responseLine = $this->{theSocket}->getline();
3893 print STDERR "CGP::CLI->_parseResponse::responseLine = $responseLine\n\n"
3894 if $this->{'debug'};
3896 $responseLine =~ /^(\d+)\s(.*)$/;
3897 return $this->_setStrangeError($responseLine) unless ($1);
3898 $this->{errCode} = $1;
3899 if($1 == $CGP::CLI_CODE_OK_INLINE) {
3900 $this->{'inlineResponse'} = $2;
3901 $this->{errMsg} = 'OK';
3903 $this->{errMsg} = $2;
3904 chomp($this->{errMsg});
3905 $this->{errMsg} =~ s/\r$//;
3907 $this->{'lastAccess'}=time();
3913 my $translate = $_[1];
3914 if(!defined($data)) {
3916 } elsif(ref($data) eq 'HASH') {
3919 foreach (sort keys %$data) {
3920 my $value=@$data{$_};
3921 $outp .= convertOutput($_,$translate).'='.convertOutput($value,$translate).';';
3927 } elsif(ref($data) eq 'ARRAY') {
3931 if(!$first) { $outp.=','; } else { $first=0; }
3932 $outp.=convertOutput($_,$translate);
3937 if($data =~ /[\W_]/ || $data eq '') {
3939 $data =~ s/\\((?![enr\d]))/\\\\$1/g;
3940 $data =~ s/\"/\\\"/g;
3942 $data =~ s/([\x00-\x1F\x7F])/'\\'.('0'x(3-length(ord($1)))).ord($1)/ge;
3944 return '"' . $data . '"';
3952 my ($this,$data)= @_;
3953 return convertOutput($data,$this->{'translateStrings'});
3966 if($this->{errCode} == $CGP::CLI_CODE_OK_INLINE) {
3967 return $this->{'inlineResponse'};
3969 my ($bag, $line) = ('', '');
3973 $line = $this->{theSocket}->getline();
3975 $line = strip($line);
3979 $lastLine = '\)' if $1 eq '(';
3980 $lastLine = '\}' if $1 eq '{';
3981 $lastLine = $lastLine . '$';
3986 last if $line =~ /$lastLine/;
3993 my ($this, $command) = @_;
3995 if(time()-$this->{'lastAccess'} > $CGP::TIMEOUT ||
3996 !($this->{theSocket}) ||
3997 $this->{theSocket}->error()) {
3998 $this->{theSocket}->shutdown(SHUT_RDWR) if($this->{theSocket});
3999 unless($this->connect()) {
4000 die "Failure: Can't reopen CLI connection";
4004 $this->{currentCGateCommand} = $command;
4005 print STDERR ref($this) . "->send($command)\n\n"
4006 if $this->{'debug'};
4007 $this->{'lastAccess'}=time();
4008 print {$this->{theSocket}} $command."\012";
4012 ###########################
4016 while($this->{'span'} < $this->{'len'} && substr($this->{'data'},$this->{'span'},1) =~ /\s/) { ++$this->{'span'}; }
4021 my ($isQuoted,$isBlock,$isUnkData)=(0,0,0);
4024 $this->skipSpaces();
4025 if(substr($this->{'data'},$this->{'span'},1) eq '"') {
4026 $isQuoted=1; ++$this->{'span'};
4027 } elsif(substr($this->{'data'},$this->{'span'},1) eq '[') {
4029 } elsif(substr($this->{'data'},$this->{'span'},2) eq '#(') {
4034 while($this->{'span'} < $this->{'len'}) {
4035 my $ch=substr($this->{'data'},$this->{'span'},1);
4039 if(substr($this->{'data'},$this->{'span'}+1,3) =~ /^(?:\"|\\|\d\d\d)/) {
4040 $ch=substr($this->{'data'},++$this->{'span'},3);
4041 if($ch =~ /\d\d\d/) {
4045 $ch=substr($ch,0,1);
4046 $ch='\\'.$ch unless($this->{'translateStrings'});
4049 } elsif($ch eq '"') {
4051 $this->skipSpaces();
4052 if(substr($this->{'data'},$this->{'span'},1) eq '"') {
4061 $this->skipSpaces();
4062 if(substr($this->{'data'},$this->{'span'},1) eq '[') {
4070 } elsif($isUnkData) {
4074 $this->skipSpaces();
4077 } elsif($ch =~ /[-a-zA-Z0-9\x80-\xff_\.\@\!\#\%\:]/) {
4090 return $this->readWord();
4096 my $startSpan=$this->{'span'};
4098 $this->readXMLElem();
4099 if(substr($this->{'data'},$this->{'span'},1) ne '<') {
4105 return substr($this->{'data'},$startSpan-1,$this->{'span'}-$startSpan+1);
4112 my $endPos=index($this->{'data'},'>',$this->{'span'});
4113 if($endPos<$this->{'span'}-1) {
4114 croak "XML parsing error:",substr($this->{'data'},$this->{'span'}-1,100);
4116 if(substr($this->{'data'},$endPos-1,1) eq '/') { # <tag attr="..." />
4117 $this->{'span'}=$endPos+1;
4120 if(substr($this->{'data'},$this->{'span'},1)=~/[\!\?]/) { # <! or <?
4121 $this->{'span'}=$endPos+1;
4124 unless(substr($this->{'data'},$this->{'span'},$endPos - $this->{'span'}+1) =~/(.+?)[ \>]/) {
4125 croak "XML reading error:",substr($this->{'data'},$this->{'span'}-1,100);
4128 #print "endElement=$1\n";
4129 $this->{'span'}=$endPos+1;
4130 #print "parsed=".substr($this->{'data'},$this->{'span'},10)."\n";
4131 $this->{'span'}++ while($this->{'span'} < $this->{'len'} && substr($this->{'data'},$this->{'span'},1) ne '<');
4132 while($this->{'span'} < $this->{'len'}) {
4133 if(substr($this->{'data'},$this->{'span'},$this->{'len'} - $this->{'span'})=~/^\<\/$element\>/) { #found closing element
4134 my $endPos=index($this->{'data'},'>',$this->{'span'}+1);
4135 $this->{'span'}=$endPos+1;
4139 $this->readXMLElem();
4146 $this->skipSpaces();
4147 my $ch=substr($this->{'data'},$this->{'span'},1);
4150 return $this->readDictionary();
4151 } elsif($ch eq '(') {
4153 return $this->readArray();
4154 } elsif($ch eq '<') {
4156 return $this->readXML();
4158 return $this->readWord();
4165 while($this->{'span'}<$this->{'len'}) {
4166 $this->skipSpaces();
4167 if(substr($this->{'data'},$this->{'span'},1) eq ')') {
4171 my $theValue=$this->readValue();
4172 $this->skipSpaces();
4173 push(@$result,$theValue);
4174 if(substr($this->{'data'},$this->{'span'},1) eq ',') {
4176 } elsif(substr($this->{'data'},$this->{'span'},1) eq ')') {
4178 croak "CGPro output format error:",substr($this->{'data'},$this->{'span'},10);
4185 sub readDictionary {
4188 while($this->{'span'} < $this->{'len'}) {
4189 $this->skipSpaces();
4190 if(substr($this->{'data'},$this->{'span'},1) eq '}') {
4194 my $theKey=$this->readKey();
4195 $this->skipSpaces();
4196 if(substr($this->{'data'},$this->{'span'},1) ne '=') { croak "CGPro output format error:",substr($this->{'data'},$this->{'span'},10); }
4198 @$result{$theKey}=$this->readValue();
4199 $this->skipSpaces();
4200 if(substr($this->{'data'},$this->{'span'},1) ne ';') { croak "CGPro output format error:",substr($this->{'data'},$this->{'span'},10); }
4210 $this->{'data'}=shift;
4212 $this->{'len'}=length($this->{'data'});
4213 return $this->readValue();
4227 See http://www.stalker.com/CGPerl/
4231 CommunigatePro Command Line Interface perl module.
4233 This is Stalker's CLI.pm packaged for CPAN.
4234 The original CLI.pm file is available from Stalker's website at:
4236 http://www.stalker.com/CGPerl/CLI.pm
4238 The only changes are the addition of the VERSION variable for MakeMaker
4239 and this short POD at the end.
4243 Stalker, Inc. <support@stalker.com>