コード例 #1
0
ファイル: IQProxy.java プロジェクト: helebest/mobilis
  /**
   * Updates the server jid from shared preferences (can be modified by user in SettingsActivity).
   */
  public void updateServerJid() {
    String serverJid =
        mXhuntService
            .getSharedPrefHelper()
            .getValue(
                mXhuntService.getResources().getString(R.string.bundle_key_settings_serverjid));

    if (serverJid == null)
      serverJid = mXhuntService.getResources().getString(R.string.default_jid_server);

    if (!serverJid.equals(mServerCoordinatorJid)) {
      Log.v(TAG, "ServerJID changed from " + mServerCoordinatorJid + " to " + serverJid);
      mServerCoordinatorJid = serverJid;
    }
  }
コード例 #2
0
ファイル: IQProxy.java プロジェクト: helebest/mobilis
        @SuppressWarnings({"rawtypes", "unchecked"})
        @Override
        public void processIQ(XMPPIQ iq) throws RemoteException {

          if (!(iq.from.equals(mGameServiceJid) || iq.from.equals(mServerCoordinatorJid))) {
            String msg =
                "Discarded IQ from unknown JID "
                    + iq.from
                    + " to prevent GameService zombies from interfering"
                    + " - see IQProxy.AbstractCallback.processIQ()";
            Log.w(TAG, msg);
            return;
          }

          Log.v(
              TAG,
              "AbstractCallback: ID: "
                  + iq.packetID
                  + " type: "
                  + iq.type
                  + " ns: "
                  + iq.namespace
                  + " payload: "
                  + iq.payload);

          XMPPBean inBean = convertXMPPIQToBean(iq);

          Log.v(TAG, "Converted Abstract Bean: " + beanToString(inBean));

          if (_waitingCallbacks.containsKey(inBean.getId())) {
            IXMPPCallback callback = _waitingCallbacks.get(inBean.getId());

            if (null != callback) {
              try {
                callback.invoke(inBean);
              } catch (ClassCastException e) {
                e.printStackTrace();
              }
            }
          } else {
            // refer XMPPIQ as XMPPBean to the current active Activities GameState
            // (hold in XHuntService)
            mXhuntService.getGameState().processPacket(inBean);
          }
        }