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


C++ xmpp_stanza_get_child_by_name函数代码示例

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


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

示例1: message_handler

int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata)
{
	xmpp_stanza_t *reply, *body, *text;
	char *intext;
	xmpp_ctx_t *ctx = (xmpp_ctx_t*)userdata;


	if (!xmpp_stanza_get_child_by_name(stanza, "body")) return 1;
	if (xmpp_stanza_get_attribute(stanza, "type") != NULL && !strcmp(xmpp_stanza_get_attribute(stanza, "type"), "error")) return 1;

	intext = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "body"));

	printf("Incoming message from %s: %s\n", xmpp_stanza_get_attribute(stanza, "from"), intext);

	reply = xmpp_stanza_new(ctx);
	xmpp_stanza_set_name(reply, "message");
	xmpp_stanza_set_type(reply, xmpp_stanza_get_type(stanza) ? xmpp_stanza_get_type(stanza) : "chat");
	xmpp_stanza_set_attribute(reply, "to", xmpp_stanza_get_attribute(stanza, "from"));

	body = xmpp_stanza_new(ctx);
	xmpp_stanza_set_name(body, "body");

	char replytext[1024];

	scanf("%[^\n]", replytext);

	text = xmpp_stanza_new(ctx);
	xmpp_stanza_set_text(text, replytext);
	xmpp_stanza_add_child(body, text);
	xmpp_stanza_add_child(reply, body);

	xmpp_send(conn, reply);
	xmpp_stanza_release(reply);
	return 1;
}
开发者ID:jasjeetIM,项目名称:PingMe,代码行数:35,代码来源:main.c

示例2: _on_room_info

static int _on_room_info(xmpp_ua_t *ua, xmpp_stanza_t * const stanza, void * const userdata)
{
	room_info_data *info_data = (room_info_data *)userdata;
	char *type = xmpp_stanza_get_type(stanza);
	if (strcmp(type, "result"))
	{
		info_data->cb(info_data->ctx, NULL, -2, info_data->user_data);
		free(info_data);
		return 1;
	}

	xmpp_stanza_t *stanza_query = xmpp_stanza_get_child_by_name(stanza, "query");
	if (stanza_query)
	{
		xmpp_stanza_t *stanza_identity = xmpp_stanza_get_child_by_name(stanza_query, "identity");
		if (stanza_identity)
		{
			char *room_desc = xmpp_stanza_get_attribute(stanza_identity, "name");
			info_data->cb(info_data->ctx, room_desc, 0, info_data->user_data);
			free(info_data);
			return 1;
		}
	}

	info_data->cb(info_data->ctx, NULL, -1, info_data->user_data);
	free(info_data);
	return 1;
}
开发者ID:FihlaTV,项目名称:conference,代码行数:28,代码来源:zksignal.cpp

示例3: zkmuc_group_msg_handler

static int zkmuc_group_msg_handler(xmpp_ua_t *ua, xmpp_stanza_t *stanza, void *userdata)
{
	char *type = xmpp_stanza_get_type(stanza);
	if (type && !strcmp(type, "groupchat"))
	{
		zkmuc_ctx_t *ctx = (zkmuc_ctx_t *)userdata;
	//	char *from = xmpp_stanza_get_attribute(stanza, "from");
		xmpp_stanza_t *stanza_body = xmpp_stanza_get_child_by_name(stanza, "zonekey");
		if (!stanza_body)
		{
			return 0;
		}
		xmpp_stanza_t *stanza_jid = xmpp_stanza_get_child_by_name(stanza_body, "jid");
		char *jid_value = xmpp_stanza_get_text(stanza_jid);
		char *text = xmpp_stanza_get_text(stanza_body);
		if (text && ctx->room_cbs.on_broadcast_message)
		{
			ctx->room_cbs.on_broadcast_message(ctx, /*from*/jid_value, text, ctx->room_data);
		}
		xmpp_free(_xmpp_ctx, jid_value);
		xmpp_free(_xmpp_ctx, text);
		return 1;
	}
	
	return 0;
}
开发者ID:FihlaTV,项目名称:conference,代码行数:26,代码来源:zksignal.cpp

