Examples of QQNotifyEvent


Examples of iqq.im.event.QQNotifyEvent

          if (event.getTarget() == null) {
            // 没有新邮件,t直接传0
            loopPoll(sid, 0);
          } else {
            // 有新邮件
            QQNotifyEvent evt = (QQNotifyEvent) event.getTarget();
            // 通知事件
            getContext().fireNotify(evt);
            // 消除所有,传上最后t的标记上去
            List<QQEmail> mailList = (List<QQEmail>) evt
                .getTarget();
            loopPoll(sid, mailList.get(mailList.size() - 1)
                .getFlag());
           
            // 把邮件标记为已读,需要邮件列表ID
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

          String pollType = poll.getString("poll_type");
          JSONObject pollData = poll.getJSONObject("value");
          if (pollType.equals("input_notify")) {
            long fromUin = pollData.getLong("from_uin");
            QQBuddy buddy = store.getBuddyByUin(fromUin);
            notifyEvents.add(new QQNotifyEvent(
                QQNotifyEvent.Type.BUDDY_INPUT, buddy));
          } else if (pollType.equals("message")) {
            // 好友消息
            notifyEvents.add(processBuddyMsg(pollData));
          } else if (pollType.equals("group_message")) {
            // 群消息
            notifyEvents.add(processGroupMsg(pollData));
          } else if (pollType.equals("discu_message")) {
            // 讨论组消息
            notifyEvents.add(processDiscuzMsg(pollData));
          } else if (pollType.equals("sess_message")) {
            // 临时会话消息
            notifyEvents.add(processSessionMsg(pollData));
          } else if (pollType.equals("shake_message")) {
            // 窗口震动
            long fromUin = pollData.getLong("from_uin");
            QQUser user = getContext().getStore().getBuddyByUin(
                fromUin);
            notifyEvents.add(new QQNotifyEvent(
                QQNotifyEvent.Type.SHAKE_WINDOW, user));
          } else if (pollType.equals("kick_message")) {
            // 被踢下线
            getContext().getAccount().setStatus(QQStatus.OFFLINE);
            getContext().getSession().setState(
                QQSession.State.KICKED);
            notifyEvents.add(new QQNotifyEvent(
                QQNotifyEvent.Type.KICK_OFFLINE, pollData
                    .getString("reason")));
          } else if (pollType.equals("buddies_status_change")) {
            notifyEvents.add(processBuddyStatusChange(pollData));
          } else {
            // TODO ...
            LOG.warn("unknown pollType: " + pollType);
          }
        }
      }
      // end recode == 0
    } else if (retcode == 102) {
      // 接连正常,没有消息到达 {"retcode":102,"errmsg":""}
      // 继续进行下一个消息请求
     
    } else if (retcode == 110 || retcode == 109) { // 客户端主动退出
      getContext().getSession().setState(QQSession.State.OFFLINE);
    } else if (retcode == 116) {
      // 需要更新Ptwebqq值,暂时不知道干嘛用的
      // {"retcode":116,"p":"2c0d8375e6c09f2af3ce60c6e081bdf4db271a14d0d85060"}
      // if (a.retcode === 116) alloy.portal.setPtwebqq(a.p)
      getContext().getSession().setPtwebqq(json.getString("p"));
    } else if (retcode == 121 || retcode == 120 || retcode == 100) {  // 121,120 : ReLinkFailure    100 : NotReLogin
      // 服务器需求重新认证
      // {"retcode":121,"t":"0"}
      LOG.info("**** NEED_REAUTH retcode: " + retcode + " ****");
      getContext().getSession().setState(QQSession.State.OFFLINE);
      QQException ex = new QQException(QQException.QQErrorCode.INVALID_LOGIN_AUTH);
      notifyActionEvent(QQActionEvent.Type.EVT_ERROR, ex);
      return ;
      //notifyEvents.add(new QQNotifyEvent(QQNotifyEvent.Type.NEED_REAUTH, null));
    } else {
     
      LOG.error("**Reply retcode to author**");
      LOG.error("***************************");
      LOG.error("Unknown retcode: " + retcode);
      LOG.error("***************************");
      // 返回错误,核心遇到未知recode
      // getContext().getSession().setState(QQSession.State.ERROR);
      notifyEvents.add(new QQNotifyEvent(QQNotifyEvent.Type.UNKNOWN_ERROR, json));
    }
    notifyActionEvent(QQActionEvent.Type.EVT_OK, notifyEvents);
  }
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

    QQBuddy buddy = getContext().getStore().getBuddyByUin(uin);
    String status = pollData.getString("status");
    int clientType = pollData.getInt("client_type");
    buddy.setStatus(QQStatus.valueOfRaw(status));
    buddy.setClientType(QQClientType.valueOfRaw(clientType));
    return new QQNotifyEvent(QQNotifyEvent.Type.BUDDY_STATUS_CHANGE, buddy);
  }
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

        store.addStranger((QQStranger) member);
      }
      msg.setFrom(member);
    }

    return new QQNotifyEvent(QQNotifyEvent.Type.CHAT_MSG, msg);
  }
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

      if (group != null) {
        group.getMembers().add(member);
      }
    }

    return new QQNotifyEvent(QQNotifyEvent.Type.CHAT_MSG, msg);
  }
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

      msg.setFrom(member);
      if (msg.getDiscuz() != null) {
        msg.getDiscuz().getMembers().add(member);
      }
    }
    return new QQNotifyEvent(QQNotifyEvent.Type.CHAT_MSG, msg);
  }
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

        store.addStranger((QQStranger)user);
      }
    }
    user.setQQ(fromQQ); // 带上QQ号码
    msg.setFrom(user);
    return new QQNotifyEvent(QQNotifyEvent.Type.CHAT_MSG, msg);
  }
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

        mail.setSummary(ct.getString("summary"));
        mail.setUnread(true);
        list.add(mail);
      }
      notifyActionEvent(QQActionEvent.Type.EVT_OK,
          new QQNotifyEvent(Type.EMAIL_NOTIFY, list));
    }
  }
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

          verify.type = QQNotifyEventArgs.ImageVerify.VerifyType.LOGIN;
          verify.image = (BufferedImage) event.getTarget();
          verify.reason = reason;
          verify.future = future;
         
          getContext().fireNotify(new QQNotifyEvent(QQNotifyEvent.Type.CAPACHA_VERIFY, verify));
        }else if(event.getType()==QQActionEvent.Type.EVT_ERROR){
          future.notifyActionEvent(
              QQActionEvent.Type.EVT_ERROR,
              (QQException) event.getTarget());
        }
View Full Code Here

Examples of iqq.im.event.QQNotifyEvent

      @Override
      public void onActionEvent(QQActionEvent event) {
        if(event.getType() == QQActionEvent.Type.EVT_OK) {
          // 重新登录成功重新POLL
          getContext().fireNotify(new QQNotifyEvent(QQNotifyEvent.Type.RELOGIN_SUCCESS, null));
        } else if(event.getType() == QQActionEvent.Type.EVT_ERROR) {
          getContext().fireNotify(new QQNotifyEvent(QQNotifyEvent.Type.UNKNOWN_ERROR, null));
        }
      }
     
    });
  }
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.