Package com.caucho.xmpp.im

Examples of com.caucho.xmpp.im.Text


          Value subjectValue = iterator.next();

          if (! subjectValue.isString())
            return env.error("subject values must be strings");

          subjects[i++] = new Text(subjectValue.toString());
        }
      }
      else if (subject.isString()) {
        if (! subject.isString())
          return env.error("subject values must be strings");

        subjects = new Text[] { new Text(subject.toString()) };
      }
    }

    // extract body text
    Text[] bodies = null;

    if (body.isArray()) {
      bodies = new Text[body.getSize()];

      int i = 0;
      Iterator<Value> iterator = body.getValueIterator(env);

      while (iterator.hasNext()) {
        Value bodyValue = iterator.next();

        if (! bodyValue.isString())
          return env.error("body values must be strings");

        bodies[i++] = new Text(bodyValue.toString());
      }
    }
    else if (body.isString()) {
      if (! body.isString())
        return env.error("body values must be strings");

      bodies = new Text[] { new Text(body.toString()) };
    }

    ImMessage message = new ImMessage(to, from, type,
                                      subjects, bodies, thread, extras);
   
View Full Code Here


      from = getAddress(env);

    if ("".equals(show))
      show = null;

    Text statusText = null;

    if (! "".equals(status))
      statusText = new Text(status);

    return new ImPresence(to, from, show, statusText, priority, extras);
  }
View Full Code Here

        String body = _in.getText();

        if (bodyList == null)
          bodyList = new ArrayList<Text>();

        bodyList.add(new Text(body, lang));

        expectEnd("body");
      }
      else if ("subject".equals(_in.getLocalName())
               && "jabber:client".equals(_in.getNamespaceURI())) {
        String lang = null;

        if (_in.getAttributeCount() > 0
            && "lang".equals(_in.getAttributeLocalName(0)))
          lang = _in.getAttributeValue(0);

        tag = _in.next();
        if (_isFinest)
          debug(_in);

        String text = _in.getText();

        if (subjectList == null)
          subjectList = new ArrayList<Text>();

        subjectList.add(new Text(text, lang));

        expectEnd("subject");
      }
      else if ("thread".equals(_in.getLocalName())
               && "jabber:client".equals(_in.getNamespaceURI())) {
View Full Code Here

      type = "";

    int tag;

    String show = null;
    Text status = null;
    int priority = 0;
    ArrayList<Serializable> extraList = new ArrayList<Serializable>();
    BamError error = null;

    while ((tag = _in.nextTag()) > 0
           && ! ("presence".equals(_in.getLocalName())
                 && tag == XMLStreamReader.END_ELEMENT)) {
      if (_isFinest)
        debug(_in);
     
      if (tag != XMLStreamReader.START_ELEMENT)
        continue;

      if ("status".equals(_in.getLocalName())) {
        tag = _in.next();
   
        if (_isFinest)
          debug(_in);

        status = new Text(_in.getText());

        skipToEnd("status");
      }
      else if ("show".equals(_in.getLocalName())) {
        tag = _in.next();
View Full Code Here

  }

  public ImMessage(String body)
  {
    _type = "chat";
    _body = new Text[] { new Text(body) };
  }
View Full Code Here

  }

  public ImMessage(String type, String body)
  {
    _type = type;
    _body = new Text[] { new Text(body) };
  }
View Full Code Here

  public ImMessage(String to, String from, String body)
  {
    _type = "chat";
    _to = to;
    _from = from;
    _body = new Text[] { new Text(body) };
  }
View Full Code Here

  public ImMessage(String to, String from, String body, Serializable extra)
  {
    _type = "chat";
    _to = to;
    _from = from;
    _body = new Text[] { new Text(body) };
    _extra = new Serializable[] { extra };
  }
View Full Code Here

  public ImMessage(String to, String from, String body, Serializable []extra)
  {
    _type = "chat";
    _to = to;
    _from = from;
    _body = new Text[] { new Text(body) };
    _extra = extra;
  }
View Full Code Here

      synchronized (out) {
        out.writeStartElement("presence");
        out.writeDefaultNamespace(JABBERC_NS);

        ImPresence imPresence = null;
        Text status = null;

        if (value instanceof ImPresence) {
          imPresence = (ImPresence) value;

          if (to == null)
            to = imPresence.getTo();

          if (from == null)
            from = imPresence.getFrom();

          status = imPresence.getStatus();
        }

        if (to != null)
          out.writeAttribute("to", to);

        if (from != null)
          out.writeAttribute("from", from);

        if (type != null)
          out.writeAttribute("type", type);

        if (status != null) {
          out.writeStartElement("status");

          if (status.getLang() != null)
            out.writeAttribute("xml", "http://xml.org", "lang",
                               status.getLang());

          out.writeCharacters(status.getValue());
          out.writeEndElement(); // </status>
        }

        if (imPresence == null)
          out.writeValue(value);
View Full Code Here

TOP

Related Classes of com.caucho.xmpp.im.Text

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.