store.addBuddy(buddy);
}
}
//检查之前的会话中,是否有BasicChatDialog 如果有,关闭
ChatDialog basicDialog = context.getDialogFactory().findChatDialog(buddy);
if(basicDialog instanceof BasicChatDialog){
basicDialog.closeDialog(); //关闭并从当前对话列表中移除
}
//和邀请的好友建立会话
final ChatDialog dialog = context.getDialogFactory().createChatDialog(notify);
Runnable r = new Runnable(){
public void run(){
//在另外一个线程里打开这个对话框
try {
dialog.openDialog();
logger.debug("Created and opened ChatDialog success - Dialog="+dialog);
} catch (FetionException e) {
logger.warn("create ChatDialog by invite notify failed.", e);
//发生错误就关闭这个对话框
dialog.closeDialog();
}
}
};
this.context.getFetionExecutor().submitTask(r);