Examples of QQActionEvent


Examples of iqq.im.event.QQActionEvent

      }
    }, 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("需要验证码!!!");
      }
    }
View Full Code Here

Examples of iqq.im.event.QQActionEvent

  public QQActionEvent waitEvent() throws QQException {
    if( !hasEvent ) {
      return null;
    }
    try {
      QQActionEvent event = eventQueue.take();
      hasEvent = !isFinalEvent(event);
      return event;
    } catch (InterruptedException e) {
      throw new QQException(QQErrorCode.WAIT_INTERUPPTED, e);
    }
View Full Code Here

Examples of iqq.im.event.QQActionEvent

  }

  /** {@inheritDoc} */
  @Override
  public QQActionEvent waitEvent(long timeoutMs) throws QQException {
    QQActionEvent event = null;
    if( !hasEvent ) {
      return null;
    }
    try {
      event = eventQueue.poll(timeoutMs, TimeUnit.MICROSECONDS);
View Full Code Here

Examples of iqq.im.event.QQActionEvent

  }

  /** {@inheritDoc} */
  @Override
  public QQActionEvent waitFinalEvent() throws QQException {
    QQActionEvent event = null;
    while( (event = waitEvent()) != null){
      if( isFinalEvent(event) ){
        return event;
      }
    }
View Full Code Here

Examples of iqq.im.event.QQActionEvent

  }

  /** {@inheritDoc} */
  @Override
  public QQActionEvent waitFinalEvent(long timeoutMs) throws QQException {
    QQActionEvent event = null;
    long start = System.currentTimeMillis();
    while( (event = waitEvent(timeoutMs)) != null){
      long end = System.currentTimeMillis();
      if( isFinalEvent(event) ){
        return event;
View Full Code Here

Examples of iqq.im.event.QQActionEvent

   *
   * @param type a {@link iqq.im.event.QQActionEvent.Type} object.
   * @param target a {@link java.lang.Object} object.
   */
  public void notifyActionEvent(QQActionEvent.Type type, Object target){
    onActionEvent(new QQActionEvent(type, target, this));
  }
View Full Code Here

Examples of iqq.im.event.QQActionEvent

  /** {@inheritDoc} */
  @Override
  public void notifyActionEvent(QQActionEvent.Type type, Object target) {
    if(listener != null){
      listener.onActionEvent(new QQActionEvent(type, target, actionFuture));
    }

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.