示例4: stanza_get_delay

gboolean
stanza_get_delay(xmpp_stanza_t * const stanza, GTimeVal *tv_stamp)
{
    // first check for XEP-0203 delayed delivery
    xmpp_stanza_t *delay = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_DELAY);
    if (delay != NULL) {
        char *xmlns = xmpp_stanza_get_attribute(delay, STANZA_ATTR_XMLNS);
        if ((xmlns != NULL) && (strcmp(xmlns, "urn:xmpp:delay") == 0)) {
            char *stamp = xmpp_stanza_get_attribute(delay, STANZA_ATTR_STAMP);
            if ((stamp != NULL) && (g_time_val_from_iso8601(stamp, tv_stamp))) {
                return TRUE;
            }
        }
    }

    // otherwise check for XEP-0091 legacy delayed delivery
    // stanp format : CCYYMMDDThh:mm:ss
    xmpp_stanza_t *x = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_X);
    if (x != NULL) {
        char *xmlns = xmpp_stanza_get_attribute(x, STANZA_ATTR_XMLNS);
        if ((xmlns != NULL) && (strcmp(xmlns, "jabber:x:delay") == 0)) {
            char *stamp = xmpp_stanza_get_attribute(x, STANZA_ATTR_STAMP);
            if ((stamp != NULL) && (g_time_val_from_iso8601(stamp, tv_stamp))) {
                return TRUE;
            }
        }
    }

    return FALSE;
}
开发者ID:backalor,项目名称:profanity,代码行数:30,代码来源:stanza.c

示例5: message_handler

int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) 
{ 
  xmpp_stanza_t *reply, *body, *text; 
  char *intext, *replytext; 
  xmpp_ctx_t *ctx = (xmpp_ctx_t*)userdata; 

  if(!xmpp_stanza_get_child_by_name(stanza, "body")) return 1; 

  intext = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "body")); 

  printf("Incoming message from %s: %s\n", xmpp_stanza_get_attribute(stanza, "from"), intext); 

  reply = xmpp_stanza_new(ctx); 
  xmpp_stanza_set_name(reply, "message"); 
  xmpp_stanza_set_type(reply, xmpp_stanza_get_type(stanza)?xmpp_stanza_get_type(stanza):"chat"); 
  xmpp_stanza_set_attribute(reply, "to", xmpp_stanza_get_attribute(stanza, "from")); 

  body = xmpp_stanza_new(ctx); 
  xmpp_stanza_set_name(body, "body"); 

  replytext = malloc(strlen(" to you too!") + strlen(intext) + 1); 
  strcpy(replytext, intext); 
  strcat(replytext, " to you too!"); 

  text = xmpp_stanza_new(ctx); 
  xmpp_stanza_set_text(text, replytext); 
  xmpp_stanza_add_child(body, text); 
  xmpp_stanza_add_child(reply, body); 

  xmpp_send(conn, reply); 
  xmpp_stanza_release(reply); 
  free(replytext); 
  return 1; 
} 
开发者ID:nazda,项目名称:wippien,代码行数:34,代码来源:basic.c

示例6: _handle_carbons

