Exemplo n.º 1
0
  void Annotations::storeAnnotations( const AnnotationsHandler::AnnotationsList& aList )
  {
    Tag *s = new Tag( "storage" );
    s->addAttribute( "xmlns", XMLNS_ANNOTATIONS );

    if( aList.size() )
    {
      AnnotationsHandler::AnnotationsList::const_iterator it = aList.begin();
      for( ; it != aList.end(); ++it )
      {
        Tag *n = new Tag( s, "note", (*it).note );
        n->addAttribute( "jid", (*it).jid );
        n->addAttribute( "cdate", (*it).cdate );
        n->addAttribute( "mdate", (*it).mdate );
      }
    }

    storeXML( s, this );
  }
Exemplo n.º 2
0
  Tag* GPGSigned::tag() const
  {
    if( !m_valid )
      return 0;

    Tag* x = new Tag( "x", m_signature );
    x->addAttribute( XMLNS, XMLNS_X_GPGSIGNED );

    return x;
  }
Exemplo n.º 3
0
Tag* GPGEncrypted::tag() const
{
    if( !m_valid )
        return 0;

    Tag* x = new Tag( "x", m_encrypted );
    x->addAttribute( XMLNS, XMLNS_X_GPGENCRYPTED );

    return x;
}
Exemplo n.º 4
0
  Tag* Receipt::tag() const
  {
    if( m_rcpt == Invalid )
      return 0;

    Tag* tag = new Tag( util::lookup( m_rcpt, receiptValues ), XMLNS, XMLNS_RECEIPTS );
    if ( !m_id.empty() )
      tag->addAttribute( "id", m_id );
    return tag;
  }
Exemplo n.º 5
0
  void Registration::changePassword( const std::string& password )
  {
    if( !m_parent || !m_parent->authed() )
      return;

    const std::string id = m_parent->getID();

    Tag *iq = new Tag( "iq" );
    iq->addAttribute( "type", "set" );
    iq->addAttribute( "id", id );
    iq->addAttribute( "to", m_parent->server() );
    Tag *q = new Tag( iq, "query" );
    q->addAttribute( "xmlns", XMLNS_REGISTER );
    new Tag( q, "username", m_parent->username() );
    new Tag( q, "password", password );

    m_parent->trackID( this, id, CHANGE_PASSWORD );
    m_parent->send( iq );
  }
Exemplo n.º 6
0
  void Search::search( const JID& directory, const DataForm& form, SearchHandler *sh )
  {
    if( !m_parent || !directory || !sh )
      return;

    const std::string& id = m_parent->getID();

    Tag *iq = new Tag( "iq" );
    iq->addAttribute( "id", id );
    iq->addAttribute( "type", "set" );
    iq->addAttribute( "to", directory.full() );
    Tag *q = new Tag( iq, "query" );
    q->addAttribute( "xmlns", XMLNS_SEARCH );
    q->addChild( form.tag() );

    m_track[id] = sh;
    m_parent->trackID( this, id, DoSearch );
    m_parent->send( iq );
  }
Exemplo n.º 7
0
  bool LastActivity::handleIq( Stanza *stanza )
  {
    switch( stanza->subtype() )
    {
      case StanzaIqGet:
      {
        time_t now = time( 0 );

        Tag *t = new Tag( "iq" );
        t->addAttribute( "type", "result" );
        t->addAttribute( "id", stanza->id() );
        t->addAttribute( "to", stanza->from().full() );
        Tag *q = new Tag( t, "query" );
        std::ostringstream oss;
        oss << (int)(now - m_active);
        q->addAttribute( "seconds", oss.str() );
        q->addAttribute( "xmlns", XMLNS_LAST );

        m_parent->send( t );
        break;
      }

      case StanzaIqSet:
      {
        Tag *t = new Tag( "iq" );
        t->addAttribute( "id", stanza->id() );
        t->addAttribute( "to", stanza->from().full() );
        t->addAttribute( "type", "error" );
        Tag *e = new Tag( t, "error" );
        e->addAttribute( "type", "cancel" );
        Tag *f = new Tag( e, "feature-not-implemented" );
        f->addAttribute( "xmlns", XMLNS_XMPP_STANZAS );

        m_parent->send( t );
        break;
      }

      default:
        break;
    }

    return true;
  }
