/** 输出用户自己信息 */ public void my() { println("--------------------------------------------------"); println( "你好," + client.getFetionUser().getDisplayName() + "! - [" + client.getFetionUser().getImpresa() + "]"); println("--------------------------------------------------"); }
/** 发送震屏 */ public void nudge(String uri) { ChatDialogProxy proxy = null; Buddy buddy = client.getFetionStore().getBuddyByUri(uri); int state = buddy.getPresence().getValue(); if (state == Presence.OFFLINE) { println("你不能给不在线的好友发送震屏。"); prompt(); return; } try { proxy = this.client.getChatDialogProxyFactory().create(buddy); if (proxy.getState() == DialogState.CREATED) { proxy.openDialog(); } } catch (Exception e) { println("建立对话失败!!"); return; } proxy.sendNudgeState( new ActionEventListener() { @Override public void fireEevent(ActionEvent event) { if (event.getEventType() == ActionEventType.SUCCESS) { println("发送震屏成功。"); } else { println("发送震屏失败!" + event.toString()); } } }); }
/* * 添加好友 * @throws Exception */ public void add(String mobile) { client.addBuddy( mobile, new ActionEventListener() { public void fireEevent(ActionEvent event) { if (event.getEventType() == ActionEventType.SUCCESS) { println("发出添加好友请求成功!请耐性地等待用户回复。"); } else { println("发出添加好友请求失败!" + event.toString()); } } }); }
/** * 创建新的分组 * * @param title */ public void newcord(String title) { client.createCord( title, new ActionEventListener() { public void fireEevent(ActionEvent event) { if (event.getEventType() == ActionEventType.SUCCESS) { println("创建新的分组成功!"); } else { println("创建新的分组失败!"); } } }); }
/* (non-Javadoc) * @see net.solosky.maplefetion.NotifyEventAdapter#imageVerify(net.solosky.maplefetion.bean.VerifyImage, java.lang.String, java.lang.String) */ @Override protected void imageVerify( final VerifyImage verifyImage, final String verifyReason, final String verifyTips, final ImageVerifyEvent event) { saveImage(verifyImage.getImageData()); if (client.getState() == ClientState.LOGGING) { System.out.print("当前登录过程需要验证,原因【" + verifyReason + "】,请输入当前目录下图片[verify.jpg]中的验证码:"); String line = this.readLine(); verifyImage.setVerifyCode(line); client.processVerify(event); } else { println( "当前操作需要验证,原因:【" + verifyReason + "】。\n请使用verify命令输入当前目录下图片[verify.jpg]中的验证码(如verify 123abc)."); this.verifyEvent = event; prompt(); } }
/** 删除好友 */ public void del(String uri) { Buddy buddy = this.client.getFetionStore().getBuddyByUri(uri); if (buddy != null) { client.deleteBuddy( buddy, new ActionEventListener() { public void fireEevent(ActionEvent event) { if (event.getEventType() == ActionEventType.SUCCESS) { println("删除好友成功!"); } else { println("删除好友失败!"); } } }); } else { println("对不起,好友" + uri + "不存在!"); } }