* @param listener a {@link iqq.im.QQActionListener} object.
* @return a {@link iqq.im.event.QQActionFuture} object.
*/
public QQActionFuture sendMsg(final QQMsg msg, QQActionListener listener) {
if(msg.getType() == QQMsg.Type.SESSION_MSG) {
final ProcActionFuture future = new ProcActionFuture(listener, true);
QQStranger stranger = (QQStranger) msg.getTo();
if(stranger.getGroupSig() == null || stranger.getGroupSig().equals("")) {
getSessionMsgSig(stranger, new QQActionListener() {
@Override
public void onActionEvent(QQActionEvent event) {
if(event.getType() == QQActionEvent.Type.EVT_OK) {
if(!future.isCanceled()){
doSendMsg(msg, future);
}
}else if(event.getType() == QQActionEvent.Type.EVT_ERROR){
future.notifyActionEvent(event.getType(), event.getTarget());
}
}
});
}
return future;
} else if(msg.getType() == QQMsg.Type.GROUP_MSG || msg.getType() == QQMsg.Type.DISCUZ_MSG) {
if(getContext().getSession().getCfaceKey() == null || getContext().getSession().getCfaceKey().equals("")) {
final ProcActionFuture future = new ProcActionFuture(listener, true);
getCFaceSig(new QQActionListener() {
@Override
public void onActionEvent(QQActionEvent event) {
if(event.getType() == QQActionEvent.Type.EVT_OK) {
if(!future.isCanceled()){
doSendMsg(msg, future);
}
}else if(event.getType() == QQActionEvent.Type.EVT_ERROR){
future.notifyActionEvent(event.getType(), event.getTarget());
}
}
});
return future;
}