Exemplo n.º 8
0
  Tag* Adhoc::Command::tag() const
  {
    if( m_node.empty() )
      return 0;

    Tag* c = new Tag( "command" );
    c->setXmlns( XMLNS_ADHOC_COMMANDS );
    c->addAttribute( "node", m_node );
    if( m_actions != 0 )
    {
      // Multi-stage command response

      if( m_status != InvalidStatus )
        c->addAttribute( "status", statusString( m_status ) );
      else
        c->addAttribute( "status", statusString( Executing ) );

      Tag* actions = new Tag( c, "actions" );

      if( m_action != InvalidAction )
        c->addAttribute( "execute", actionString( m_action ) );
      else
        c->addAttribute( "execute", actionString( Complete ) );

      if( ( m_actions & Previous ) == Previous )
        new Tag( actions, "prev" );
      if( ( m_actions & Next ) == Next )
        new Tag( actions, "next" );
      if( ( m_actions & Complete ) == Complete )
        new Tag( actions, "complete" );
    }
    else
    {
      // Single-stage command request/response or Multi-stage command request

      if( m_action != InvalidAction )
        c->addAttribute( "action", actionString( m_action ) );
      if( m_status != InvalidStatus )
        c->addAttribute( "status", statusString( m_status ) );
    }

    if ( !m_sessionid.empty() )
      c->addAttribute( "sessionid", m_sessionid );

    if( m_plugin && *m_plugin )
      c->addChild( m_plugin->tag()->clone() );

    NoteList::const_iterator it = m_notes.begin();
    for( ; it != m_notes.end(); ++it )
      c->addChild( (*it)->tag() );

    return c;
  }
Exemplo n.º 9
0
Arquivo: iq.cpp Projeto: OSUser/avbot
  Tag* IQ::tag() const
  {
    if( m_subtype == Invalid )
      return 0;

    Tag* t = new Tag( "iq" );
    if( m_to )
      t->addAttribute( "to", m_to.full() );
    if( m_from )
      t->addAttribute( "from", m_from.full() );
    if( !m_id.empty() )
      t->addAttribute( "id", m_id );
    t->addAttribute( TYPE, typeString( m_subtype ) );

    StanzaExtensionList::const_iterator it = m_extensionList.begin();
    for( ; it != m_extensionList.end(); ++it )
      t->addChild( (*it)->tag() );

    return t;
  }
Exemplo n.º 10
0
  Tag* SIManager::SI::tag() const
  {
    if( !m_valid )
      return 0;

    Tag* t = new Tag( "si" );
    t->setXmlns( XMLNS_SI );
    if( !m_id.empty() )
      t->addAttribute( "id", m_id );
    if( !m_mimetype.empty() )
      t->addAttribute( "mime-type", m_mimetype.empty() ? "binary/octet-stream" : m_mimetype );
    if( !m_profile.empty() )
      t->addAttribute( "profile", m_profile );
    if( m_tag1 )
      t->addChildCopy( m_tag1 );
    if( m_tag2 )
      t->addChildCopy( m_tag2 );

    return t;
  }
