当前位置: 首页>>代码示例>>C++>>正文


C++ xmlnode_free函数代码示例

本文整理汇总了C++中xmlnode_free函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlnode_free函数的具体用法?C++ xmlnode_free怎么用?C++ xmlnode_free使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xmlnode_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: shinima_message_links_foreach

static void
shinima_message_links_foreach(gchar **message,
							  void(*foreach_func)(xmlnode*,
												  const gchar*,
												  gchar**,
												  gboolean*,
												  gpointer),
							  gboolean *_changed,
							  gpointer *user_data)
{
	xmlnode *root, *a;
	gboolean *changed =
		(_changed != NULL) ? changed : g_malloc(sizeof(gboolean));

	g_return_if_fail(foreach_func != NULL);

	root = xmlnode_from_str(*message, -1);

	for(a=xmlnode_get_child(root, "a"); a; a=xmlnode_get_next_twin(a))
	{
		const gchar *href = xmlnode_get_attrib(a, "href");
		if(href) foreach_func(a, href, message, changed, user_data);
	}

	if(changed)
	{
		g_free(*message);
		*message = xmlnode_to_str(root, NULL);
	}

	if(_changed == NULL) g_free(changed);

	xmlnode_free(root);
}
开发者ID:inickey,项目名称:shinima-pidgin-plugin,代码行数:34,代码来源:shinima-message.c

示例2: purple_smileys_load

static void
purple_smileys_load(void)
{
	xmlnode *root_node, *profile_node;
	xmlnode *smileyset_node = NULL;
	xmlnode *smiley_node;

	smileys_loaded = TRUE;

	root_node = purple_util_read_xml_from_file(XML_FILE_NAME,
			_(SMILEYS_LOG_ID));

	if (root_node == NULL)
		return;

	/* See the top comments above to understand why initial tag elements
	 * are not being considered by now. */
	profile_node = xmlnode_get_child(root_node, XML_PROFILE_TAG);
	if (profile_node)
		smileyset_node = xmlnode_get_child(profile_node, XML_SMILEY_SET_TAG);

	if (smileyset_node) {
		smiley_node = xmlnode_get_child(smileyset_node, XML_SMILEY_TAG);
		for (; smiley_node != NULL;
				smiley_node = xmlnode_get_next_twin(smiley_node)) {
			PurpleSmiley *smiley;

			smiley = parse_smiley(smiley_node);
		}
	}

	xmlnode_free(root_node);
}
开发者ID:matyapiro31,项目名称:instantbird-1.5,代码行数:33,代码来源:smiley.c

示例3: campfire_xaction_free

void
campfire_xaction_free(CampfireSslTransaction *xaction)
{
	if (xaction) {
		if (xaction->http_request) {
			g_string_free(xaction->http_request, TRUE);
		}
		if (xaction->http_response.response) {
			g_string_free(xaction->http_response.response,
				      TRUE);
		}
		if (xaction->http_response.header) {
			g_string_free(xaction->http_response.header,
				      TRUE);
		}
		if (xaction->http_response.content) {
			g_string_free(xaction->http_response.content,
				      TRUE);
		}
		if (xaction->xml_response) {
			xmlnode_free(xaction->xml_response);
		}
		if (xaction->room_id) {
			g_free(xaction->room_id);
		}
		g_list_free_full(xaction->messages, &campfire_message_free);
		xaction->campfire->num_xaction_free++; /* valgrind investigation */
		purple_debug_info("campfire", "xaction: %p, num_xaction_malloc:%d: num_xaction_free:%d\n",
		                  xaction,
		                  xaction->campfire->num_xaction_malloc,
		                  xaction->campfire->num_xaction_free);
		g_free(xaction);
	}

}
开发者ID:CloCkWeRX,项目名称:campfire-libpurple,代码行数:35,代码来源:http.c

示例4: session_destroy

/* destroys Session object */
static int session_destroy(Session *s){
GList *it;

	g_message(L_("Deleting session for '%s'"),s->jid);
	if (s->ping_timeout_func) g_source_remove(s->ping_timeout_func);
	if (s->timeout_func) g_source_remove(s->timeout_func);
	if (s->ping_timer) g_timer_destroy(s->ping_timer);
	session_remove_g_source(s);
	while(s->resources) resource_remove((Resource *)s->resources->data,0);
	if (s->ggs){
		if (s->connected){
			debug("gg_logoff(%p)",s->ggs);
			gg_logoff(s->ggs);
		}
		gg_free_session(s->ggs);
		s->ggs=NULL;
	}
	if (s->connected && s->s && s->jid){
		for(it=g_list_first(s->user->contacts);it;it=g_list_next(it)){
			Contact *c=(Contact *)it->data;

			if (!GG_S_NA(c->status) && c->status!=-1){
				char *ujid;
				ujid=jid_build_full(c->uin);
				presence_send(s->s,ujid,s->user->jid,0,NULL,NULL,0);
				g_free(ujid);
			}
		}
	}
	if (s->query) xmlnode_free(s->query);
	if (s->user) user_unref(s->user);
	g_free(s->gg_status_descr);
	g_free(s);
	return 0;
}
开发者ID:Doap,项目名称:transports,代码行数:36,代码来源:sessions.c

