Changeset 5962
- Timestamp:
- 05/17/08 17:37:46 (8 months ago)
- Files:
-
- 1 modified
-
trunk/components/Needlworks.Mail.Pop3.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/Needlworks.Mail.Pop3.php
r5953 r5962 11 11 $this->uidl_filter = null; 12 12 $this->size_filter = null; 13 $this->stat_callback = null; 13 14 $this->retr_callback = null; 14 15 $this->mails = array(); … … 31 32 $this->ctx = fsockopen( $bSSL ? "ssl://$server" : $server, $port); 32 33 if( !$this->ctx ) { 33 $this->log( "Connect failed: $server:$port" );34 34 return false; 35 35 } … … 126 126 } 127 127 128 function setStatCallback( $func ) 129 { 130 $this->stat_callback =& $func; 131 } 132 128 133 function setRetrCallback( $func ) 129 134 { … … 152 157 list( $number, $uid ) = split( " ", $line ); 153 158 if( !empty($this->filterred[$number]) ) { 154 $this->log( "Msg $number: Already filterred" );155 159 continue; 156 160 } 157 if( $this->uidl_filter && call_user_func($this->uidl_filter, $uid) ) { 158 $this->log( "Msg $number: Filterred by uid: $uid" ); 161 if( $this->uidl_filter && call_user_func($this->uidl_filter, $uid, $number) ) { 159 162 $this->filterred[$number] = true; 160 163 continue; … … 177 180 } 178 181 list( $total, $totalsize ) = split( " ", $this->status ); 182 if( $this->stat_callback ) { 183 if( !call_user_func( $this->stat_callback, $total, $totalsize ) ) { 184 return false; 185 } 186 } 187 188 if( $total == 0 ) { 189 return false; 190 } 179 191 180 192 $this->log( "Send: LIST" ); … … 188 200 list( $number, $size ) = split( " ", $line ); 189 201 if( !empty($this->filterred[$number]) ) { 190 $this->log( "Msg $number: Already filterred" );191 202 continue; 192 203 } 193 204 if( $this->size_filter && call_user_func($this->size_filter, $size, $number, $total) ) { 194 $this->log( "Msg $number: Filterred by size: $size" );195 205 if( isset( $this->uids[$number] ) ) { 196 206 unset( $this->mails[$this->uids[$number]] ); … … 221 231 $count = 1000000; /* Maximum 1000000 lines! it's enough to handle 6MB bytes */ 222 232 $line = fgets($this->ctx, 1024); 223 $this->log( "Recv: $line");233 $this->log( "Recv: ".trim($line) ); 224 234 if( !$line ) { 225 235 return false;