Exemplo n.º 11
0
static void sendXhtmlTag(Tag *body, void *data) {
	Tag *stanzaTag = (Tag*) data;
	if (body) {
		Tag *html = new Tag("html");
		html->addAttribute("xmlns", "http://jabber.org/protocol/xhtml-im");
		body->addAttribute("xmlns", "http://www.w3.org/1999/xhtml");
		html->addChild(body);
		stanzaTag->addChild(html);
	}
	Transport::instance()->send(stanzaTag);
}
Exemplo n.º 12
0
void TagTest::testAttributes()
{
    Tag tag;
    {
        tag.setGid("gid2");
        TagAttribute *attr = tag.attribute<TagAttribute>(Tag::AddIfMissing);
        attr->setDisplayName(QStringLiteral("name"));
        attr->setInToolbar(true);
        tag.addAttribute(attr);
        TagCreateJob *createjob = new TagCreateJob(tag, this);
        AKVERIFYEXEC(createjob);
        QVERIFY(createjob->tag().isValid());
        tag = createjob->tag();

        {
            TagFetchJob *fetchJob = new TagFetchJob(createjob->tag(), this);
            fetchJob->fetchScope().fetchAttribute<TagAttribute>();
            AKVERIFYEXEC(fetchJob);
            QCOMPARE(fetchJob->tags().size(), 1);
            QVERIFY(fetchJob->tags().first().hasAttribute<TagAttribute>());
            //we need to clone because the returned attribute is just a reference and destroyed on the next line
            //FIXME we should find a better solution for this (like returning a smart pointer or value object)
            QScopedPointer<TagAttribute> tagAttr(fetchJob->tags().first().attribute<TagAttribute>()->clone());
            QVERIFY(tagAttr);
            QCOMPARE(tagAttr->displayName(), QStringLiteral("name"));
            QCOMPARE(tagAttr->inToolbar(), true);
        }
    }
    //Try fetching multiple items
    Tag tag2;
    {
        tag2.setGid("gid22");
        TagAttribute *attr = tag.attribute<TagAttribute>(Tag::AddIfMissing)->clone();
        attr->setDisplayName(QStringLiteral("name2"));
        attr->setInToolbar(true);
        tag2.addAttribute(attr);
        TagCreateJob *createjob = new TagCreateJob(tag2, this);
        AKVERIFYEXEC(createjob);
        QVERIFY(createjob->tag().isValid());
        tag2 = createjob->tag();

        {
            TagFetchJob *fetchJob = new TagFetchJob(Tag::List() << tag << tag2, this);
            fetchJob->fetchScope().fetchAttribute<TagAttribute>();
            AKVERIFYEXEC(fetchJob);
            QCOMPARE(fetchJob->tags().size(), 2);
            QVERIFY(fetchJob->tags().at(0).hasAttribute<TagAttribute>());
            QVERIFY(fetchJob->tags().at(1).hasAttribute<TagAttribute>());
        }
    }

    TagDeleteJob *deleteJob = new TagDeleteJob(Tag::List() << tag << tag2, this);
    AKVERIFYEXEC(deleteJob);
}
Exemplo n.º 13
0
Tag* SOCKS5BytestreamManager::Query::tag() const
{
    if( m_type == TypeInvalid /*|| m_sid.empty()*/ )
        return 0;

    Tag* t = new Tag( "query" );
    t->setXmlns( XMLNS_BYTESTREAMS );
    t->addAttribute( "sid", m_sid );
    switch( m_type )
    {
    case TypeSH:
    {
        t->addAttribute( "mode", util::deflookup( m_mode, s5bModeValues, "tcp" ) );
        StreamHostList::const_iterator it = m_hosts.begin();
        for( ; it != m_hosts.end(); ++it )
        {
            Tag* s = new Tag( t, "streamhost" );
            s->addAttribute( "jid", (*it).jid.full() );
            s->addAttribute( "host", (*it).host );
            s->addAttribute( "port", (*it).port );
        }
        break;
    }
    case TypeSHU:
    {
        Tag* s = new Tag( t, "streamhost-used" );
        s->addAttribute( "jid", m_jid.full() );
        break;
    }
    case TypeA:
    {
        Tag* c = new Tag( t, "activate" );
        c->setCData( m_jid.full() );
        break;
    }
    default:
        break;
    }

    return t;
}
Exemplo n.º 14
0
bool AutoConnectLoop::restoreNextConnection() {
	if (m_users.size() == 0) {
		Log("connection restorer", "There is no other account to be checked => stopping Restorer");
		delete this;
		return false;
	}
	std::string jid = m_users.back();
	m_users.pop_back();

	Log("connection restorer", "Checking next jid " << jid);
	User *user = Transport::instance()->userManager()->getUserByJID(jid);
	if (user == NULL) {
		Log("connection restorer", "Sending probe presence to " << jid);
		Tag *stanza = new Tag("presence");
		stanza->addAttribute( "to", jid);
		stanza->addAttribute( "type", "probe");
		stanza->addAttribute( "from", Transport::instance()->jid());
		Transport::instance()->send(stanza);
	}
	return true;
}
Exemplo n.º 15
0
void SpectrumMUCConversation::removeUsers(AbstractUser *_user, GList *users) {
	GList *l;
	for (l = users; l != NULL; l = l->next) {
		std::string user((char *)l->data);
		Tag *tag = new Tag("presence");
		tag->addAttribute("from", m_jid + "/" + user);
		tag->addAttribute("to", _user->jid() + m_res);
		tag->addAttribute("type", "unavailable");

		Tag *x = new Tag("x");
		x->addAttribute("xmlns", "http://jabber.org/protocol/muc#user");

		Tag *item = new Tag("item");
		item->addAttribute("affiliation", "member");
		item->addAttribute("role", "participant");

		x->addChild(item);
		tag->addChild(x);
		Transport::instance()->send(tag);
	}
}
Exemplo n.º 16
0
  Tag* AMP::tag() const
  {
    if( !m_valid || !m_rules.size() )
      return 0;

    Tag* amp = new Tag( "amp" );
    amp->setXmlns( XMLNS_AMP );
    if( m_from )
      amp->addAttribute( "from", m_from.full() );
    if( m_to )
      amp->addAttribute( "to", m_to.full() );
    if( m_status != StatusInvalid )
      amp->addAttribute( "status", util::lookup( m_status, statusValues ) );
    if( m_perhop )
      amp->addAttribute( "per-hop", "true" );
    RuleList::const_iterator it = m_rules.begin();
    for( ; it != m_rules.end(); ++it )
      amp->addChild( (*it)->tag() );

    return amp;
  }