示例5: jabber_chat_change_nick

void jabber_chat_change_nick(JabberChat *chat, const char *nick)
{
	xmlnode *presence;
	char *full_jid;
	PurplePresence *gpresence;
	PurpleStatus *status;
	JabberBuddyState state;
	char *msg;
	int priority;

	if(!chat->muc) {
		purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "",
				_("Nick changing not supported in non-MUC chatrooms"),
				PURPLE_MESSAGE_SYSTEM, time(NULL));
		return;
	}

	gpresence = purple_account_get_presence(chat->js->gc->account);
	status = purple_presence_get_active_status(gpresence);

	purple_status_to_jabber(status, &state, &msg, &priority);

	presence = jabber_presence_create(state, msg, priority);
	full_jid = g_strdup_printf("%[email protected]%s/%s", chat->room, chat->server, nick);
	xmlnode_set_attrib(presence, "to", full_jid);
	g_free(full_jid);
	g_free(msg);

	jabber_send(chat->js, presence);
	xmlnode_free(presence);
}
开发者ID:arminius2,项目名称:apolloim,代码行数:31,代码来源:chat.c

示例6: mod_presence_deliver

/* thread safe with sem */
mreturn mod_presence_deliver(mapi m, void *arg)
{
	session cur;

	if (m->packet->type != JPACKET_PRESENCE)
		return M_IGNORE;

	log_debug("deliver phase");

	/* only if we HAVE a user, and it was sent to ONLY the [email protected], and there is at least one session available */
	if (m->user != NULL && m->packet->to->resource == NULL && js_session_primary_all_sem(m->user) != NULL) {
		log_debug("broadcasting to %s", m->user->user);

		/* broadcast */
		for (cur = m->user->sessions; cur != NULL; cur = cur->next) {
			if (cur->priority < -128)
				continue;
			js_session_to(cur, jpacket_new(xmlnode_dup(m->packet->x)));
		}
		SEM_UNLOCK(m->user->sem);

		if (jpacket_subtype(m->packet) != JPACKET__PROBE) {
			/* probes get handled by the offline thread as well? */
			xmlnode_free(m->packet->x);
			return M_HANDLED;
		}
	}

	return M_PASS;
}
开发者ID:smokku,项目名称:wpjabber,代码行数:31,代码来源:mod_presence.c

示例7: 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,代码来源:receive.c

示例8: format_message

static char*
format_message(char *sender,
               char *message)
{
    GString* format_message = g_string_new("");
    xmlnode* message_node = xmlnode_from_str(message, -1);

    /* raw */
    if ( !message_node ||
            !( strcmp(message_node->name, "html")==0 ||
               strcmp(message_node->name, "body")==0 )) {
        g_string_printf(format_message, "%s: %s", sender, message);
        return g_string_free(format_message, FALSE);
    }

    xmlnode* body_node =
        (strcmp(message_node->name, "body")) ?
        xmlnode_get_child(message_node, "body") :
        message_node;

    char* message_content = xmlnode_get_content(body_node);
    g_string_printf(format_message, "%s: %s", sender, message_content);
    g_free(message_content);

    xmlnode_free(message_node);

    return g_string_free(format_message, FALSE);
}
开发者ID:bhuztez,项目名称:purple-chatroom-bridge,代码行数:28,代码来源:purple-chatroom-bridge.c

示例9: xmlnode_str

xmlnode xmlnode_str(char *str, int len)
{
    XML_Parser p;
    xmlnode *x, node; /* pointer to an xmlnode */

    if(NULL == str)
        return NULL;

    x = malloc(sizeof(void *));

    *x = NULL; /* pointer to NULL */
    p = XML_ParserCreate(NULL);
    XML_SetUserData(p, x);
    XML_SetElementHandler(p, expat_startElement, expat_endElement);
    XML_SetCharacterDataHandler(p, expat_charData);
    if(!XML_Parse(p, str, len, 1))
    {
        /*        jdebug(ZONE,"xmlnode_str_error: %s",(char *)XML_ErrorString(XML_GetErrorCode(p)));*/
        xmlnode_free(*x);
        *x = NULL;
    }
    node = *x;
    free(x);
    XML_ParserFree(p);
    return node; /* return the xmlnode x points to */
}
开发者ID:BackupTheBerlios,项目名称:irssi-icq,代码行数:26,代码来源:expat.c