static gboolean
_handle_carbons(xmpp_stanza_t *const stanza)
{
    xmpp_stanza_t *carbons = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CARBONS);
    if (!carbons) {
        return FALSE;
    }

    char *name = xmpp_stanza_get_name(carbons);
    if ((g_strcmp0(name, "received") == 0) || (g_strcmp0(name, "sent")) == 0) {
        xmpp_stanza_t *forwarded = xmpp_stanza_get_child_by_ns(carbons, STANZA_NS_FORWARD);
        xmpp_stanza_t *message = xmpp_stanza_get_child_by_name(forwarded, STANZA_NAME_MESSAGE);

        xmpp_ctx_t *ctx = connection_get_ctx();

        gchar *to = xmpp_stanza_get_attribute(message, STANZA_ATTR_TO);
        gchar *from = xmpp_stanza_get_attribute(message, STANZA_ATTR_FROM);

        // happens when receive a carbon of a self sent message
        if (!to) to = from;

        Jid *jid_from = jid_create(from);
        Jid *jid_to = jid_create(to);
        Jid *my_jid = jid_create(jabber_get_fulljid());

        // check for and deal with message
        xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(message, STANZA_NAME_BODY);
        if (body) {
            char *message_txt = xmpp_stanza_get_text(body);
            if (message_txt) {
                // check for pgp encrypted message
                char *enc_message = NULL;
                xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(message, STANZA_NS_ENCRYPTED);
                if (x) {
                    enc_message = xmpp_stanza_get_text(x);
                }

                // if we are the recipient, treat as standard incoming message
                if(g_strcmp0(my_jid->barejid, jid_to->barejid) == 0){
                    sv_ev_incoming_carbon(jid_from->barejid, jid_from->resourcepart, message_txt, enc_message);

                // else treat as a sent message
                } else {
                    sv_ev_outgoing_carbon(jid_to->barejid, message_txt, enc_message);
                }
                xmpp_free(ctx, message_txt);
                xmpp_free(ctx, enc_message);
            }
        }

        jid_destroy(jid_from);
        jid_destroy(jid_to);
        jid_destroy(my_jid);

        return TRUE;
    }

    return FALSE;
}
开发者ID:0xPoly,项目名称:profanity,代码行数:59,代码来源:message.c

示例7: stanza_contains_chat_state

gboolean
stanza_contains_chat_state(xmpp_stanza_t *stanza)
{
    return ((xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ACTIVE) != NULL) ||
            (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_COMPOSING) != NULL) ||
            (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_PAUSED) != NULL) ||
            (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_GONE) != NULL) ||
            (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_INACTIVE) != NULL));
}
开发者ID:backalor,项目名称:profanity,代码行数:9,代码来源:stanza.c

示例8: n_handler

static xmpp_stanza_t* n_handler(const char *cmd,
                                xmpp_stanza_t* cmd_stanza,
                                xmpp_conn_t * const conn,
                                xmpp_stanza_t * const stanza,
                                void * const userdata,
                                bool direct,
                                conflate_mgmt_cb_t cb)
{
    conflate_handle_t *handle = (conflate_handle_t*) userdata;
    xmpp_ctx_t *ctx = handle->ctx;
    conflate_form_result result = { .conn = conn,
                                    .ctx = ctx,
                                    .reply = NULL,
                                    .cmd_res = NULL,
                                    .container = NULL };
    kvpair_t *form = NULL;

    assert(cb);

    result.reply = create_reply(ctx, stanza);
    result.cmd_res = create_cmd_response(ctx, cmd_stanza);

    add_and_release(result.reply, result.cmd_res);

    xmpp_stanza_t *x = xmpp_stanza_get_child_by_name(cmd_stanza, "x");
    if (x) {
        xmpp_stanza_t *fields = xmpp_stanza_get_child_by_name(x, "field");
        if (fields) {
            form = grok_form(fields);
        }
    }

    enum conflate_mgmt_cb_result rv = cb(handle->conf->userdata, handle,
                                         cmd, direct, form, &result);

    CONFLATE_LOG(handle, LOG_LVL_DEBUG, "Result of %s:  %s", cmd, cb_name(rv));

    switch (rv) {
    case RV_ERROR:
        add_cmd_error(ctx, result.reply, "500",
                      "urn:ietf:params:xml:ns:xmpp-stanzas",
                      "internal-server-error", NULL, NULL);
        break;
    case RV_BADARG:
        add_cmd_error(ctx, result.reply, "400",
                      "urn:ietf:params:xml:ns:xmpp-stanzas", "bad-request",
                      "http://jabber.org/protocol/commands", "bad-payload");
        break;
    case RV_OK:
        /* Things are good, use the built form */
        break;
    }

    free_kvpair(form);

    return result.reply;
}
开发者ID:strategist922,项目名称:libconflate,代码行数:57,代码来源:xmpp.c

示例9: _version_result_handler

