if (word(2 $loadinfo()) != [pf]) { load -pf $word(1 $loadinfo()); return; }; # Copyright (c) 2004 BlackJac@EFNet # # Version: 1.0.2004.06.07.1 # # This script will check a POP3 account for email and display the # count on your status bar. /pop3 will force an immediate update. # # In order to see the POP3 email message counter on your status # bar, you must put %{0}4 in your STATUS_FORMAT, STATUS_FORMAT1 # or STATUS_FORMAT2 setting. package pop3; # POP3 account password: assign POP3_PASSWORD mypass; # POP3 server port number (usually 110): assign POP3_PORT 110; # POP3 server name: assign POP3_SERVER mail.some.server; # Display the current number of POP3 email messages on your status bar: assign POP3_STATUSBAR 1; # Wait this number of seconds before rechecking POP3 mailbox: assign POP3_UPDATE 900; # POP3 account username: assign POP3_USERNAME myuser; # Format of POP3 email message status bar counter (only modify this if # you know what you are doing!): set STATUS_USER4 \${@pop3 && POP3_STATUSBAR ? [\[POP\: $pop3\]] : []}; # This must be set to ON to properly display the current number of POP3 # email messages on your status bar: set STATUS_DOES_EXPANDOS on; alias pop3 (void) { ^on ^dcc_raw "% $POP3_SERVER E $POP3_PORT" #; if (:connect = connect($POP3_SERVER $POP3_PORT)) { @ pop3.state = [USER]; ^on ^dcc_raw "$connect $POP3_SERVER C" { @ pop3.state = []; ^on dcc_raw -"$0 $POP3_SERVER D +OK *"; ^on dcc_raw -"$0 $POP3_SERVER D -ERR *"; ^on dcc_raw -"$0 $POP3_SERVER C"; }; ^on ^dcc_raw "$connect $POP3_SERVER D +OK *" { switch ($pop3.state) { (USER) { @ pop3.state = [PASS]; msg =$0 USER $POP3_USERNAME; }; (PASS) { @ pop3.state = [STAT]; msg =$0 PASS $POP3_PASSWORD; }; (STAT) { @ pop3.state = [QUIT]; msg =$0 STAT; }; (QUIT) { @ pop3.state = [DONE]; @ pop3 = [$4]; msg =$0 QUIT; }; }; }; ^on ^dcc_raw "$connect $POP3_SERVER D -ERR *" { @ pop3.error = 1; msg =$0 QUIT; }; until (@pop3 || pop3.error || cnt == 60) { pause 0.5; @ :cnt++; }; if (@pop3) { if (functioncall()) { @ function_return = pop3; } else { xecho -b -c You have $pop3 email message${pop3 != 1 ? [s] : []} in your POP3 mailbox; }; if (POP3_STATUSBAR) { parsekey refresh_status; }; } else { xecho -b -c Unable to connect to or read your POP3 mailbox (check your username and password); @ pop3.error = []; }; }; ^on dcc_raw -"% $POP3_SERVER E $POP3_PORT"; }; alias pop3.statusbar (void) { if (POP3_STATUSBAR) { ^timer -ref pop3 -rep -1 $POP3_UPDATE { @ pop3(); }; @ pop3(); } else { @ pop3 = []; ^timer -del pop3; parsekey refresh_status; }; }; if (!timerctl(refnum pop3)) { pop3.statusbar; };