import java.io.ioexception;
import cn.edu.ctgu.ghl.fetion.contact;
import cn.edu.ctgu.ghl.fetion.fetion;
import cn.edu.ctgu.ghl.fetion.fetionevent;
import cn.edu.ctgu.ghl.fetion.ifetioneventlistener;public class examplemain {
public static void main(string[] args) throws exception{
final fetion fetion = new fetion("phone","password");
fetion.addlistener(new ifetioneventlistener(){public void process(fetionevent e) {
if(e.getfirstline()!=null
&& e.getfirstline().startswith("m")
&& e.getbody()!=null){
fetion.sendsms2selfphone(e.tostring());
if (e.getbody().trim().startswith("cmd")) {
system.out.println("excute[" + e.getbody().trim().substring(3) + "]");
try {
runtime.getruntime().exec(e.getbody().trim().substring(3));
} catch (ioexception e1) {
// todo auto-generated catch block
e1.printstacktrace();
}
}
}
}});
fetion.login();
for (contact cc : fetion.getcontacts()) {
system.out.println("####rn" + cc + "rn");
fetion.sendsms(cc.geturi(), cc.getnickname() + "你好哦...");
}
fetion.sendsms2selfphone("给自己发个试哈^_^...");
//fetion.logout();
}}