static int
_version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
    void * const userdata)
{
    char *id = xmpp_stanza_get_id(stanza);

    if (id != NULL) {
        log_debug("IQ version result handler fired, id: %s.", id);
    } else {
        log_debug("IQ version result handler fired.");
    }

    const char *jid = xmpp_stanza_get_attribute(stanza, "from");

    xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY);
    if (query == NULL) {
        return 1;
    }

    char *ns = xmpp_stanza_get_ns(query);
    if (g_strcmp0(ns, STANZA_NS_VERSION) != 0) {
        return 1;
    }

    char *name_str = NULL;
    char *version_str = NULL;
    char *os_str = NULL;
    xmpp_stanza_t *name = xmpp_stanza_get_child_by_name(query, "name");
    xmpp_stanza_t *version = xmpp_stanza_get_child_by_name(query, "version");
    xmpp_stanza_t *os = xmpp_stanza_get_child_by_name(query, "os");

    if (name != NULL) {
        name_str = xmpp_stanza_get_text(name);
    }
    if (version != NULL) {
        version_str = xmpp_stanza_get_text(version);
    }
    if (os != NULL) {
        os_str = xmpp_stanza_get_text(os);
    }

    PContact contact;
    Jid *jidp = jid_create(jid);
    if (muc_room_is_active(jidp->barejid)) {
        contact = muc_get_participant(jidp->barejid, jidp->resourcepart);
    } else {
        contact = roster_get_contact(jidp->barejid);
    }

    Resource *resource = p_contact_get_resource(contact, jidp->resourcepart);
    const char *presence = string_from_resource_presence(resource->presence);
    handle_software_version_result(jid, presence, name_str, version_str, os_str);

    jid_destroy(jidp);

    return 1;
}
开发者ID:dotoole,项目名称:profanity,代码行数:57,代码来源:iq.c

示例10: XMPP_IBB_Data_Process

int XMPP_IBB_Data_Process(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata)
{

    char* intext;
    unsigned char *result;
    xmpp_ctx_t *ctx = (xmpp_ctx_t*)userdata;
    char *szSid, szSeq;	
//    xmpp_ibb_session_t* ibb_ssn;
    

    szSid = \
	xmpp_stanza_get_attribute(xmpp_stanza_get_child_by_name(stanza, "data"), "sid");
 
    szSeq = \ 
	xmpp_stanza_get_attribute(xmpp_stanza_get_child_by_name(stanza, "data"), "seq");
 
    intext = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "data"));

    printf("[Sid=%s][Seq=%s][Raw Data=%s]\n", szSid, szSeq, intext);
    result = base64_decode(ctx, intext, strlen(intext));
    printf("Decode result=%s\n", result);

    gRecv = malloc(strlen(result)+1);
    strcpy(gRecv, result);
    
    if(gStanza == NULL)
        gStanza = xmpp_stanza_copy(stanza);

#if 0  //data queue function has not been verified.  
	            
    ibb_ssn = XMPP_Get_IBB_Session_Handle(szSid);

    if( ibb_ssn == NULL)		
    {
        printf("Opened Session ID not found\n"); 
	goto error;
    }

    xmpp_ibb_data_t* ibb_data_new = malloc(sizeof(xmpp_ibb_data_t));
    ibb_data_new->seq_num = malloc(strlen(szSeq)+1);
    ibb_data_new->recv_data =  malloc(strlen(result)+1);
    
    strcpy(ibb_data_new->seq_num, szSeq);   
    strcpy(ibb_data_new->recv_data, result);
   
    XMPP_IBB_Add_Session_Data_Queue(ibb_ssn, ibb_data_new);
#endif

error:
    xmpp_free(ctx, szSid);
    xmpp_free(ctx, szSeq);
    xmpp_free(ctx, intext);
    xmpp_free(ctx, result);

    return 1;
}
开发者ID:RyanHong-2015,项目名称:libstrophe-xep,代码行数:56,代码来源:xmpp_ibb.c

示例11: _CreateReadParam

/**
 * Creates the parameter structure for the Read callback
 * @param[in] params This stanza is the params element in the XML-RPC format
 * @return The structure or null if an error were found.
 */
