}
}, new ThreadActorDispatcher());
//测试同步模式登录
QQActionFuture future = client.login(QQStatus.ONLINE, null);
QQActionEvent event = future.waitFinalEvent();
if(event.getType() == Type.EVT_OK){
System.out.println("登录成功!!!!");
event = client.getUserInfo(client.getAccount(), null).waitFinalEvent();
System.out.println("用户信息:" + event.getType() +" - " + event.getTarget());
// BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// String line = null;
// while( (line = reader.readLine())!= null){
// MsgModule m = (MsgModule)client.getModule(QQModule.Type.MSG);
// QQMsg msg = new QQMsg();
// try {
// QQActionEvent e = m.sendMsg(null, msg).waitFinalEvent();;
// System.out.println("发送消息:" + e.toString());
// } catch (Exception e) {
// System.out.println("错误!!!");
// e.printStackTrace();
// }
//
// }
client.getBuddyList(null).waitFinalEvent();
System.out.println("Buddy count: " + client.getBuddyList().size());
// int i = 0;
// for(QQBuddy buddy: client.getBuddyList()){
// QQActionFuture f = client.getUserQQ(buddy, null);
// QQActionEvent e = f.waitFinalEvent();
// System.out.println("# " +(i++) + " QQ: " + buddy.getNickname() +" : " + buddy.getQQ() +" ["+e.getType()+"]");
// }
//
// client.getGroupList(null).waitFinalEvent();
// System.out.println("Buddy count: " + client.getGroupList().size());
// for(QQGroup group: client.getGroupList()){
// client.getGroupInfo(group, null).waitFinalEvent();
// System.out.println("group member count:" + group.getMembers().size());
// for(QQGroupMember mem: group.getMembers()){
// QQActionFuture f = client.getUserQQ(mem, null);
// QQActionEvent e = f.waitFinalEvent();
// System.out.println("# " +(i++) + "Group:"+group.getName()+", QQ: " + mem.getNickname() +" : " + mem.getQQ() +" ["+e.getType()+"]");
// }
// }
//所有的逻辑完了后,启动消息轮询
client.beginPollMsg();
}else if(event.getType() == Type.EVT_ERROR){
QQException ex = (QQException) event.getTarget();
if(ex.getError() == QQErrorCode.NEED_CAPTCHA){
//TODO ..
System.out.println("需要验证码!!!");
}
}