Exemplo n.º 17
0
  Tag* Subscription::tag() const
  {
    if( m_subtype == Invalid )
      return 0;

    Tag* t = new Tag( "presence" );
    if( m_to )
      t->addAttribute( "to", m_to.full() );
    if( m_from )
      t->addAttribute( "from", m_from.full() );

    t->addAttribute( "type", typeString( m_subtype ) );

    getLangs( m_stati, m_status, "status", t );

    StanzaExtensionList::const_iterator it = m_extensionList.begin();
    for( ; it != m_extensionList.end(); ++it )
      t->addChild( (*it)->tag() );

    return t;
  }
  bool InBandBytestreamManager::requestInBandBytestream( const JID& to, InBandBytestreamHandler *ibbh )
  {
    if( !m_parent || !ibbh )
      return false;

    const std::string sid = m_parent->getID();
    const std::string id = m_parent->getID();
    Tag *iq = new Tag( "iq" );
    iq->addAttribute( "type", "set" );
    iq->addAttribute( "to", to.full() );
    iq->addAttribute( "id", id );
    Tag *o = new Tag( iq, "open" );
    o->addAttribute( "sid", sid );
    o->addAttribute( "block-size", m_blockSize );
    o->addAttribute( "xmlns", XMLNS_IBB );

    TrackItem item;
    item.sid = sid;
    item.ibbh = ibbh;
    m_trackMap[id] = item;
    m_parent->trackID( this, id, IBBOpenStream );
    m_parent->send( iq );

    return true;
  }
Exemplo n.º 19
0
  void Client::negotiateCompression( StreamFeature method )
  {
    Tag *t = new Tag( "compress" );
    t->addAttribute( "xmlns", XMLNS_COMPRESSION );

    if( method == StreamFeatureCompressZlib )
      new Tag( t, "method", "zlib" );

    if( method == StreamFeatureCompressDclz )
      new Tag( t, "method", "lzw" );

    send( t );
  }
Exemplo n.º 20
0
  const std::string SIProfileFT::requestFT( const JID& to, 
	                                        const std::string& name, 
											long size,
                                            const std::string& hash, 
											const std::string& desc,
                                            const std::string& date, 
											const std::string& mimetype,
                                            int streamTypes, 
											const JID& from,
                                            const std::string& sid )
  {
    if( name.empty() || size <= 0 || !m_manager )
      return EmptyString;

    Tag* file = new Tag( "file", XMLNS, XMLNS_SI_FT );
    file->addAttribute( "name", name );
    file->addAttribute( "size", size );
    if( !hash.empty() )
      file->addAttribute( "hash", hash );
    if( !date.empty() )
      file->addAttribute( "date", date );
    if( !desc.empty() )
      new Tag( file, "desc", desc );

    Tag* feature = new Tag( "feature", XMLNS, XMLNS_FEATURE_NEG );
    DataForm df( TypeForm );
    DataFormField* dff = df.addField( DataFormField::TypeListSingle, "stream-method" );
    StringMultiMap sm;
    if( streamTypes & FTTypeS5B )
      sm.insert( std::make_pair( "s5b", XMLNS_BYTESTREAMS ) );
    if( streamTypes & FTTypeIBB )
      sm.insert( std::make_pair( "ibb", XMLNS_IBB ) );
    if( streamTypes & FTTypeOOB )
      sm.insert( std::make_pair( "oob", XMLNS_IQ_OOB ) );
    dff->setOptions( sm );
    feature->addChild( df.tag() );

    return m_manager->requestSI( this, to, XMLNS_SI_FT, file, feature, mimetype, from, sid );
  }