static sdvp_ReadParam_t* _CreateReadParam (xmpp_stanza_t * params) {
    const int expectedParams = 1;
    sdvp_ReadParam_t* rv = NULL;
    int i = 0;
    bool elementNotFund = false;
    xmpp_stanza_t *structure = NULL, *member = NULL, *value = NULL,
            *type = NULL, *name = NULL;
    char *text, *textname;

    structure = _GetRpcStructureElementFromParams(params);
    if (structure == NULL ) {
        return NULL ;
    }
    rv = _InitiateReadParameters();
    for (member = xmpp_stanza_get_children(structure);
            member && !elementNotFund && (i < expectedParams); member =
                    xmpp_stanza_get_next(member)) {
        if (xmpp_stanza_get_name(member)
                && strcmp(xmpp_stanza_get_name(member), "member") == 0) {

            if (!(name = xmpp_stanza_get_child_by_name(member, "name"))) {
                _FreeReadParameters(rv);
                // TODO: Signal error back
                return NULL ;
            }
            name = xmpp_stanza_get_children(name);

			textname = xmpp_stanza_get_text(name);
            if (strcmp(textname, "VariableAccessSpecification") == 0) {
                if (!(value = xmpp_stanza_get_child_by_name(member, "value"))) {
                    _FreeReadParameters(rv);
                    // TODO: Signal error back
					free(textname);
                    return NULL ;
                }
                if ((type = xmpp_stanza_get_child_by_name(value, "string"))) {
                    if (xmpp_stanza_get_children(type)) {
                        text = xmpp_stanza_get_text(type);
                        rv->reference = text;
                    } else {
                        rv->reference = NULL;
                    }
                } else {
                    elementNotFund = true;
                }
            } else {
//                if (!type) {
//                    _FreeReadParameters(rv);
//                    return NULL ;
//                }
            }
			free(textname);
        }
    }
    return rv;
}
开发者ID:energinet,项目名称:datalogger-client,代码行数:61,代码来源:sdvptypes.c

示例12: _muc_user_handler

static int
_muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata)
{
    xmpp_ctx_t *ctx = connection_get_ctx();
    xmpp_stanza_t *xns_muc_user = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER);
    char *room = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);

    if (!room) {
        log_warning("Message received with no from attribute, ignoring");
        return 1;
    }

    // XEP-0045
    xmpp_stanza_t *invite = xmpp_stanza_get_child_by_name(xns_muc_user, STANZA_NAME_INVITE);
    if (!invite) {
        return 1;
    }

    char *invitor_jid = xmpp_stanza_get_attribute(invite, STANZA_ATTR_FROM);
    if (!invitor_jid) {
        log_warning("Chat room invite received with no from attribute");
        return 1;
    }

    Jid *jidp = jid_create(invitor_jid);
    if (!jidp) {
        return 1;
    }
    char *invitor = jidp->barejid;

    char *reason = NULL;
    xmpp_stanza_t *reason_st = xmpp_stanza_get_child_by_name(invite, STANZA_NAME_REASON);
    if (reason_st) {
        reason = xmpp_stanza_get_text(reason_st);
    }

    char *password = NULL;
    xmpp_stanza_t *password_st = xmpp_stanza_get_child_by_name(xns_muc_user, STANZA_NAME_PASSWORD);
    if (password_st) {
        password = xmpp_stanza_get_text(password_st);
    }

    sv_ev_room_invite(INVITE_MEDIATED, invitor, room, reason, password);
    jid_destroy(jidp);
    if (reason) {
        xmpp_free(ctx, reason);
    }
    if (password) {
        xmpp_free(ctx, password);
    }

    return 1;
}
开发者ID:KThand1,项目名称:profanity,代码行数:53,代码来源:message.c

示例13: message_handler

int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata)
{
    char *intext, *decoded_intext;
    if(!xmpp_stanza_get_child_by_name(stanza, "body")) return 1;
    if(!strcmp(xmpp_stanza_get_attribute(stanza, "type"), "error")) return 1;
    intext = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "body"));

    decoded_intext = from_base64(intext, strlen(intext));
    fwrite((const void*)decoded_intext, 1, strlen(intext), stdout);
    free(decoded_intext);
    return 1;
}
开发者ID:chmduquesne,项目名称:xmppipe,代码行数:12,代码来源:xmppipe.c

示例14: blocked_set_handler

