]>
git.proxmox.com Git - pmg-api.git/blob - PMG/RuleDB/Object.pm
1 package PMG
:: RuleDB
:: Object
;
11 my ( $type, $otype, $ogroup ) = @_ ;
26 croak
"never call this method: ERROR" ;
30 croak
"never call this method: ERROR" ;
34 my ( $ruledb, $objid ) = @_ ;
36 return $ruledb -> load_object ( $objid );
40 croak
"never call this method: ERROR" ;
44 croak
"never call this method: ERROR" ;
48 croak
"never call this method: ERROR" ;
52 croak
"never call this method: ERROR" ;
92 return "def_icon.gif" ;
103 # some who object only matches 'receivers'
109 croak
"never call this method: ERROR" ;
119 return "basic object" ;
126 =head1 PMG::RuleDB::Object
128 The Proxmox Rules consists of Objects. There are several classes of Objects. Ech such class has a method to check if the object 'matches'.
130 =head2 WHO Objects ($obj->oclass() eq 'who')
132 Who sent the mail, who is the receiver?
134 =head3 $obj->who_match ($addr)
136 Returns true if $addr belongs to this objects. $addr is a text string representing the email address you want to check.
142 EMail: the only attribute is a regex to test email addresses
146 =head2 WHEN Objects ($obj->oclass() eq 'when')
148 Used to test for a certain daytime
150 =head3 $obj->when_match ($time)
152 Return true if $time matches the when object constraints. $time is an integer like returned by the time() system call (or generated with POSIX::mktime()).
158 TimeFrame: specifies a start and a end time
162 =head2 WHAT Objects ($obj->oclass() eq 'what')
166 =head2 ACTION Objects ($obj->oclass() eq 'action')
168 actions which can be executed
170 =head3 $obj->execute ($mod_group, $queue, $ruledb, $mod_group, $targets, $msginfo, $vars, $marks)
172 Execute the action code. $target is a array reference containing all
175 =head2 Common Methods
177 =head3 $obj->oclass()
179 Returns 'who', 'when' 'what' or 'action';
181 =head3 $obj->short_desc()
183 Returns a short text describing the contents of the object. This is used
184 for debugging purposes.
188 Returns an integer representing the Type of the objects. This integer
189 is used in the database to uniquely identify object types.
193 Returns the unique database ID of the object. undef means the object is not jet stored in the databse.
197 Return true if the object is an action and the action is final, i.e. the action stops further rule processing for all matching targets.
199 =head3 $obj->priority()
201 Return a priority between 0 and 100. This is currently used to sort action objects by priority.