Exemplo n.º 21
0
Tag* XmppGSTalk::tag() const
{
	Tag* i = new Tag( "gstalk" );
	i->setXmlns( XMLNS_GSIOT_TALK );

	Tag *tmgr = new Tag( i,"gstalk" );

	std::string strcmd = TalkCmd2String( m_cmd );
	
	new Tag( tmgr, "command", strcmd );

	new Tag( tmgr, "url", m_url );

	if( !m_vecdev.empty() )
	{
		Tag *tdevicelist = new Tag( tmgr,"devicelist" );
		for( int i=0; i<m_vecdev.size(); ++i )
		{
			Tag *tDev = new Tag( tdevicelist, "device" );
			tDev->addAttribute( "type", (int)m_vecdev[i].m_type );
			tDev->addAttribute( "id", (int)m_vecdev[i].m_id );
		}
	}

	switch( m_cmd )
	{
	case defTalkCmd_adddev:
	case defTalkCmd_removedev:
		{
			new Tag( tmgr, "result", m_result?"true":"false" );
		}
		break;

	default:
		break;
	}

	return i;
}
Exemplo n.º 22
0
  Tag* Disco::Items::tag() const
  {
    Tag* t = new Tag( "query", XMLNS, XMLNS_DISCO_ITEMS );

    if( !m_node.empty() )
      t->addAttribute( "node", m_node );

    ItemList::const_iterator it_i = m_items.begin();
    for( ; it_i != m_items.end(); ++it_i )
      t->addChild( (*it_i)->tag() );

    return t;
  }
Exemplo n.º 23
0
void DiscoTest::send( const IQ& iq, IqHandler*, int ctx )
{
  Tag* q = 0;
  if( m_test == 8 )
  {
    IQ re( IQ::Result, iq.from(), iq.id() );
    q = new Tag( "query" );
    q->setXmlns( XMLNS_DISCO_INFO );
    new Tag( q, "feature", "var", XMLNS_DISCO_INFO );
    new Tag( q, "feature", "var", "foofeature" );
    new Tag( q, "feature", "var", "foofeature2" );
    re.addExtension( new Disco::Info( q ) );
    m_disco->handleIqID( re, ctx );
  }
  else if( m_test == 9 )
  {
    IQ re( IQ::Result, iq.from(), iq.id() );
    q = new Tag( "query" );
    q->setXmlns( XMLNS_DISCO_ITEMS );
    q->addAttribute( "node", "foonode" );
    Tag* i = new Tag( q, "item", "jid", "jid1" );
    i->addAttribute( "node", "node1" );
    i->addAttribute( "name", "name1" );
    i = new Tag( q, "item", "jid", "jid2" );
    i->addAttribute( "node", "node2" );
    i->addAttribute( "name", "name2" );
    re.addExtension( new Disco::Items( q ) );
    m_disco->handleIqID( re, ctx );
  }
  else if( m_test == 10 )
  {
    IQ re( IQ::Error, iq.from(), iq.id() );
    re.addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorItemNotFound ) );
    m_disco->handleIqID( re, ctx );
  }

  delete q;
}
Exemplo n.º 24
0
    Tag* Session::Jingle::tag() const
    {
      if( m_action == InvalidAction || m_sid.empty() )
        return 0;

      Tag* t = new Tag( "jingle" );
      t->setXmlns( XMLNS_JINGLE );
      t->addAttribute( "action", util::lookup( m_action, actionValues ) );

      if( m_initiator && m_action == SessionInitiate )
        t->addAttribute( "initiator", m_initiator.full() );

      if( m_responder && m_action == SessionAccept )
        t->addAttribute( "responder", m_responder.full() );

      t->addAttribute( "sid", m_sid );

      PluginList::const_iterator it = m_plugins.begin();
      for( ; it != m_plugins.end(); ++it )
        t->addChild( (*it)->tag() );

      return t;
    }
Exemplo n.º 25
0
  void MessageSession::send( const std::string& message, const std::string& subject )
  {
    if( !m_hadMessages )
    {
      m_thread = "gloox" + m_parent->getID();
      m_hadMessages = true;
    }

    Tag *m = new Tag( "message" );
    m->addAttribute( "type", "chat" );
    new Tag( m, "body", message );
    if( !subject.empty() )
      new Tag( m, "subject", subject );

    m->addAttribute( "from", m_parent->jid().full() );
    m->addAttribute( "to", m_target.full() );
    m->addAttribute( "id", m_parent->getID() );
    new Tag( m, "thread", m_thread );

    decorate( m );

    m_parent->send( m );
  }
