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
49 # [Get|Set|Update]AccountPrefs
50 # GetEffectiveaAccountPrefs
55 ############################## Group Commands
63 ############################## Forwarder Commands
71 ############################## Domain commands
74 # [Get|Update|Set]DomainSettings
75 # GetDomainEffectiveSettings
76 # [Create|Rename|Delete]Domain
77 # [Suspend|Resume]Domain
79 # CreateDirectoryDomain
80 # [Get|Set]DomainRules
81 # [Get|Set]DomainAliases
83 # [Insert|Delete]DirectoryRecords
84 # [Get|Set][Server|Cluster]TrustedCerts
86 # [Get|Set]DirectoryIntegration
87 # [Get|Set]ClusterDirectoryIntegration
90 # [Get|Update|Set]DomainDefaults
91 # [Get|Update|Set]ClusterDomainDefaults
92 # [Get|Update|Set]AllAccountsDefaults *
93 # [Get|Update|Set]ServerAccountsDefaults
96 # [Get|Update|Set]AccountDefaults
97 # [Get|Update|Set]ClusterAccountDefaults
98 # [Get|Set|Update]AccountDefaultPrefs
99 # [Get|Set][Server|Cluster]AccountPrefs
100 # [Get|Update|Set]AccountTemplate
102 ############################## Mailbox Administration
104 # [Create|Rename|Delete]Mailbox
105 # [Rename|Delete]Mailboxes
107 # [Get|Set]MailboxACL
111 # [Get|Set]AccountSubscription
112 # [Get|Set]MailboxAliases
114 ############################## Alerts Administration
115 # Get[Domain|Account|Server|Cluster]Alerts
116 # Set[Domain|Account|Server|Cluster]Alerts
117 # Post[Domain|Account|Server|Cluster]Alert
118 # Remove[Domain|Account|Server|Cluster]Alert
120 ############################## Personal Web Site Administration
128 ############################## Lists commands
132 # [Create|Rename|Delete|Get|Update]List
139 ############################## Web Skins Administration
140 # ListDomainSkins( [domainName] )
141 # CreateDomainSkin(domainName,skinName)
142 # RenameDomainSkin(domainName,oldSkinName,newSkinName)
143 # DeleteDomainSkin(domainName,skinName)
144 # ListDomainSkinFiles(domainName,skinName)
145 # ReadDomainSkinFile(domainName,skinName,fileName)
146 # StoreDomainSkinFile(domainName,skinName,fileName,base64data)
147 # DeleteDomainSkinFile(domainName,skinName,fileName)
150 # CreateServerSkin(skinName)
151 # RenameServerSkin(oldSkinName,newSkinName)
152 # DeleteServerSkin(skinName)
153 # ListServerSkinFiles(skinName)
154 # ReadServerSkinFile(skinName,fileName)
155 # StoreServerSkinFile(skinName,fileName,base64data)
156 # DeleteServerSkinFile(skinName,fileName)
159 # CreateClusterSkin(skinName)
160 # RenameClusterSkin(oldSkinName,newSkinName)
161 # DeleteClusterSkin(skinName)
162 # ListClusterSkinFiles(skinName)
163 # ReadClusterSkinFile(skinName,fileName)
164 # StoreClusterSkinFile(skinName,fileName,base64data)
165 # DeleteClusterSkinFile(skinName,fileName)
167 ############################## Web Interface Tuning
168 # [List|Get|Put|Delete]WebUserInterface
171 ############################## Web Interface Integration
172 # [Create|Get|Kill|Find]WebUserSession
174 ############################## Real-Time Application Administration
175 # Create[Domain|Server|Cluster]PBX
176 # List[Domain|Server|Cluster]PBXFiles
177 # [Read|Store|Delete][Domain|Server|Cluster]PBXFile
179 ############################## Server commands
180 # [Get|Update|Set]Module
183 # [Get|Set]BlacklistedIPs
185 # [Get|Set]WhiteHoleIPs
186 # [Get|Set]Protection
189 # [Get|Set]ClusterLANIPs
190 # [Get|Set]ClusterBlacklistedIPs
191 # [Get|Set]ClusterClientIPs
192 # [Get|Set]ClusterWhiteHoleIPs
193 # [Get|Set]ClusterProtection
196 # [Get|Set][Server|Cluster]Rules
197 # [Get|Set][Server|Cluster][Mail|Signal]Rules
198 ## Update[Server|Cluster][Mail|Signal]Rule
201 # [Get|Set]RouterTable
202 # [Get|Set]RouterSettings
203 # [Get|Set]ClusterRouterTable
204 # [Get|Set][Server|Cluster]Intercept
208 ############################## Monitoring commands
212 ############################## Statistics commands
213 # [Get|Reset]AccountStat
214 # [Get|Reset]DomainStat
216 ############################## Miscellaneous commands
220 # GetMessageQueueInfo
221 # GetCurrentController
223 # [Get|Set]TempBlacklistedIPs
224 # RemoveAccountSubset
225 # List[Domain|Server|Cluster]Telnums
227 ##############################################################
234 # You may need to change this to "use IO::Socket::INET;" if you have INET.pm
237 # You may need to install this module.
238 # See <http://search.cpan.org/search?module=Digest::MD5>
241 use vars qw($VERSION);
242 ($VERSION) = '2.7.5';
245 $CGP::SECURE_LOGIN = 1;
246 $CGP::WEBUSER_LOGIN = 0;
247 $CGP::TIMEOUT = 60*5-5; # 5 minutes timeout
249 $CGP::ERR_STRING = "No error";
251 $CGP::CLI_CODE_OK = 200;
252 $CGP::CLI_CODE_OK_INLINE = 201;
254 $CGP::CLI_CODE_PASSWORD = 300;
255 $CGP::CLI_CODE_UNKNOW_USER = 500;
256 $CGP::CLI_CODE_GEN_ERR = 501;
257 $CGP::CLI_CODE_STRANGE = 10000;
264 $this->{isConnected}=0;
266 delete $this->{theSocket};
268 $this->{theSocket} = new IO::Socket::INET( %{$this->{connParams}} );
270 unless(defined $this->{theSocket} && $this->{theSocket}) {
271 $CGP::ERR_STRING="Can't open connection to CGPro Server";
274 $this->{theSocket}->autoflush(1);
276 unless($this->_parseResponse()) {
277 $CGP::ERR_STRING="Can't read CGPro Server prompt";
281 if($this->{isSecureLogin} && $this->{errMsg} =~ /(\<.*\@*\>)/) {
282 my $md5=Digest::MD5->new;
284 $md5->add($1.$this->{password});
285 $this->send('APOP '.$this->{login}.' '.$md5->hexdigest);
286 $this->_parseResponse();
288 $CGP::ERR_STRING="Can't create MD5 object";
289 close($this->{theSocket});
292 } elsif($this->{isWebUserLogin}) {
293 $this->send('AUTH WEBUSER '.$this->{login}.' '.$this->{password});
294 $this->_parseResponse();
297 $this->send('USER '.$this->{login});
298 $this->_parseResponse();
299 unless( $this->{errCode} == $CGP::CLI_CODE_PASSWORD) {
300 $CGP::ERR_STRING="Unexpected answer: ".$this->{errCode};
301 close($this->{theSocket});
304 $this->send('PASS '.$this->{password});
305 $this->_parseResponse();
308 unless($this->isSuccess) {
309 $CGP::ERR_STRING=$this->{errMsg};
310 close($this->{theSocket});
313 $this->send('INLINE');
314 $this->_parseResponse();
315 $this->setStringsTranslateMode(0);
316 $this->{isConnected}=1;
322 my ($class, $params) = @_;
325 $this->{login} = delete $params->{'login'};
326 $this->{password} = delete $params->{'password'};
328 $this->{isSecureLogin} = delete $params->{'SecureLogin'};
329 $this->{isWebUserLogin} = delete $params->{'WebUserLogin'};
332 $this->{isSecureLogin} = $CGP::SECURE_LOGIN unless defined $this->{isSecureLogin};
333 $this->{isWebUserLogin} = $CGP::WEBUSER_LOGIN unless defined $this->{isWebUserLogin};
336 croak 'You must pass login parameter to CGP::CLI::new'
337 unless defined $this->{login};
338 croak 'You must pass password parameter to CGP::CLI::new'
339 unless defined $this->{password};
341 croak 'SecureLogin and WebUserLogin are mutually exclusive'
342 if($this->{isSecureLogin} && $this->{isWebUserLogin});
346 $this->{connParams}=$params;
348 if(!(defined $params->{'connectNow'}) || $params->{'connectNow'}) {
349 unless($this->connect()) {
358 $this->Logout() if($this->{isConnected});
363 return $this->{errCode};
368 return $this->{errMsg};
373 return $this->{'currentCGateCommand'};
378 return ($this->{errCode} == $CGP::CLI_CODE_OK || $this->{errCode} == $CGP::CLI_CODE_OK_INLINE);
382 my ($this, $debugFlag) = @_;
383 $this->{'debug'} = $debugFlag;
386 sub setStringsTranslateMode {
387 my ($this, $onFlag) = @_;
388 $this->{'translateStrings'} = $onFlag;
394 $this->_parseResponse();
395 $this->{isConnected}=0;
399 my ($this, $newPassword) = @_;
400 croak 'usage CGP::CLI->NewPassword($newPassword)'
401 unless defined $newPassword;
402 $this->send('NEWPASS '.$newPassword);
403 $this->_parseResponse();
407 my ($this, $command) = @_;
408 croak 'usage CGP::CLI->SendCommand($commandString)'
409 unless defined $command;
410 $this->send($command);
411 $this->_parseResponse();
414 sub GetResponseData {
416 $this->parseWords($this->getWords);
420 ####################################################################
423 sub ListDomainObjects {
424 my ($this, $domainName,$limit,$filter,$what,$cookie) = @_;
425 croak 'usage CGP::CLI->ListDomainObjects($domainName,$limit[,$filter][,$what][,$cookie])'
426 unless defined $domainName && defined $limit;
427 my $line = "ListDomainObjects $domainName";
428 $line .= ' FILTER '.$this->printWords($filter) if defined $filter;
430 $line .= " $what" if $what;
431 $line .= " COOKIE ".$this->printWords($cookie) if defined $cookie;
433 return undef unless $this->_parseResponse();
434 $this->parseWords($this->getWords);
439 my ($this, $domainName) = @_;
440 my $line = 'ListAccounts';
441 $line .= ' '.$domainName if $domainName;
443 return undef unless $this->_parseResponse();
444 $this->parseWords($this->getWords);
447 sub ListDomainTelnums {
448 my ($this, $domainName,$limit,$filter) = @_;
449 croak 'usage CGP::CLI->ListDomainTelnums($domainName,$limit[,$filter])'
450 unless defined $domainName && defined $limit;
451 my $line = "ListDomainTelnums $domainName";
452 $line .= ' FILTER '.$this->printWords($filter) if defined $filter;
455 return undef unless $this->_parseResponse();
456 $this->parseWords($this->getWords);
465 croak 'usage CGP::CLI->CreateAccount(accountName => \'newAccountName\',
466 accountType => \'accountType\',
467 externalFlag => \'externalFlag\',
468 settings => $settings)'
469 unless exists $params{accountName};
470 my $line = 'CreateAccount '.$params{accountName};
471 $line .= ' ' . $params{accountType} if exists $params{accountType};
472 $line .= ' ' . 'external' if exists $params{externalFlag};
473 $line .= ' ' . $this->printWords($params{settings}) if exists $params{settings};
476 $this->_parseResponse();
480 my ($this, $oldAccountName, $newAccountName) = @_;
481 croak 'usage CGP::CLI->RenameAccount($oldAccountName, $newAccountName)'
482 unless defined $oldAccountName && defined $newAccountName;
483 $this->send('RenameAccount '.$oldAccountName.' into '.$newAccountName);
484 $this->_parseResponse();
488 my ($this, $accountName) = @_;
489 croak 'usage CGP::CLI->DeleteAccount($accountName)'
490 unless defined $accountName;
491 $this->send('DeleteAccount '.$accountName);
492 $this->_parseResponse();
495 my ($this, $accountName,$type) = @_;
496 croak 'usage CGP::CLI->SetAccountType($accountName,$type)'
497 unless (defined $accountName && defined $type);
498 $this->send('SetAccountType '.$accountName.' '.$type);
499 $this->_parseResponse();
502 sub GetAccountSettings {
503 my ($this, $accountName) = @_;
504 croak 'usage CGP::CLI->GetAccountSettings($accountName)'
505 unless defined $accountName;
506 $this->send('GetAccountSettings '.$accountName);
507 return undef unless $this->_parseResponse();
508 $this->parseWords($this->getWords);
512 GetAccountSettings(@_);
515 sub GetAccountEffectiveSettings {
516 my ($this, $accountName) = @_;
517 croak 'usage CGP::CLI->GetAccountEffectiveSettings($accountName)'
518 unless defined $accountName;
519 $this->send('GetAccountEffectiveSettings '.$accountName);
520 return undef unless $this->_parseResponse();
521 $this->parseWords($this->getWords);
524 sub UpdateAccountSettings {
525 my ($this, $accountName, $params) = @_;
526 croak 'usage CGP::CLI->UpdateAccountSettings($accountName, \%settings)'
527 unless defined $accountName;
528 $this->send('UpdateAccountSettings '.$accountName.' '.$this->printWords($params));
529 $this->_parseResponse();
533 UpdateAccountSettings(@_);
536 sub SetAccountSettings {
537 my ($this, $accountName, $params) = @_;
538 croak 'usage CGP::CLI->SetAccountSettings($accountName, \%settings)'
539 unless defined $accountName;
540 $this->send('SetAccountSettings '.$accountName.' '.$this->printWords($params));
541 $this->_parseResponse();
545 SetAccountSettings(@_);
548 sub SetAccountPassword {
549 my ($this, $accountName, $newPass) = @_;
550 croak 'usage CGP::CLI->SetAccountPassword($accountName, $newPassword)'
551 unless defined $accountName && defined $newPass;
552 $this->send('SetAccountPassword '.$accountName.' TO '.$this->printWords($newPass));
553 $this->_parseResponse();
556 sub VerifyAccountPassword {
557 my ($this, $accountName, $pass) = @_;
558 croak 'usage CGP::CLI->VerifyAccountPassword($accountName, $password)'
559 unless defined $accountName && defined $pass;
560 $this->send('VerifyAccountPassword '.$accountName.' PASSWORD '.$this->printWords($pass));
561 $this->_parseResponse();
565 sub GetAccountAliases {
566 my ($this, $accountName) = @_;
567 croak 'usage CGP::CLI->GetAccountAliases($accountName)'
568 unless defined $accountName;
569 $this->send('GetAccountAliases '.$accountName);
570 return undef unless $this->_parseResponse();
571 $this->parseWords($this->getWords);
574 sub SetAccountAliases {
575 my ($this, $accountName, $aliases) = @_;
576 croak 'usage CGP::CLI->SetAccountAliases($accountName, \@aliases)'
577 unless defined $accountName && defined $aliases;
578 $this->send('SetAccountAliases '.$accountName.' '.$this->printWords($aliases));
579 $this->_parseResponse();
582 sub GetAccountTelnums {
583 my ($this, $accountName) = @_;
584 croak 'usage CGP::CLI->GetAccountTelnums($accountName)'
585 unless defined $accountName;
586 $this->send('GetAccountTelnums '.$accountName);
587 return undef unless $this->_parseResponse();
588 $this->parseWords($this->getWords);
591 sub SetAccountTelnums {
592 my ($this, $accountName, $aliases) = @_;
593 croak 'usage CGP::CLI->SetAccountTelnums($accountName, \@telnums)'
594 unless defined $accountName && defined $aliases;
595 $this->send('SetAccountTelnums '.$accountName.' '.$this->printWords($aliases));
596 $this->_parseResponse();
600 sub GetAccountRules {
601 my ($this, $accountName) = @_;
602 croak 'usage CGP::CLI->GetAccountRules($accountName)'
603 unless defined $accountName;
604 $this->send('GetAccountRules '.$accountName);
605 return undef unless $this->_parseResponse();
606 $this->parseWords($this->getWords);
609 sub SetAccountRules {
610 my ($this, $accountName, $rules) = @_;
611 croak 'usage CGP::CLI->SetAccountRules($accountName, \@rules)'
612 unless defined $accountName && defined $rules;
613 $this->send('SetAccountRules '.$accountName.' '.$this->printWords($rules));
614 $this->_parseResponse();
617 sub GetAccountMailRules {
618 my ($this, $accountName) = @_;
619 croak 'usage CGP::CLI->GetAccountMailRules($accountName)'
620 unless defined $accountName;
621 $this->send('GetAccountMailRules '.$accountName);
622 return undef unless $this->_parseResponse();
623 $this->parseWords($this->getWords);
626 sub SetAccountMailRules {
627 my ($this, $accountName, $rules) = @_;
628 croak 'usage CGP::CLI->SetAccountMailRules($accountName, \@rules)'
629 unless defined $accountName && defined $rules;
630 $this->send('SetAccountMailRules '.$accountName.' '.$this->printWords($rules));
631 $this->_parseResponse();
633 sub UpdateAccountMailRule {
634 my ($this, $accountName, $rule) = @_;
635 croak 'usage CGP::CLI->UpdateAccountMailRule($accountName, \@rule)'
636 unless defined $accountName && defined $rule;
637 $this->send('UpdateAccountMailRule '.$accountName.' '.$this->printWords($rule));
638 $this->_parseResponse();
641 sub GetAccountSignalRules {
642 my ($this, $accountName) = @_;
643 croak 'usage CGP::CLI->GetAccountSignalRules($accountName)'
644 unless defined $accountName;
645 $this->send('GetAccountSignalRules '.$accountName);
646 return undef unless $this->_parseResponse();
647 $this->parseWords($this->getWords);
650 sub SetAccountSignalRules {
651 my ($this, $accountName, $rules) = @_;
652 croak 'usage CGP::CLI->SetAccountSignalRules($accountName, \@rules)'
653 unless defined $accountName && defined $rules;
654 $this->send('SetAccountSignalRules '.$accountName.' '.$this->printWords($rules));
655 $this->_parseResponse();
657 sub UpdateAccountSignalRule {
658 my ($this, $accountName, $rule) = @_;
659 croak 'usage CGP::CLI->UpdateAccountSignalRule($accountName, \@rule)'
660 unless defined $accountName && defined $rule;
661 $this->send('UpdateAccountSignalRule '.$accountName.' '.$this->printWords($rule));
662 $this->_parseResponse();
666 my ($this, $accountName) = @_;
667 croak 'usage CGP::CLI->GetAccountRPOP($accountName)'
668 unless defined $accountName;
669 $this->send('GetAccountRPOP '.$accountName);
670 return undef unless $this->_parseResponse();
671 $this->parseWords($this->getWords);
675 my ($this, $accountName, $newRecords) = @_;
676 croak 'usage CGP::CLI->SetAccountAliases($accountName, \@newRecords)'
677 unless defined $accountName && defined $newRecords;
678 $this->send('SetAccountRPOP '.$accountName.' '.$this->printWords($newRecords));
679 $this->_parseResponse();
682 sub GetAccountRights {
683 my ($this, $account) = @_;
684 croak 'usage CGP::CLI->GetAccountRights($account)'
685 unless defined $account;
686 $this->send('GetAccountRights '.$account);
687 return undef unless $this->_parseResponse();
688 $this->parseWords($this->getWords);
691 sub SetAccountRights {
692 my ($this, $account, $list) = @_;
693 croak 'usage CGP::CLI->SetAccountRigthts($acount, \@list)'
694 unless defined $account && defined $list;
695 my $line = 'SetAccountRights '.$account.' '.$this->printWords($list);
698 $this->_parseResponse();
702 my ($this, $account, $key) = @_;
703 croak 'usage CGP::CLI->GetAccountInfo($account,$key)'
704 unless defined $account && defined $key;
705 $this->send('GetAccountInfo '.$account.' Key '.$this->printWords($key));
706 return undef unless $this->_parseResponse();
707 $this->parseWords($this->getWords);
711 my ($this, $account) = @_;
712 croak 'usage CGP::CLI->GetWebUser($account)'
713 unless defined $account;
714 $this->send('GetWebUser '.$account);
715 return undef unless $this->_parseResponse();
716 $this->parseWords($this->getWords);
720 sub GetAccountPrefs {
721 my ($this, $account) = @_;
722 croak 'usage CGP::CLI->GetAccountPrefs($account)'
723 unless defined $account;
724 $this->send('GetAccountPrefs '.$account);
725 return undef unless $this->_parseResponse();
726 $this->parseWords($this->getWords);
730 my ($this, $account, $settings) = @_;
731 croak 'usage CGP::CLI->SetWebUser($acount, \%settings)'
732 unless defined $account && defined $settings;
733 my $line = 'SetWebUser '.$account.' '.$this->printWords($settings);
736 $this->_parseResponse();
739 sub SetAccountPrefs {
740 my ($this, $account, $settings) = @_;
741 croak 'usage CGP::CLI->SetAccountPrefs($acount, \%settings)'
742 unless defined $account && defined $settings;
743 my $line = 'SetAccountPrefs '.$account.' '.$this->printWords($settings);
746 $this->_parseResponse();
748 sub UpdateAccountPrefs {
749 my ($this, $account, $settings) = @_;
750 croak 'usage CGP::CLI->UpdateAccountPrefs($acount, \%settings)'
751 unless defined $account && defined $settings;
752 my $line = 'UpdateAccountPrefs '.$account.' '.$this->printWords($settings);
755 $this->_parseResponse();
759 sub GetEffectiveWebUser {
760 my ($this, $account) = @_;
761 croak 'usage CGP::CLI->GetEffectiveWebUser($account)'
762 unless defined $account;
763 $this->send('GetEffectiveWebUser '.$account);
764 return undef unless $this->_parseResponse();
765 $this->parseWords($this->getWords);
768 sub GetEffectiveAccountPrefs {
769 my ($this, $account) = @_;
770 croak 'usage CGP::CLI->GetEffectiveAccountPrefs($account)'
771 unless defined $account;
772 $this->send('GetEffectiveAccountPrefs '.$account);
773 return undef unless $this->_parseResponse();
774 $this->parseWords($this->getWords);
778 sub KillAccountSessions {
779 my ($this, $account) = @_;
780 croak 'usage CGP::CLI->KillAccountSessions($account)'
781 unless defined $account;
782 $this->send('KillAccountSessions '.$account);
783 $this->_parseResponse();
787 my ($this, $account,$authAccountName) = @_;
788 croak 'usage CGP::CLI->GetAccountACL($accountName [,authAccountName])'
789 unless defined $account;
791 my $line = 'GetAccountACL '.$account;
792 $line .= ' AUTH '.$authAccountName if($authAccountName);
794 return undef unless $this->_parseResponse();
795 $this->parseWords($this->getWords);
799 my ($this, $account, $newACL,$authAccountName) = @_;
800 croak 'usage CGP::CLI->SetAccountACL($acountACL, \%newACL [,$authAccountName])'
801 unless defined $account && defined $newACL;
802 my $line = 'SetAccountACL '.$account;
803 $line .= ' AUTH '.$authAccountName if($authAccountName);
804 $line.=' '.$this->printWords($newACL);
806 $this->_parseResponse();
809 sub GetAccountACLRights {
810 my ($this, $account,$authAccountName) = @_;
811 croak 'usage CGP::CLI->GetAccountACLRights($accountName ,authAccountName)'
812 unless (defined $account && defined $authAccountName);
814 my $line = 'GetAccountACLRights '.$account.' AUTH '.$authAccountName ;
816 return undef unless $this->_parseResponse();
817 $this->parseWords($this->getWords);
820 #################################################################
821 # Group managent commands
824 my ($this, $domainName) = @_;
825 my $line = 'ListGroups';
826 $line .= ' '.$domainName if $domainName;
828 return undef unless $this->_parseResponse();
829 $this->parseWords($this->getWords);
833 my ($this, $groupName, $params) = @_;
834 croak 'usage CGP::CLI->CreateGroup($groupName[, \%params])'
835 unless defined $groupName;
836 my $line = 'CreateGroup '.$groupName;
837 $line .= ' '.$this->printWords($params) if $params;
839 $this->_parseResponse();
843 my ($this, $oldGroupName, $newGroupName) = @_;
844 croak 'usage CGP::CLI->RenameGroup($oldGroupName, $newGroupName)'
845 unless defined $oldGroupName && defined $newGroupName;
846 $this->send('RenameGroup '.$oldGroupName.' into '.$newGroupName);
847 $this->_parseResponse();
851 my ($this, $groupName) = @_;
852 croak 'usage CGP::CLI->DeleteGroup($groupName)'
853 unless defined $groupName;
854 $this->send('DeleteGroup '.$groupName);
855 $this->_parseResponse();
859 my ($this, $groupName) = @_;
860 croak 'usage CGP::CLI->GetGroup($groupName)'
861 unless defined $groupName;
862 $this->send('GetGroup '.$groupName);
863 return undef unless $this->_parseResponse();
864 $this->parseWords($this->getWords);
868 my ($this, $groupName, $params) = @_;
869 croak 'usage CGP::CLI->SetGroup($groupName, \%settings)'
870 unless defined $groupName && defined $params;
871 $this->send('SetGroup '.$groupName.' '.$this->printWords($params));
872 $this->_parseResponse();
876 #################################################################
877 # Forwarder managent commands
880 my ($this, $domainName) = @_;
881 my $line = 'ListForwarders';
882 $line .= ' ' .$domainName if $domainName;
884 return undef unless $this->_parseResponse();
885 $this->parseWords($this->getWords);
888 sub CreateForwarder {
889 my ($this, $forwarderName, $address) = @_;
890 croak 'usage CGP::CLI->CreateForwarder($forwarderName, $address)'
891 unless defined $forwarderName && defined $address;
892 $this->send('CreateForwarder '.$forwarderName.' TO '.$this->printWords($address));
893 $this->_parseResponse();
895 sub RenameForwarder {
896 my ($this, $forwarderName, $newName) = @_;
897 croak 'usage CGP::CLI->RenameForwarder($forwarderName, $newName)'
898 unless defined $forwarderName && defined $newName;
899 $this->send('RenameForwarder '.$forwarderName.' into '.$newName);
900 $this->_parseResponse();
903 sub DeleteForwarder {
904 my ($this, $forwarderName) = @_;
905 croak 'usage CGP::CLI->DeleteForwarder($forwarderName)'
906 unless defined $forwarderName;
907 $this->send('DeleteForwarder '.$forwarderName);
908 $this->_parseResponse();
912 my ($this, $forwarderName) = @_;
913 croak 'usage CGP::CLI->GetForwarder($forwarderName)'
914 unless defined $forwarderName;
915 $this->send('GetForwarder '.$forwarderName);
916 return undef unless $this->_parseResponse();
917 $this->parseWords($this->getWords);
920 my ($this, $domain,$forwarderAddress) = @_;
921 croak 'usage CGP::CLI->FindForwarders($domainName,$forwarderAddress)'
922 unless (defined $domain && defined $forwarderAddress);
923 $this->send('FindForwarders '.$domain.' TO '.$this->printWords($forwarderAddress));
924 return undef unless $this->_parseResponse();
925 $this->parseWords($this->getWords);
928 #################################################################
929 # Domain managent commands
933 $this->send('ListDomains');
934 return undef unless $this->_parseResponse();
935 $this->parseWords($this->getWords);
940 $this->send('MainDomainName');
941 return undef unless $this->_parseResponse();
942 $this->parseWords($this->getWords);
945 sub GetDomainSettings {
946 my ($this, $domainName) = @_;
948 my $line = 'GetDomainSettings';
949 $line .= ' '.$domainName if($domainName);
952 return undef unless $this->_parseResponse();
953 $this->parseWords($this->getWords);
957 GetDomainSettings(@_);
960 sub GetDomainEffectiveSettings {
961 my ($this, $domainName) = @_;
962 my $line = 'GetDomainEffectiveSettings';
963 $line .= ' '.$domainName if($domainName);
965 return undef unless $this->_parseResponse();
966 $this->parseWords($this->getWords);
969 sub UpdateDomainSettings {
973 croak 'usage CGP::CLI->UpdateDomainSettings(domain => \'domainName\',settings => {settings})'
974 unless exists $params{settings};
976 my $line = 'UpdateDomainSettings';
977 $line .= ' '.$params{domain} if exists $params{domain};
978 $this->send($line.' '.$this->printWords($params{settings}));
979 $this->_parseResponse();
983 UpdateDomainSettings(@_);
986 sub SetDomainSettings {
990 croak 'usage CGP::CLI->SetDomainSettings(domain => \'domainName\',settings => {settings})'
991 unless exists $params{settings};
993 my $line = 'SetDomainSettings';
994 $line .= ' '.$params{domain} if exists $params{domain};
995 $this->send($line.' '.$this->printWords($params{settings}));
996 $this->_parseResponse();
1000 SetDomainSettings(@_);
1005 my ($this, $domainName, $params) = @_;
1006 croak 'usage CGP::CLI->CreateDomain($domainName[, \%params])'
1007 unless defined $domainName;
1008 my $line = 'CreateDomain '.$domainName;
1009 $line .= ' '.$this->printWords($params) if $params;
1011 $this->_parseResponse();
1015 my ($this, $oldDomainName, $newDomainName) = @_;
1016 croak 'usage CGP::CLI->RenameDomain($oldDomainName, $newDomainName)'
1017 unless defined $oldDomainName && defined $newDomainName;
1018 $this->send('RenameDomain '.$oldDomainName.' into '.$newDomainName );
1019 $this->_parseResponse();
1023 my ($this, $domainName, $force) = @_;
1024 croak 'usage CGP::CLI->DeleteDomain($domainName[, $force])'
1025 unless defined $domainName;
1026 my $line = 'DeleteDomain '.$domainName;
1027 $line .= ' force' if $force;
1029 $this->_parseResponse();
1033 my ($this, $domainName) = @_;
1034 croak 'usage CGP::CLI->SuspendDomain($domainName)'
1035 unless defined $domainName;
1036 $this->send('SuspendDomain '.$domainName);
1037 $this->_parseResponse();
1040 my ($this, $domainName) = @_;
1041 croak 'usage CGP::CLI->ResumeDomain($domainName)'
1042 unless defined $domainName;
1043 $this->send('ResumeDomain '.$domainName);
1044 $this->_parseResponse();
1047 sub CreateSharedDomain {
1048 my ($this, $domainName, $params) = @_;
1049 croak 'usage CGP::CLI->CreateSharedDomain($domainName[, \%params])'
1050 unless defined $domainName;
1051 my $line = 'CreateSharedDomain '.$domainName;
1052 $line .= ' '.$this->printWords($params) if $params;
1054 $this->_parseResponse();
1057 sub CreateDirectoryDomain {
1058 my ($this, $domainName, $params) = @_;
1059 croak 'usage CGP::CLI->CreateDirectoryDomain($domainName[, \%params])'
1060 unless defined $domainName;
1061 my $line = 'CreateDirectoryDomain '.$domainName;
1062 $line .= ' '.$this->printWords($params) if $params;
1064 $this->_parseResponse();
1067 sub ReloadDirectoryDomains {
1069 $this->send('ReloadDirectoryDomains');
1070 $this->_parseResponse();
1073 sub GetDomainRules {
1074 my ($this, $domainName) = @_;
1075 croak 'usage CGP::CLI->GetDomainRules($domainName)'
1076 unless defined $domainName;
1077 $this->send('GetDomainRules '.$domainName);
1078 return undef unless $this->_parseResponse();
1079 $this->parseWords($this->getWords);
1082 sub SetDomainRules {
1083 my ($this, $domainName, $rules) = @_;
1084 croak 'usage CGP::CLI->SetDomainRules($domainName, \@rules)'
1085 unless defined $domainName && defined $rules;
1086 $this->send('SetDomainRules '.$domainName.' '.$this->printWords($rules));
1087 $this->_parseResponse();
1090 sub GetDomainMailRules {
1091 my ($this, $domainName) = @_;
1092 croak 'usage CGP::CLI->GetDomainMailRules($domainName)'
1093 unless defined $domainName;
1094 $this->send('GetDomainMailRules '.$domainName);
1095 return undef unless $this->_parseResponse();
1096 $this->parseWords($this->getWords);
1099 sub SetDomainMailRules {
1100 my ($this, $domainName, $rules) = @_;
1101 croak 'usage CGP::CLI->SetDomainMailRules($domainName, \@rules)'
1102 unless defined $domainName && defined $rules;
1103 $this->send('SetDomainMailRules '.$domainName.' '.$this->printWords($rules));
1104 $this->_parseResponse();
1107 #sub UpdateDomainMailRule {
1108 # my ($this, $domainName, $rule) = @_;
1109 # croak 'usage CGP::CLI->UpdateDomainMailRules($domainName, \@rule)'
1110 # unless defined $domainName && defined $rule;
1111 # $this->send('UpdateDomainMailRule '.$domainName.' '.$this->printWords($rule));
1112 # $this->_parseResponse();
1114 sub GetDomainSignalRules {
1115 my ($this, $domainName) = @_;
1116 croak 'usage CGP::CLI->GetDomainSignalRules($domainName)'
1117 unless defined $domainName;
1118 $this->send('GetDomainSignalRules '.$domainName);
1119 return undef unless $this->_parseResponse();
1120 $this->parseWords($this->getWords);
1123 sub SetDomainSignalRules {
1124 my ($this, $domainName, $rules) = @_;
1125 croak 'usage CGP::CLI->SetDomainSignalRules($domainName, \@rules)'
1126 unless defined $domainName && defined $rules;
1127 $this->send('SetDomainSignalRules '.$domainName.' '.$this->printWords($rules));
1128 $this->_parseResponse();
1131 #sub UpdateDomainSignalRule {
1132 # my ($this, $domainName, $rule) = @_;
1133 # croak 'usage CGP::CLI->UpdateDomainSignalRules($domainName, \@rule)'
1134 # unless defined $domainName && defined $rule;
1135 # $this->send('UpdateDomainSignalRule '.$domainName.' '.$this->printWords($rule));
1136 # $this->_parseResponse();
1140 sub GetDomainAliases {
1141 my ($this, $domain) = @_;
1143 my $line = 'GetDomainAliases';
1144 $line .= ' '.$domain if $domain;
1146 return undef unless $this->_parseResponse();
1147 $this->parseWords($this->getWords);
1151 sub SetDomainAliases {
1152 my ($this, $domain, $aliases) = @_;
1153 croak 'usage CGP::CLI->SetDomainAliases($domainName, \@aliases)'
1154 unless defined $domain && defined $aliases;
1155 $this->send('SetDomainAliases '.$domain.' '.$this->printWords($aliases));
1156 $this->_parseResponse();
1159 sub ListAdminDomains {
1160 my ($this, $domain) = @_;
1161 my $line = 'ListAdminDomains';
1162 $line .= ' '.$domain if $domain;
1164 return undef unless $this->_parseResponse();
1165 $this->parseWords($this->getWords);
1168 sub InsertDirectoryRecords {
1169 my ($this, $domain) = @_;
1170 my $line = 'InsertDirectoryRecords';
1171 $line .= ' '.$domain if $domain;
1173 $this->_parseResponse();
1175 sub DeleteDirectoryRecords {
1176 my ($this, $domain) = @_;
1177 my $line = 'DeleteDirectoryRecords';
1178 $line .= ' '.$domain if $domain;
1180 $this->_parseResponse();
1183 sub GetServerTrustedCerts {
1185 $this->send('GetServerTrustedCerts');
1186 return undef unless $this->_parseResponse();
1187 $this->parseWords($this->getWords);
1190 sub SetServerTrustedCerts {
1191 my ( $this, $certs ) = @_;
1192 croak 'usage CGP::CLI->SetServerTrustedCerts(\@certs)'
1193 unless defined $certs;
1194 $this->send('SetServerTrustedCerts '.$this->printWords($certs));
1195 $this->_parseResponse();
1198 sub GetClusterTrustedCerts {
1200 $this->send('GetClusterTrustedCerts');
1201 return undef unless $this->_parseResponse();
1202 $this->parseWords($this->getWords);
1205 sub SetClusterTrustedCerts {
1206 my ( $this, $certs ) = @_;
1207 croak 'usage CGP::CLI->SetClusterTrustedCerts(\@certs)'
1208 unless defined $certs;
1209 $this->send('SetClusterTrustedCerts '.$this->printWords($certs));
1210 $this->_parseResponse();
1214 sub GetDirectoryIntegration {
1216 $this->send('GetDirectoryIntegration');
1217 return undef unless $this->_parseResponse();
1218 $this->parseWords($this->getWords);
1221 sub SetDirectoryIntegration {
1222 my ( $this, $dict ) = @_;
1223 croak 'usage CGP::CLI->SetDirectoryIntegration(\%settings)'
1224 unless defined $dict;
1226 $this->send('SetDirectoryIntegration '.$this->printWords($dict));
1227 $this->_parseResponse();
1230 sub GetClusterDirectoryIntegration {
1232 $this->send('GetClusterDirectoryIntegration');
1233 return undef unless $this->_parseResponse();
1234 $this->parseWords($this->getWords);
1237 sub SetClusterDirectoryIntegration {
1238 my ( $this, $dict ) = @_;
1239 croak 'usage CGP::CLI->SetClusterDirectoryIntegration(\%settings)'
1240 unless defined $dict;
1242 $this->send('SetClusterDirectoryIntegration '.$this->printWords($dict));
1243 $this->_parseResponse();
1247 sub GetDomainDefaults {
1249 $this->send('GetDomainDefaults');
1250 return undef unless $this->_parseResponse();
1251 $this->parseWords($this->getWords);
1254 sub UpdateDomainDefaults {
1255 my ( $this, $dict ) = @_;
1256 croak 'usage CGP::CLI->UpdateDomainDefaults(\%settings)'
1257 unless defined $dict;
1259 $this->send('UpdateDomainDefaults '.$this->printWords($dict));
1260 $this->_parseResponse();
1263 sub SetDomainDefaults {
1264 my ( $this, $dict ) = @_;
1265 croak 'usage CGP::CLI->SetDomainDefaults(\%settings)'
1266 unless defined $dict;
1267 $this->send('SetDomainDefaults '.$this->printWords($dict));
1268 $this->_parseResponse();
1271 sub GetClusterDomainDefaults {
1273 $this->send('GetClusterDomainDefaults');
1274 return undef unless $this->_parseResponse();
1275 $this->parseWords($this->getWords);
1278 sub UpdateClusterDomainDefaults {
1279 my ( $this, $dict ) = @_;
1280 $this->send('UpdateClusterDomainDefaults '.$this->printWords($dict));
1281 $this->_parseResponse();
1284 sub SetClusterDomainDefaults {
1285 my ( $this, $dict ) = @_;
1286 $this->send('SetClusterDomainDefaults '.$this->printWords($dict));
1287 $this->_parseResponse();
1291 sub GetAllAccountsDefaults {
1293 $this->send('GetAllAccountsDefaults');
1294 return undef unless $this->_parseResponse();
1295 $this->parseWords($this->getWords);
1298 sub UpdateAllAccountsDefaults {
1299 my ( $this, $dict ) = @_;
1300 $this->send('UpdateAllAccountsDefaults '.$this->printWords($dict));
1301 $this->_parseResponse();
1304 sub SetAllAccountsDefaults {
1305 my ( $this, $dict ) = @_;
1306 $this->send('SetAllAccountsDefaults '.$this->printWords($dict));
1307 $this->_parseResponse();
1310 sub GetServerAccountDefaults {
1312 $this->send('GetServerAccountDefaults');
1313 return undef unless $this->_parseResponse();
1314 $this->parseWords($this->getWords);
1317 sub UpdateServerAccountDefaults {
1318 my ( $this, $dict ) = @_;
1319 $this->send('UpdateServerAccountDefaults '.$this->printWords($dict));
1320 $this->_parseResponse();
1323 sub SetServerAccountDefaults {
1324 my ( $this, $dict ) = @_;
1325 $this->send('SetServerAccountDefaults '.$this->printWords($dict));
1326 $this->_parseResponse();
1329 sub GetClusterAccountDefaults {
1331 $this->send('GetClusterAccountDefaults');
1332 return undef unless $this->_parseResponse();
1333 $this->parseWords($this->getWords);
1336 sub UpdateClusterAccountDefaults {
1337 my ( $this, $dict ) = @_;
1338 $this->send('UpdateClusterAccountDefaults '.$this->printWords($dict));
1339 $this->_parseResponse();
1342 sub SetClusterAccountDefaults {
1343 my ( $this, $dict ) = @_;
1344 $this->send('SetClusterAccountDefaults '.$this->printWords($dict));
1345 $this->_parseResponse();
1348 sub GetServerWebUserDefaults {
1350 $this->send('GetServerWebUserDefaults');
1351 return undef unless $this->_parseResponse();
1352 $this->parseWords($this->getWords);
1354 sub GetServerAccountPrefs {
1356 $this->send('GetServerAccountPrefs');
1357 return undef unless $this->_parseResponse();
1358 $this->parseWords($this->getWords);
1361 sub SetServerWebUserDefaults {
1362 my ( $this, $dict ) = @_;
1363 $this->send('SetServerWebUserDefaults '.$this->printWords($dict));
1364 $this->_parseResponse();
1366 sub SetServerAccountPrefs {
1367 my ( $this, $dict ) = @_;
1368 $this->send('SetServerAccountPrefs '.$this->printWords($dict));
1369 $this->_parseResponse();
1372 sub GetClusterWebUserDefaults {
1374 $this->send('GetClusterWebUserDefaults');
1375 return undef unless $this->_parseResponse();
1376 $this->parseWords($this->getWords);
1378 sub GetClusterAccountPrefs {
1380 $this->send('GetClusterAccountPrefs');
1381 return undef unless $this->_parseResponse();
1382 $this->parseWords($this->getWords);
1384 sub SetClusterWebUserDefaults {
1385 my ( $this, $dict ) = @_;
1386 $this->send('SetClusterWebUserDefaults '.$this->printWords($dict));
1387 $this->_parseResponse();
1389 sub SetClusterAccountPrefs {
1390 my ( $this, $dict ) = @_;
1391 $this->send('SetClusterAccountPrefs '.$this->printWords($dict));
1392 $this->_parseResponse();
1395 sub GetDomainLocation {
1396 my ( $this, $account ) = @_;
1397 $this->send('GetDomainLocation '.$account);
1398 return undef unless $this->_parseResponse();
1399 $this->parseWords($this->getWords);
1402 sub GetAccountLocation {
1403 my ( $this, $account ) = @_;
1404 $this->send('GetAccountLocation '.$account);
1405 return undef unless $this->_parseResponse();
1406 $this->parseWords($this->getWords);
1409 sub ListServerTelnums {
1410 my ($this, $limit,$filter) = @_;
1411 croak 'usage CGP::CLI->ListServerTelnums($limit[,$filter])'
1412 unless defined $limit;
1413 my $line = "ListServerTelnums";
1414 $line .= ' FILTER '.$this->printWords($filter) if defined $filter;
1417 return undef unless $this->_parseResponse();
1418 $this->parseWords($this->getWords);
1421 sub ListClusterTelnums {
1422 my ($this, $limit,$filter) = @_;
1423 croak 'usage CGP::CLI->ListClusterTelnums($limit[,$filter])'
1424 unless defined $limit;
1425 my $line = "ListClusterTelnums";
1426 $line .= ' FILTER '.$this->printWords($filter) if defined $filter;
1429 return undef unless $this->_parseResponse();
1430 $this->parseWords($this->getWords);
1434 sub GetAccountDefaults {
1435 my ($this, $domain) = @_;
1437 my $line = 'GetAccountDefaults';
1438 $line .= ' '.$domain if($domain);
1440 return undef unless $this->_parseResponse();
1441 $this->parseWords($this->getWords);
1444 sub UpdateAccountDefaults {
1448 croak 'usage CGP::CLI->UpdateAccountDefaults(domain => \'domainName\',settings => {settings})'
1449 unless exists $params{settings};
1451 my $line = 'UpdateAccountDefaults';
1452 $line .= ' '.$params{domain} if exists $params{domain};
1454 $this->send($line . ' ' . $this->printWords($params{settings}));
1455 $this->_parseResponse();
1458 sub SetAccountDefaults {
1462 croak 'usage CGP::CLI->SetAccountDefaults(domain => \'domainName\',settings => {settings})'
1463 unless exists $params{settings};
1465 my $line = 'SetAccountDefaults';
1466 $line .= ' '.$params{domain} if exists $params{domain};
1468 $this->send($line . ' ' . $this->printWords($params{settings}));
1469 $this->_parseResponse();
1472 sub GetWebUserDefaults {
1473 my ($this, $domain) = @_;
1475 my $line = 'GetWebUserDefaults';
1476 $line .= ' '.$domain if($domain);
1479 return undef unless $this->_parseResponse();
1480 $this->parseWords($this->getWords);
1483 sub GetAccountDefaultPrefs {
1484 my ($this, $domain) = @_;
1486 my $line = 'GetAccountDefaultPrefs';
1487 $line .= ' '.$domain if($domain);
1490 return undef unless $this->_parseResponse();
1491 $this->parseWords($this->getWords);
1494 sub SetWebUserDefaults {
1495 my ($this) = shift;;
1497 croak 'usage CGP::CLI->SetWebUserDefaults(domain => \'domainName\',settings => {settings})'
1498 unless exists $params{settings};
1500 my $line = 'SetWebUserDefaults';
1501 $line .= ' ' .$params{domain} if exists $params{domain};
1503 $this->send($line . ' ' . $this->printWords($params{settings}));
1504 $this->_parseResponse();
1506 sub SetAccountDefaultPrefs {
1507 my ($this) = shift;;
1509 croak 'usage CGP::CLI->SetAccountDefaultPrefs(domain => \'domainName\',settings => {settings})'
1510 unless exists $params{settings};
1512 my $line = 'SetAccountDefaultPrefs';
1513 $line .= ' ' .$params{domain} if exists $params{domain};
1515 $this->send($line . ' ' . $this->printWords($params{settings}));
1516 $this->_parseResponse();
1519 sub UpdateWebUserDefaults {
1520 my ($this) = shift;;
1522 croak 'usage CGP::CLI->UpdateWebUserDefaults(domain => \'domainName\',settings => {settings})'
1523 unless exists $params{settings};
1525 my $line = 'UpdateWebUserDefaults';
1526 $line .= ' ' .$params{domain} if exists $params{domain};
1528 $this->send($line . ' ' . $this->printWords($params{settings}));
1529 $this->_parseResponse();
1531 sub UpdateAccountDefaultPrefs {
1532 my ($this) = shift;;
1534 croak 'usage CGP::CLI->UpdateAccountDefaultPrefs(domain => \'domainName\',settings => {settings})'
1535 unless exists $params{settings};
1537 my $line = 'UpdateAccountDefaultPrefs';
1538 $line .= ' ' .$params{domain} if exists $params{domain};
1540 $this->send($line . ' ' . $this->printWords($params{settings}));
1541 $this->_parseResponse();
1544 sub GetAccountTemplate {
1545 my ($this, $domain) = @_;
1547 my $line = 'GetAccountTemplate';
1548 $line .= ' '.$domain if($domain);
1551 return undef unless $this->_parseResponse();
1552 $this->parseWords($this->getWords);
1555 sub UpdateAccountTemplate {
1556 my ($this) = shift;;
1559 croak 'usage CGP::CLI->UpdateAccountTemplate(domain => \'domainName\',settings => {settings})'
1560 unless exists $params{settings};
1562 my $line = 'UpdateAccountTemplate';
1563 $line .= ' '.$params{domain} if exists $params{domain};
1565 $this->send($line.' '.$this->printWords($params{settings}));
1566 $this->_parseResponse();
1569 sub SetAccountTemplate {
1570 my ($this) = shift;;
1573 croak 'usage CGP::CLI->SetAccountTemplate(domain => \'domainName\',settings => {settings})'
1574 unless exists $params{settings};
1576 my $line = 'SetAccountTemplate';
1577 $line .= ' '.$params{domain} if exists $params{domain};
1579 $this->send($line.' '.$this->printWords($params{settings}));
1580 $this->_parseResponse();
1583 #################################################################
1584 # Mailbox managent commands
1587 my ($this) = shift;;
1590 croak 'usage CGP::CLI->ListMailboxes(accountName => \'account\',filter => \'*\',authAccountName => \'extAccount\')'
1591 unless exists $params{accountName};
1593 my $line = 'ListMailboxes '.$params{accountName};
1594 $line .= ' FILTER '.$this->printWords($params{filter}) if exists $params{filter};
1595 $line .= ' AUTH '.$params{authAccountName} if exists $params{authAccountName};
1598 return undef unless $this->_parseResponse();
1599 $this->parseWords($this->getWords);
1603 my ($this,$accountName,$mailboxName,$authAccountName,$class) = @_;
1606 croak 'usage CGP::CLI->CreateMailbox(accountName,mailboxName,[authAccountName],[class])'
1607 unless (defined $accountName && defined $mailboxName);
1609 my $line = 'CREATEMAILBOX '.$accountName;
1610 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1611 $line .= ' AUTH '.$authAccountName if($authAccountName);
1612 $line .= ' CLASS '.$class if($class);
1615 $this->_parseResponse();
1619 my ($this,$accountName,$oldMailboxName,$newMailboxName,$authAccountName) = @_;
1621 croak 'usage CGP::CLI->RenameMailbox(accountName,oldMailboxName,newMailboxName[,authAccountName])'
1622 unless (defined $accountName && defined $oldMailboxName && defined $newMailboxName);
1624 my $line = 'RENAMEMAILBOX '.$accountName;
1625 $line .= ' MAILBOX '.$this->printWords($oldMailboxName);
1626 $line .= ' INTO '.$this->printWords($newMailboxName);
1627 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1630 $this->_parseResponse();
1633 sub RenameMailboxes {
1634 my ($this,$accountName,$oldMailboxName,$newMailboxName,$authAccountName) = @_;
1636 croak 'usage CGP::CLI->RenameMailboxes(accountName,oldMailboxName,newMailboxName[,authAccountName])'
1637 unless (defined $accountName && defined $oldMailboxName && defined $newMailboxName);
1639 my $line = 'RENAMEMAILBOX '.$accountName;
1640 $line .= ' MAILBOXES '.$this->printWords($oldMailboxName);
1641 $line .= ' INTO '.$this->printWords($newMailboxName);
1642 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1645 $this->_parseResponse();
1649 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1651 croak 'usage CGP::CLI->DeleteMailbox(accountName,mailboxName[,authAccountName])'
1652 unless (defined $accountName && defined $mailboxName);
1654 my $line = 'DELETEMAILBOX '.$accountName;
1655 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1656 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1659 $this->_parseResponse();
1662 sub DeleteMailboxes {
1663 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1665 croak 'usage CGP::CLI->DeleteMailboxes(accountName,mailboxName[,authAccountName])'
1666 unless (defined $accountName && defined $mailboxName);
1668 my $line = 'DELETEMAILBOX '.$accountName;
1669 $line .= ' MAILBOXES '.$this->printWords($mailboxName);
1670 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1673 $this->_parseResponse();
1676 sub GetMailboxInfo {
1677 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1679 croak 'usage CGP::CLI->GetMailboxInfo(accountName,mailboxName[,authAccountName])'
1680 unless (defined $accountName && defined $mailboxName);
1682 my $line = 'GETMAILBOXINFO '.$accountName;
1683 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1684 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1687 return undef unless $this->_parseResponse();
1688 $this->parseWords($this->getWords);
1692 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1694 croak 'usage CGP::CLI->GetMailboxACL(accountName,mailboxName[,authAccountName])'
1695 unless (defined $accountName && defined $mailboxName);
1697 my $line = 'GETMAILBOXACL '.$accountName;
1698 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1699 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1702 return undef unless $this->_parseResponse();
1703 $this->parseWords($this->getWords);
1707 my ($this,$accountName,$mailboxName,$newACL,$authAccountName) = @_;
1709 croak 'usage CGP::CLI->SetMailboxACL(accountName,mailboxName,\@newACL[,authAccountName])'
1710 unless (defined $accountName && defined $mailboxName && defined $newACL);
1712 my $line = 'SETMAILBOXACL '.$accountName;
1713 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1714 $line .= ' AUTH '.$authAccountName if defined $authAccountName;
1716 $this->send($line.' '.$this->printWords($newACL));
1717 $this->_parseResponse();
1721 sub GetMailboxRights {
1722 my ($this,$accountName,$mailboxName,$authAccountName) = @_;
1724 croak 'usage CGP::CLI->GetMailboxRights(accountName,mailboxName,authAccountName)'
1725 unless (defined $accountName && defined $mailboxName && defined $authAccountName);
1727 my $line = 'GETMAILBOXRIGHTS '.$accountName;
1728 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1729 $line .= ' AUTH '.$authAccountName;
1732 return undef unless $this->_parseResponse();
1733 $this->parseWords($this->getWords);
1736 sub SetMailboxClass {
1737 my ($this,$accountName,$mailboxName,$class,$authAccountName) = @_;
1739 croak 'usage CGP::CLI->SetMailboxClass(accountName,mailboxName,class [,authAccountName])'
1740 unless (defined $accountName && defined $mailboxName && defined $class);
1742 my $line = 'SetMailboxClass '.$accountName;
1743 $line .= ' MAILBOX '.$this->printWords($mailboxName);
1744 $line .= ' AUTH '.$authAccountName if(defined $authAccountName);
1745 $line .= ' CLASS '.$class;
1748 return undef unless $this->_parseResponse();
1752 sub GetAccountSubscription {
1753 my ($this,$accountName) = @_;
1754 croak 'usage CGP::CLI->GetAccountSubscription(accountName)'
1755 unless defined $accountName;
1757 $this->send('GetAccountSubscription '.$accountName);
1758 return undef unless $this->_parseResponse();
1759 $this->parseWords($this->getWords);
1762 sub SetAccountSubscription {
1763 my ($this,$accountName,$newSubscription) = @_;
1764 croak 'usage CGP::CLI->SetAccountSubscription(accountName,\%newSubscription)'
1765 unless (defined $accountName && defined $newSubscription);
1767 $this->send('SetAccountSubscription '.$accountName.' '.$this->printWords($newSubscription));
1768 $this->_parseResponse();
1771 sub GetMailboxAliases {
1772 my ($this,$accountName) = @_;
1773 croak 'usage CGP::CLI->GetMailboxAliases(accountName)'
1774 unless defined $accountName;
1776 $this->send('GetMailboxAliases '.$accountName);
1777 return undef unless $this->_parseResponse();
1778 $this->parseWords($this->getWords);
1781 sub SetMailboxAliases {
1782 my ($this,$accountName,$newAliases) = @_;
1783 croak 'usage CGP::CLI->SetMailboxAliases(accountName,\%newAliases)'
1784 unless (defined $accountName && defined $newAliases);
1786 $this->send('SetMailboxAliases '.$accountName.' '.$this->printWords($newAliases));
1787 $this->_parseResponse();
1791 #################################################################
1792 # Alerts Administration
1794 sub GetDomainAlerts {
1795 my ($this, $domain) = @_;
1797 my $line = 'GetDomainAlerts';
1798 $line .= ' '.$domain if $domain;
1800 return undef unless $this->_parseResponse();
1801 $this->parseWords($this->getWords);
1804 sub SetDomainAlerts {
1805 my ($this, $domain, $alerts) = @_;
1806 croak 'usage CGP::CLI->SetDomainAlerts($domainName, \@alerts)'
1807 unless defined $domain && defined $alerts;
1808 $this->send('SetDomainAlerts '.$domain.' '.$this->printWords($alerts));
1809 $this->_parseResponse();
1812 sub PostDomainAlert {
1813 my ($this, $domain, $alert) = @_;
1814 croak 'usage CGP::CLI->PostDomainAlert($domainName, $alertString)'
1815 unless defined $domain && defined $alert;
1816 $this->send('PostDomainAlert '.$domain.' ALERT '.$this->printWords($alert));
1817 $this->_parseResponse();
1820 sub RemoveDomainAlert {
1821 my ($this, $domain, $timeStamp) = @_;
1822 croak 'usage CGP::CLI->RemoveDomainAlert($domainName, $timeStamp)'
1823 unless defined $domain && defined $timeStamp;
1824 $this->send('RemoveDomainAlert '.$domain.' ALERT '.$timeStamp);
1825 $this->_parseResponse();
1828 sub GetAccountAlerts {
1829 my ($this, $account) = @_;
1830 $this->send('GetAccountAlerts '.$account);
1831 return undef unless $this->_parseResponse();
1832 $this->parseWords($this->getWords);
1835 sub SetAccountAlerts {
1836 my ($this, $account, $alerts) = @_;
1837 croak 'usage CGP::CLI->SetAccountAlerts($account, \@alerts)'
1838 unless defined $account && defined $alerts;
1839 $this->send('SetAccountAlerts '.$account.' '.$this->printWords($alerts));
1840 $this->_parseResponse();
1843 sub PostAccountAlert {
1844 my ($this, $account, $alert) = @_;
1845 croak 'usage CGP::CLI->PostAccountAlert($account, $alertString)'
1846 unless defined $account && defined $alert;
1847 $this->send('PostAccountAlert '.$account.' ALERT '.$this->printWords($alert));
1848 $this->_parseResponse();
1851 sub RemoveAccountAlert {
1852 my ($this, $account, $timeStamp) = @_;
1853 croak 'usage CGP::CLI->RemoveAccountAlert($account, $timeStamp)'
1854 unless defined $account && defined $timeStamp;
1855 $this->send('RemoveAccountAlert '.$account.' ALERT '.$timeStamp);
1856 $this->_parseResponse();
1860 sub GetServerAlerts {
1862 $this->send('GetServerAlerts');
1863 return undef unless $this->_parseResponse();
1864 $this->parseWords($this->getWords);
1867 sub SetServerAlerts {
1868 my ($this, $alerts) = @_;
1869 croak 'usage CGP::CLI->SetServerAlerts(\@alerts)'
1870 unless defined $alerts;
1871 $this->send('SetServerAlerts '.$this->printWords($alerts));
1872 $this->_parseResponse();
1875 sub PostServerAlert {
1876 my ($this, $alert) = @_;
1877 croak 'usage CGP::CLI->PostServerAlert($alertString)'
1878 unless defined $alert;
1879 $this->send('PostServerAlert '.$this->printWords($alert));
1880 $this->_parseResponse();
1883 sub RemoveServerAlert {
1884 my ($this, $timeStamp) = @_;
1885 croak 'usage CGP::CLI->RemoveServerAlert($timeStamp)'
1886 unless defined $timeStamp;
1887 $this->send('RemoveServerAlert '.$timeStamp);
1888 $this->_parseResponse();
1891 sub GetClusterAlerts {
1893 $this->send('GetClusterAlerts');
1894 return undef unless $this->_parseResponse();
1895 $this->parseWords($this->getWords);
1898 sub SetClusterAlerts {
1899 my ($this, $alerts) = @_;
1900 croak 'usage CGP::CLI->SetClusterAlerts(\@alerts)'
1901 unless defined $alerts;
1902 $this->send('SetClusterAlerts '.$this->printWords($alerts));
1903 $this->_parseResponse();
1906 sub PostClusterAlert {
1907 my ($this, $alert) = @_;
1908 croak 'usage CGP::CLI->PostClusterAlert($alertString)'
1909 unless defined $alert;
1910 $this->send('PostClusterAlert '.$this->printWords($alert));
1911 $this->_parseResponse();
1914 sub RemoveClusterAlert {
1915 my ($this, $timeStamp) = @_;
1916 croak 'usage CGP::CLI->RemoveClusterAlert($timeStamp)'
1917 unless defined $timeStamp;
1918 $this->send('RemoveClusterAlert '.$timeStamp);
1919 $this->_parseResponse();
1922 #################################################################
1923 # Personal Web Site Administration
1926 my ($this,$accountName,$fileName,$position,$sliceSize) = @_;
1928 croak 'usage CGP::CLI->GetWebFile(accountName,fileName[,position,sliceSize])'
1929 unless (defined $accountName && defined $fileName);
1930 my $line='GetWebFile '.$accountName.' FILE '.$this->printWords($fileName);
1931 $line .= ' OFFSET '. $position if(defined $position && $position!=0);
1932 $line .= ' SIZE '. $sliceSize if(defined $sliceSize);
1935 return undef unless $this->_parseResponse;
1936 $this->parseWords($this->getWords);
1940 my ($this,$accountName,$fileName,$data,$position) = @_;
1942 croak 'usage CGP::CLI->PutWebFile(accountName,fileName,data [,position])'
1943 unless (defined $accountName && defined $fileName && defined $data);
1944 my $line='PutWebFile '.$accountName.' FILE '.$this->printWords($fileName);
1945 $line .= ' OFFSET '. $position if(defined $position && $position!=0);
1947 $line .= ' DATA ['.$data.']';
1950 $this->_parseResponse;
1954 my ($this,$accountName,$oldFileName,$newFileName) = @_;
1956 croak 'usage CGP::CLI->RenameWebFile(accountName,oldFileName,newFileName)'
1957 unless (defined $accountName && defined $oldFileName && defined $newFileName);
1958 $this->send('RenameWebFile '.$accountName.' FILE '.$this->printWords($oldFileName).' INTO '.$this->printWords($newFileName));
1959 $this->_parseResponse;
1963 my ($this,$accountName,$fileName) = @_;
1965 croak 'usage CGP::CLI->DeleteWebFile(accountName,fileName)'
1966 unless (defined $accountName && defined $fileName);
1967 $this->send('DeleteWebFile '.$accountName.' FILE '.$this->printWords($fileName));
1968 $this->_parseResponse;
1972 my ($this,$accountName,$filePath) = @_;
1974 croak 'usage CGP::CLI->ListWebFiles(accountName [,filePath])'
1975 unless defined $accountName;
1976 my $line = 'ListWebFiles '.$accountName;
1977 $line .= ' PATH '.$this->printWords($filePath) if $filePath;
1979 return undef unless $this->_parseResponse;
1980 $this->parseWords($this->getWords);
1983 sub GetWebFilesInfo {
1984 my ($this,$accountName) = @_;
1986 croak 'usage CGP::CLI->InfoWebFiles(accountName)'
1987 unless defined $accountName;
1988 $this->send('GetWebFilesInfo '.$accountName);
1989 return undef unless $this->_parseResponse;
1990 $this->parseWords($this->getWords);
1993 #################################################################
1994 # List management commands
1997 my ( $this, $domain ) = @_;
1998 my $line = 'LISTLISTS';
1999 $line .= ' '.$domain if $domain;
2001 return undef unless $this->_parseResponse;
2002 $this->parseWords($this->getWords);
2005 sub GetDomainLists {
2006 my ( $this, $domain ) = @_;
2007 my $line = 'GetDomainLists';
2008 $line .= ' '.$domain if $domain;
2010 return undef unless $this->_parseResponse;
2011 $this->parseWords($this->getWords);
2014 sub GetAccountLists {
2015 my ( $this, $accountName ) = @_;
2016 croak 'usage CGP::CLI->GetAccoountLists($accountName)'
2017 unless defined $accountName;
2019 $this->send('GetAccountLists '.$accountName);
2020 return undef unless $this->_parseResponse;
2021 $this->parseWords($this->getWords);
2025 my ($this, $listName, $accountName) = @_;
2026 croak 'usage CGP::CLI->CreateList($listName, $accountName)'
2027 unless defined $listName && defined $accountName;
2028 $this->send('CREATELIST '.$listName.' for '.$accountName);
2029 $this->_parseResponse();
2033 my ($this, $oldListName, $newListName) = @_;
2034 croak 'usage CGP::CLI->RenameList($oldListName, $newListName)'
2035 unless defined $oldListName && defined $newListName;
2036 $this->send('RENAMELIST '.$oldListName.' into '.$newListName);
2037 $this->_parseResponse();
2041 my ( $this, $listName ) = @_;
2042 croak 'usage CGP::CLI->DeleteList($listName)'
2043 unless defined $listName;
2045 $this->send('DELETELIST '.$listName);
2046 $this->_parseResponse();
2050 my ( $this, $listName ) = @_;
2051 croak 'usage CGP::CLI->GetList($listName)'
2052 unless defined $listName;
2054 $this->send('GETLIST '.$listName);
2055 return undef unless $this->_parseResponse();
2056 $this->parseWords($this->getWords);
2060 my ( $this, $listName, $dict ) = @_;
2061 croak 'usage CGP::CLI->UpdateList($listName,\%params)'
2062 unless defined $listName && defined $dict;
2064 $this->send('UPDATELIST '.$listName.' '.$this->printWords($dict) );
2065 $this->_parseResponse();
2069 my ( $this, $listName, $command, $subscriber, @options ) = @_;
2070 croak 'usage CGP::CLI->List($listName, $command, $subscriber, @options)'
2071 unless defined $listName && defined $command && defined $subscriber;
2073 $this->send('LIST '.$listName.' '.$command.' '.join(' ',@options).' '.$subscriber);
2074 $this->_parseResponse();
2077 sub ListSubscribers {
2078 my ( $this, $listName,$filter,$limit ) = @_;
2079 croak 'usage CGP::CLI->ListSubscribers($listName [,$filter[,$limit]])'
2080 unless defined $listName;
2082 my $line = 'ListSubscribers '.$listName;
2083 $line .= ' FILTER '. ($filter eq '' ? '""' : $this->printWords($filter)) if($filter || $limit);
2084 $line .= " $limit" if($limit);
2086 $this->send($line );
2087 return undef unless $this->_parseResponse();
2088 $this->parseWords($this->getWords);
2091 sub GetSubscriberInfo {
2092 my ( $this, $listName,$address ) = @_;
2093 croak 'usage CGP::CLI->GetSubscriberInfo($listName ,$subscriberAddress)'
2094 unless defined $listName && defined $address;
2095 $this->send('GetSubscriberInfo '.$listName.' NAME '.$address);
2096 return undef unless $this->_parseResponse();
2097 $this->parseWords($this->getWords);
2100 sub SetPostingMode {
2101 my ($this, $listName, $address, $mode) = @_;
2102 croak 'usage CGP::CLI->SetPostingMode($listName,$subscriberAddress,$mode)'
2103 unless defined $listName && defined $address && defined $mode;
2104 $this->send('SetPostingMode '.$listName.' FOR '.$address.' '.$mode);
2105 $this->_parseResponse();
2109 my ($this, $listName, $address, $fatal) = @_;
2110 croak 'usage CGP::CLI->ProcessBounce($listName,$subscriberAddress,"fatal")'
2111 unless defined $listName && defined $address;
2112 my $line = 'ProcessBounce '.$listName;
2113 $line .= ' FATAL' if($fatal);
2114 $this->send($line. ' FOR '.$address);
2115 $this->_parseResponse();
2118 #############################################
2119 # Web Skins Administration
2121 sub ListDomainSkins {
2122 my ($this, $domainName) = @_;
2123 my $line = 'ListDomainSkins';
2124 $line .= ' '.$domainName if($domainName);
2126 return undef unless $this->_parseResponse();
2127 $this->parseWords($this->getWords);
2130 sub CreateDomainSkin {
2131 my ( $this, $domain, $skin ) = @_;
2132 croak 'usage CGP::CLI->CreateDomainSkin($domainName,$skinName)'
2133 unless defined $domain && defined $skin;
2135 $this->send('CreateDomainSkin '.$domain.' SKIN '.$this->printWords($skin));
2136 $this->_parseResponse();
2139 sub RenameDomainSkin {
2140 my ( $this, $domain, $skin, $newName ) = @_;
2141 croak 'usage CGP::CLI->RenameDomainSkin($domainName,$oldSkinName,$newSkinName)'
2142 unless defined $domain && defined $skin && defined $newName;
2144 $this->send('RenameDomainSkin '.$domain.' SKIN '.$this->printWords($skin).' INTO '.$this->printWords($newName));
2145 $this->_parseResponse();
2148 sub DeleteDomainSkin {
2149 my ( $this, $domain, $skin ) = @_;
2150 croak 'usage CGP::CLI->DeleteDomainSkin($domainName,$skinName)'
2151 unless defined $domain && defined $skin;
2153 $this->send('DeleteDomainSkin '.$domain.' SKIN '.$this->printWords($skin));
2154 $this->_parseResponse();
2157 sub ListDomainSkinFiles {
2158 my ( $this, $domain, $skin ) = @_;
2159 croak 'usage CGP::CLI->ListDomainSkinFiles($domainName,$skinName)'
2160 unless defined $domain && defined $skin;
2162 $this->send('ListDomainSkinFiles '.$domain.' SKIN '.$this->printWords($skin));
2163 return undef unless $this->_parseResponse();
2164 $this->parseWords($this->getWords);
2167 sub ReadDomainSkinFile {
2168 my ( $this, $domain, $skin, $fileName ) = @_;
2169 croak 'usage CGP::CLI->ReadDomainSkinFile($domainName,$skinName,$fileName)'
2170 unless defined $domain && defined $skin && defined $fileName;
2172 $this->send('ReadDomainSkinFile '.$domain.' SKIN '.$this->printWords($skin).' FILE '.$this->printWords($fileName));
2173 return undef unless $this->_parseResponse();
2174 $this->parseWords($this->getWords);
2177 sub StoreDomainSkinFile {
2178 my ( $this, $domain, $skin, $fileName,$base64data ) = @_;
2179 croak 'usage CGP::CLI->StoreDomainSkinFile($domainName,$skinName,$fileName,$base64data)'
2180 unless defined $domain && defined $skin && defined $fileName && defined $base64data;
2181 $this->send('StoreDomainSkinFile '.$domain.' SKIN '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DATA ['.$base64data.']');
2182 $this->_parseResponse();
2185 sub DeleteDomainSkinFile {
2186 my ( $this, $domain, $skin, $fileName ) = @_;
2187 croak 'usage CGP::CLI->DeleteDomainSkinFile($domainName,$skinName,$fileName)'
2188 unless defined $domain && defined $skin && defined $fileName;
2190 $this->send('StoreDomainSkinFile '.$domain.' SKIN '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DELETE');
2191 $this->_parseResponse();
2195 sub ListServerSkins {
2197 $this->send('ListServerSkins');
2198 return undef unless $this->_parseResponse();
2199 $this->parseWords($this->getWords);
2202 sub CreateServerSkin {
2203 my ( $this, $skin ) = @_;
2204 croak 'usage CGP::CLI->CreateServerSkin($skinName)'
2205 unless defined $skin;
2207 $this->send('CreateServerSkin '.$this->printWords($skin));
2208 $this->_parseResponse();
2211 sub RenameServerSkin {
2212 my ( $this, $skin, $newName ) = @_;
2213 croak 'usage CGP::CLI->RenameServerSkin($oldSkinName,$newSkinName)'
2214 unless defined $skin && defined $newName;
2216 $this->send('RenameServerSkin '.$this->printWords($skin).' INTO '.$this->printWords($newName));
2217 $this->_parseResponse();
2220 sub DeleteServerSkin {
2221 my ( $this, $skin ) = @_;
2222 croak 'usage CGP::CLI->DeleteServerSkin($skinName)'
2223 unless defined $skin;
2225 $this->send('DeleteServerSkin '.$this->printWords($skin));
2226 $this->_parseResponse();
2229 sub ListServerSkinFiles {
2230 my ( $this, $skin ) = @_;
2231 croak 'usage CGP::CLI->ListServerSkinFiles($skinName)'
2232 unless defined $skin;
2234 $this->send('ListServerSkinFiles '.$this->printWords($skin));
2235 return undef unless $this->_parseResponse();
2236 $this->parseWords($this->getWords);
2239 sub ReadServerSkinFile {
2240 my ( $this, $skin, $fileName ) = @_;
2241 croak 'usage CGP::CLI->ReadServerSkinFile($skinName,$fileName)'
2242 unless defined $skin && defined $fileName;
2244 $this->send('ReadServerSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName));
2245 return undef unless $this->_parseResponse();
2246 $this->parseWords($this->getWords);
2249 sub StoreServerSkinFile {
2250 my ( $this, $skin, $fileName,$data ) = @_;
2251 croak 'usage CGP::CLI->StoreServerSkinFile($skinName,$fileName,$base64data)'
2252 unless defined $skin && defined $fileName && defined $data;
2254 $this->send('StoreServerSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DATA ['.$data.']');
2255 $this->_parseResponse();
2258 sub DeleteServerSkinFile {
2259 my ( $this, $skin, $fileName ) = @_;
2260 croak 'usage CGP::CLI->DeleteServerSkinFile($skinName,$fileName)'
2261 unless defined $skin && defined $fileName;
2263 $this->send('StoreServerSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DELETE');
2264 $this->_parseResponse();
2268 sub ListClusterSkins {
2270 $this->send('ListClusterSkins');
2271 return undef unless $this->_parseResponse();
2272 $this->parseWords($this->getWords);
2275 sub CreateClusterSkin {
2276 my ( $this, $skin ) = @_;
2277 croak 'usage CGP::CLI->CreateClusterSkin($skinName)'
2278 unless defined $skin;
2280 $this->send('CreateClusterSkin '.$this->printWords($skin));
2281 $this->_parseResponse();
2284 sub RenameClusterSkin {
2285 my ( $this, $skin, $newName ) = @_;
2286 croak 'usage CGP::CLI->RenameClusterSkin($oldSkinName,$newSkinName)'
2287 unless defined $skin && defined $newName;
2289 $this->send('RenameClusterSkin '.$this->printWords($skin).' INTO '.$this->printWords($newName));
2290 $this->_parseResponse();
2293 sub DeleteClusterSkin {
2294 my ( $this, $skin ) = @_;
2295 croak 'usage CGP::CLI->DeleteClusterSkin($skinName)'
2296 unless defined $skin;
2298 $this->send('DeleteClusterSkin '.$this->printWords($skin));
2299 $this->_parseResponse();
2302 sub ListClusterSkinFiles {
2303 my ( $this, $skin ) = @_;
2304 croak 'usage CGP::CLI->ListClusterSkinFiles($skinName)'
2305 unless defined $skin;
2307 $this->send('ListClusterSkinFiles '.$this->printWords($skin));
2308 return undef unless $this->_parseResponse();
2309 $this->parseWords($this->getWords);
2312 sub ReadClusterSkinFile {
2313 my ( $this, $skin, $fileName ) = @_;
2314 croak 'usage CGP::CLI->ReadClusterSkinFile($skinName,$fileName)'
2315 unless defined $skin && defined $fileName;
2317 $this->send('ReadClusterSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName));
2318 return undef unless $this->_parseResponse();
2319 $this->parseWords($this->getWords);
2322 sub StoreClusterSkinFile {
2323 my ( $this, $skin, $fileName,$data ) = @_;
2324 croak 'usage CGP::CLI->StoreClusterSkinFile($skinName,$fileName,$base64data)'
2325 unless defined $skin && defined $fileName && defined $data;
2327 $this->send('StoreClusterSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DATA ['.$data.']');
2328 $this->_parseResponse();
2331 sub DeleteClusterSkinFile {
2332 my ( $this, $skin, $fileName ) = @_;
2333 croak 'usage CGP::CLI->DeleteClusterSkinFile($skinName,$fileName)'
2334 unless defined $skin && defined $fileName;
2336 $this->send('StoreClusterSkinFile '.$this->printWords($skin).' FILE '.$this->printWords($fileName).' DELETE');
2337 $this->_parseResponse();
2340 #############################################
2341 # Web Interface Tuning
2343 sub ListWebUserInterface {
2344 my ($this, $domainName, $path) = @_;
2346 my $line = 'ListWebUserInterface';
2347 $line .= ' '.$domainName if($domainName);
2348 $line .= ' PATH '.$this->printWords($path) if($path);
2351 return undef unless $this->_parseResponse();
2352 $this->parseWords($this->getWords);
2355 sub GetWebUserInterface {
2356 my ($this, $domainName, $path) = @_;
2357 croak 'usage CGP::CLI->GetWebUserInterface($domainName, $fileName)'
2358 unless defined $domainName && defined $path;
2360 my $line = 'GetWebUserInterface '.$domainName.' FILE '.$this->printWords($path);
2362 return undef unless $this->_parseResponse();
2363 $this->parseWords($this->getWords);
2366 sub PutWebUserInterface {
2367 my ($this, $domainName, $path, $data) = @_;
2368 croak 'usage CGP::CLI->PutWebUserInterface($domainName, $fileName, $base64data)'
2369 unless defined $domainName && defined $path && defined $data;
2371 my $line = 'PutWebUserInterface '.$domainName;
2372 $line .= ' FILE '.$this->printWords($path).' DATA ['.$data.']';
2374 $this->_parseResponse();
2377 sub DeleteWebUserInterface {
2378 my ($this, $domainName, $path) = @_;
2379 croak 'usage CGP::CLI->DeleteWebUserInterface($domainName, $fileName)'
2380 unless defined $domainName && defined $path;
2382 my $line = 'DeleteWebUserInterface ';
2383 $line .= ' '.$domainName if($domainName);
2384 $line .= ' FILE '.$this->printWords($path) if($path);
2387 $this->_parseResponse();
2390 sub ClearWebUserCache {
2391 my ($this, $domainName) = @_;
2393 my $line = 'ClearWebUserCache';
2394 $line .= ' '.$domainName if($domainName);
2397 $this->_parseResponse();
2400 #############################################
2401 # Web Interface Integration
2403 sub CreateWebUserSession {
2404 my ($this, $accountName, $ipAddress, $wml,$skin,$origAddress) = @_;
2405 croak 'usage CGP::CLI->CreateWebUserSession($accountName, $IP_Address[, "WML"[,"mySkin"]][,$origAddress )'
2406 unless defined $accountName && defined $ipAddress;
2407 my $line='CreateWebUserSession '.$accountName.' ADDRESS '.$ipAddress;
2408 $line .= " FOR $origAddress" if($origAddress);
2409 $line .= " $wml" if($wml);
2410 $line .= " SKIN $skin" if($skin);
2413 return undef unless $this->_parseResponse();
2414 $this->parseWords($this->getWords);
2417 sub CreateXIMSSSession {
2418 my ($this, $accountName, $ipAddress,$origAddress) = @_;
2419 croak 'usage CGP::CLI->CreateXIMSSSession($accountName, $IP_Address,[$origAddress] )'
2420 unless defined $accountName && defined $ipAddress;
2421 my $line='CreateXIMSSSession '.$accountName.' ADDRESS '.$ipAddress;
2422 $line .= " FOR $origAddress" if($origAddress);
2424 return undef unless $this->_parseResponse();
2425 $this->parseWords($this->getWords);
2428 sub FindWebUserSession {
2429 my ($this, $accountName,$address) = @_;
2430 croak 'usage CGP::CLI->FindWebUserSession($accountName [,$address])' unless defined $accountName;
2432 my $line='FindWebUserSession '.$accountName;
2433 $line .= ' ADDRESS '.$address if($address);
2436 return undef unless $this->_parseResponse();
2437 $this->parseWords($this->getWords);
2440 sub GetWebUserSession {
2441 my ($this, $sessionID,$domain) = @_;
2442 croak 'usage CGP::CLI->GetWebUserSession($sessionID [,$domain])' unless defined $sessionID;
2444 my $line='GetWebUserSession '.$sessionID;
2445 $line .= ' DOMAIN '.$domain if($domain);
2448 return undef unless $this->_parseResponse();
2449 $this->parseWords($this->getWords);
2452 my ($this, $sessionID,$domain) = @_;
2453 croak 'usage CGP::CLI->GetSession($sessionID [,$domain])' unless defined $sessionID;
2455 my $line='GetSession '.$sessionID;
2456 $line .= ' DOMAIN '.$domain if($domain);
2459 return undef unless $this->_parseResponse();
2460 $this->parseWords($this->getWords);
2465 sub KillWebUserSession {
2466 my ($this, $sessionID,$domain) = @_;
2467 croak 'usage CGP::CLI->KillWebUserSession($sessionID [,$domain])' unless defined $sessionID;
2468 my $line='KillWebUserSession '.$sessionID;
2469 $line .= ' DOMAIN '.$domain if($domain);
2472 $this->_parseResponse();
2475 my ($this, $sessionID,$domain) = @_;
2476 croak 'usage CGP::CLI->KillSession($sessionID [,$domain])' unless defined $sessionID;
2477 my $line='KillSession '.$sessionID;
2478 $line .= ' DOMAIN '.$domain if($domain);
2481 $this->_parseResponse();
2484 #############################################
2485 # Real-Time Application Administration
2487 sub CreateDomainPBX {
2488 my ( $this, $domain, $language ) = @_;
2489 croak 'usage CGP::CLI->CreateDomainPBX($domainName,$language)'
2490 unless defined $domain;
2491 my $line = 'CreateDomainPBX '.$domain;
2492 $line .= ' FILE '.$this->printWords($language) if($language);
2495 $this->_parseResponse();
2498 sub ListDomainPBXFiles {
2499 my ($this, $domain,$language) = @_;
2500 croak 'usage CGP::CLI->ListDomainPBXFiles($domainName,$language)'
2501 unless defined $domain;
2502 my $line = 'ListDomainPBXFiles '.$domain;
2503 $line .= ' FILE '.$this->printWords($language) if($language);
2505 return undef unless $this->_parseResponse();
2506 $this->parseWords($this->getWords);
2509 sub ReadDomainPBXFile {
2510 my ( $this, $domain, $fileName ) = @_;
2511 croak 'usage CGP::CLI->ReadDomainPBXFile($domainName,$fileName)'
2512 unless defined $domain && defined $fileName;
2514 $this->send('ReadDomainPBXFile '.$domain.' FILE '.$this->printWords($fileName));
2515 return undef unless $this->_parseResponse();
2516 $this->parseWords($this->getWords);
2519 sub StoreDomainPBXFile {
2520 my ( $this, $domain, $fileName,$base64data ) = @_;
2521 croak 'usage CGP::CLI->StoreDomainPBXFile($domainName,$fileName,$base64data)'
2522 unless defined $domain && defined $fileName && defined $base64data;
2523 $this->send('StoreDomainPBXFile '.$domain.' FILE '.$this->printWords($fileName).' DATA ['.$base64data.']');
2524 $this->_parseResponse();
2527 sub DeleteDomainPBXFile {
2528 my ( $this, $domain, $fileName ) = @_;
2529 croak 'usage CGP::CLI->DeleteDomainPBXFile($domainName,$fileName)'
2530 unless defined $domain && defined $fileName;
2532 $this->send('StoreDomainPBXFile '.$domain.' FILE '.$this->printWords($fileName).' DELETE');
2533 $this->_parseResponse();
2538 sub CreateServerPBX {
2539 my ( $this, $language ) = @_;
2540 my $line = 'CreateServerPBX';
2541 $line .= $this->printWords($language) if($language);
2543 $this->_parseResponse();
2546 sub ListServerPBXFiles {
2547 my ($this,$language) = @_;
2549 my $line = 'ListServerPBXFiles ';
2550 $line .= $this->printWords($language) if($language);
2552 return undef unless $this->_parseResponse();
2553 $this->parseWords($this->getWords);
2556 sub ReadServerPBXFile {
2557 my ( $this, $fileName ) = @_;
2558 croak 'usage CGP::CLI->ReadServerPBXFile($fileName)'
2559 unless defined $fileName;
2561 $this->send('ReadServerPBXFile '.$this->printWords($fileName));
2562 return undef unless $this->_parseResponse();
2563 $this->parseWords($this->getWords);
2566 sub StoreServerPBXFile {
2567 my ( $this, $fileName,$base64data ) = @_;
2568 croak 'usage CGP::CLI->StoreServerPBXFile($fileName,$base64data)'
2569 unless defined $fileName && defined $base64data;
2570 $this->send('StoreServerPBXFile ' .$this->printWords($fileName).' DATA ['.$base64data.']');
2571 $this->_parseResponse();
2574 sub DeleteServerPBXFile {
2575 my ( $this, $fileName ) = @_;
2576 croak 'usage CGP::CLI->DeleteServerPBXFile($fileName)'
2577 unless defined $fileName;
2579 $this->send('StoreServerPBXFile '.$this->printWords($fileName).' DELETE');
2580 $this->_parseResponse();
2585 sub CreateClusterPBX {
2586 my ( $this, $language ) = @_;
2587 my $line = 'CreateClusterPBX';
2588 $line .= $this->printWords($language) if($language);
2590 $this->_parseResponse();
2593 sub ListClusterPBXFiles {
2594 my ($this,$language) = @_;
2596 my $line = 'ListClusterPBXFiles ';
2597 $line .= $this->printWords($language) if($language);
2599 return undef unless $this->_parseResponse();
2600 $this->parseWords($this->getWords);
2603 sub ReadClusterPBXFile {
2604 my ( $this, $fileName ) = @_;
2605 croak 'usage CGP::CLI->ReadClusterPBXFile($fileName)'
2606 unless defined $fileName;
2608 $this->send('ReadClusterPBXFile '.$this->printWords($fileName));
2609 return undef unless $this->_parseResponse();
2610 $this->parseWords($this->getWords);
2613 sub StoreClusterPBXFile {
2614 my ( $this, $fileName,$base64data ) = @_;
2615 croak 'usage CGP::CLI->StoreClusterPBXFile($fileName,$base64data)'
2616 unless defined $fileName && defined $base64data;
2617 $this->send('StoreClusterPBXFile ' .$this->printWords($fileName).' DATA ['.$base64data.']');
2618 $this->_parseResponse();
2621 sub DeleteClusterPBXFile {
2622 my ( $this, $fileName ) = @_;
2623 croak 'usage CGP::CLI->DeleteClusterPBXFile($fileName)'
2624 unless defined $fileName;
2626 $this->send('StoreClusterPBXFile '.$this->printWords($fileName).' DELETE');
2627 $this->_parseResponse();
2630 #############################################
2634 my ( $this, $moduleName ) = @_;
2635 $this->send('GetModule '.$moduleName);
2636 return undef unless $this->_parseResponse();
2637 $this->parseWords($this->getWords);
2641 my ( $this, $moduleName, $newSettings ) = @_;
2642 croak 'usage CGP::CLI->UpdateModule($moduleName, \%newSettings)'
2643 unless defined $moduleName && defined $newSettings;
2644 $this->send ('UpdateModule '.$moduleName.' '.$this->printWords($newSettings) );
2645 $this->_parseResponse();
2649 my ( $this, $moduleName, $newSettings ) = @_;
2650 croak 'usage CGP::CLI->SetModule($moduleName, \%newSettings)'
2651 unless defined $moduleName && defined $newSettings;
2652 $this->send ('SetModule '.$moduleName.' '.$this->printWords($newSettings) );
2653 $this->_parseResponse();
2656 sub GetQueueSettings {
2658 $this->send('GetQueueSettings');
2659 return undef unless $this->_parseResponse();
2660 $this->parseWords($this->getWords);
2662 sub SetQueueSettings {
2663 my ( $this, $newSettings ) = @_;
2664 croak 'usage CGP::CLI->SetQueueSettings(\%newSettings)'
2665 unless defined $newSettings;
2666 $this->send ('SetQueueSettings '.$this->printWords($newSettings) );
2667 $this->_parseResponse();
2670 sub GetSignalSettings {
2672 $this->send('GetSignalSettings');
2673 return undef unless $this->_parseResponse();
2674 $this->parseWords($this->getWords);
2676 sub SetSignalSettings {
2677 my ( $this, $newSettings ) = @_;
2678 croak 'usage CGP::CLI->SetSignalSettings(\%newSettings)'
2679 unless defined $newSettings;
2680 $this->send ('SetSignalSettings '.$this->printWords($newSettings) );
2681 $this->_parseResponse();
2683 sub GetClusterSettings {
2685 $this->send('GetClusterSettings');
2686 return undef unless $this->_parseResponse();
2687 $this->parseWords($this->getWords);
2689 sub SetClusterSettings {
2690 my ( $this, $newSettings ) = @_;
2691 croak 'usage CGP::CLI->SetClusterSettings(\%newSettings)'
2692 unless defined $newSettings;
2693 $this->send ('SetClusterSettings '.$this->printWords($newSettings) );
2694 $this->_parseResponse();
2700 $this->send('GetLANIPs');
2701 return undef unless $this->_parseResponse();
2702 $this->parseWords($this->getWords);
2705 sub GetBlacklistedIPs {
2707 $this->send('GetBlacklistedIPs');
2708 return undef unless $this->_parseResponse();
2709 $this->parseWords($this->getWords);
2714 $this->send('GetClientIPs');
2715 return undef unless $this->_parseResponse();
2716 $this->parseWords($this->getWords);
2719 sub GetWhiteHoleIPs {
2721 $this->send('GetWhiteHoleIPs');
2722 return undef unless $this->_parseResponse();
2723 $this->parseWords($this->getWords);
2727 $this->send('GetNATedIPs');
2728 return undef unless $this->_parseResponse();
2729 $this->parseWords($this->getWords);
2733 $this->send('GetDebugIPs');
2734 return undef unless $this->_parseResponse();
2735 $this->parseWords($this->getWords);
2739 $this->send('GetDeniedIPs');
2740 return undef unless $this->_parseResponse();
2741 $this->parseWords($this->getWords);
2746 $this->send('GetProtection');
2747 return undef unless $this->_parseResponse();
2748 $this->parseWords($this->getWords);
2753 $this->send('GetBanned');
2754 return undef unless $this->_parseResponse();
2755 $this->parseWords($this->getWords);
2759 my ( $this, $addresses ) = @_;
2760 croak 'usage CGP::CLI->SetLANIPs("10.0.0.1\e192.168.0.1")'
2761 unless defined $addresses;
2762 $this->send ('SetLANIPs '.$this->printWords($addresses));
2763 $this->_parseResponse();
2767 sub SetBlacklistedIPs {
2768 my ( $this, $addresses ) = @_;
2769 croak 'usage CGP::CLI->SetBlacklistedIPs("11.22.33.44\e55.66.77.88")'
2770 unless defined $addresses;
2771 $this->send ('SetBlacklistedIPs '.$this->printWords($addresses));
2772 $this->_parseResponse();
2776 my ( $this, $addresses ) = @_;
2777 croak 'usage CGP::CLI->SetClientIPs("11.22.33.44\e55.66.77.88")'
2778 unless defined $addresses;
2779 $this->send ('SetClientIPs '.$this->printWords($addresses));
2780 $this->_parseResponse();
2783 sub SetWhiteHoleIPs {
2784 my ( $this, $addresses ) = @_;
2785 croak 'usage CGP::CLI->SetWhiteHoleIPs("11.22.33.44\e55.66.77.88")'
2786 unless defined $addresses;
2787 $this->send ('SetWhiteHoleIPs '.$this->printWords($addresses));
2788 $this->_parseResponse();
2791 my ( $this, $addresses ) = @_;
2792 croak 'usage CGP::CLI->SetNATedIPs("192.168.0.1\e10.0.0.1")'
2793 unless defined $addresses;
2794 $this->send ('SetNATedIPs '.$this->printWords($addresses));
2795 $this->_parseResponse();
2798 my ( $this, $addresses ) = @_;
2799 croak 'usage CGP::CLI->SetDebugIPs("11.22.33.44\e55.66.77.88")'
2800 unless defined $addresses;
2801 $this->send ('SetDebugIPs '.$this->printWords($addresses));
2802 $this->_parseResponse();
2805 my ( $this, $addresses ) = @_;
2806 croak 'usage CGP::CLI->SetDeniedIPs("11.22.33.44\e55.66.77.88")'
2807 unless defined $addresses;
2808 $this->send ('SetDeniedIPs '.$this->printWords($addresses));
2809 $this->_parseResponse();
2813 my ( $this, $settings ) = @_;
2814 croak 'usage CGP::CLI->SetProtection(\%settings)'
2815 unless defined $settings;
2816 $this->send ('SetProtection '.$this->printWords($settings));
2817 $this->_parseResponse();
2821 my ( $this, $settings ) = @_;
2822 croak 'usage CGP::CLI->SetBanned(\%settings)'
2823 unless defined $settings;
2824 $this->send ('SetBanned '.$this->printWords($settings));
2825 $this->_parseResponse();
2828 sub GetClusterLANIPs {
2830 $this->send('GetClusterLANIPs');
2831 return undef unless $this->_parseResponse();
2832 $this->parseWords($this->getWords);
2835 sub GetClusterBlacklistedIPs {
2837 $this->send('GetClusterBlacklistedIPs');
2838 return undef unless $this->_parseResponse();
2839 $this->parseWords($this->getWords);
2842 sub GetClusterClientIPs {
2844 $this->send('GetClusterClientIPs');
2845 return undef unless $this->_parseResponse();
2846 $this->parseWords($this->getWords);
2849 sub GetClusterWhiteHoleIPs {
2851 $this->send('GetClusterWhiteHoleIPs');
2852 return undef unless $this->_parseResponse();
2853 $this->parseWords($this->getWords);
2855 sub GetClusterNATedIPs {
2857 $this->send('GetClusterNATedIPs');
2858 return undef unless $this->_parseResponse();
2859 $this->parseWords($this->getWords);
2861 sub GetClusterDebugIPs {
2863 $this->send('GetClusterDebugIPs');
2864 return undef unless $this->_parseResponse();
2865 $this->parseWords($this->getWords);
2867 sub GetClusterDeniedIPs {
2869 $this->send('GetClusterDeniedIPs');
2870 return undef unless $this->_parseResponse();
2871 $this->parseWords($this->getWords);
2874 sub GetClusterProtection {
2876 $this->send('GetClusterProtection');
2877 return undef unless $this->_parseResponse();
2878 $this->parseWords($this->getWords);
2880 sub GetClusterBanned {
2882 $this->send('GetClusterBanned');
2883 return undef unless $this->_parseResponse();
2884 $this->parseWords($this->getWords);
2887 sub SetClusterLANIPs {
2888 my ( $this, $addresses ) = @_;
2889 croak 'usage CGP::CLI->SetClusterLANIPs("10.0.0.1\e192.168.0.1")'
2890 unless defined $addresses;
2891 $this->send ('SetClusterLANIPs '.$this->printWords($addresses));
2892 $this->_parseResponse();
2895 sub SetClusterBlacklistedIPs {
2896 my ( $this, $addresses ) = @_;
2897 croak 'usage CGP::CLI->SetClusterBlacklistedIPs("11.22.33.44\e55.66.77.88")'
2898 unless defined $addresses;
2899 $this->send ('SetClusterBlacklistedIPs '.$this->printWords($addresses));
2900 $this->_parseResponse();
2903 sub SetClusterClientIPs {
2904 my ( $this, $addresses ) = @_;
2905 croak 'usage CGP::CLI->SetClusterClientIPs("11.22.33.44\e55.66.77.88")'
2906 unless defined $addresses;
2907 $this->send ('SetClusterClientIPs '.$this->printWords($addresses));
2908 $this->_parseResponse();
2911 sub SetClusterWhiteHoleIPs {
2912 my ( $this, $addresses ) = @_;
2913 croak 'usage CGP::CLI->SetClusterWhiteHoleIPs("11.22.33.44\e55.66.77.88")'
2914 unless defined $addresses;
2915 $this->send ('SetClusterWhiteHoleIPs '.$this->printWords($addresses));
2916 $this->_parseResponse();
2918 sub SetClusterNATedIPs {
2919 my ( $this, $addresses ) = @_;
2920 croak 'usage CGP::CLI->SetClusterNATedIPs("192.168.0.1\e10.0.0.1")'
2921 unless defined $addresses;
2922 $this->send ('SetClusterNATedIPs '.$this->printWords($addresses));
2923 $this->_parseResponse();
2925 sub SetClusterDebugIPs {
2926 my ( $this, $addresses ) = @_;
2927 croak 'usage CGP::CLI->SetClusterDebugIPs("11.22.33.44\e55.66.77.88")'
2928 unless defined $addresses;
2929 $this->send ('SetClusterDebugIPs '.$this->printWords($addresses));
2930 $this->_parseResponse();
2932 sub SetClusterDeniedIPs {
2933 my ( $this, $addresses ) = @_;
2934 croak 'usage CGP::CLI->SetClusterDeniedIPs("11.22.33.44\e55.66.77.88")'
2935 unless defined $addresses;
2936 $this->send ('SetClusterDeniedIPs '.$this->printWords($addresses));
2937 $this->_parseResponse();
2940 sub SetClusterProtection {
2941 my ( $this, $settings ) = @_;
2942 croak 'usage CGP::CLI->SetClusterProtection(\%settings)'
2943 unless defined $settings;
2944 $this->send ('SetClusterProtection '.$this->printWords($settings));
2945 $this->_parseResponse();
2948 sub GetServerRules {
2950 $this->send('GetServerRules');
2951 return undef unless $this->_parseResponse();
2952 $this->parseWords($this->getWords);
2955 sub SetServerRules {
2956 my ($this, $rules) = @_;
2957 croak 'usage CGP::CLI->SetServerRules(\@rules)'
2958 unless defined $rules;
2959 $this->send('SetServerRules '.$this->printWords($rules));
2960 $this->_parseResponse();
2964 sub GetClusterRules {
2966 $this->send('GetClusterRules');
2967 return undef unless $this->_parseResponse();
2968 $this->parseWords($this->getWords);
2971 sub SetClusterRules {
2972 my ($this, $rules) = @_;
2973 croak 'usage CGP::CLI->SetClusterRules(\@rules)'
2974 unless defined $rules;
2975 $this->send('SetClusterRules '.$this->printWords($rules));
2976 $this->_parseResponse();
2979 sub GetServerMailRules {
2981 $this->send('GetServerMailRules');
2982 return undef unless $this->_parseResponse();
2983 $this->parseWords($this->getWords);
2986 sub SetServerMailRules {
2987 my ($this, $rules) = @_;
2988 croak 'usage CGP::CLI->SetServerMailRules(\@rules)'
2989 unless defined $rules;
2990 $this->send('SetServerMailRules '.$this->printWords($rules));
2991 $this->_parseResponse();
2994 #sub UpdateServerMailRule {
2995 # my ($this, $rule) = @_;
2996 # croak 'usage CGP::CLI->UpdateServerMailRules(\@rule)'
2997 # unless defined $rule;
2998 # $this->send('UpdateServerMailRule '.$this->printWords($rule));
2999 # $this->_parseResponse();
3002 sub GetServerSignalRules {
3004 $this->send('GetServerSignalRules');
3005 return undef unless $this->_parseResponse();
3006 $this->parseWords($this->getWords);
3009 sub SetServerSignalRules {
3010 my ($this, $rules) = @_;
3011 croak 'usage CGP::CLI->SetServerSignalRules(\@rules)'
3012 unless defined $rules;
3013 $this->send('SetServerSignalRules '.$this->printWords($rules));
3014 $this->_parseResponse();
3017 #sub UpdateServerSignalRule {
3018 # my ($this, $rule) = @_;
3019 # croak 'usage CGP::CLI->UpdateServerSignalRule(\@rule)'
3020 # unless defined $rule;
3021 # $this->send('UpdateServerSignalRule '.$this->printWords($rule));
3022 # $this->_parseResponse();
3025 sub GetClusterMailRules {
3027 $this->send('GetClusterMailRules');
3028 return undef unless $this->_parseResponse();
3029 $this->parseWords($this->getWords);
3032 sub SetClusterMailRules {
3033 my ($this, $rules) = @_;
3034 croak 'usage CGP::CLI->SetClusterMailRules(\@rules)'
3035 unless defined $rules;
3036 $this->send('SetClusterMailRules '.$this->printWords($rules));
3037 $this->_parseResponse();
3040 #sub UpdateClusterMailRule {
3041 # my ($this, $rule) = @_;
3042 # croak 'usage CGP::CLI->UpdateClusterMailRule(\@rule)'
3043 # unless defined $rule;
3044 # $this->send('UpdateClusterMailRule '.$this->printWords($rule));
3045 # $this->_parseResponse();
3048 sub GetClusterSignalRules {
3050 $this->send('GetClusterSignalRules');
3051 return undef unless $this->_parseResponse();
3052 $this->parseWords($this->getWords);
3055 sub SetClusterSignalRules {
3056 my ($this, $rules) = @_;
3057 croak 'usage CGP::CLI->SetClusterSignalRules(\@rules)'
3058 unless defined $rules;
3059 $this->send('SetClusterSignalRules '.$this->printWords($rules));
3060 $this->_parseResponse();
3063 #sub UpdateClusterSignalRule {
3064 # my ($this, $rule) = @_;
3065 # croak 'usage CGP::CLI->UpdateClusterSignalRule(\@rule)'
3066 # unless defined $rule;
3067 # $this->send('UpdateClusterSignalRule '.$this->printWords($rule));
3068 # $this->_parseResponse();
3075 $this->send('RefreshOSData');
3076 $this->_parseResponse();
3079 sub GetRouterTable {
3081 $this->send('GetRouterTable');
3082 return undef unless $this->_parseResponse();
3083 $this->parseWords($this->getWords);
3086 sub SetRouterTable {
3087 my ($this, $table) = @_;
3088 croak 'usage CGP::CLI->GetRouterTable("<addr1>=addr1\@domain.com\\e<addr2>=addr2\@domain.com\\e")'
3089 unless defined $table;
3090 $this->send('SetRouterTable '.$this->printWords($table));
3091 $this->_parseResponse();
3094 sub GetRouterSettings {
3096 $this->send('GetRouterSettings');
3097 return undef unless $this->_parseResponse();
3098 $this->parseWords($this->getWords);
3101 sub SetRouterSettings {
3102 my ($this, $settings) = @_;
3103 croak 'usage CGP::CLI->SetRouterSettings(\@settings)'
3104 unless defined $settings;
3105 $this->send('SetRouterSettings '.$this->printWords($settings));
3106 $this->_parseResponse();
3110 sub GetClusterRouterTable {
3112 $this->send('GetClusterRouterTable');
3113 return undef unless $this->_parseResponse();
3114 $this->parseWords($this->getWords);
3117 sub SetClusterRouterTable {
3118 my ($this, $table) = @_;
3119 croak 'usage CGP::CLI->SetClusterRouterTable("<addr1>=addr1\@domain.com\\e<addr2>=addr2\@domain.com\\e")'
3120 unless defined $table;
3121 $this->send('SetClusterRouterTable '.$this->printWords($table));
3122 $this->_parseResponse();
3126 sub GetServerIntercept {
3128 $this->send('GetServerIntercept');
3129 return undef unless $this->_parseResponse();
3130 $this->parseWords($this->getWords);
3132 sub SetServerIntercept {
3133 my ( $this, $settings ) = @_;
3134 croak 'usage CGP::CLI->SetServerIntercept(\%settings)'
3135 unless defined $settings;
3136 $this->send ('SetServerIntercept '.$this->printWords($settings));
3137 $this->_parseResponse();
3140 sub GetClusterIntercept {
3142 $this->send('GetClusterIntercept');
3143 return undef unless $this->_parseResponse();
3144 $this->parseWords($this->getWords);
3146 sub SetClusterIntercept {
3147 my ( $this, $settings ) = @_;
3148 croak 'usage CGP::CLI->SetClusterIntercept(\%settings)'
3149 unless defined $settings;
3150 $this->send ('SetClusterIntercept '.$this->printWords($settings));
3151 $this->_parseResponse();
3156 my ($this, $address, $mail) = @_;
3157 croak 'usage CGP::CLI->Route(address[,"mail"])'
3158 unless defined $address;
3159 my $line='Route '.$address;
3160 $line .= ' mail' if($mail);
3162 return undef unless $this->_parseResponse();
3163 $this->parseWords($this->getWords);
3166 #############################################
3167 # Monitoring commands
3169 sub GetSNMPElement {
3170 my ($this, $element) = @_;
3171 $this->send('GetSNMPElement '.$element);
3172 return undef unless $this->_parseResponse();
3173 $this->parseWords($this->getWords);
3176 my ($this, $dialogID) = @_;
3177 $this->send('GetDialogInfo '.$dialogID);
3178 return undef unless $this->_parseResponse();
3179 $this->parseWords($this->getWords);
3184 $this->send('SHUTDOWN');
3185 $this->_parseResponse();
3188 #############################################
3189 # Statistics commands
3191 sub GetAccountStat {
3192 my ($this, $account, $key) = @_;
3193 croak 'usage CGP::CLI->GetAccountStat($account[,$key])'
3194 unless defined $account;
3195 my $line = 'GetAccountStat '.$account;
3196 $line .= ' Key '.$key if $key;
3198 return undef unless $this->_parseResponse();
3199 $this->parseWords($this->getWords);
3202 sub ResetAccountStat {
3203 my ($this, $account, $key) = @_;
3204 croak 'usage CGP::CLI->ResetAccountStat($account[,$key])'
3205 unless defined $account;
3206 my $line = 'ResetAccountStat '.$account;
3207 $line .= ' Key '.$key if $key;
3209 $this->_parseResponse();
3213 my ($this, $domain, $key) = @_;
3214 croak 'usage CGP::CLI->GetDomainStat($domain[,$key])'
3215 unless defined $domain;
3216 my $line = 'GetDomainStat '.$domain;
3217 $line .= ' Key '.$key if $key;
3219 return undef unless $this->_parseResponse();
3220 $this->parseWords($this->getWords);
3223 sub ResetDomainStat {
3224 my ($this, $domain, $key) = @_;
3225 croak 'usage CGP::CLI->ResetDomainStat($domain[,$key])'
3226 unless defined $domain;
3227 my $line = 'ResetDomainStat '.$domain;
3228 $line .= ' Key '.$key if $key;
3230 $this->_parseResponse();
3233 #############################################
3234 # Miscellaneous commands
3237 my ($this, $level, $msg) = @_;
3238 croak 'usage CGP::CLI->WriteLog($level,$message)'
3239 unless defined $level && defined $msg;
3240 $this->send('WriteLog '.$level.' '.$this->printWords($msg));
3241 $this->_parseResponse();
3243 sub ReleaseSMTPQueue {
3244 my ($this, $queue) = @_;
3245 croak 'usage CGP::CLI->ReleaseSMTPQueue($queueName)'
3246 unless defined $queue;
3247 $this->send('ReleaseSMTPQueue '.$this->printWords($queue));
3248 $this->_parseResponse();
3250 sub RejectQueueMessage {
3251 my ($this, $msg, $text) = @_;
3252 croak 'usage CGP::CLI->RejectQueueMessage($msgID [,$errorText])'
3253 unless defined $msg;
3254 my $line = 'RejectQueueMessage '.$msg;
3255 $line .= $this->printWords($text) if $text;
3257 $this->_parseResponse();
3259 sub GetMessageQueueInfo {
3260 my ($this, $moduleName, $queueName) = @_;
3261 croak 'usage CGP::CLI->GetMessageQueueInfo($moduleName,$queueName)'
3262 unless (defined $moduleName && defined $queueName);
3263 my $line = 'GetMessageQueueInfo '.$moduleName.' QUEUE '.$this->printWords($queueName);
3265 return undef unless $this->_parseResponse();
3266 $this->parseWords($this->getWords);
3269 sub GetCurrentController {
3271 $this->send('GetCurrentController');
3272 return undef unless $this->_parseResponse();
3273 $this->parseWords($this->getWords);
3275 sub GetTempClientIPs {
3277 $this->send('GetTempClientIPs');
3278 return undef unless $this->_parseResponse();
3279 $this->parseWords($this->getWords);
3281 sub GetTempBlacklistedIPs {
3283 $this->send('GetTempBlacklistedIPs');
3284 return undef unless $this->_parseResponse();
3285 $this->parseWords($this->getWords);
3287 sub SetTempBlacklistedIPs {
3288 my ( $this, $addresses ) = @_;
3289 croak 'usage CGP::CLI->SetTempBlacklistedIPs("111.11.1.1\e222.2.2.2")'
3290 unless defined $addresses;
3291 $this->send ('SetTempBlacklistedIPs '.$this->printWords($addresses));
3292 $this->_parseResponse();
3295 sub RemoveAccountSubset {
3296 my ($this, $account, $subset) = @_;
3297 croak 'usage CGP::CLI->RemoveAccountSubset($account,$subset)'
3298 unless defined $account && defined $subset;
3299 $this->send('RemoveAccountSubset '.$account.' SUBSET '.$this->printWords($subset));
3300 return undef unless $this->_parseResponse();
3304 #########################################################################
3305 #########################################################################
3306 ## Internal routines
3308 sub _setStrangeError
3310 my ($this, $line, $code) = @_;
3313 $this->{errCode} = $code;
3317 $this->{errCode} = $CGP::CLI_CODE_STRANGE;
3319 $this->{errMsg} = $line;
3327 my $responseLine = $this->{theSocket}->getline();
3330 print STDERR "CGP::CLI->_parseResponse::responseLine = $responseLine\n\n"
3331 if $this->{'debug'};
3333 $responseLine =~ /^(\d+)\s(.*)$/;
3334 return $this->_setStrangeError($responseLine) unless ($1);
3335 $this->{errCode} = $1;
3336 if($1 == $CGP::CLI_CODE_OK_INLINE) {
3337 $this->{'inlineResponse'} = $2;
3338 $this->{errMsg} = 'OK';
3340 $this->{errMsg} = $2;
3341 chomp($this->{errMsg});
3342 $this->{errMsg} =~ s/\r$//;
3344 $this->{'lastAccess'}=time();
3350 my $translate = $_[1];
3351 if(!defined($data)) {
3353 } elsif(ref($data) eq 'HASH') {
3356 foreach (sort keys %$data) {
3357 my $value=@$data{$_};
3358 $outp .= convertOutput($_,$translate).'='.convertOutput($value,$translate).';';
3364 } elsif(ref($data) eq 'ARRAY') {
3368 if(!$first) { $outp.=','; } else { $first=0; }
3369 $outp.=convertOutput($_,$translate);
3374 if($data =~ /[\W_]/ || $data eq '') {
3376 $data =~ s/\\((?![enr\d]))/\\\\$1/g;
3377 $data =~ s/\"/\\\"/g;
3379 $data =~ s/([\x00-\x1F\x7F])/'\\'.('0'x(3-length(ord($1)))).ord($1)/ge;
3381 return '"' . $data . '"';
3389 my ($this,$data)= @_;
3390 return convertOutput($data,$this->{'translateStrings'});
3403 if($this->{errCode} == $CGP::CLI_CODE_OK_INLINE) {
3404 return $this->{'inlineResponse'};
3406 my ($bag, $line) = ('', '');
3410 $line = $this->{theSocket}->getline();
3412 $line = strip($line);
3416 $lastLine = '\)' if $1 eq '(';
3417 $lastLine = '\}' if $1 eq '{';
3418 $lastLine = $lastLine . '$';
3423 last if $line =~ /$lastLine/;
3430 my ($this, $command) = @_;
3432 if(time()-$this->{'lastAccess'} > $CGP::TIMEOUT ||
3433 !($this->{theSocket}) ||
3434 $this->{theSocket}->error()) {
3435 $this->{theSocket}->shutdown(SHUT_RDWR) if($this->{theSocket});
3436 unless($this->connect()) {
3437 die "Failure: Can't reopen CLI connection";
3441 $this->{currentCGateCommand} = $command;
3442 print STDERR ref($this) . "->send($command)\n\n"
3443 if $this->{'debug'};
3444 $this->{'lastAccess'}=time();
3445 print {$this->{theSocket}} $command."\012";
3449 ###########################
3453 while($this->{'span'} < $this->{'len'} && substr($this->{'data'},$this->{'span'},1) =~ /\s/) { ++$this->{'span'}; }
3462 $this->skipSpaces();
3463 if(substr($this->{'data'},$this->{'span'},1) eq '"') {
3464 $isQuoted=1; ++$this->{'span'};
3465 } elsif(substr($this->{'data'},$this->{'span'},1) eq '[') {
3468 while($this->{'span'} < $this->{'len'}) {
3469 my $ch=substr($this->{'data'},$this->{'span'},1);
3473 if(substr($this->{'data'},$this->{'span'}+1,3) =~ /^(?:\"|\\|\d\d\d)/) {
3474 $ch=substr($this->{'data'},++$this->{'span'},3);
3475 if($ch =~ /\d\d\d/) {
3479 $ch=substr($ch,0,1);
3480 $ch='\\'.$ch unless($this->{'translateStrings'});
3483 } elsif($ch eq '"') {
3485 $this->skipSpaces();
3486 if(substr($this->{'data'},$this->{'span'},1) eq '"') {
3495 $this->skipSpaces();
3496 if(substr($this->{'data'},$this->{'span'},1) eq '[') {
3504 } elsif($ch =~ /[-a-zA-Z0-9\x80-\xff_\.\@\!\#\%\:]/) {
3517 return $this->readWord();
3523 $this->skipSpaces();
3524 my $ch=substr($this->{'data'},$this->{'span'},1);
3527 return $this->readDictionary();
3528 } elsif($ch eq '(') {
3530 return $this->readArray();
3532 return $this->readWord();
3539 while($this->{'span'}<$this->{'len'}) {
3540 $this->skipSpaces();
3541 if(substr($this->{'data'},$this->{'span'},1) eq ')') {
3545 my $theValue=$this->readValue();
3546 $this->skipSpaces();
3547 push(@$result,$theValue);
3548 if(substr($this->{'data'},$this->{'span'},1) eq ',') {
3550 } elsif(substr($this->{'data'},$this->{'span'},1) eq ')') {
3552 croak "CGPro output format error:",substr($this->{'data'},$this->{'span'},10);
3559 sub readDictionary {
3562 while($this->{'span'} < $this->{'len'}) {
3563 $this->skipSpaces();
3564 if(substr($this->{'data'},$this->{'span'},1) eq '}') {
3568 my $theKey=$this->readKey();
3569 $this->skipSpaces();
3570 if(substr($this->{'data'},$this->{'span'},1) ne '=') { croak "CGPro output format error:",substr($this->{'data'},$this->{'span'},10); }
3572 @$result{$theKey}=$this->readValue();
3573 $this->skipSpaces();
3574 if(substr($this->{'data'},$this->{'span'},1) ne ';') { croak "CGPro output format error:",substr($this->{'data'},$this->{'span'},10); }
3584 $this->{'data'}=shift;
3586 $this->{'len'}=length($this->{'data'});
3587 return $this->readValue();
3600 See http://www.stalker.com/CGPerl/
3604 CommunigatePro Command Line Interface perl module.
3606 This is Stalker's CLI.pm packaged for CPAN.
3607 The original CLI.pm file is available from Stalker's website at:
3609 http://www.stalker.com/CGPerl/CLI.pm
3611 The only changes are the addition of the VERSION variable for MakeMaker
3612 and this short POD at the end.
3616 Stalker, Inc. <support@stalker.com>