ジャバーの新しい手紙の通知

Gtalkには新しいメッセージについてユーザーに通知するための素晴らしいオプションがありますが、私は別のjabberサーバーを使用しているので、自分でそのような機能をかき立てることは便利だと思いました。 たぶん、私はひどく見ていました、そして、Gmailでそのような機会があります、しかし、私はそれを見つけなかった、そして、私はcronに掛けた小さなスクリプトを書きました。 そして、もちろん、そのような手紙がない限り、彼は15分ごとに新しい手紙を喜んで通知してくれます。



jabberを使用するには、ライブラリXMPPHPを使用します。

その他のコードとコメント...



まず、設定で通知ヘルメットの場所と場所を説明します

  1. // config.php $jabberServer = 'jabber . ru' ; // - $jabberPort = 5223 ; // $jabberLogin = 'mailnotify' ; // $jabberPassword = ' 123; // $jabberID = “you @ jabber . ru” ; // JabberID $email = “yourEmail” ; // $emailPassword = “emailPassword” ; //



  2. // config.php $jabberServer = 'jabber . ru' ; // - $jabberPort = 5223 ; // $jabberLogin = 'mailnotify' ; // $jabberPassword = ' 123; // $jabberID = “you @ jabber . ru” ; // JabberID $email = “yourEmail” ; // $emailPassword = “emailPassword” ; //



  3. // config.php $jabberServer = 'jabber . ru' ; // - $jabberPort = 5223 ; // $jabberLogin = 'mailnotify' ; // $jabberPassword = ' 123; // $jabberID = “you @ jabber . ru” ; // JabberID $email = “yourEmail” ; // $emailPassword = “emailPassword” ; //



  4. // config.php $jabberServer = 'jabber . ru' ; // - $jabberPort = 5223 ; // $jabberLogin = 'mailnotify' ; // $jabberPassword = ' 123; // $jabberID = “you @ jabber . ru” ; // JabberID $email = “yourEmail” ; // $emailPassword = “emailPassword” ; //



  5. // config.php $jabberServer = 'jabber . ru' ; // - $jabberPort = 5223 ; // $jabberLogin = 'mailnotify' ; // $jabberPassword = ' 123; // $jabberID = “you @ jabber . ru” ; // JabberID $email = “yourEmail” ; // $emailPassword = “emailPassword” ; //



  6. // config.php $jabberServer = 'jabber . ru' ; // - $jabberPort = 5223 ; // $jabberLogin = 'mailnotify' ; // $jabberPassword = ' 123; // $jabberID = “you @ jabber . ru” ; // JabberID $email = “yourEmail” ; // $emailPassword = “emailPassword” ; //



  7. // config.php $jabberServer = 'jabber . ru' ; // - $jabberPort = 5223 ; // $jabberLogin = 'mailnotify' ; // $jabberPassword = ' 123; // $jabberID = “you @ jabber . ru” ; // JabberID $email = “yourEmail” ; // $emailPassword = “emailPassword” ; //



  8. // config.php $jabberServer = 'jabber . ru' ; // - $jabberPort = 5223 ; // $jabberLogin = 'mailnotify' ; // $jabberPassword = ' 123; // $jabberID = “you @ jabber . ru” ; // JabberID $email = “yourEmail” ; // $emailPassword = “emailPassword” ; //







メインスクリプトコード:

  1. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  2. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  3. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  4. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  5. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  6. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  7. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  8. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  9. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  10. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  11. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  12. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  13. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  14. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  15. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  16. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  17. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  18. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  19. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  20. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  21. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  22. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  23. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  24. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  25. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }



  26. include_once ( 'config . php' ) ; $mbox = imap_open ({ pop . gmail . com : 995 / pop3 / ssl / novalidate - cert } INBOX” , $email , $emailPassword ) ; $recentMails = imap_num_recent ( $mbox ) ; if ( $recentMails > 0 ) { include_once ( “XMPPHP / XMPP . php” ) ; $notifySent = false ; $jabberConnection = new XMPPHP_XMPP ( $jabberServer , $jabberPort , $jabberLogin , $jabberPassword , 'xmpphp' , $jabberServer , $printlog = false , $loglevel = LEVEL_ERROR ) ; $jabberConnection -> useSSL ( true ) ; $jabberConnection -> connect ( ) ; $jabberConnection -> processUntil ( ' session_start ' ) ; $jabberConnection -> presence ( ) ; $jabberConnection -> message ( $jabberID , ' ' . $recentMails . ' , ' ) ; for ( $i = 1 ; $i <= $recentMails ; $i ++ ) imap_fetchbody ( $mbox , $i , 1 ) ; $jabberConnection -> disconnect ( ) ; }







それだけです、簡単な警告灯が用意されています。 少しインタラクティブ性を追加することもできます。たとえば、ヒキガエルで直接文字を読むことができます。次のようなデザインを追加するだけです。

  1. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  2. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  3. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  4. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  5. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  6. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  7. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  8. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  9. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  10. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  11. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  12. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  13. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  14. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  15. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  16. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  17. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  18. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  19. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }



  20. $notifySent = false ; while ( ! $jabberConnection -> isDisconnected ( ) ) { $loads = $jabberConnection -> processUntil ( array ( 'message' , ' session_start ' ) ) ; foreach ( $loads as $event ) { $pl = $event [ 1 ] ; switch ( $event [ 0 ] ) { case “message” : if ( $pl [ 'body' ] == ' ! read' ) $jabberConnection -> message ( 'user @ jabber . ru' , getEmails ( $mbox , $recentMails ) ) ; elseif ( $pl [ 'body' ] == ' ! exit ' ) $jabberConnection -> disconnect ( ) ; break ; default : if ( ! $notifySent ) { $jabberConnection -> message ( 'user @ jabber . ru' , ' ' . $recentMails . ' , ' ) ; $notifySent = true ; } break ; } }







コマンドとハンドラーを追加するだけで、このようなジャバーボットを取得できます。



All Articles