Package org.openmim.mn

Examples of org.openmim.mn.MessagingNetworkAdapter


          if (usersLoggedIn % REQPARAM_REPORT_INTERVAL == 0) report("usersLoggedIn", usersLoggedIn);
        }
      }
      else
      {
        plugin.addMessagingNetworkListener(new MessagingNetworkAdapter()
        {
          public void messageReceived(byte networkId, String srcLoginId, String dstLoginId, String text)
          {
            synchronized (statLock)
            {
View Full Code Here


                //events from this operationId are never delivered to a external listeners
                //they are delivered to internal listeners only.
                //addInternalMessagingNetworkListener() adds an internal listener.
                //removeInternalMessagingNetworkListener() removes an internal listener.
                MessagingNetworkListener l =
                  new MessagingNetworkAdapter()
                  {
                    public final void getUserDetailsFailed(byte networkId, long operationId,
                      String originalSrcLoginId, String originalDstLoginId,
                      MessagingNetworkException ex)
                    {
                      if (loginId.equals(originalSrcLoginId) && loginId.equals(originalDstLoginId))
                        authReq(false, ex);
                    }

                    public final void getUserDetailsSuccess(byte networkId, long operationId,
                      String originalSrcLoginId, String originalDstLoginId,
                      UserDetails userDetails)
                    {
                      if (loginId.equals(originalSrcLoginId) && loginId.equals(originalDstLoginId))
                      {
                        boolean ar = false;
                        try
                        {
                          ar = userDetails.isAuthorizationRequired();
                        }
                        catch (MessagingNetworkException exar)
                        {
                          ar = false;
                        }
                        authReq(ar, null);
                      }
                    }

                    private final void authReq(boolean authorizationRequired, MessagingNetworkException mex)
                    {
                      Session.this.authorizationRequired = authorizationRequired;

                      if (mex == null
                      || mex.getLogger() == MessagingNetworkException.CATEGORY_STILL_CONNECTED)
                      {
                        if (Defines.DEBUG && CAT.isDebugEnabled())
                          CAT.debug("login(): fetching my authorizationRequired flag done.");

                        setupSessionTasks();

                        opLogin.success();
                        opLogin = null;
                      }
                    }
                  }
                ;

//                try
//                {
//                  ctx.getGal().addForcedAop();
//                  AsyncOperationImpl aop = null;
//                  try
//                  {
//                    Session.this.enqueue(aop = new AsyncOperations.
//                      OpGetUserDetails(loginId, Session.this, false, ctx), l);
//                  }
//                  catch (MessagingNetworkException mex)
//                  {
//                    ctx.getPlug().handleEarlyException(aop, mex);
//                    throw mex;
//                  }
//                }
//                catch (MessagingNetworkException mex1)
//                {
//                  l.getUserDetailsFailed((byte) -1, -1L, loginId, loginId, mex1);
//                }
                l.getUserDetailsFailed((byte) -1, -1L, loginId, loginId, new MessagingNetworkException(MessagingNetworkException.CATEGORY_STILL_CONNECTED,MessagingNetworkException.ENDUSER_NO_ERROR));
                break;
              }

              case 40: //mainloop state case; must deliver events to Rx handlers etc etc etc
              {
View Full Code Here

    //events from this operationId are never delivered to a external listeners
    //they are delivered to internal listeners only.
    //addInternalMessagingNetworkListener() adds an internal listener.
    //removeInternalMessagingNetworkListener() removes an internal listener.
    MessagingNetworkListener l =
      new MessagingNetworkAdapter()
      {
        public void getUserDetailsFailed(byte networkId, long operationId,
          String originalSrcLoginId, String originalDstLoginId,
          MessagingNetworkException ex)
        {
View Full Code Here

      System.exit(1);
      */


      //start logging in
      plugin.addMessagingNetworkListener(new MessagingNetworkAdapter()
      {
        /** @see MessagingNetwork#startSendMessage(String, String, String) */
        public void sendMessageFailed(byte networkId, long operationId,
          String originalMessageSrcLoginId, String originalMessageDstLoginId, String originalMessageText,
          MessagingNetworkException ex)
View Full Code Here

  messagingNetworkImpl = (MessagingNetwork) Class.forName(mnImplClassName).newInstance();

  messagingNetworkImpl.init();

  messagingNetworkImpl.addMessagingNetworkListener(//
  new MessagingNetworkAdapter()
  {
    public void messageReceived(byte mnId, String src, String dst, String text)
    {
      if (Defines.DEBUG && CAT.isInfoEnabled()) CAT.info("INCOMING EVENT: messageReceived(" + mnId + ", " + StringUtil.toPrintableString(src) + ", " + StringUtil.toPrintableString(dst) + ", " + (text == null ? null : "\""+(text.length() < 80 ? text + "\"" : text.substring(0, 80)+"...\" (the rest not printed, message length="+text.length())) + ")");
    }
View Full Code Here

//<!ELEMENT on-msg (reply)+>
//<!ELEMENT reply (#PCDATA)>
private void onMsg(final Node node, final Context ctx) throws ExpectException, MessagingNetworkException
{
  MessagingNetworkListener oldlistener = ctx.listener;
  ctx.listener = new MessagingNetworkAdapter()
  {
    public void contactsReceived(byte networkId, String from, String to, String[] contactsUins, String[] contactsNicks)
    {
    }
    public void authorizationResponse(byte networkId, String srcLoginId, String dstLoginId, boolean grant)
View Full Code Here

TOP

Related Classes of org.openmim.mn.MessagingNetworkAdapter

Copyright © 2018 www.massapicom. 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.