这篇教程C++ xmpp_stanza_get_attribute函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xmpp_stanza_get_attribute函数的典型用法代码示例。如果您正苦于以下问题:C++ xmpp_stanza_get_attribute函数的具体用法?C++ xmpp_stanza_get_attribute怎么用?C++ xmpp_stanza_get_attribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xmpp_stanza_get_attribute函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: filesvoid files(const char *from, const char *to, int error, xmpp_stanza_t *stanza, xmpp_conn_t *const conn, void *const userdata){ wlog("files()"); if (error == 0) { char *action_attr = xmpp_stanza_get_attribute(stanza, "action"); /* action attribute */ if (action_attr == NULL) { werr("xmpp_stanza_get_attribute attribute = action"); } wfatal(action_attr == NULL, "xmpp_stanza_get_attribute [attribute = action]"); if (strcmp(action_attr, "attributes") == 0) { files_attr(stanza); } else if (strcmp(action_attr, "list") == 0) { files_list(stanza); } else if (strncasecmp(action_attr, "read", 4) == 0) { files_read(stanza); } else { werr("Unknown action: %s", action_attr); } } else { werr("error stanza %s %s", xmpp_stanza_get_attribute(stanza, "path"), xmpp_stanza_get_attribute(stanza, "action")); } wlog("Return from files()");}
开发者ID:RedPitaya,项目名称:wyliodrin-server,代码行数:26,
示例2: _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,
示例3: _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,
示例4: stanza_get_delaygbooleanstanza_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,
示例5: _conference_handlerstatic int_conference_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata){ xmpp_stanza_t *xns_conference = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if (!from) { log_warning("Message received with no from attribute, ignoring"); return 1; } Jid *jidp = jid_create(from); if (!jidp) { return 1; } // XEP-0249 char *room = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_JID); if (!room) { jid_destroy(jidp); return 1; } char *reason = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_REASON); char *password = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_PASSWORD); sv_ev_room_invite(INVITE_DIRECT, jidp->barejid, room, reason, password); jid_destroy(jidp); return 1;}
开发者ID:KThand1,项目名称:profanity,代码行数:31,
示例6: _room_config_submit_handlerstatic int_room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata){ const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if (id != NULL) { log_debug("IQ room config submit handler fired, id: %s.", id); } else { log_debug("IQ room config submit handler fired."); } // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); handle_room_config_submit_result_error(from, error_message); free(error_message); return 0; } handle_room_config_submit_result(from); return 0;}
开发者ID:dotoole,项目名称:profanity,代码行数:26,
示例7: _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,
示例8: _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,
示例9: _receipt_received_handlerstatic int_receipt_received_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata){ xmpp_stanza_t *receipt = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS); char *name = xmpp_stanza_get_name(receipt); if (g_strcmp0(name, "received") != 0) { return 1; } char *id = xmpp_stanza_get_attribute(receipt, STANZA_ATTR_ID); if (!id) { return 1; } char *fulljid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if (!fulljid) { return 1; } Jid *jidp = jid_create(fulljid); sv_ev_message_receipt(jidp->barejid, id); jid_destroy(jidp); return 1;}
开发者ID:KThand1,项目名称:profanity,代码行数:25,
示例10: handle_replyint handle_reply(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata){ xmpp_stanza_t *query, *item; char *type, *name; type = xmpp_stanza_get_type(stanza); if (strcmp(type, "error") == 0) fprintf(stderr, "ERROR: query failed/n"); else { query = xmpp_stanza_get_child_by_name(stanza, "query"); printf("Roster:/n"); for (item = xmpp_stanza_get_children(query); item; item = xmpp_stanza_get_next(item)) if ((name = xmpp_stanza_get_attribute(item, "name"))) printf("/t %s (%s) sub=%s/n", name, xmpp_stanza_get_attribute(item, "jid"), xmpp_stanza_get_attribute(item, "subscription")); else printf("/t %s sub=%s/n", xmpp_stanza_get_attribute(item, "jid"), xmpp_stanza_get_attribute(item, "subscription")); printf("END OF LIST/n"); } /* disconnect */ xmpp_disconnect(conn); return 0;}
开发者ID:1Project,项目名称:SafeBoardMessenger,代码行数:32,
示例11: _zkmuc_on_source_querystatic int _zkmuc_on_source_query(xmpp_ua_t *ua, xmpp_stanza_t *stanza, void *userdata){ query_source_data *data = (query_source_data *)userdata; char *from = xmpp_stanza_get_attribute(stanza, "from"); xmpp_stanza_t *x = xmpp_stanza_get_child_by_name(stanza, "x"); xmpp_stanza_t *item = xmpp_stanza_get_children(x); zkmuc_source_t *head = NULL; zkmuc_source_t **current = &head; while (item) { if (!strcmp("item", xmpp_stanza_get_name(item))) { *current = (zkmuc_source_t *)malloc(sizeof(zkmuc_source_t)); (*current)->cid = atoi(xmpp_stanza_get_attribute(item, "cid")); (*current)->sid = atoi(xmpp_stanza_get_attribute(item, "sid")); (*current)->description = strdup(xmpp_stanza_get_attribute(item, "desc")); (*current)->mcu = strdup(xmpp_stanza_get_attribute(item, "mcu")); current = &(*current)->next; } item = xmpp_stanza_get_next(item); } *current = NULL; data->cb(data->ctx, from, data->userdata, head); _zkmuc_free_all_remote_source(head); free(data); return 1;}
开发者ID:FihlaTV,项目名称:conference,代码行数:28,
示例12: 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,
示例13: 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,
示例14: PresenceHandler/** * This handles a status response iq be printing it out */int PresenceHandler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) {// xmpp_stanza_t *reply; char *type;// char *id; char *sender; xmpp_ctx_t *ctx = (xmpp_ctx_t *) userdata; sdvpIdleCounter = 0; sdvpPingsSent = 0;// type is NULL if initial presence is received type = xmpp_stanza_get_type(stanza); if (type != NULL ) { if (strcmp(type, "error") == 0) { syslog(LOG_WARNING, "ERROR: Received presence with type of error/n"); } else {// id = xmpp_stanza_get_id(stanza); sender = xmpp_stanza_get_attribute(stanza, "from");// reply = xmpp_stanza_new(ctx);// xmpp_stanza_set_name(reply, "presence");// xmpp_stanza_set_type(reply, "result");// if (id != NULL ) {// xmpp_stanza_set_id(reply, id);// }// xmpp_stanza_set_attribute(reply, "to", sender);// xmpp_send(conn, reply);// xmpp_stanza_release(reply); } } else {// id = xmpp_stanza_get_id(stanza); sender = strdup(xmpp_stanza_get_attribute(stanza, "from")); // Check if the presence is from the server user char *senderUsername; senderUsername = GetUsernameFromJid(sender); if (strcmp(sdvpServerUsername, senderUsername) == 0) { sdvpServerFullJid = strdup(sender); // Send status-request _SendRpcCall(conn, ctx, sdvpServerFullJid); } free(sender); // Dont send reply as the server should do this automatically // to all connected users on the roster// reply = xmpp_stanza_new(ctx);// xmpp_stanza_set_name(reply, "presence");// xmpp_stanza_set_type(reply, "result");// if (id != NULL ) {// xmpp_stanza_set_id(reply, id);// }// xmpp_stanza_set_attribute(reply, "to", sender);// xmpp_send(conn, reply);// xmpp_stanza_release(reply); } return 1;}
开发者ID:energinet,项目名称:datalogger-client,代码行数:62,
示例15: _handle_carbonsstatic 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,
示例16: files_liststatic void files_list(xmpp_stanza_t *stanza) { int rc; /* Return code */ rc = pthread_mutex_lock(&mutex); wsyserr(rc != 0, "pthread_mutex_lock"); char *error_attr = xmpp_stanza_get_attribute(stanza, "error"); /* error attribute */ wfatal(error_attr == NULL, "no error attribute in files stanza"); if (strcmp(error_attr, "0") != 0) { wlog("Error in attributes: %s", error_attr); } else { char *path_attr = xmpp_stanza_get_attribute(stanza, "path"); /* path attribute */ wfatal(path_attr == NULL, "xmpp_stanza_get_attribute [attribute = path]"); xmpp_stanza_t *child = xmpp_stanza_get_children(stanza); while (child != NULL) { elem_t *elem = (elem_t *)malloc(sizeof(elem_t)); wsyserr(elem == NULL, "malloc"); elem->next = NULL; char *name = xmpp_stanza_get_name(child); wfatal(name == NULL, "xmpp_stanza_get_name"); if (strcmp(name, "directory") == 0) { elem->type = DIR; } else if (strcmp(name, "file") == 0) { elem->type = REG; } else { werr("Unknown name: %s", name); } char *filename_attr = xmpp_stanza_get_attribute(child, "filename"); wfatal(filename_attr == NULL, "xmpp_stanza_get_attribute [attribute = filename]"); elem->filename = strdup(filename_attr); wsyserr(elem->filename == NULL, "strdup"); /* Add elem in list */ if (root == NULL) { root = elem; } else { last->next = elem; } last = elem; child = xmpp_stanza_get_next(child); } } /* Data set */ signal_list = true; rc = pthread_cond_signal(&cond); wsyserr(rc != 0, "pthread_cond_signal"); rc = pthread_mutex_unlock(&mutex); wsyserr(rc != 0, "pthread_mutex_unlock");}
开发者ID:RedPitaya,项目名称:wyliodrin-server,代码行数:59,
示例17: 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_get_child_by_name函数代码示例 C++ xmpp_send函数代码示例
|