这篇教程C++ xmpp_stanza_set_attribute函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xmpp_stanza_set_attribute函数的典型用法代码示例。如果您正苦于以下问题:C++ xmpp_stanza_set_attribute函数的具体用法?C++ xmpp_stanza_set_attribute怎么用?C++ xmpp_stanza_set_attribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xmpp_stanza_set_attribute函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _iq_handle_ping_getstatic int_iq_handle_ping_get(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata){ xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *to = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TO); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if ((from == NULL) || (to == NULL)) { return 1; } xmpp_stanza_t *pong = xmpp_stanza_new(ctx); xmpp_stanza_set_name(pong, STANZA_NAME_IQ); xmpp_stanza_set_attribute(pong, STANZA_ATTR_TO, from); xmpp_stanza_set_attribute(pong, STANZA_ATTR_FROM, to); xmpp_stanza_set_attribute(pong, STANZA_ATTR_TYPE, STANZA_TYPE_RESULT); if (id != NULL) { xmpp_stanza_set_attribute(pong, STANZA_ATTR_ID, id); } xmpp_send(conn, pong); xmpp_stanza_release(pong); return 1;}
开发者ID:louiecaulfield,项目名称:profanity,代码行数:28,
示例2: add_cmd_errorstatic void add_cmd_error(xmpp_ctx_t *ctx, xmpp_stanza_t * reply, const char *code, const char *ns, const char *name, const char *specificns, const char *specificcond){ xmpp_stanza_set_attribute(reply, "type", "error"); xmpp_stanza_t *error = xmpp_stanza_new(ctx); assert(error); xmpp_stanza_set_name(error, "error"); xmpp_stanza_set_attribute(error, "type", "modify"); xmpp_stanza_set_attribute(error, "code", code); add_and_release(reply, error); xmpp_stanza_t *etype = xmpp_stanza_new(ctx); assert(etype); xmpp_stanza_set_name(etype, name); xmpp_stanza_set_attribute(etype, "xmlns", ns); add_and_release(error, etype); if (specificns && specificcond) { xmpp_stanza_t *specific = xmpp_stanza_new(ctx); assert(specific); xmpp_stanza_set_name(specific, specificcond); xmpp_stanza_set_attribute(specific, "xmlns", specificns); add_and_release(error, specific); }}
开发者ID:strategist922,项目名称:libconflate,代码行数:33,
示例3: _respond_iq_with_errorstatic void _respond_iq_with_error(xmpp_conn_t *conn, xmpp_stanza_t *stanza, const char *type, const char* condition){ char *id = xmpp_stanza_get_attribute(stanza, "id"); if (!id) return; xmpp_stanza_t *response = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(response, "iq"); xmpp_stanza_set_attribute(response, "type", "error"); xmpp_stanza_set_attribute(response, "id", id); char *req_from = xmpp_stanza_get_attribute(stanza, "from"); //当req_from为NULL时, to属性应该设为服务器, 不设应该默认是服务器; if (req_from) xmpp_stanza_set_attribute(response, "to", req_from); xmpp_stanza_t *stanza_error = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(stanza_error, "error"); xmpp_stanza_set_attribute(stanza_error, "type", type); xmpp_stanza_t *stanza_condition = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(stanza_condition, condition); xmpp_stanza_set_ns(stanza_condition, XMPP_NS_STANZA); xmpp_stanza_add_child(stanza_error, stanza_condition); xmpp_stanza_add_child(response, stanza_error); xmpp_stanza_release(stanza_condition); xmpp_stanza_release(stanza_error); xmpp_send(conn, response); xmpp_stanza_release(response);}
开发者ID:FihlaTV,项目名称:conference,代码行数:32,
示例4: zkmuc_get_room_descriptionint zkmuc_get_room_description(zkmuc_ctx_t *ctx, const char *room_id, on_get_room_description cb, void *user_data){ char iq_id[128]; xmpp_ua_get_unique_string(ctx->ua, iq_id); xmpp_stanza_t *stanza_iq = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(stanza_iq, "iq"); xmpp_stanza_set_attribute(stanza_iq, "to", room_id); xmpp_stanza_set_attribute(stanza_iq, "id", iq_id); xmpp_stanza_set_type(stanza_iq, "get"); xmpp_stanza_t *stanza_query = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(stanza_query, "query"); xmpp_stanza_set_ns(stanza_query, XMPP_NS_MUC_ROOM_INFO); xmpp_stanza_add_child(stanza_iq, stanza_query); xmpp_stanza_release(stanza_query); room_info_data *info_data = (room_info_data *)malloc(sizeof(room_info_data)); info_data->cb = cb; info_data->ctx = ctx; info_data->user_data = user_data; xmpp_ua_id_handler_add(ctx->ua, _on_room_info, iq_id, info_data); xmpp_ua_send(ctx->ua, stanza_iq); xmpp_stanza_release(stanza_iq); return 0;}
开发者ID:FihlaTV,项目名称:conference,代码行数:25,
示例5: _zkmuc_destroy_roomstatic void _zkmuc_destroy_room(char *room_jid, xmpp_ua_t *ua){ xmpp_stanza_t *iq = xmpp_stanza_new(_xmpp_ctx); char id[128]; xmpp_ua_get_unique_string(ua, id); xmpp_stanza_set_name(iq, "iq"); xmpp_stanza_set_id(iq, id); xmpp_stanza_set_type(iq, "set"); xmpp_stanza_set_attribute(iq, "to", room_jid); xmpp_stanza_t *query = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(query, "query"); xmpp_stanza_set_ns(query, XMPP_NS_MUC_OWNER); xmpp_stanza_t *destroy = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(destroy, "destroy"); xmpp_stanza_set_attribute(destroy, "jid", room_jid); xmpp_stanza_add_child(query, destroy); xmpp_stanza_release(destroy); xmpp_stanza_add_child(iq, query); xmpp_stanza_release(query); xmpp_ua_id_handler_add(ua, zkmuc_destroy_room_result, id, NULL); xmpp_ua_send(ua, iq); xmpp_stanza_release(iq);}
开发者ID:FihlaTV,项目名称:conference,代码行数:27,
示例6: _iq_handle_discoinfo_getstatic int_iq_handle_discoinfo_get(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata){ xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); xmpp_stanza_t *incoming_query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); const char *node_str = xmpp_stanza_get_attribute(incoming_query, STANZA_ATTR_NODE); if (from != NULL) { xmpp_stanza_t *response = xmpp_stanza_new(ctx); xmpp_stanza_set_name(response, STANZA_NAME_IQ); xmpp_stanza_set_id(response, xmpp_stanza_get_id(stanza)); xmpp_stanza_set_attribute(response, STANZA_ATTR_TO, from); xmpp_stanza_set_type(response, STANZA_TYPE_RESULT); xmpp_stanza_t *query = caps_create_query_response_stanza(ctx); if (node_str != NULL) { xmpp_stanza_set_attribute(query, STANZA_ATTR_NODE, node_str); } xmpp_stanza_add_child(response, query); xmpp_send(conn, response); xmpp_stanza_release(query); xmpp_stanza_release(response); } return 1;}
开发者ID:louiecaulfield,项目名称:profanity,代码行数:29,
示例7: XMPP_IBB_SendPayloadvoid XMPP_IBB_SendPayload(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata, char* resp ){ static int seq = 0; int data_seq = 0; char Data_Seq_Buf[32]; char ID_Buf[32]; char* encoded_data; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_stanza_t *iq, *data, *text; iq = xmpp_stanza_new(ctx); data = xmpp_stanza_new(ctx); text = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, "iq"); xmpp_stanza_set_type(iq, "set"); sprintf(ID_Buf, "ID-seq-%d", seq); seq++; xmpp_stanza_set_id(iq, ID_Buf); xmpp_stanza_set_attribute(iq, "to", xmpp_stanza_get_attribute(stanza, "from")); xmpp_stanza_set_attribute(iq, "from", xmpp_stanza_get_attribute(stanza, "to")); xmpp_stanza_set_name(data, "data"); xmpp_stanza_set_ns(data, XMLNS_IBB); xmpp_stanza_set_attribute(data, "sid", / xmpp_stanza_get_attribute(xmpp_stanza_get_child_by_name(stanza, "data"), "sid")); sprintf(Data_Seq_Buf , "%d", data_seq); xmpp_stanza_set_attribute(data, "seq", Data_Seq_Buf); printf("/n[Response =%s]/n", resp); encoded_data = base64_encode(ctx, (unsigned char*)resp, strlen(resp)); xmpp_stanza_set_text_with_size(text, encoded_data, strlen(encoded_data)); xmpp_stanza_add_child(data, text); xmpp_stanza_add_child(iq, data); xmpp_send(conn, iq); seq++; free(resp); xmpp_free(ctx, encoded_data); xmpp_stanza_release(data); xmpp_stanza_release(iq); xmpp_stanza_release(text); xmpp_stanza_release(stanza); //copied by IBB IQ receiver handler}
开发者ID:RyanHong-2015,项目名称:libstrophe-xep,代码行数:54,
示例8: XMPP_IBB_Ack_Sendvoid XMPP_IBB_Ack_Send(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata){ xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_stanza_t *iq; iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, "iq"); xmpp_stanza_set_type(iq, "result"); xmpp_stanza_set_id(iq, xmpp_stanza_get_attribute(stanza, "id")); xmpp_stanza_set_attribute(iq, "to", xmpp_stanza_get_attribute(stanza, "from")); xmpp_stanza_set_attribute(iq, "from", xmpp_stanza_get_attribute(stanza, "to")); xmpp_send(conn, iq); xmpp_stanza_release(iq);}
开发者ID:RyanHong-2015,项目名称:libstrophe-xep,代码行数:15,
示例9: _stanza_copy_attributes/* * Copy the attributes of stanza src into stanza dst. Return -1 on error. */static int _stanza_copy_attributes(xmpp_stanza_t * dst, const xmpp_stanza_t * const src){ hash_iterator_t *iter; const char *key; const char *val; int rc = XMPP_EOK; iter = hash_iter_new(src->attributes); if (!iter) rc = XMPP_EMEM; while (rc == XMPP_EOK && (key = hash_iter_next(iter))) { val = hash_get(src->attributes, key); if (!val) rc = XMPP_EINT; if (rc == XMPP_EOK) rc = xmpp_stanza_set_attribute(dst, key, val); } hash_iter_release(iter); if (rc != XMPP_EOK && dst->attributes) { hash_release(dst->attributes); dst->attributes = NULL; } return rc;}
开发者ID:apophys,项目名称:libstrophe,代码行数:28,
示例10: send_stdin_oncevoid send_stdin_once(xmpp_conn_t * const conn, xmpp_ctx_t *ctx, char *jid_to){ int n; char buf[1024], *stdin_b64; xmpp_stanza_t *message, *body, *text; while (n = fread(buf, sizeof(char), sizeof buf, stdin)){ stdin_b64 = to_base64(buf, n); message = xmpp_stanza_new(ctx); xmpp_stanza_set_name(message, "message"); xmpp_stanza_set_type(message, "chat"); xmpp_stanza_set_attribute(message, "to", jid_to); body = xmpp_stanza_new(ctx); xmpp_stanza_set_name(body, "body"); text = xmpp_stanza_new(ctx); xmpp_stanza_set_text(text, stdin_b64); xmpp_stanza_add_child(body, text); xmpp_stanza_add_child(message, body); xmpp_send(conn, message); xmpp_stanza_release(message); free(stdin_b64); }}
开发者ID:chmduquesne,项目名称:xmppipe,代码行数:27,
示例11: _disco_items_get_handlerstatic int_disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata){ xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if (id != NULL) { log_debug("IQ disco items get handler fired, id: %s.", id); } else { log_debug("IQ disco items get handler fired."); } if (from != NULL) { xmpp_stanza_t *response = xmpp_stanza_new(ctx); xmpp_stanza_set_name(response, STANZA_NAME_IQ); xmpp_stanza_set_id(response, xmpp_stanza_get_id(stanza)); xmpp_stanza_set_attribute(response, STANZA_ATTR_TO, from); xmpp_stanza_set_type(response, STANZA_TYPE_RESULT); xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_set_name(query, STANZA_NAME_QUERY); xmpp_stanza_set_ns(query, XMPP_NS_DISCO_ITEMS); xmpp_stanza_add_child(response, query); xmpp_send(conn, response); xmpp_stanza_release(response); } return 1;}
开发者ID:dotoole,项目名称:profanity,代码行数:31,
示例12: zkmuc_broadcast_messageint zkmuc_broadcast_message(zkmuc_ctx_t *ctx, const char *msg){ xmpp_stanza_t *stanza_msg = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(stanza_msg, "message"); xmpp_stanza_set_attribute(stanza_msg, "to", ctx->room_id); xmpp_stanza_set_type(stanza_msg, "groupchat"); xmpp_stanza_t *stanza_body = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(stanza_body, "zonekey"); xmpp_stanza_t *stanza_jid = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(stanza_jid, "jid"); xmpp_stanza_t *stanza_jid_value = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_text(stanza_jid_value, xmpp_ua_get_jid(ctx->ua)); xmpp_stanza_add_child(stanza_jid, stanza_jid_value); xmpp_stanza_release(stanza_jid_value); xmpp_stanza_add_child(stanza_body, stanza_jid); xmpp_stanza_release(stanza_jid); xmpp_stanza_t *stanza_txt = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_text(stanza_txt, msg); xmpp_stanza_add_child(stanza_body, stanza_txt); xmpp_stanza_release(stanza_txt); xmpp_stanza_add_child(stanza_msg, stanza_body); xmpp_stanza_release(stanza_body); xmpp_ua_send(ctx->ua, stanza_msg); xmpp_stanza_release(stanza_msg); return 0;}
开发者ID:FihlaTV,项目名称:conference,代码行数:27,
示例13: zkmuc_enter_roomint zkmuc_enter_room(zkmuc_ctx_t *ctx, const char *room_id, const char *nick, zkmuc_room_cbs *cbs, void *user_data){ char room_jid[256]; ctx->room_id = strdup(room_id); sprintf(room_jid, "%s/%s", room_id, nick); ctx->room_jid = strdup(room_jid); ctx->room_cbs = *cbs;/////// ctx->room_data = user_data;/////// xmpp_ua_presence_handler_add(ctx->ua, zkmuc_room_presence_handler, ctx); xmpp_ua_msg_handler_add(ctx->ua, zkmuc_group_msg_handler, ctx); xmpp_ua_msg_handler_add(ctx->ua, _zkmuc_source_query, ctx); xmpp_stanza_t *prensece = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(prensece, "presence"); xmpp_stanza_set_attribute(prensece, "to", ctx->room_jid); xmpp_stanza_t *x = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(x, "x"); xmpp_stanza_set_ns(x, XMPP_NS_MUC); xmpp_stanza_add_child(prensece, x); xmpp_stanza_release(x); xmpp_ua_send(ctx->ua, prensece); xmpp_stanza_release(prensece); return 0;}
开发者ID:FihlaTV,项目名称:conference,代码行数:27,
示例14: stanza_create_messagexmpp_stanza_t *stanza_create_message(xmpp_ctx_t *ctx, const char * const recipient, const char * const type, const char * const message, const char * const state){ char *encoded_xml = encode_xml(message); xmpp_stanza_t *msg, *body, *text; msg = xmpp_stanza_new(ctx); xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); xmpp_stanza_set_type(msg, type); xmpp_stanza_set_attribute(msg, STANZA_ATTR_TO, recipient); body = xmpp_stanza_new(ctx); xmpp_stanza_set_name(body, STANZA_NAME_BODY); text = xmpp_stanza_new(ctx); xmpp_stanza_set_text(text, encoded_xml); xmpp_stanza_add_child(body, text); xmpp_stanza_add_child(msg, body); if (state != NULL) { xmpp_stanza_t *chat_state = xmpp_stanza_new(ctx); xmpp_stanza_set_name(chat_state, state); xmpp_stanza_set_ns(chat_state, STANZA_NS_CHATSTATES); xmpp_stanza_add_child(msg, chat_state); } g_free(encoded_xml); return msg;}
开发者ID:backalor,项目名称:profanity,代码行数:33,
示例15: message_handlerint 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,
示例16: message_handlerint 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,
示例17: _send_room_presencestatic void_send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence){ GList *rooms_p = muc_get_active_room_list(); GList *rooms = rooms_p; while (rooms != NULL) { const char *room = rooms->data; const char *nick = muc_get_room_nick(room); if (nick != NULL) { char *full_room_jid = create_fulljid(room, nick); xmpp_stanza_set_attribute(presence, STANZA_ATTR_TO, full_room_jid); log_debug("Sending presence to room: %s", full_room_jid); xmpp_send(conn, presence); free(full_room_jid); } rooms = g_list_next(rooms); } if (rooms_p != NULL) { g_list_free(rooms_p); }}
开发者ID:dotoole,项目名称:profanity,代码行数:26,
示例18: xmppchat_send_messageint xmppchat_send_message(xmpp_conn_t *conn, xmppdata_t *xdata){ xmpp_stanza_t *szmsg, *szbody, *sztext; xmpp_ctx_t *ctx; ctx = xmpp_conn_get_context(conn); sztext = xmpp_stanza_new(ctx); xmpp_stanza_set_text(sztext, xdata->data); szbody = xmpp_stanza_new(ctx); xmpp_stanza_set_name(szbody, "body"); xmpp_stanza_add_child(szbody, sztext); szmsg = xmpp_stanza_new(ctx); xmpp_stanza_set_name(szmsg, "message"); xmpp_stanza_set_type(szmsg, "chat"); xmpp_stanza_set_attribute(szmsg, "to", xdata->tojid); xmpp_stanza_add_child(szmsg, szbody); xmpp_send(conn, szmsg); xmpp_stanza_release(szmsg); return 0;}
开发者ID:WorksSystems,项目名称:wks_xep0047,代码行数:25,
示例19: zkmuc_unlock_roomstatic void zkmuc_unlock_room(zkmuc_ctx_t *ctx){ xmpp_stanza_t *iq = xmpp_stanza_new(_xmpp_ctx); char id[128]; xmpp_ua_get_unique_string(ctx->ua, id); xmpp_stanza_set_name(iq, "iq"); xmpp_stanza_set_id(iq, id); xmpp_stanza_set_type(iq, "set"); xmpp_stanza_set_attribute(iq, "to", ctx->room_id); xmpp_stanza_t *query = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(query, "query"); xmpp_stanza_set_ns(query, XMPP_NS_MUC_OWNER); xmpp_stanza_t *x = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(x, "x"); xmpp_stanza_set_ns(x, XMPP_NS_X); xmpp_stanza_set_type(x, "submit"); xmpp_stanza_t *field = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(field, "field"); xmpp_stanza_set_attribute(field, "var", "muc#roomconfig_roomname"); xmpp_stanza_t *stanza_value = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_name(stanza_value, "value"); xmpp_stanza_t *stanza_text = xmpp_stanza_new(_xmpp_ctx); xmpp_stanza_set_text(stanza_text, ctx->room_desc); xmpp_stanza_add_child(stanza_value, stanza_text); xmpp_stanza_release(stanza_text); xmpp_stanza_add_child(field, stanza_value); xmpp_stanza_release(stanza_value); xmpp_stanza_add_child(x, field); xmpp_stanza_release(field); xmpp_stanza_add_child(query, x); xmpp_stanza_release(x); xmpp_stanza_add_child(iq, query); xmpp_stanza_release(query); xmpp_ua_id_handler_add(ctx->ua, zkmuc_unlock_room_result, id, ctx); xmpp_ua_send(ctx->ua, iq); xmpp_stanza_release(iq);}
开发者ID:FihlaTV,项目名称:conference,代码行数:47,
示例20: xmpp_conn_get_bound_jidxmpp_ibb_session_t *xmpp_ibb_open(xmpp_conn_t * const conn, char * const peer, char * const sid){ xmpp_ibb_session_t *sess; xmpp_stanza_t *iq, *open; xmpp_ctx_t *ctx; const char *jid = xmpp_conn_get_bound_jid(conn); char sizetemp[6] = ""; int size; if (peer == NULL || strlen(peer) == 0) { return NULL; } sess = _ibb_session_init(conn, peer, sid); if (sess == NULL) { return NULL; } size = snprintf(sizetemp, sizeof(sizetemp), "%d", sess->block_size); if (size < sizeof(sizetemp)) { sizetemp[size] = '/0'; } nmtoken_generate(sess->id, 8); ctx = xmpp_conn_get_context(conn); iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, "iq"); xmpp_stanza_set_type(iq, "set"); xmpp_stanza_set_id(iq, sess->id); xmpp_stanza_set_attribute(iq, "from", jid); xmpp_stanza_set_attribute(iq, "to", sess->peer); open = xmpp_stanza_new(ctx); xmpp_stanza_set_name(open, "open"); xmpp_stanza_set_ns(open, XMLNS_IBB); xmpp_stanza_set_attribute(open, "block-size", sizetemp); xmpp_stanza_set_attribute(open, "sid", sess->sid); xmpp_stanza_set_attribute(open, "stanza", "iq"); xmpp_stanza_add_child(iq, open); xmpp_send(conn, iq); xmpp_stanza_release(open); xmpp_stanza_release(iq); ilist_add(g_list, sess); return sess;}
开发者ID:WorksSystems,项目名称:wks_xep0047,代码行数:46,
示例21: HandleRpcCall/** * This is called when someone sends a RPC method call * Checks for XML-RPC format validation and sends error if so otherwise it calls the * HandleServiceCall for finding the right service and creating the right structures * @return KEEP_THIS_HANDLER_ACTIVE */int HandleRpcCall(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) { xmpp_stanza_t *reply; xmpp_stanza_t *xmlRpcReply; xmpp_ctx_t *ctx = (xmpp_ctx_t*) userdata; sdvp_from_t* from; sdvp_reply_params_t* replyParams = NULL; int formatInvalid; sdvpIdleCounter = 0; sdvpPingsSent = 0; reply = xmpp_stanza_new(ctx); xmpp_stanza_set_name(reply, "iq"); // TODO: Get the Group and get the jid from = _CreateFrom(xmpp_stanza_get_attribute(stanza, "from"), "TODO", "TODO"); syslog(LOG_DEBUG, "Received a RPC Method call from %s/n", from->name); formatInvalid = _CheckRpcFormat(stanza); if (formatInvalid) { // FIXME: Something here fails! syslog(LOG_WARNING, "Error in XML-RPC format/n"); sdvp_InitiateReplyParameters(&replyParams, 1); replyParams->params[0].strValue = strdup("Error in XML-RPC format/n"); replyParams->params[0].type = IEC_VISIBLE_STRING; xmpp_stanza_set_type(reply, "error"); // TODO: Create a type //HJP var her! xmlRpcReply = _CreateReply(ctx, SDVP_METHOD_UNDEFINED ,replyParams); xmpp_stanza_add_child(reply, xmlRpcReply); //HJP: stanza_add_child laver en kopi, s C++ xmpp_stanza_set_name函数代码示例 C++ xmpp_stanza_new函数代码示例
|