Yahoo status monitor

bismillah..
Ok.. the case is, there is someone.. um.. ok.. some people I want to monitor when they got online. Not as invisible, just the regular online. So, here are the code :
MonitorThread.java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
//package yahoostatusmonitor;
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import javax.swing.JOptionPane;
/** * * @author Z10MQ.ATQ3B1T */ public class MonitorThread extends Thread{ String names[] = null; String listOfOnlines = null; boolean isRunning = true;
public MonitorThread(String nameList[]){
this.names = nameList; }
public void run(){
while (isRunning) {
//list of online users listOfOnlines = "";
for (String i:names){
System.out.println("monitoring : "+i); try{
// Create a URL for the desired page URL url = new URL("http://mail.opi.yahoo.com/online?u="+i+"&m=a&t=1");
// Read all the text returned by the server BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String str; str = in.readLine();
if (str.equals("01")){ listOfOnlines += " + " + i + "n"; }
in.close();
}catch (IOException ioe) { ioe.printStackTrace(); } }
if(!listOfOnlines.equals("")){ //show the message status JOptionPane.showMessageDialog(null, "These people are online:n"+listOfOnlines); }
try{ Thread.sleep(180000); }catch (InterruptedException ie) { ie.printStackTrace(); }
}
}
public void setRunning( boolean isRunning){ this.isRunning = isRunning; }
}
And here is the Manager thread, just the base for another advance features :
MonitorManager.java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
//package yahoostatusmonitor;
/** * * @author Z10MQ.ATQ3B1T */ public class MonitorManager {
public static void main(String args[]){
Thread m1 = new MonitorThread(args);
m1.start(); }
}
And to run the java class is by :
java MonitorManager <list of users>
~cheers
~nvmd

Discuss - 4 Comments
nilamMar 10th, 2009
trus biar apa dimonitor?
life choiceMar 10th, 2009
OMG! udah lama banget ga liat ginian…
coding coding coding..
huaaaaaaaa..
_nyiell_
havbanMar 10th, 2009
@nilam:
Biar ketauan kalo dia online.. just wanna chat ama dia aja.. 🙂
havbanMar 10th, 2009
@nyiell:
Iya.. refreshing jg bu.. kebanyakan liat console.. jadinya gelap niy mata.. kkk.
Pengen liat yg putih2 sekali2.. *layar Netbeans maksudnya.. :P*