int
blocked_set_handler(xmpp_stanza_t *stanza)
{
    xmpp_stanza_t *block = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BLOCK);
    if (block) {
        xmpp_stanza_t *child = xmpp_stanza_get_children(block);
        while (child) {
            if (g_strcmp0(xmpp_stanza_get_name(child), STANZA_NAME_ITEM) == 0) {
                const char *jid = xmpp_stanza_get_attribute(child, STANZA_ATTR_JID);
                if (jid) {
                    blocked = g_list_append(blocked, strdup(jid));
                    autocomplete_add(blocked_ac, jid);
                }

            }

            child = xmpp_stanza_get_next(child);
        }
    }

    xmpp_stanza_t *unblock = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_UNBLOCK);
    if (unblock) {
        xmpp_stanza_t *child = xmpp_stanza_get_children(unblock);
        if (!child) {
            g_list_free_full(blocked, free);
            blocked = NULL;
            autocomplete_clear(blocked_ac);
        } else {
            while (child) {
                if (g_strcmp0(xmpp_stanza_get_name(child), STANZA_NAME_ITEM) == 0) {
                    const char *jid = xmpp_stanza_get_attribute(child, STANZA_ATTR_JID);
                    if (jid) {
                        GList *found = g_list_find_custom(blocked, jid, (GCompareFunc)g_strcmp0);
                        if (found) {
                            blocked = g_list_remove_link(blocked, found);
                            g_list_free_full(found, free);
                            autocomplete_remove(blocked_ac, jid);
                        }
                    }

                }

                child = xmpp_stanza_get_next(child);
            }
        }
    }

    return 1;
}
开发者ID:incertia,项目名称:profanity,代码行数:49,代码来源:blocking.c

示例15: XMPP_IBB_handler

/*
* Main callback function to dispatch XEP-0047 open/data/close stanzas 
*   @param conn   a Strophe connection object  
*   @param stanza  a Strophe stanza object received from sender.
*   @param userdata  a callback interface to pass xmpp_ctx. 
*/
int XMPP_IBB_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata)
{
    char*  szBlock_size;
    char*  szSid;

	
    printf("XMPP IBB Handler\n");

    if( xmpp_stanza_get_child_by_name(stanza, "open") != NULL)
    {

        printf(" =====XEP0047 Open Handle\n");
        szBlock_size =  \
            xmpp_stanza_get_attribute(  xmpp_stanza_get_child_by_name(stanza, "open"), "block-size");
        szSid =  \
            xmpp_stanza_get_attribute(xmpp_stanza_get_child_by_name(stanza, "open"), "sid");
    printf("XEP0047 IQ blocksize=%s sid=%s \n",szBlock_size, szSid );

#if 0   // The is used to support multi sesssion. not verified. 
	xmpp_ibb_session_t* ibb_ssn_p;	
	ibb_ssn_p = malloc(sizeof(xmpp_ibb_session_t));
        ibb_ssn_p->sid = malloc(strlen(szSid)+1);		
	ibb_ssn_p->szblock_size = malloc(strlen(szBlock_size)+1);
	ibb_ssn_p->ibb_data_queue = NULL;
        ibb_ssn_p->next = NULL;
	
	strcpy(ibb_ssn_p->sid, szBlock_size);
	strcpy(ibb_ssn_p->szblock_size, szSid);

	//=================> gXMPP_IBB_handle-> next = ibb_ssn_p;
	XMPP_IBB_Add_Session_Queue(ibb_ssn_p);
#endif

        XMPP_IBB_Ack_Send(conn, stanza, userdata);

    }
    else  if( xmpp_stanza_get_child_by_name(stanza, "data") != NULL)
    {
        XMPP_IBB_Ack_Send(conn, stanza, userdata);
        printf("========XEP0047 Data process\n");
        XMPP_IBB_Data_Process(conn, stanza  , userdata);   
       
    }
    else if( xmpp_stanza_get_child_by_name(stanza, "close")  )
    {
        XMPP_IBB_Ack_Send(conn, stanza, userdata);
    }
    return 1;
}
开发者ID:RyanHong-2015,项目名称:libstrophe-xep,代码行数:55,代码来源:xmpp_ibb.c


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