Exemplo n.º 26
0
  Tag* OOB::tag() const
  {
    if( !m_valid )
      return 0;

    Tag *t = 0;

    if( m_iqext )
    {
      t = new Tag( "query" );
      t->addAttribute( "xmlns", XMLNS_IQ_OOB );
    }
    else
    {
      t = new Tag( "x" );
      t->addAttribute( "xmlns", XMLNS_X_OOB );
    }

    new Tag( t, "url", m_url );
    if( !m_desc.empty() )
      new Tag( t, "desc", m_desc );

    return t;
  }
Exemplo n.º 27
0
static void sendCurrentPresence(gpointer key, gpointer v, gpointer data) {
	AbstractSpectrumBuddy *s_buddy = (AbstractSpectrumBuddy *) v;
	SendPresenceToAllData *d = (SendPresenceToAllData *) data;
	int features = d->features;
	std::string &to = d->to;
	std::cout << "online: " << s_buddy->isOnline() << "\n";
	if (s_buddy->isOnline()) {
		Tag *tag = s_buddy->generatePresenceStanza(features);
		std::cout << "online: " << tag << "\n";
		if (tag) {
			tag->addAttribute("to", to);
			Transport::instance()->send( tag );
		}
	}
}
Exemplo n.º 28
0
 Tag *MRIMProtocol::getVCardTag(AbstractUser *user, GList *vcardEntries) {
     PurpleNotifyUserInfoEntry *vcardEntry;
     std::string label;
     std::string firstName;
     std::string lastName;
     std::string header;
  
     Tag *N = new Tag("N");
     Tag *head = new Tag("ADR");
     Tag *vcard = new Tag( "vCard" );
     vcard->addAttribute( "xmlns", "vcard-temp" );
  
     while (vcardEntries) {
         vcardEntry = (PurpleNotifyUserInfoEntry *)(vcardEntries->data);
         if (purple_notify_user_info_entry_get_label(vcardEntry) && purple_notify_user_info_entry_get_value(vcardEntry)){
             label=(std::string)purple_notify_user_info_entry_get_label(vcardEntry);
             Log("vcard label", label << " => " << (std::string)purple_notify_user_info_entry_get_value(vcardEntry));
             if (label=="Firstname"){
                 N->addChild( new Tag("GIVEN", (std::string)purple_notify_user_info_entry_get_value(vcardEntry)));
                 firstName = (std::string)purple_notify_user_info_entry_get_value(vcardEntry);
             }
             else if (label=="Lastname"){
                 N->addChild( new Tag("FAMILY", (std::string)purple_notify_user_info_entry_get_value(vcardEntry)));
                 lastName = (std::string)purple_notify_user_info_entry_get_value(vcardEntry);
             }
             else if (label=="Nickname"){
                 vcard->addChild( new Tag("NICKNAME", (std::string)purple_notify_user_info_entry_get_value(vcardEntry)));
             }
             else if (label=="Sex"){
                 vcard->addChild( new Tag("GENDER", (std::string)purple_notify_user_info_entry_get_value(vcardEntry)));
             }
             else if (label=="Birthday"){
                 vcard->addChild( new Tag("BDAY", (std::string)purple_notify_user_info_entry_get_value(vcardEntry)));
             }
            else if (label=="E-Mail"){
                vcard->addChild( new Tag("UID", (std::string)purple_notify_user_info_entry_get_value(vcardEntry)));
            }
         }
         vcardEntries = vcardEntries->next;
     }
     if (!firstName.empty() || !lastName.empty())
         vcard->addChild( new Tag("FN", firstName + " " + lastName));
         // add photo ant N if any
         if(!N->children().empty())
             vcard->addChild(N);
  
     return vcard;
 }
Exemplo n.º 29
0
Tag* XmppGSManager::tag() const
{
	Tag* i = new Tag( "gsiot" );
	i->setXmlns( XMLNS_GSIOT_MANAGER );

	Tag *tmgr = new Tag( i,"manager" );

	tmgr->addAttribute( "method", m_srcmethod );

	for( std::list<GSIOTDevice*>::const_iterator it=m_devices.begin(); it!=m_devices.end(); ++it )
	{
		tmgr->addChild( (*it)->tag(m_TagParam) );
	}

	return i;
}
Exemplo n.º 30
0
  Tag* SHIM::tag() const
  {
    if( !m_headers.size() )
      return 0;

    Tag* t = new Tag( "headers" );
    t->setXmlns( XMLNS_SHIM );

    HeaderList::const_iterator it = m_headers.begin();
    for( ; it != m_headers.end(); ++it )
    {
      Tag* h = new Tag( t, "header" );
      h->addAttribute( "name", (*it).first );
      h->setCData( (*it).second );
    }
    return t;
  }