Package org.jivesoftware.smack.packet

Examples of org.jivesoftware.smack.packet.PacketExtension


     * @throws Exception if an error occurs parsing the XML.
     */
    public PacketExtension parseExtension (XmlPullParser parser)
        throws Exception
    {
        PacketExtension extension = null;

        StringBuilder sb = new StringBuilder ();
        boolean done = false;
        while (!done)
        {
View Full Code Here


  }


  public static String getSendDate(Message msg, Locale loc) {
    for (Iterator iter = msg.getExtensions().iterator(); iter.hasNext();) {
      PacketExtension extension = (PacketExtension) iter.next();
      if (extension.getNamespace().equals("jabber:x:delay")) {
        DelayInformation delayInfo = (DelayInformation) extension;
        Date date = delayInfo.getStamp();
        // why does formatter with this method return a time in the afternoon
        // like 03:24 instead of 15:24 like formatTime does??
        return Formatter.getInstance(loc).formatDateAndTime(date);
View Full Code Here

     * @throws Exception if an error occurs parsing the XML.
     */
    public PacketExtension parseExtension (XmlPullParser parser)
        throws Exception
    {
        PacketExtension extension = null;

        StringBuilder sb = new StringBuilder ();
        boolean done = false;
        while (!done)
        {
View Full Code Here

    static class PresenceListener implements PacketListener {

        public void processPacket(Packet packet) {
            Presence presence = (Presence) packet;
            String iqString = presence.toString();
            final PacketExtension extension = presence.getExtension("http://jabber.org/protocol/caps");
            if (extension != null)
                System.out.println("T" + System.currentTimeMillis() + " Pres: " + iqString + ": " + presence.toXML());
        }
View Full Code Here

        oldWrapper.date,
        new Date());
    db.commit();
    Iterator i = oldWrapper.presence.getExtensions();
    while(i.hasNext()) {
      PacketExtension ex = (PacketExtension)i.next();
      if(ex instanceof GameStatusExtension) {
        GameStatusExtension status = (GameStatusExtension)ex;
        String gameId = status.gameId;
        String destination;
        if(status.gameId.equals("lfss2")) {
View Full Code Here

   *
   * @param message
   * @return
   */
  protected MessageEvent getMessageEvent(Message message) {
    PacketExtension extension = message.getExtension(messageEvent
        .getElementName(), messageEvent.getNamespace());
    if (extension == null || !(extension instanceof MessageEvent))
      return null;
    return (MessageEvent) extension;
  }
View Full Code Here

        }

        if (packet.getType() == Message.Type.NORMAL) {
            if (packet.getBody() == null)
                return;
            PacketExtension ex = packet.getExtension("x",
                    "http://jabber.org/protocol/muc#user");
            if (ex != null)
                return;

            ex = packet.getExtension("x", "jabber:x:conference");
View Full Code Here

          for (Control control : ((Composite) editor.getEditor())
              .getChildren())
            control.dispose();
        }
      while (iterator.hasNext()) {
        PacketExtension ex = (PacketExtension) iterator.next();
        if (ex instanceof IGameExtension) {
          extensions++;
          if (editor == null)
            editor = getEditor(item, true);
          final IGameExtension gameEx = (IGameExtension) ex;
View Full Code Here

    StringBuffer status = new StringBuffer();
    boolean changestate = false;
    String changeStateTo = GOIMPlugin.getDefault().getMyPreferenceStore().getString(PreferenceConstants.P_CHANGE_STATUS_TO_ON_GAME_LAUNCH);
    for(GOIMGameItem game : gameList) {
      String str = game.retrieveExtensionProxy().getStatusString(game);
      PacketExtension ex = game.retrieveExtensionProxy().getStatusPacket(game);
      if(str != null) status.append(str).append(" ");
      if(ex != null) presence.addExtension(ex);
      if(game.retrieveExtensionProxy().needsOnlineStatusChange(game))
        changestate = true;
    }
View Full Code Here

        public void chatCreated(final Chat chat, boolean createdLocally) {
            chat.addMessageListener(this);
        }

        public void processMessage(Chat chat, Message message) {
            PacketExtension extension
                    = message.getExtension("http://jabber.org/protocol/chatstates");
            if (extension == null) {
                return;
            }

            ChatState state;
            try {
                state = ChatState.valueOf(extension.getElementName());
            }
            catch (Exception ex) {
                return;
            }
View Full Code Here

TOP

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

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.