Package org.jivesoftware.smack.packet

Examples of org.jivesoftware.smack.packet.XMPPError


        // we don't want to accept the file so we need to send the IQ error message
        // to the Initiator
        IQ errorPacket = receive.getSI().createConfirmationMessage();
        errorPacket.setType(IQ.Type.ERROR);

        errorPacket.setError(new XMPPError(403,"forbidden"));
        sendPacket( errorPacket );
        dispose();
    }
View Full Code Here


    }

    public void reject() throws XMPPException {
        StreamInitiation si = this.si.createConfirmationMessage(manager.getPreferredType());
        si.setType(IQ.Type.ERROR);
        si.setError(new XMPPError(503, "File Rejected"));
        manager.getConnection().sendPacket(si);
    }
View Full Code Here

        Message result = new Message();

        if (muleMessage.getExceptionPayload() != null)
        {
            result.setError(
                new XMPPError(XMPPError.Condition.service_unavailable,
                    muleMessage.getExceptionPayload().getMessage()));
        }

        for (String propertyName : muleMessage.getOutboundPropertyNames())
        {
View Full Code Here

        }
    }
   
    protected boolean roomDoesNotExist(XMPPException exception)
    {
        XMPPError error = exception.getXMPPError();
        if ((error.getCode() == 404) &&
            error.getCondition().equals(XMPPError.Condition.recipient_unavailable.toString()))
        {
            return true;
        }
        return false;
    }
View Full Code Here

        VCard result = null;
        try {
            result = (VCard) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

            if (result == null) {
                throw new XMPPException(new XMPPError(408, "Timeout getting VCard information"));
            }
            if (result.getError() != null) {
                throw new XMPPException(result.getError());
            }
        }
View Full Code Here

              });
            }});
          doLogin(type, mode);
        } catch (final XMPPException e) {
          e.printStackTrace();
          final XMPPError error = e.getXMPPError();
          if(false && error != null && error.getCode() == 401) {
//            MessageBox box = new MessageBox(GOIMPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL);
//            box.setMessage("Could not log in .. (401 Unauthorized) Trying to register ?");
//            int test = box.open();
//            if(test != SWT.OK) return;
            try {
              PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
                public void run() {
                }});
              tryRegister();
              doLogin(type,mode);
            } catch (XMPPException e1) {
              e1.printStackTrace();
              return;
            }
          } else {
            if(conn != null)
              conn.close();
            conn = null;
            lastPresenceSent = null;
            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
              public void run() {
                ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),"Error while logging in","Error while trying to log into jabber server: " + account.getServer() + (error == null ? "" : ": " + error.getMessage()),new Status(IStatus.ERROR,GOIMPlugin.ID,IStatus.OK,"Error while logging into account " + account.name,e));
              }
            });
          }
        }
      }
View Full Code Here

 
    /**
     * Check the creation of a new xmppError locally.
    */
    public void testLocalErrorCreation() {
      XMPPError error = new XMPPError(XMPPError.Condition.item_not_found);
        error.toXML();

      assertEquals(error.getCondition(), "item-not-found");
      assertEquals(error.getCode(), 404);
      assertEquals(error.getType(), XMPPError.Type.CANCEL);
      assertNull(error.getMessage());
    }
View Full Code Here

    /**
     * Check the creation of a new xmppError locally.
    */
    public void testLocalErrorWithCommentCreation() {
        String message = "Error Message";
        XMPPError error = new XMPPError(XMPPError.Condition.item_not_found, message);
        error.toXML();

        assertEquals(error.getCondition(), "item-not-found");
        assertEquals(error.getCode(), 404);
        assertEquals(error.getType(), XMPPError.Type.CANCEL);
        assertEquals(error.getMessage(), message);
    }
View Full Code Here

    /**
     * Check the creation of a new xmppError locally where there is not a default defined.
    */
    public void testUserDefinedErrorWithCommentCreation() {
        String message = "Error Message";
        XMPPError error = new XMPPError(new XMPPError.Condition("my_own_error"), message);
        error.toXML();

        assertEquals(error.getCondition(), "my_own_error");
        assertEquals(error.getCode(), 0);
        assertNull(error.getType());
        assertEquals(error.getMessage(), message);
    }
View Full Code Here

          "</error></iq>";
        try {
          // Create the xml parser
          XmlPullParser parser = getParserFromXML(xml);
          // Create a packet from the xml
          XMPPError packet = parseError(parser);
         
            assertNotNull(packet);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

TOP

Related Classes of org.jivesoftware.smack.packet.XMPPError

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.