这篇教程C++ xmlnode_put_attrib函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xmlnode_put_attrib函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlnode_put_attrib函数的具体用法?C++ xmlnode_put_attrib怎么用?C++ xmlnode_put_attrib使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xmlnode_put_attrib函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dnsrv_child_process_xstream_io/* Coprocess functionality */void dnsrv_child_process_xstream_io(int type, xmlnode x, void* args){ dns_io di = (dns_io)args; char* hostname; char* str = NULL; dns_resend_list iternode = NULL; if (type == XSTREAM_NODE) { /* Get the hostname out... */ hostname = xmlnode_get_data(x); log_debug(ZONE, "dnsrv: Recv'd lookup request for %s", hostname); if (hostname != NULL) { /* For each entry in the svclist, try and resolve using the specified service and resend it to the specified host */ iternode = di->svclist; while (iternode != NULL) { str = srv_lookup(x->p, iternode->service, hostname); if (str != NULL) { log_debug(ZONE, "Resolved %s(%s): %s/tresend to:%s", hostname, iternode->service, str, iternode->host); xmlnode_put_attrib(x, "ip", str); xmlnode_put_attrib(x, "to", iternode->host); break; } iternode = iternode->next; } str = xmlnode2str(x); write(di->out, str, strlen(str)); } } xmlnode_free(x);}
开发者ID:TooKennySupreme,项目名称:jabberd,代码行数:36,
示例2: mt_unknown_bounce/* bounces packet for unknown users with the appropriate error */void mt_unknown_bounce(void *arg){ jpacket jp = (jpacket) arg; mti ti = (mti) jp->aux1; xmlnode reg; lowercase(jp->from->user); lowercase(jp->from->server); if ((reg = xdb_get(ti->xc,mt_xdb_id(jp->p,jp->from,jp->to->server),NS_REGISTER)) != NULL) { xmlnode p = xmlnode_new_tag("presence"); xmlnode_put_attrib(p,"to",jid_full(jp->from)); xmlnode_put_attrib(p,"from",jp->to->server); xmlnode_put_attrib(p,"type","probe"); mt_deliver(ti,p); jutil_error(jp->x,TERROR_NOTFOUND); xmlnode_free(reg); } else jutil_error(jp->x,TERROR_REGISTER); mt_deliver(ti,jp->x);}
开发者ID:Doap,项目名称:transports,代码行数:27,
示例3: jutil_msgnew/** * utility for making message stanzas * * @param type the type of the message (as a string!) * @param to the recipient of the message * @param subj the subject of the message (NULL for no subject element) * @param body the body of the message * @return the xmlnode containing the new message stanza */xmlnode jutil_msgnew(char *type, char *to, char *subj, char *body){ xmlnode msg; msg = xmlnode_new_tag("message"); if (type != NULL) { xmlnode_put_attrib(msg, "type", type); } if (to != NULL) { xmlnode_put_attrib(msg, "to", to); } if (subj != NULL) { xmlnode_insert_cdata(xmlnode_insert_tag(msg, "subject"), subj, strlen(subj)); } if (body != NULL) { xmlnode_insert_cdata(xmlnode_insert_tag(msg, "body"), body, strlen(body)); } return msg;}
开发者ID:smokku,项目名称:wpjabber,代码行数:35,
示例4: message_send_errorint message_send_error(struct stream_s *stream,const char *from, const char *to,const char *body,int code,const char *str){xmlnode msg;xmlnode n;char *s; msg=xmlnode_new_tag("message"); if (from!=NULL) xmlnode_put_attrib(msg,"from",from); else{ char *jid; jid=jid_my_registered(); xmlnode_put_attrib(msg,"from",jid); g_free(jid); } xmlnode_put_attrib(msg,"to",to); xmlnode_put_attrib(msg,"type","error"); s=g_strdup_printf("%03u",code); xmlnode_put_attrib(msg,"code",s); g_free(s); n=xmlnode_insert_tag(msg,"error"); xmlnode_insert_cdata(n,str,-1); if (body){ n=xmlnode_insert_tag(msg,"body"); xmlnode_insert_cdata(n,body,-1); } stream_write(stream,msg); xmlnode_free(msg); return 0;}
开发者ID:AdamPrzybyla,项目名称:jggtrans,代码行数:30,
示例5: presence_send_errorint presence_send_error(struct stream_s *stream,const char *from,const char *to, int code,const char *string){xmlnode pres;xmlnode error;char *jid;char *str; pres=xmlnode_new_tag("presence"); jid=jid_my_registered(); if (from!=NULL) xmlnode_put_attrib(pres,"from",from); else{ char *jid; jid=jid_my_registered(); xmlnode_put_attrib(pres,"from",jid); g_free(jid); } g_free(jid); xmlnode_put_attrib(pres,"to",to); xmlnode_put_attrib(pres,"type","error"); error=xmlnode_insert_tag(pres,"error"); if (code>0){ str=g_strdup_printf("%03u",(unsigned)code); xmlnode_put_attrib(error,"code",str); g_free(str); } xmlnode_insert_cdata(error,string,-1); stream_write(stream,pres); xmlnode_free(pres); return 0;}
开发者ID:AdamPrzybyla,项目名称:jggtrans,代码行数:32,
示例6: mod_browse_replymreturn mod_browse_reply(mapi m, void *arg){ xmlnode browse, ns, cur; session s; if (m->packet->type != JPACKET_IQ) return M_IGNORE; if (!NSCHECK(m->packet->iq, NS_BROWSE)) return M_PASS; /* first, is this a valid request? */ switch (jpacket_subtype(m->packet)) { case JPACKET__RESULT: case JPACKET__ERROR: return M_PASS; case JPACKET__SET: js_bounce(m->si, m->packet->x, TERROR_NOTALLOWED); return M_HANDLED; } log_debug("handling query for user %s", m->user->user); /* get this dudes browse info */ browse = mod_browse_get(m, m->packet->to); /* insert the namespaces */ ns = xdb_get(m->si->xc, m->packet->to, NS_XDBNSLIST); for (cur = xmlnode_get_firstchild(ns); cur != NULL; cur = xmlnode_get_nextsibling(cur)) if (xmlnode_get_attrib(cur, "type") == NULL) xmlnode_insert_tag_node(browse, cur); /* only include the generic <ns>foo</ns> */ xmlnode_free(ns); /* include any connected resources if there's a s10n from them */ if (js_trust(m->user, m->packet->from)) { SEM_LOCK(m->user->sem); for (s = m->user->sessions; s != NULL; s = s->next) { /* if(s->priority < 0) continue; *** include all resources I guess */ if (xmlnode_get_tag (browse, spools(m->packet->p, "?jid=", jid_full(s->id), m->packet->p)) != NULL) continue; /* already in the browse result */ cur = xmlnode_insert_tag(browse, "user"); xmlnode_put_attrib(cur, "type", "client"); xmlnode_put_attrib(cur, "jid", jid_full(s->id)); } SEM_UNLOCK(m->user->sem); } /* XXX include iq:filter forwards */ jutil_iqresult(m->packet->x); jpacket_reset(m->packet); xmlnode_insert_tag_node(m->packet->x, browse); js_deliver(m->si, m->packet); xmlnode_free(browse); return M_HANDLED;}
开发者ID:smokku,项目名称:wpjabber,代码行数:60,
示例7: message_send_subjectint message_send_subject(struct stream_s *stream,const char *from, const char *to,const char *subject,const char *message,time_t timestamp){xmlnode msg;xmlnode n;struct tm *tm;char buf[101]; msg=xmlnode_new_tag("message"); if (from!=NULL) xmlnode_put_attrib(msg,"from",from); else{ char *jid; jid=jid_my_registered(); xmlnode_put_attrib(msg,"from",jid); g_free(jid); } xmlnode_put_attrib(msg,"to",to); n=xmlnode_insert_tag(msg,"subject"); xmlnode_insert_cdata(n,subject,-1); n=xmlnode_insert_tag(msg,"body"); xmlnode_insert_cdata(n,message,-1); if (timestamp){ n=xmlnode_insert_tag(msg,"x"); xmlnode_put_attrib(n,"xmlns","jabber:x:delay"); tm=gmtime(×tamp); strftime(buf,100,"%Y%m%dT%H:%M:%S",tm); xmlnode_put_attrib(n,"stamp",buf); xmlnode_insert_cdata(n,"Delayed message",-1); } stream_write(stream,msg); xmlnode_free(msg); return 0;}
开发者ID:AdamPrzybyla,项目名称:jggtrans,代码行数:33,
示例8: at_iq_vcardint at_iq_vcard(ati ti, jpacket jp){ xmlnode data; at_session s; s = at_session_find_by_jid(ti, jp->from); if(jpacket_subtype(jp) != JPACKET__GET || (s && ((!s->icq && jp->to->user) || (s->icq && s->icq_vcard_response)))) { at_bounce(ti, jp, TERROR_BAD); return 1; } if(!jp->to->user) { xmlnode_insert_node(jutil_iqresult(jp->x),ti->vcard); at_deliver(ti,jp->x); return 1; } if(!s) return 0; jutil_iqresult(jp->x); jp->iq = data = xmlnode_insert_tag(jp->x,"vCard"); xmlnode_put_attrib(data,"xmlns",NS_VCARD); xmlnode_put_attrib(data,"version","3.0"); xmlnode_put_attrib(data,"prodid","-//HandGen//NONSGML vGen v1.0//EN"); s->icq_vcard_response = jp; aim_icq_getsimpleinfo(s->ass, jp->to->user); return 1;}
开发者ID:Doap,项目名称:transports,代码行数:35,
示例9: base_to_deliverresult base_to_deliver(instance id, dpacket p, void *arg){ char *log_data = xmlnode_get_data(p->x); char *subject; xmlnode message; if (log_data == NULL) return r_ERR; message = xmlnode_new_tag("message"); xmlnode_insert_cdata(xmlnode_insert_tag(message, "body"), log_data, -1); subject = spools(xmlnode_pool(message), "Log Packet from ", xmlnode_get_attrib(p->x, "from"), xmlnode_pool(message)); xmlnode_insert_cdata(xmlnode_insert_tag(message, "thread"), shahash(subject), -1); xmlnode_insert_cdata(xmlnode_insert_tag(message, "subject"), subject, -1); xmlnode_put_attrib(message, "from", xmlnode_get_attrib(p->x, "from")); xmlnode_put_attrib(message, "to", (char *) arg); deliver(dpacket_new(message), id); pool_free(p->p); return r_DONE;}
开发者ID:smokku,项目名称:wpjabber,代码行数:30,
示例10: jutil_tofromvoid jutil_tofrom(xmlnode x){ char *to, *from; to = xmlnode_get_attrib(x,"to"); from = xmlnode_get_attrib(x,"from"); xmlnode_put_attrib(x,"from",to); xmlnode_put_attrib(x,"to",from);}
开发者ID:GunioRobot,项目名称:jab_simul,代码行数:9,
示例11: mod_roster_auto_in_s10nmreturn mod_roster_auto_in_s10n(mapi m, void *arg){ xmlnode reply, x; log_debug("AUTO ROSTER"); //in not s10n if (m->packet->type != JPACKET_S10N) return M_IGNORE; //if no to if (m->packet->to == NULL) return M_PASS; //if from me if (jid_cmpx(m->s->uid, m->packet->from, JID_USER | JID_SERVER) == 0) return M_PASS; log_debug("handling incoming s10n"); switch (jpacket_subtype(m->packet)) { case JPACKET__SUBSCRIBE: log_debug("SUBSCRIBE"); reply = jutil_presnew(JPACKET__SUBSCRIBED, jid_full(m->packet->from), NULL); js_session_from(m->s, jpacket_new(reply)); reply = jutil_presnew(JPACKET__SUBSCRIBE, jid_full(m->packet->from), NULL); js_session_from(m->s, jpacket_new(reply)); break; case JPACKET__SUBSCRIBED: break; case JPACKET__UNSUBSCRIBE: log_debug("UNSUBSCRIBE"); //reply = jutil_presnew(JPACKET__UNSUBSCRIBED, jid_full(m->packet->from),NULL); //js_session_from(m->s, jpacket_new(reply)); //remove account. reply = jutil_iqnew(JPACKET__SET, NS_ROSTER); x = xmlnode_get_tag(reply, "query"); x = xmlnode_insert_tag(x, "item"); xmlnode_put_attrib(x, "jid", jid_full(jid_user(m->packet->from))); xmlnode_put_attrib(x, "subscription", "remove"); js_session_from(m->s, jpacket_new(reply)); // reply = jutil_iqnewpresnew(JPACKET__UNSUBSCRIBE, jid_full(m->packet->from),NULL); // js_session_from(m->s, jpacket_new(reply)); break; case JPACKET__UNSUBSCRIBED: break; } xmlnode_free(m->packet->x); return M_HANDLED;}
开发者ID:smokku,项目名称:wpjabber,代码行数:56,
示例12: _js_session_from/* child that handles packets from the user */void _js_session_from(void *arg){ jpacket p = (jpacket) arg; session s = (session) (p->aux1); /* if this session is dead */ if (s->exit_flag) { /* send the packet into oblivion */ xmlnode_free(p->x); return; } /* at least we must have a valid packet */ if (p->type == JPACKET_UNKNOWN) { /* send an error back */ jutil_error(p->x, TERROR_BAD); jpacket_reset(p); js_session_to(s, p); return; } /* debug message */ log_debug("THREAD:SESSION:FROM received a packet!"); /* increment packet out count */ s->si->stats->packets_out++; s->c_out++; /* make sure we have our from set correctly for outgoing packets */ if (jid_cmpx(p->from, s->id, JID_USER | JID_SERVER) != 0) { /* nope, fix it */ xmlnode_put_attrib(p->x, "from", jid_full(s->id)); p->from = jid_new(p->p, jid_full(s->id)); } /* if you use to="[email C++ xmlnode_set_attrib函数代码示例 C++ xmlnode_get_data函数代码示例
|