Ejemplo n.º 1
0
  /** 收到群成员发生变更消息 服务端主动发出 DB */
  public void receiveGroupChangeMemberNotify(IMGroup.IMGroupChangeMemberNotify notify) {
    int groupId = notify.getGroupId();
    int changeType = ProtoBuf2JavaBean.getGroupChangeType(notify.getChangeType());
    List<Integer> changeList = notify.getChgUserIdListList();

    List<Integer> curMemberList = notify.getCurUserIdListList();
    if (groupMap.containsKey(groupId)) {
      GroupEntity entity = groupMap.get(groupId);
      entity.setlistGroupMemberIds(curMemberList);
      dbInterface.insertOrUpdateGroup(entity);
      groupMap.put(groupId, entity);

      GroupEvent groupEvent = new GroupEvent(GroupEvent.Event.CHANGE_GROUP_MEMBER_SUCCESS);
      groupEvent.setChangeList(changeList);
      groupEvent.setChangeType(changeType);
      groupEvent.setGroupEntity(entity);
      triggerEvent(groupEvent);
    } else {
      // todo 没有就暂时不管了,只要聊过天都会显示在回话里面
    }
  }
Ejemplo n.º 2
0
  public void onReqChangeGroupMember(IMGroup.IMGroupChangeMemberRsp groupChangeMemberRsp) {
    int resultCode = groupChangeMemberRsp.getResultCode();
    if (0 != resultCode) {
      triggerEvent(new GroupEvent(GroupEvent.Event.CHANGE_GROUP_MEMBER_FAIL));
      return;
    }

    int groupId = groupChangeMemberRsp.getGroupId();
    List<Integer> changeUserIdList = groupChangeMemberRsp.getChgUserIdListList();
    IMBaseDefine.GroupModifyType groupModifyType = groupChangeMemberRsp.getChangeType();

    GroupEntity groupEntityRet = groupMap.get(groupId);
    groupEntityRet.setlistGroupMemberIds(groupChangeMemberRsp.getCurUserIdListList());
    groupMap.put(groupId, groupEntityRet);
    dbInterface.insertOrUpdateGroup(groupEntityRet);

    GroupEvent groupEvent = new GroupEvent(GroupEvent.Event.CHANGE_GROUP_MEMBER_SUCCESS);
    groupEvent.setChangeList(changeUserIdList);
    groupEvent.setChangeType(ProtoBuf2JavaBean.getGroupChangeType(groupModifyType));
    groupEvent.setGroupEntity(groupEntityRet);
    triggerEvent(groupEvent);
  }