示例10: jabber_presence_send

void jabber_presence_send(GaimConnection *gc, const char *state,
		const char *msg)
{
	JabberStream *js = gc->proto_data;
	xmlnode *presence;
	char *stripped = NULL;

	if(msg) {
		gaim_markup_html_to_xhtml(msg, NULL, &stripped);
	} else if(!state || strcmp(state, GAIM_AWAY_CUSTOM)) {
		/* i can't wait until someone re-writes the status/away stuff */
		stripped = g_strdup("");
	}

	if(gc->away)
		g_free(gc->away);
	gc->away = stripped;

	presence = jabber_presence_create(state, stripped);
	jabber_send(js, presence);
	g_hash_table_foreach(js->chats, chats_send_presence_foreach, presence);
	xmlnode_free(presence);

	jabber_presence_fake_to_self(js, state, stripped);
}
开发者ID:BackupTheBerlios,项目名称:maemo-gaim-svn,代码行数:25,代码来源:presence.c

示例11: presence_send_error

int 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:Jajcus,项目名称:jggtrans,代码行数:32,代码来源:presence.c

示例12: xmpp_message_send

gint
xmpp_message_send(XmppStream *stream, const gchar *text, const gchar *to)
{
    xmlnode *root;
    xmlnode *node;
    gchar   *xml_string;

    g_return_val_if_fail(stream != NULL, HYBRID_ERROR);
    g_return_val_if_fail(text != NULL, HYBRID_ERROR);
    g_return_val_if_fail(to != NULL, HYBRID_ERROR);

    root = xmlnode_create("message");
    xmlnode_new_prop(root, "from", stream->jid);
    xmlnode_new_prop(root, "to", to);
    xmlnode_new_prop(root, "type", "chat");
    node = xmlnode_new_child(root, "body");
    xmlnode_set_content(node, text);

    xml_string = xmlnode_to_string(root);
    xmlnode_free(root);

    hybrid_debug_info("xmpp", "send message to %s:\n%s", to, xml_string);

    if (hybrid_ssl_write(stream->ssl, xml_string, strlen(xml_string)) == -1) {

        hybrid_debug_error("xmpp", "send message to %s failed\n", to);
        g_free(xml_string);

        return HYBRID_ERROR;
    }

    g_free(xml_string);

    return HYBRID_OK;
}
开发者ID:CinsonChen,项目名称:hybrid,代码行数:35,代码来源:xmpp_message.c

示例13: GetBuddyInfo

void GetBuddyInfo(struct fetion_account_data *sip, const char *who)
{
	gint xml_len;
	xmlnode *root, *son, *item;
	gchar *body;

	root = xmlnode_new("args");
	g_return_if_fail(root != NULL);
	son = xmlnode_new_child(root, "contacts");
	xmlnode_set_attrib(son, "attributes", "all");
	//xmlnode_set_attrib(son,"extended-attributes","score-level");
	g_return_if_fail(son != NULL);
	item = xmlnode_new_child(son, "contact");
	g_return_if_fail(item != NULL);

	xmlnode_set_attrib(item, "uri", who);

	body = g_strdup_printf("%s",xmlnode_to_str(root, &xml_len));
	purple_debug_info("fetion:", "GetBuddyInfo:body=[%s]", body);

	send_sip_request(sip->gc, "S", "", "", "N: GetContactsInfo\r\n", body,
			 NULL, (TransCallback) GetBuddyInfo_cb);

	xmlnode_free(root);
	g_free(body);

}
开发者ID:firefeifei,项目名称:fetion,代码行数:27,代码来源:f_buddy.c

示例14: 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,代码来源:dnsrv.c

示例15: generate_handle_request_body

static gchar*
generate_handle_request_body(const gchar *sipuri, const gchar *userid,
		const gchar *alias, const gchar *groupid, gboolean accept)
{
	xmlnode *root;
	xmlnode *node;
	gchar *res;

	root = xmlnode_create("args");
	node = xmlnode_new_child(root, "contacts");
	node = xmlnode_new_child(node, "buddies");
	node = xmlnode_new_child(node, "buddy");

	xmlnode_new_prop(node, "user-id", userid);
	xmlnode_new_prop(node, "uri", sipuri);
	xmlnode_new_prop(node, "result", accept ? "1": "0");
	xmlnode_new_prop(node, "buddy-lists", groupid);
	xmlnode_new_prop(node, "expose-mobile-no", "1");
	xmlnode_new_prop(node, "expose-name", "1");
	xmlnode_new_prop(node, "local-name", alias);

	res = xmlnode_to_string(root);

	xmlnode_free(root);

	return res;
}
开发者ID:chenyukang,项目名称:hybrid,代码行数:27,代码来源:fx_buddy.c


注:本文中的xmlnode_free函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。