diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-02-04 17:06:54 +0000 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-05-02 15:11:32 +0100 |
commit | 3cd3ffc609f92a534317f006eb4401f39bc4b279 (patch) | |
tree | cfad467e4798bf5cacd09f8953fcd48a61c10f26 | |
parent | 0de3d249d69bb99fddbcf72e4dafe36660245eb7 (diff) | |
download | telepathy-gabble-3cd3ffc609f92a534317f006eb4401f39bc4b279.tar.gz |
stop using LmMessageNode wrapper
WockyNode is the future.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
50 files changed, 1041 insertions, 1019 deletions
diff --git a/src/bytestream-factory.c b/src/bytestream-factory.c index a2059cd7f..99c0d7ae4 100644 --- a/src/bytestream-factory.c +++ b/src/bytestream-factory.c @@ -303,7 +303,7 @@ socks5_proxy_query_reply_cb (GabbleConnection *conn, GabbleBytestreamFactory *self = GABBLE_BYTESTREAM_FACTORY (obj); GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE ( self); - LmMessageNode *query, *streamhost; + WockyNode *query, *streamhost; const gchar *from; const gchar *jid, *host, *portstr; gint64 port; @@ -311,7 +311,7 @@ socks5_proxy_query_reply_cb (GabbleConnection *conn, gboolean fallback = GPOINTER_TO_INT (user_data); GSList *found = NULL; - from = lm_message_node_get_attribute ( + from = wocky_node_get_attribute ( wocky_stanza_get_top_node (reply_msg), "from"); if (from == NULL) goto fail; @@ -324,13 +324,13 @@ socks5_proxy_query_reply_cb (GabbleConnection *conn, if (query == NULL) goto fail; - streamhost = lm_message_node_get_child (query, "streamhost"); + streamhost = wocky_node_get_child (query, "streamhost"); if (streamhost == NULL) goto fail; - jid = lm_message_node_get_attribute (streamhost, "jid"); - host = lm_message_node_get_attribute (streamhost, "host"); - portstr = lm_message_node_get_attribute (streamhost, "port"); + jid = wocky_node_get_attribute (streamhost, "jid"); + host = wocky_node_get_attribute (streamhost, "host"); + portstr = wocky_node_get_attribute (streamhost, "port"); if (jid == NULL || host == NULL || portstr == NULL) goto fail; @@ -435,7 +435,7 @@ proxies_disco_cb (GabbleDisco *disco, GabbleDiscoRequest *request, const gchar *j, const gchar *n, - LmMessageNode *query_result, + WockyNode *query_result, GError *error, gpointer user_data) { @@ -453,13 +453,13 @@ proxies_disco_cb (GabbleDisco *disco, for (i = node_iter (query_result); i; i = node_iter_next (i)) { - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); const gchar *jid; if (tp_strdiff (node->name, "item")) continue; - jid = lm_message_node_get_attribute (node, "jid"); + jid = wocky_node_get_attribute (node, "jid"); if (jid == NULL) continue; @@ -832,7 +832,7 @@ remove_bytestream (GabbleBytestreamFactory *self, */ static gboolean streaminit_parse_request (LmMessage *message, - LmMessageNode *si, + WockyNode *si, const gchar **profile, const gchar **from, const gchar **stream_id, @@ -841,13 +841,13 @@ streaminit_parse_request (LmMessage *message, GSList **stream_methods, gboolean *multiple) { - LmMessageNode *iq = wocky_stanza_get_top_node (message); - LmMessageNode *feature, *x, *si_multiple; + WockyNode *iq = wocky_stanza_get_top_node (message); + WockyNode *feature, *x, *si_multiple; NodeIter i, j; - *stream_init_id = lm_message_node_get_attribute (iq, "id"); + *stream_init_id = wocky_node_get_attribute (iq, "id"); - *from = lm_message_node_get_attribute (iq, "from"); + *from = wocky_node_get_attribute (iq, "from"); if (*from == NULL) { STANZA_DEBUG (message, "got a message without a from field"); @@ -856,18 +856,18 @@ streaminit_parse_request (LmMessage *message, /* Parse <si> */ - *stream_id = lm_message_node_get_attribute (si, "id"); + *stream_id = wocky_node_get_attribute (si, "id"); if (*stream_id == NULL) { STANZA_DEBUG (message, "got a SI request without a stream id field"); return FALSE; } - *mime_type = lm_message_node_get_attribute (si, "mime-type"); + *mime_type = wocky_node_get_attribute (si, "mime-type"); /* if no mime_type is defined, XEP-0095 says to assume "binary/octect-stream" * which is presumably a typo for "application/octet-stream" */ - *profile = lm_message_node_get_attribute (si, "profile"); + *profile = wocky_node_get_attribute (si, "profile"); if (*profile == NULL) { STANZA_DEBUG (message, "got a SI request without a profile field"); @@ -892,14 +892,14 @@ streaminit_parse_request (LmMessage *message, for (i = node_iter (x); i; i = node_iter_next (i)) { - LmMessageNode *field = node_iter_data (i); + WockyNode *field = node_iter_data (i); - if (tp_strdiff (lm_message_node_get_attribute (field, "var"), + if (tp_strdiff (wocky_node_get_attribute (field, "var"), "stream-method")) /* some future field, ignore it */ continue; - if (tp_strdiff (lm_message_node_get_attribute (field, "type"), + if (tp_strdiff (wocky_node_get_attribute (field, "type"), "list-single")) { STANZA_DEBUG (message, "SI request's stream-method field was " @@ -911,15 +911,15 @@ streaminit_parse_request (LmMessage *message, *stream_methods = NULL; for (j = node_iter (field); j; j = node_iter_next (j)) { - LmMessageNode *stream_method = node_iter_data (j); - LmMessageNode *value; + WockyNode *stream_method = node_iter_data (j); + WockyNode *value; const gchar *stream_method_str; - value = lm_message_node_get_child (stream_method, "value"); + value = wocky_node_get_child (stream_method, "value"); if (value == NULL) continue; - stream_method_str = lm_message_node_get_value (value); + stream_method_str = value->content; if (!tp_strdiff (stream_method_str, "")) continue; @@ -1033,7 +1033,7 @@ static GabbleBytestreamSocks5 *gabble_bytestream_factory_create_socks5 ( static void si_tube_received (GabbleBytestreamFactory *self, LmMessage *msg, - LmMessageNode *si, + WockyNode *si, GabbleBytestreamIface *bytestream, TpHandle peer_handle, TpHandle room_handle, @@ -1112,7 +1112,7 @@ bytestream_factory_iq_si_cb (LmMessageHandler *handler, (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_ROOM); - LmMessageNode *si; + WockyNode *si; TpHandle peer_handle = 0, room_handle; GabbleBytestreamIface *bytestream = NULL; GSList *l; @@ -1165,7 +1165,7 @@ bytestream_factory_iq_si_cb (LmMessageHandler *handler, peer_handle = tp_handle_ensure (contact_repo, from, NULL, NULL); /* we are not in a muc so our own jid is the one in the 'to' attribute */ - self_jid = g_strdup (lm_message_node_get_attribute ( + self_jid = g_strdup (wocky_node_get_attribute ( wocky_stanza_get_top_node (msg), "to")); } else @@ -1301,7 +1301,7 @@ handle_ibb_open_iq (GabbleBytestreamFactory *self, GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (self); GabbleBytestreamIBB *bytestream; - LmMessageNode *open_node; + WockyNode *open_node; ConstBytestreamIdentifier bsid = { NULL, NULL }; const gchar *tmp; guint state; @@ -1314,7 +1314,7 @@ handle_ibb_open_iq (GabbleBytestreamFactory *self, if (open_node == NULL) return FALSE; - bsid.jid = lm_message_node_get_attribute ( + bsid.jid = wocky_node_get_attribute ( wocky_stanza_get_top_node (msg), "from"); if (bsid.jid == NULL) { @@ -1324,7 +1324,7 @@ handle_ibb_open_iq (GabbleBytestreamFactory *self, return TRUE; } - bsid.stream = lm_message_node_get_attribute (open_node, "sid"); + bsid.stream = wocky_node_get_attribute (open_node, "sid"); if (bsid.stream == NULL) { DEBUG ("IBB open stanza doesn't contain stream id"); @@ -1354,7 +1354,7 @@ handle_ibb_open_iq (GabbleBytestreamFactory *self, return TRUE; } - tmp = lm_message_node_get_attribute (open_node, "block-size"); + tmp = wocky_node_get_attribute (open_node, "block-size"); if (tmp != NULL) { guint block_size = strtoul (tmp, NULL, 10); @@ -1379,7 +1379,7 @@ handle_ibb_close_iq (GabbleBytestreamFactory *self, GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (self); ConstBytestreamIdentifier bsid = { NULL, NULL }; GabbleBytestreamIBB *bytestream; - LmMessageNode *close_node; + WockyNode *close_node; if (lm_message_get_sub_type (msg) != LM_MESSAGE_SUB_TYPE_SET) return FALSE; @@ -1389,7 +1389,7 @@ handle_ibb_close_iq (GabbleBytestreamFactory *self, if (close_node == NULL) return FALSE; - bsid.jid = lm_message_node_get_attribute (wocky_stanza_get_top_node (msg), + bsid.jid = wocky_node_get_attribute (wocky_stanza_get_top_node (msg), "from"); if (bsid.jid == NULL) { @@ -1399,7 +1399,7 @@ handle_ibb_close_iq (GabbleBytestreamFactory *self, return TRUE; } - bsid.stream = lm_message_node_get_attribute (close_node, "sid"); + bsid.stream = wocky_node_get_attribute (close_node, "sid"); if (bsid.stream == NULL) { DEBUG ("IBB close stanza doesn't contain stream id"); @@ -1435,7 +1435,7 @@ handle_ibb_data (GabbleBytestreamFactory *self, GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (self); GabbleBytestreamIBB *bytestream = NULL; - LmMessageNode *data; + WockyNode *data; ConstBytestreamIdentifier bsid = { NULL, NULL }; priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (self); @@ -1448,7 +1448,7 @@ handle_ibb_data (GabbleBytestreamFactory *self, if (data == NULL) return FALSE; - bsid.jid = lm_message_node_get_attribute (wocky_stanza_get_top_node (msg), + bsid.jid = wocky_node_get_attribute (wocky_stanza_get_top_node (msg), "from"); if (bsid.jid == NULL) { @@ -1459,7 +1459,7 @@ handle_ibb_data (GabbleBytestreamFactory *self, return TRUE; } - bsid.stream = lm_message_node_get_attribute (data, "sid"); + bsid.stream = wocky_node_get_attribute (data, "sid"); if (bsid.stream == NULL) { DEBUG ("got a IBB message data without a stream id field"); @@ -1493,7 +1493,7 @@ handle_muc_data (GabbleBytestreamFactory *self, GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (self); GabbleBytestreamMuc *bytestream = NULL; - LmMessageNode *data; + WockyNode *data; ConstBytestreamIdentifier bsid = { NULL, NULL }; gchar *room_name; const gchar *from; @@ -1505,7 +1505,7 @@ handle_muc_data (GabbleBytestreamFactory *self, if (data == NULL) return FALSE; - from = lm_message_node_get_attribute ( + from = wocky_node_get_attribute ( wocky_stanza_get_top_node (msg), "from"); if (from == NULL) { @@ -1513,7 +1513,7 @@ handle_muc_data (GabbleBytestreamFactory *self, return TRUE; } - bsid.stream = lm_message_node_get_attribute (data, "sid"); + bsid.stream = wocky_node_get_attribute (data, "sid"); if (bsid.stream == NULL) { DEBUG ("got a pseudo IBB muc message data without a stream id field"); @@ -1595,7 +1595,7 @@ handle_socks5_query_iq (GabbleBytestreamFactory *self, GabbleBytestreamFactoryPrivate *priv = GABBLE_BYTESTREAM_FACTORY_GET_PRIVATE (self); GabbleBytestreamSocks5 *bytestream; - LmMessageNode *query_node; + WockyNode *query_node; ConstBytestreamIdentifier bsid = { NULL, NULL }; const gchar *tmp; NodeIter i; @@ -1608,7 +1608,7 @@ handle_socks5_query_iq (GabbleBytestreamFactory *self, if (query_node == NULL) return FALSE; - bsid.jid = lm_message_node_get_attribute ( + bsid.jid = wocky_node_get_attribute ( wocky_stanza_get_top_node (msg), "from"); if (bsid.jid == NULL) { @@ -1618,7 +1618,7 @@ handle_socks5_query_iq (GabbleBytestreamFactory *self, return TRUE; } - bsid.stream = lm_message_node_get_attribute (query_node, "sid"); + bsid.stream = wocky_node_get_attribute (query_node, "sid"); if (bsid.stream == NULL) { DEBUG ("SOCKS5 query stanza doesn't contain stream id"); @@ -1638,7 +1638,7 @@ handle_socks5_query_iq (GabbleBytestreamFactory *self, return TRUE; } - tmp = lm_message_node_get_attribute (query_node, "mode"); + tmp = wocky_node_get_attribute (query_node, "mode"); /* If this attribute is missing, the default value of "tcp" MUST be assumed */ if (tmp != NULL && tp_strdiff (tmp, "tcp")) { @@ -1651,7 +1651,7 @@ handle_socks5_query_iq (GabbleBytestreamFactory *self, for (i = node_iter (query_node); i; i = node_iter_next (i)) { - LmMessageNode *child_node = node_iter_data (i); + WockyNode *child_node = node_iter_data (i); if (!tp_strdiff (child_node->name, "streamhost")) gabble_bytestream_socks5_add_streamhost (bytestream, child_node); @@ -1895,7 +1895,7 @@ gabble_bytestream_factory_create_multiple (GabbleBytestreamFactory *self, static GabbleBytestreamIface * streaminit_get_multiple_bytestream (GabbleBytestreamFactory *self, LmMessage *reply_msg, - LmMessageNode *si, + WockyNode *si, const gchar *stream_id, TpHandle peer_handle, const gchar *peer_resource, @@ -1903,7 +1903,7 @@ streaminit_get_multiple_bytestream (GabbleBytestreamFactory *self, { /* If the other client supports si-multiple we have directly a list of * supported methods inside <value/> tags */ - LmMessageNode *si_multi; + WockyNode *si_multi; const gchar *stream_method; GabbleBytestreamMultiple *bytestream = NULL; NodeIter i; @@ -1919,12 +1919,12 @@ streaminit_get_multiple_bytestream (GabbleBytestreamFactory *self, for (i = node_iter (si_multi); i; i = node_iter_next (i)) { - LmMessageNode *value = node_iter_data (i); + WockyNode *value = node_iter_data (i); if (tp_strdiff (value->name, "value")) continue; - stream_method = lm_message_node_get_value (value); + stream_method = value->content; if (!stream_method_supported (stream_method)) { DEBUG ("got a si-multiple reply with an unsupported " @@ -1941,13 +1941,13 @@ streaminit_get_multiple_bytestream (GabbleBytestreamFactory *self, static GabbleBytestreamIface * streaminit_get_bytestream (GabbleBytestreamFactory *self, LmMessage *reply_msg, - LmMessageNode *si, + WockyNode *si, const gchar *stream_id, TpHandle peer_handle, const gchar *peer_resource, const gchar *self_jid) { - LmMessageNode *feature, *x, *value; + WockyNode *feature, *x, *value; GabbleBytestreamIface *bytestream = NULL; const gchar *stream_method; NodeIter i; @@ -1969,14 +1969,14 @@ streaminit_get_bytestream (GabbleBytestreamFactory *self, for (i = node_iter (x); i; i = node_iter_next (i)) { - LmMessageNode *field = node_iter_data (i); + WockyNode *field = node_iter_data (i); - if (tp_strdiff (lm_message_node_get_attribute (field, "var"), + if (tp_strdiff (wocky_node_get_attribute (field, "var"), "stream-method")) /* some future field, ignore it */ continue; - value = lm_message_node_get_child (field, "value"); + value = wocky_node_get_child (field, "value"); if (value == NULL) { STANZA_DEBUG (reply_msg, "SI reply's stream-method field " @@ -1984,7 +1984,7 @@ streaminit_get_bytestream (GabbleBytestreamFactory *self, return NULL; } - stream_method = lm_message_node_get_value (value); + stream_method = value->content; bytestream = gabble_bytestream_factory_create_from_method (self, stream_method, peer_handle, stream_id, NULL, peer_resource, self_jid, GABBLE_BYTESTREAM_STATE_INITIATING); @@ -2032,7 +2032,7 @@ streaminit_reply_cb (GabbleConnection *conn, (struct _streaminit_reply_cb_data*) user_data; GabbleBytestreamIface *bytestream = NULL; gchar *peer_resource = NULL; - LmMessageNode *si; + WockyNode *si; const gchar *from; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); @@ -2063,7 +2063,7 @@ streaminit_reply_cb (GabbleConnection *conn, /* stream accepted */ - from = lm_message_node_get_attribute ( + from = wocky_node_get_attribute ( wocky_stanza_get_top_node (reply_msg), "from"); if (from == NULL) { @@ -2091,7 +2091,7 @@ streaminit_reply_cb (GabbleConnection *conn, } /* we are not in a muc so our own jid is the one in the 'to' attribute */ - self_jid = g_strdup (lm_message_node_get_attribute ( + self_jid = g_strdup (wocky_node_get_attribute ( wocky_stanza_get_top_node (reply_msg), "to")); } else @@ -2279,7 +2279,7 @@ gabble_bytestream_factory_make_multi_accept_iq (const gchar *full_jid, GList *stream_methods) { LmMessage *msg; - LmMessageNode *multi_node; + WockyNode *multi_node; GList *l; msg = lm_message_build (full_jid, LM_MESSAGE_TYPE_IQ, @@ -2295,7 +2295,7 @@ gabble_bytestream_factory_make_multi_accept_iq (const gchar *full_jid, for (l = stream_methods; l != NULL; l = l->next) { - lm_message_node_add_child (multi_node, "value", l->data); + wocky_node_add_child_with_content (multi_node, "value", l->data); } return msg; diff --git a/src/bytestream-ibb.c b/src/bytestream-ibb.c index eeb1f8348..9ec7a0b52 100644 --- a/src/bytestream-ibb.c +++ b/src/bytestream-ibb.c @@ -613,7 +613,7 @@ gabble_bytestream_ibb_receive (GabbleBytestreamIBB *self, gboolean is_iq) { GabbleBytestreamIBBPrivate *priv = GABBLE_BYTESTREAM_IBB_GET_PRIVATE (self); - LmMessageNode *data; + WockyNode *data; GString *str; TpHandle sender; @@ -639,7 +639,7 @@ gabble_bytestream_ibb_receive (GabbleBytestreamIBB *self, /* FIXME: check sequence number */ - str = base64_decode (lm_message_node_get_value (data)); + str = base64_decode (data->content); if (str == NULL) { DEBUG ("base64 decoding failed"); @@ -711,7 +711,7 @@ gabble_bytestream_ibb_accept (GabbleBytestreamIface *iface, GabbleBytestreamIBB *self = GABBLE_BYTESTREAM_IBB (iface); GabbleBytestreamIBBPrivate *priv = GABBLE_BYTESTREAM_IBB_GET_PRIVATE (self); LmMessage *msg; - LmMessageNode *si; + WockyNode *si; if (priv->state != GABBLE_BYTESTREAM_STATE_LOCAL_PENDING) { diff --git a/src/bytestream-iface.h b/src/bytestream-iface.h index f8802b5b8..67b55e3f9 100644 --- a/src/bytestream-iface.h +++ b/src/bytestream-iface.h @@ -43,7 +43,7 @@ typedef enum } GabbleBytestreamState; typedef void (* GabbleBytestreamAugmentSiAcceptReply) ( - LmMessageNode *si, gpointer user_data); + WockyNode *si, gpointer user_data); typedef struct _GabbleBytestreamIface GabbleBytestreamIface; typedef struct _GabbleBytestreamIfaceClass GabbleBytestreamIfaceClass; diff --git a/src/bytestream-muc.c b/src/bytestream-muc.c index 385c02683..4cab448a3 100644 --- a/src/bytestream-muc.c +++ b/src/bytestream-muc.c @@ -305,7 +305,7 @@ send_data_to (GabbleBytestreamMuc *self, guint send_now; GError *error = NULL; LmMessage *msg; - LmMessageNode *data = NULL; + WockyNode *data = NULL; msg = lm_message_build (to, LM_MESSAGE_TYPE_MESSAGE, '(', "data", "", @@ -331,7 +331,7 @@ send_data_to (GabbleBytestreamMuc *self, if (groupchat) { - lm_message_node_set_attribute (wocky_stanza_get_top_node (msg), + wocky_node_set_attribute (wocky_stanza_get_top_node (msg), "type", "groupchat"); } @@ -357,18 +357,18 @@ send_data_to (GabbleBytestreamMuc *self, } encoded = base64_encode (send_now, str + sent, FALSE); - lm_message_node_set_value (data, encoded); + wocky_node_set_content (data, encoded); switch (frag) { case FRAG_FIRST: - lm_message_node_set_attribute (data, "frag", "first"); + wocky_node_set_attribute (data, "frag", "first"); break; case FRAG_MIDDLE: - lm_message_node_set_attribute (data, "frag", "middle"); + wocky_node_set_attribute (data, "frag", "middle"); break; case FRAG_LAST: - lm_message_node_set_attribute (data, "frag", "last"); + wocky_node_set_attribute (data, "frag", "last"); break; } @@ -420,7 +420,7 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); const gchar *from; - LmMessageNode *data; + WockyNode *data; GString *str; TpHandle sender; GString *buffer; @@ -441,7 +441,7 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self, return; } - from = lm_message_node_get_attribute ( + from = wocky_node_get_attribute ( wocky_stanza_get_top_node (msg), "from"); g_return_if_fail (from != NULL); sender = tp_handle_lookup (contact_repo, from, @@ -453,7 +453,7 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self, return; } - frag_val = lm_message_node_get_attribute (data, "frag"); + frag_val = wocky_node_get_attribute (data, "frag"); if (frag_val == NULL) frag = FRAG_COMPLETE; else if (!tp_strdiff (frag_val, "first")) @@ -470,7 +470,7 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self, return; } - str = base64_decode (lm_message_node_get_value (data)); + str = base64_decode (data->content); if (str == NULL) { DEBUG ("base64 decoding failed"); diff --git a/src/bytestream-multiple.c b/src/bytestream-multiple.c index 48e609710..7c6a5ad3a 100644 --- a/src/bytestream-multiple.c +++ b/src/bytestream-multiple.c @@ -388,7 +388,7 @@ gabble_bytestream_multiple_accept (GabbleBytestreamIface *iface, GabbleBytestreamMultiplePrivate *priv = GABBLE_BYTESTREAM_MULTIPLE_GET_PRIVATE (self); LmMessage *msg; - LmMessageNode *si; + WockyNode *si; GList *all_methods; gchar *current_method; diff --git a/src/bytestream-socks5.c b/src/bytestream-socks5.c index eaf645357..86aa7fc5a 100644 --- a/src/bytestream-socks5.c +++ b/src/bytestream-socks5.c @@ -746,20 +746,20 @@ target_got_connect_reply (GabbleBytestreamSocks5 *self) priv->msg_for_acknowledge_connection); if (NULL != iq_result) { - LmMessageNode *node; + WockyNode *node; Streamhost *current_streamhost; - node = lm_message_node_add_child ( + node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (iq_result), "query", ""); - lm_message_node_set_attribute (node, "xmlns", NS_BYTESTREAMS); + node->ns = g_quark_from_string (NS_BYTESTREAMS); /* streamhost-used informs the other end of the streamhost we * decided to use. In case of a direct connetion this is useless * but if we are using an external proxy we need to know which * one was selected */ - node = lm_message_node_add_child (node, "streamhost-used", ""); + node = wocky_node_add_child_with_content (node, "streamhost-used", ""); current_streamhost = priv->streamhosts->data; - lm_message_node_set_attribute (node, "jid", + wocky_node_set_attribute (node, "jid", current_streamhost->jid); _gabble_connection_send (priv->conn, iq_result, NULL); @@ -1257,7 +1257,7 @@ socks5_connect (GabbleBytestreamSocks5 *self) */ void gabble_bytestream_socks5_add_streamhost (GabbleBytestreamSocks5 *self, - LmMessageNode *streamhost_node) + WockyNode *streamhost_node) { GabbleBytestreamSocks5Private *priv = GABBLE_BYTESTREAM_SOCKS5_GET_PRIVATE (self); @@ -1270,7 +1270,7 @@ gabble_bytestream_socks5_add_streamhost (GabbleBytestreamSocks5 *self, g_return_if_fail (!tp_strdiff (streamhost_node->name, "streamhost")); - zeroconf = lm_message_node_get_attribute (streamhost_node, "zeroconf"); + zeroconf = wocky_node_get_attribute (streamhost_node, "zeroconf"); if (zeroconf != NULL) { /* TODO: add suppport for zeroconf */ @@ -1278,21 +1278,21 @@ gabble_bytestream_socks5_add_streamhost (GabbleBytestreamSocks5 *self, return; } - jid = lm_message_node_get_attribute (streamhost_node, "jid"); + jid = wocky_node_get_attribute (streamhost_node, "jid"); if (jid == NULL) { DEBUG ("streamhost doesn't contain a JID"); return; } - host = lm_message_node_get_attribute (streamhost_node, "host"); + host = wocky_node_get_attribute (streamhost_node, "host"); if (host == NULL) { DEBUG ("streamhost doesn't contain a host"); return; } - portstr = lm_message_node_get_attribute (streamhost_node, "port"); + portstr = wocky_node_get_attribute (streamhost_node, "port"); if (portstr == NULL) { DEBUG ("streamhost doesn't contain a port"); @@ -1409,7 +1409,7 @@ gabble_bytestream_socks5_accept (GabbleBytestreamIface *iface, GabbleBytestreamSocks5Private *priv = GABBLE_BYTESTREAM_SOCKS5_GET_PRIVATE (self); LmMessage *msg; - LmMessageNode *si; + WockyNode *si; if (priv->bytestream_state != GABBLE_BYTESTREAM_STATE_LOCAL_PENDING) { @@ -1566,14 +1566,14 @@ socks5_init_reply_cb (GabbleConnection *conn, if (lm_message_get_sub_type (reply_msg) == LM_MESSAGE_SUB_TYPE_RESULT) { - LmMessageNode *query, *streamhost = NULL; + WockyNode *query, *streamhost = NULL; const gchar *jid; query = lm_message_node_get_child_with_namespace ( wocky_stanza_get_top_node (reply_msg), "query", NS_BYTESTREAMS); if (query != NULL) - streamhost = lm_message_node_get_child (query, "streamhost-used"); + streamhost = wocky_node_get_child (query, "streamhost-used"); if (streamhost == NULL) { @@ -1581,7 +1581,7 @@ socks5_init_reply_cb (GabbleConnection *conn, goto socks5_init_error; } - jid = lm_message_node_get_attribute (streamhost, "jid"); + jid = wocky_node_get_attribute (streamhost, "jid"); if (jid == NULL) { DEBUG ("no jid attribute in streamhost. Closing the bytestream"); @@ -1960,17 +1960,17 @@ gabble_bytestream_socks5_initiate (GabbleBytestreamIface *iface) for (l = proxies; l != NULL; l = g_slist_next (l)) { - LmMessageNode *node; + WockyNode *node; gchar *portstr; GabbleSocks5Proxy *proxy = (GabbleSocks5Proxy *) l->data; NodeIter i = node_iter (wocky_stanza_get_top_node (msg)); - node = lm_message_node_add_child (node_iter_data (i), + node = wocky_node_add_child_with_content (node_iter_data (i), "streamhost", ""); portstr = g_strdup_printf ("%d", proxy->port); - lm_message_node_set_attributes (node, + wocky_node_set_attributes (node, "jid", proxy->jid, "host", proxy->host, "port", portstr, diff --git a/src/bytestream-socks5.h b/src/bytestream-socks5.h index 27c2c8ef1..298cbafab 100644 --- a/src/bytestream-socks5.h +++ b/src/bytestream-socks5.h @@ -65,7 +65,7 @@ GType gabble_bytestream_socks5_get_type (void); GabbleBytestreamSocks5Class)) void gabble_bytestream_socks5_add_streamhost (GabbleBytestreamSocks5 *socks5, - LmMessageNode *streamhost_node); + WockyNode *streamhost_node); void gabble_bytestream_socks5_connect_to_streamhost ( GabbleBytestreamSocks5 *socks5, LmMessage *msg); diff --git a/src/conn-aliasing.c b/src/conn-aliasing.c index a795118f8..c00fb60bb 100644 --- a/src/conn-aliasing.c +++ b/src/conn-aliasing.c @@ -166,7 +166,7 @@ static void aliases_request_vcard_cb (GabbleVCardManager *manager, GabbleVCardManagerRequest *request, TpHandle handle, - LmMessageNode *vcard, + WockyNode *vcard, GError *error, gpointer user_data) { @@ -490,9 +490,9 @@ nick_publish_msg_reply_cb (GabbleConnection *conn, #ifdef ENABLE_DEBUG if (lm_message_get_sub_type (reply_msg) == LM_MESSAGE_SUB_TYPE_ERROR) { - LmMessageNode *error_node; + WockyNode *error_node; - error_node = lm_message_node_get_child ( + error_node = wocky_node_get_child ( wocky_stanza_get_top_node (reply_msg), "error"); if (error_node != NULL) @@ -645,7 +645,7 @@ gabble_conn_aliasing_pep_alias_quark (void) static gboolean _grab_nickname (GabbleConnection *self, TpHandle handle, - LmMessageNode *node) + WockyNode *node) { TpBaseConnection *base = (TpBaseConnection *) self; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, @@ -663,7 +663,7 @@ _grab_nickname (GabbleConnection *self, return FALSE; } - nickname = lm_message_node_get_value (node); + nickname = node->content; old = tp_handle_get_qdata (contact_handles, handle, quark); if (tp_strdiff (old, nickname)) @@ -693,7 +693,7 @@ pep_nick_node_changed (WockyPepService *pep, { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - LmMessageNode *node; + WockyNode *node; TpHandle handle; const gchar *jid; @@ -705,8 +705,8 @@ pep_nick_node_changed (WockyPepService *pep, return; } - node = lm_message_node_find_child (wocky_stanza_get_top_node (stanza), - "item"); + node = lm_message_node_get_child_with_namespace (wocky_stanza_get_top_node (stanza), + "item", NULL); if (NULL == node) { STANZA_DEBUG (stanza, "PEP event without item node, ignoring"); @@ -722,7 +722,7 @@ gabble_conn_aliasing_pep_nick_reply_handler (GabbleConnection *conn, LmMessage *msg, TpHandle handle) { - LmMessageNode *pubsub_node, *items_node; + WockyNode *pubsub_node, *items_node; gboolean found = FALSE; NodeIter i; @@ -746,7 +746,7 @@ gabble_conn_aliasing_pep_nick_reply_handler (GabbleConnection *conn, } } - items_node = lm_message_node_get_child (pubsub_node, "items"); + items_node = wocky_node_get_child (pubsub_node, "items"); if (items_node == NULL) { STANZA_DEBUG (msg, "No items in PEP reply"); @@ -756,7 +756,7 @@ gabble_conn_aliasing_pep_nick_reply_handler (GabbleConnection *conn, for (i = node_iter (items_node); i; i = node_iter_next (i)) { - LmMessageNode *item_node = node_iter_data (i); + WockyNode *item_node = node_iter_data (i); if (_grab_nickname (conn, handle, item_node)) { diff --git a/src/conn-avatars.c b/src/conn-avatars.c index f6a39bee5..6733d742b 100644 --- a/src/conn-avatars.c +++ b/src/conn-avatars.c @@ -409,17 +409,17 @@ gabble_connection_get_known_avatar_tokens (TpSvcConnectionInterfaceAvatars *ifac static gboolean -parse_avatar (LmMessageNode *vcard, +parse_avatar (WockyNode *vcard, const gchar **mime_type, GString **avatar, GError **error) { - LmMessageNode *photo_node; - LmMessageNode *type_node; - LmMessageNode *binval_node; + WockyNode *photo_node; + WockyNode *type_node; + WockyNode *binval_node; const gchar *binval_value; - photo_node = lm_message_node_get_child (vcard, "PHOTO"); + photo_node = wocky_node_get_child (vcard, "PHOTO"); if (NULL == photo_node) { @@ -428,18 +428,18 @@ parse_avatar (LmMessageNode *vcard, return FALSE; } - type_node = lm_message_node_get_child (photo_node, "TYPE"); + type_node = wocky_node_get_child (photo_node, "TYPE"); if (NULL != type_node) { - *mime_type = lm_message_node_get_value (type_node); + *mime_type = type_node->content; } else { *mime_type = ""; } - binval_node = lm_message_node_get_child (photo_node, "BINVAL"); + binval_node = wocky_node_get_child (photo_node, "BINVAL"); if (NULL == binval_node) { @@ -448,7 +448,7 @@ parse_avatar (LmMessageNode *vcard, return FALSE; } - binval_value = lm_message_node_get_value (binval_node); + binval_value = binval_node->content; if (NULL == binval_value) { @@ -473,7 +473,7 @@ static void _request_avatar_cb (GabbleVCardManager *self, GabbleVCardManagerRequest *request, TpHandle handle, - LmMessageNode *vcard, + WockyNode *vcard, GError *vcard_error, gpointer user_data) { @@ -598,7 +598,7 @@ gabble_connection_request_avatar (TpSvcConnectionInterfaceAvatars *iface, TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); GError *err = NULL; - LmMessageNode *vcard_node; + WockyNode *vcard_node; TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED (base, context); @@ -625,7 +625,7 @@ gabble_connection_request_avatar (TpSvcConnectionInterfaceAvatars *iface, static void emit_avatar_retrieved (TpSvcConnectionInterfaceAvatars *iface, TpHandle contact, - LmMessageNode *vcard_node) + WockyNode *vcard_node) { const gchar *mime_type; GString *avatar_str; @@ -656,7 +656,7 @@ static void request_avatars_cb (GabbleVCardManager *manager, GabbleVCardManagerRequest *request, TpHandle handle, - LmMessageNode *vcard, + WockyNode *vcard, GError *vcard_error, gpointer user_data) { @@ -697,7 +697,7 @@ gabble_connection_request_avatars (TpSvcConnectionInterfaceAvatars *iface, for (i = 0; i < contacts->len; i++) { - LmMessageNode *vcard_node; + WockyNode *vcard_node; TpHandle contact = g_array_index (contacts, TpHandle, i); if (gabble_vcard_manager_get_cached (self->vcard_manager, @@ -748,7 +748,7 @@ _set_avatar_ctx_free (struct _set_avatar_ctx *ctx) static void _set_avatar_cb2 (GabbleVCardManager *manager, GabbleVCardManagerEditRequest *request, - LmMessageNode *vcard, + WockyNode *vcard, GError *vcard_error, gpointer user_data) { diff --git a/src/conn-location.c b/src/conn-location.c index be3b62c0f..7c90ffd11 100644 --- a/src/conn-location.c +++ b/src/conn-location.c @@ -246,7 +246,7 @@ location_request_location ( static gboolean add_to_geoloc_node (const gchar *tp_name, GValue *value, - LmMessageNode *geoloc, + WockyNode *geoloc, GError **err) { LocationMapping *mapping; @@ -263,7 +263,7 @@ add_to_geoloc_node (const gchar *tp_name, return FALSE; } - lm_message_node_set_attribute ( + wocky_node_set_attribute ( geoloc, "xml:lang", g_value_get_string (value)); return TRUE; } @@ -307,7 +307,7 @@ add_to_geoloc_node (const gchar *tp_name, /* Keys and their type have been checked */ g_assert_not_reached (); - lm_message_node_add_child (geoloc, mapping->xmpp_name, str); + wocky_node_add_child_with_content (geoloc, mapping->xmpp_name, str); DEBUG ("\t - %s: %s", (gchar *) tp_name, str); g_free (str); return TRUE; @@ -349,7 +349,7 @@ location_set_location (TpSvcConnectionInterfaceLocation *iface, { GabbleConnection *conn = GABBLE_CONNECTION (iface); LmMessage *msg; - LmMessageNode *geoloc; + WockyNode *geoloc; WockyNode *item; GHashTableIter iter; gpointer key, value; @@ -520,7 +520,7 @@ update_location_from_msg (GabbleConnection *conn, TpHandle contact, LmMessage *msg) { - LmMessageNode *node; + WockyNode *node; GHashTable *location = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_free, (GDestroyNotify) tp_g_value_slice_free); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( @@ -529,14 +529,14 @@ update_location_from_msg (GabbleConnection *conn, NodeIter i; const gchar *lang; - node = lm_message_node_find_child (wocky_stanza_get_top_node (msg), - "geoloc"); + node = lm_message_node_get_child_with_namespace (wocky_stanza_get_top_node (msg), + "geoloc", NULL); if (node == NULL) return FALSE; DEBUG ("LocationsUpdate for %s:", from); - lang = lm_message_node_get_attribute (node, "xml:lang"); + lang = wocky_node_get_language (node); if (lang != NULL) { g_hash_table_insert (location, g_strdup ("language"), @@ -547,14 +547,14 @@ update_location_from_msg (GabbleConnection *conn, for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *subloc_node = node_iter_data (i); + WockyNode *subloc_node = node_iter_data (i); GValue *value = NULL; gchar *xmpp_name; const gchar *str; LocationMapping *mapping; xmpp_name = subloc_node->name; - str = lm_message_node_get_value (subloc_node); + str = subloc_node->content; if (str == NULL) continue; diff --git a/src/conn-olpc.c b/src/conn-olpc.c index 655a5cc9f..f286c4b22 100644 --- a/src/conn-olpc.c +++ b/src/conn-olpc.c @@ -52,10 +52,10 @@ update_activities_properties (GabbleConnection *conn, const gchar *contact, */ static gboolean activity_info_contribute_properties (GabbleOlpcActivity *activity, - LmMessageNode *parent, + WockyNode *parent, gboolean only_public) { - LmMessageNode *props_node; + WockyNode *props_node; if (activity->id == NULL || activity->properties == NULL) return FALSE; @@ -63,13 +63,14 @@ activity_info_contribute_properties (GabbleOlpcActivity *activity, if (only_public && !gabble_olpc_activity_is_visible (activity)) return FALSE; - props_node = lm_message_node_add_child (parent, + props_node = wocky_node_add_child_with_content (parent, "properties", ""); - lm_message_node_set_attributes (props_node, - "xmlns", NS_OLPC_ACTIVITY_PROPS, + wocky_node_set_attributes (props_node, "room", gabble_olpc_activity_get_room (activity), "activity", activity->id, NULL); + props_node->ns = g_quark_from_string (NS_OLPC_ACTIVITY_PROPS); + lm_message_node_add_children_from_properties (props_node, activity->properties, "property"); return TRUE; @@ -160,10 +161,10 @@ check_publish_reply_msg (LmMessage *reply_msg, default: { - LmMessageNode *error_node; + WockyNode *error_node; GError *error = NULL; - error_node = lm_message_node_get_child ( + error_node = wocky_node_get_child ( wocky_stanza_get_top_node (reply_msg), "error"); if (error_node != NULL) { @@ -201,10 +202,10 @@ check_query_reply_msg (LmMessage *reply_msg, default: { - LmMessageNode *error_node; + WockyNode *error_node; GError *error = NULL; - error_node = lm_message_node_get_child ( + error_node = wocky_node_get_child ( wocky_stanza_get_top_node (reply_msg), "error"); if (error_node != NULL) { @@ -265,7 +266,7 @@ get_properties_reply_cb (GObject *source, WockyStanza *reply_msg; GError *error = NULL; GHashTable *properties; - LmMessageNode *node; + WockyNode *node; reply_msg = wocky_pep_service_get_finish (WOCKY_PEP_SERVICE (source), res, &error); @@ -284,8 +285,8 @@ get_properties_reply_cb (GObject *source, if (!check_query_reply_msg (reply_msg, ctx->context)) goto out; - node = lm_message_node_find_child ( - wocky_stanza_get_top_node (reply_msg), "properties"); + node = lm_message_node_get_child_with_namespace ( + wocky_stanza_get_top_node (reply_msg), "properties", NULL); properties = lm_message_node_extract_properties (node, "property"); gabble_svc_olpc_buddy_info_return_from_get_properties (ctx->context, @@ -474,7 +475,7 @@ olpc_buddy_props_pep_node_changed (WockyPepService *pep, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); GHashTable *properties; - LmMessageNode *node; + WockyNode *node; TpBaseConnection *base = (TpBaseConnection *) conn; TpHandle handle; const gchar *jid; @@ -491,8 +492,8 @@ olpc_buddy_props_pep_node_changed (WockyPepService *pep, /* Ignore echoed pubsub notifications */ goto out; - node = lm_message_node_find_child ( - wocky_stanza_get_top_node (stanza), "properties"); + node = lm_message_node_get_child_with_namespace ( + wocky_stanza_get_top_node (stanza), "properties", NULL); properties = lm_message_node_extract_properties (node, "property"); gabble_svc_olpc_buddy_info_emit_properties_changed (conn, handle, properties); @@ -522,7 +523,7 @@ get_activity_properties_reply_cb (GObject *source, return; } - from = lm_message_node_get_attribute ( + from = wocky_node_get_attribute ( wocky_stanza_get_top_node (reply_msg), "from"); update_activities_properties (conn, from, reply_msg); g_object_unref (reply_msg); @@ -645,14 +646,14 @@ extract_activities (GabbleConnection *conn, LmMessage *msg, TpHandle sender) { - LmMessageNode *activities_node; + WockyNode *activities_node; TpHandleSet *activities_set, *old_activities; TpHandleRepoIface *room_repo = tp_base_connection_get_handles ( (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); NodeIter i; - activities_node = lm_message_node_find_child ( - wocky_stanza_get_top_node (msg), "activities"); + activities_node = lm_message_node_get_child_with_namespace ( + wocky_stanza_get_top_node (msg), "activities", NULL); activities_set = tp_handle_set_new (room_repo); @@ -662,21 +663,21 @@ extract_activities (GabbleConnection *conn, { const gchar *act_id; const gchar *room; - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); GabbleOlpcActivity *activity; TpHandle room_handle; if (tp_strdiff (node->name, "activity")) continue; - act_id = lm_message_node_get_attribute (node, "type"); + act_id = wocky_node_get_attribute (node, "type"); if (act_id == NULL) { NODE_DEBUG (node, "No activity ID, skipping"); continue; } - room = lm_message_node_get_attribute (node, "room"); + room = wocky_node_get_attribute (node, "room"); if (room == NULL) { NODE_DEBUG (node, "No room name, skipping"); @@ -828,7 +829,7 @@ get_activities_reply_cb (GObject *source, goto out; } - from = lm_message_node_get_attribute ( + from = wocky_node_get_attribute ( wocky_stanza_get_top_node (reply_msg), "from"); if (from == NULL) { @@ -936,15 +937,15 @@ upload_activities_pep (GabbleConnection *conn, { GabbleOlpcActivity *activity = g_hash_table_lookup ( conn->olpc_activities_info, GUINT_TO_POINTER (iter.element)); - LmMessageNode *activity_node; + WockyNode *activity_node; g_assert (activity != NULL); if (!gabble_olpc_activity_is_visible (activity)) continue; - activity_node = lm_message_node_add_child (activities, + activity_node = wocky_node_add_child_with_content (activities, "activity", ""); - lm_message_node_set_attributes (activity_node, + wocky_node_set_attributes (activity_node, "type", activity->id, "room", gabble_olpc_activity_get_room (activity), NULL); @@ -1241,7 +1242,7 @@ add_activity_info_in_set (GabbleConnection *conn, static GabbleOlpcActivity * extract_current_activity (GabbleConnection *conn, - LmMessageNode *node, + WockyNode *node, const gchar *contact, gboolean create_activity) { @@ -1259,13 +1260,13 @@ extract_current_activity (GabbleConnection *conn, /* For some weird reasons, the PEP protocol use "type" for the activity ID. * We can't change that without breaking compatibility but if there is no * "type" attribute then we can use the "id" one. */ - id = lm_message_node_get_attribute (node, "type"); + id = wocky_node_get_attribute (node, "type"); if (id == NULL) { - id = lm_message_node_get_attribute (node, "id"); + id = wocky_node_get_attribute (node, "id"); } - room = lm_message_node_get_attribute (node, "room"); + room = wocky_node_get_attribute (node, "room"); if (room == NULL || room[0] == '\0') return NULL; @@ -1319,7 +1320,7 @@ get_current_activity_reply_cb (GObject *source, pubsub_query_ctx *ctx = (pubsub_query_ctx *) user_data; WockyStanza *reply_msg; GError *error = NULL; - LmMessageNode *node; + WockyNode *node; const gchar *from; GabbleOlpcActivity *activity; @@ -1347,10 +1348,10 @@ get_current_activity_reply_cb (GObject *source, goto out; } - from = lm_message_node_get_attribute ( + from = wocky_node_get_attribute ( wocky_stanza_get_top_node (reply_msg), "from"); - node = lm_message_node_find_child ( - wocky_stanza_get_top_node (reply_msg), "activity"); + node = lm_message_node_get_child_with_namespace ( + wocky_stanza_get_top_node (reply_msg), "activity", NULL); activity = extract_current_activity (ctx->conn, node, from, TRUE); if (activity == NULL) { @@ -1506,7 +1507,7 @@ olpc_buddy_info_set_current_activity (GabbleSvcOLPCBuddyInfo *iface, publish = wocky_node_add_child_ns (item, "activity", NS_OLPC_CURRENT_ACTIVITY); - lm_message_node_set_attributes (publish, + wocky_node_set_attributes (publish, "type", activity, "room", room, NULL); @@ -1532,7 +1533,7 @@ olpc_current_act_pep_node_changed (WockyPepService *pep, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); TpBaseConnection *base = (TpBaseConnection *) conn; - LmMessageNode *node; + WockyNode *node; GabbleOlpcActivity *activity; TpHandle handle; const gchar *jid; @@ -1549,8 +1550,8 @@ olpc_current_act_pep_node_changed (WockyPepService *pep, /* Ignore echoed pubsub notifications */ goto out; - node = lm_message_node_find_child (wocky_stanza_get_top_node (stanza), - "activity"); + node = lm_message_node_get_child_with_namespace (wocky_stanza_get_top_node (stanza), + "activity", NULL); activity = extract_current_activity (conn, node, jid, TRUE); if (activity != NULL) @@ -1659,7 +1660,7 @@ upload_activity_properties_pep (GabbleConnection *conn, GError **error) { TpBaseConnection *base = (TpBaseConnection *) conn; - LmMessageNode *publish, *item; + WockyNode *publish, *item; LmMessage *msg; GError *e = NULL; gboolean ret; @@ -1798,7 +1799,7 @@ refresh_invitations (GabbleConnection *conn, { const gchar *to = tp_handle_inspect (contact_repo, iter.element); - lm_message_node_set_attribute ( + wocky_node_set_attribute ( wocky_stanza_get_top_node (msg), "to", to); if (!_gabble_connection_send (conn, msg, error)) { @@ -1886,7 +1887,7 @@ olpc_activity_properties_set_properties (GabbleSvcOLPCActivityProperties *iface, is_visible = gabble_olpc_activity_is_visible (activity); msg = lm_message_new (jid, LM_MESSAGE_TYPE_MESSAGE); - lm_message_node_set_attribute ( + wocky_node_set_attribute ( wocky_stanza_get_top_node (msg), "type", "groupchat"); activity_info_contribute_properties (activity, wocky_stanza_get_top_node (msg), FALSE); @@ -2054,7 +2055,7 @@ static void update_activity_properties (GabbleConnection *conn, const gchar *room, const gchar *contact, - LmMessageNode *properties_node) + WockyNode *properties_node) { GHashTable *new_properties, *old_properties; gboolean new_infos = FALSE; @@ -2127,22 +2128,22 @@ update_activities_properties (GabbleConnection *conn, LmMessage *msg) { const gchar *room; - LmMessageNode *node; + WockyNode *node; NodeIter i; - node = lm_message_node_find_child ( - wocky_stanza_get_top_node (msg), "activities"); + node = lm_message_node_get_child_with_namespace ( + wocky_stanza_get_top_node (msg), "activities", NULL); if (node == NULL) return FALSE; for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *properties_node = node_iter_data (i); + WockyNode *properties_node = node_iter_data (i); if (strcmp (properties_node->name, "properties") != 0) continue; - room = lm_message_node_get_attribute (properties_node, "room"); + room = wocky_node_get_attribute (properties_node, "room"); if (room == NULL) continue; @@ -2232,7 +2233,7 @@ conn_olpc_process_activity_properties_message (GabbleConnection *conn, TP_HANDLE_TYPE_CONTACT); TpHandleRepoIface *room_repo = tp_base_connection_get_handles (base, TP_HANDLE_TYPE_ROOM); - LmMessageNode *node = lm_message_node_get_child_with_namespace ( + WockyNode *node = lm_message_node_get_child_with_namespace ( wocky_stanza_get_top_node (msg), "properties", NS_OLPC_ACTIVITY_PROPS); const gchar *id; TpHandle room_handle, contact_handle = 0; @@ -2249,7 +2250,7 @@ conn_olpc_process_activity_properties_message (GabbleConnection *conn, DEBUG ("Found <properties> node in <message>"); - id = lm_message_node_get_attribute (node, "activity"); + id = wocky_node_get_attribute (node, "activity"); if (id == NULL) { NODE_DEBUG (node, "... activity ID missing - ignoring"); @@ -2279,7 +2280,7 @@ conn_olpc_process_activity_properties_message (GabbleConnection *conn, return TRUE; } - room = lm_message_node_get_attribute (node, "room"); + room = wocky_node_get_attribute (node, "room"); if (room == NULL) { NODE_DEBUG (node, "... room name missing - ignoring"); @@ -2495,15 +2496,15 @@ revoke_invitations (GabbleConnection *conn, LmMessage *msg = lm_message_new (NULL, LM_MESSAGE_TYPE_MESSAGE); TpIntSetIter iter = TP_INTSET_ITER_INIT (tp_handle_set_peek (invitees)); - LmMessageNode *uninvite_node; + WockyNode *uninvite_node; - uninvite_node = lm_message_node_add_child ( + uninvite_node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "uninvite", ""); - lm_message_node_set_attribute (uninvite_node, "xmlns", + uninvite_node->ns = g_quark_from_string ( NS_OLPC_ACTIVITY_PROPS); - lm_message_node_set_attribute (uninvite_node, "room", + wocky_node_set_attribute (uninvite_node, "room", gabble_olpc_activity_get_room (activity)); - lm_message_node_set_attribute (uninvite_node, "id", + wocky_node_set_attribute (uninvite_node, "id", activity->id); DEBUG ("revoke invitations for activity %s", activity->id); @@ -2511,7 +2512,7 @@ revoke_invitations (GabbleConnection *conn, { const gchar *to = tp_handle_inspect (contact_repo, iter.element); - lm_message_node_set_attribute ( + wocky_node_set_attribute ( wocky_stanza_get_top_node (msg), "to", to); if (!_gabble_connection_send (conn, msg, error)) { @@ -2537,7 +2538,7 @@ conn_olpc_process_activity_uninvite_message (GabbleConnection *conn, (TpBaseConnection *) conn, TP_HANDLE_TYPE_ROOM); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); - LmMessageNode *node; + WockyNode *node; const gchar *id, *room; TpHandle room_handle, from_handle; TpHandleSet *rooms; @@ -2549,14 +2550,14 @@ conn_olpc_process_activity_uninvite_message (GabbleConnection *conn, if (node == NULL) return FALSE; - id = lm_message_node_get_attribute (node, "id"); + id = wocky_node_get_attribute (node, "id"); if (id == NULL) { DEBUG ("no activity id. Skip"); return TRUE; } - room = lm_message_node_get_attribute (node, "room"); + room = wocky_node_get_attribute (node, "room"); if (room == NULL) { DEBUG ("no room. Skip"); diff --git a/src/conn-presence.c b/src/conn-presence.c index 0d28d6030..c2ab375ed 100644 --- a/src/conn-presence.c +++ b/src/conn-presence.c @@ -516,7 +516,7 @@ activate_current_privacy_list (GabbleConnection *self, gboolean invisible; GabblePresence *presence = self->self_presence; GError *error = NULL; - LmMessageNode *active_node; + WockyNode *active_node; g_assert (priv->privacy_statuses != NULL); @@ -866,14 +866,14 @@ iq_privacy_list_push_cb (LmMessageHandler *handler, { GabbleConnection *conn = GABBLE_CONNECTION (user_data); LmMessage *result; - LmMessageNode *list_node, *iq; + WockyNode *list_node, *iq; const gchar *list_name; if (lm_message_get_sub_type (message) != LM_MESSAGE_SUB_TYPE_SET) return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; iq = lm_message_get_node (message); - list_node = lm_message_node_find_child (iq, "list"); + list_node = lm_message_node_get_child_with_namespace (iq, "list", NULL); if (!lm_message_node_get_child_with_namespace (iq, "query", NS_PRIVACY) || !list_node) @@ -883,7 +883,7 @@ iq_privacy_list_push_cb (LmMessageHandler *handler, wocky_porter_send (wocky_session_get_porter (conn->session), result); - list_name = lm_message_node_get_attribute (list_node, "name"); + list_name = wocky_node_get_attribute (list_node, "name"); if (g_strcmp0 (list_name, conn->presence_priv->invisible_list_name) == 0) setup_invisible_privacy_list_async (conn, NULL, NULL); @@ -1042,7 +1042,7 @@ get_existing_privacy_lists_cb (GabbleConnection *conn, else { GabbleConnectionPresencePrivate *priv = conn->presence_priv; - LmMessageNode *list_node; + WockyNode *list_node; WockyNodeIter iter; GabblePluginLoader *loader = gabble_plugin_loader_dup (); @@ -1056,7 +1056,7 @@ get_existing_privacy_lists_cb (GabbleConnection *conn, wocky_node_iter_init (&iter, query_node, "list", NULL); while (wocky_node_iter_next (&iter, &list_node)) { - const gchar *list_name = lm_message_node_get_attribute (list_node, + const gchar *list_name = wocky_node_get_attribute (list_node, "name"); const gchar *status_name; @@ -1166,15 +1166,15 @@ setup_invisible_privacy_list_finish (GabbleConnection *self, } static gboolean -is_valid_invisible_list (LmMessageNode *list_node) +is_valid_invisible_list (WockyNode *list_node) { - LmMessageNode *top_node = NULL; + WockyNode *top_node = NULL; NodeIter i; guint top_order = G_MAXUINT; for (i = node_iter (list_node); i; i = node_iter_next (i)) { - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); const gchar *order_str; guint order; gchar *end; @@ -1182,7 +1182,7 @@ is_valid_invisible_list (LmMessageNode *list_node) if (g_strcmp0 (lm_message_node_get_name (child), "item") != 0) continue; - order_str = lm_message_node_get_attribute (child, "order"); + order_str = wocky_node_get_attribute (child, "order"); if (order_str == NULL) continue; @@ -1201,9 +1201,9 @@ is_valid_invisible_list (LmMessageNode *list_node) if (top_node != NULL) { - const gchar *value = lm_message_node_get_attribute (top_node, "value"); - const gchar *action = lm_message_node_get_attribute (top_node, "action"); - LmMessageNode *presence_out = lm_message_node_get_child (top_node, + const gchar *value = wocky_node_get_attribute (top_node, "value"); + const gchar *action = wocky_node_get_attribute (top_node, "action"); + WockyNode *presence_out = wocky_node_get_child (top_node, "presence-out"); return (value == NULL && g_strcmp0 (action, "deny") == 0 && @@ -1221,8 +1221,8 @@ verify_invisible_privacy_list_cb (GabbleConnection *conn, gpointer user_data) { GabbleConnectionPresencePrivate *priv = conn->presence_priv; - LmMessageNode *node = lm_message_node_find_child - (wocky_stanza_get_top_node (reply_msg), "list"); + WockyNode *node = lm_message_node_get_child_with_namespace ( + wocky_stanza_get_top_node (reply_msg), "list", NULL); GError *error = gabble_message_get_xmpp_error (reply_msg); if (lm_message_get_sub_type (reply_msg) == LM_MESSAGE_SUB_TYPE_RESULT && @@ -1481,7 +1481,7 @@ conn_presence_signal_own_presence (GabbleConnection *self, if (presence->status == GABBLE_PRESENCE_HIDDEN && to == NULL) { if (priv->invisibility_method == INVISIBILITY_METHOD_PRESENCE_INVISIBLE) - lm_message_node_set_attribute (lm_message_get_node (message), + wocky_node_set_attribute (lm_message_get_node (message), "type", "invisible"); /* FIXME: or if sending directed presence, should we add * <show>away</show>? */ diff --git a/src/connection.c b/src/connection.c index 8a017777b..c2a644b98 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1534,7 +1534,7 @@ static gboolean iq_disco_cb (WockyPorter *, WockyStanza *, gpointer); static gboolean iq_version_cb (WockyPorter *, WockyStanza *, gpointer); static gboolean iq_unknown_cb (WockyPorter *, WockyStanza *, gpointer); static void connection_disco_cb (GabbleDisco *, GabbleDiscoRequest *, - const gchar *, const gchar *, LmMessageNode *, GError *, gpointer); + const gchar *, const gchar *, WockyNode *, GError *, gpointer); static void decrement_waiting_connected (GabbleConnection *connection); static void connection_initial_presence_cb (GObject *, GAsyncResult *, gpointer); @@ -1683,7 +1683,7 @@ bare_jid_disco_cb (GabbleDisco *disco, GabbleDiscoRequest *request, const gchar *jid, const gchar *node, - LmMessageNode *result, + WockyNode *result, GError *disco_error, gpointer user_data) { @@ -1698,13 +1698,13 @@ bare_jid_disco_cb (GabbleDisco *disco, { for (i = node_iter (result); i; i = node_iter_next (i)) { - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); if (!tp_strdiff (child->name, "identity")) { - const gchar *category = lm_message_node_get_attribute (child, + const gchar *category = wocky_node_get_attribute (child, "category"); - const gchar *type = lm_message_node_get_attribute (child, "type"); + const gchar *type = wocky_node_get_attribute (child, "type"); if (!tp_strdiff (category, "pubsub") && !tp_strdiff (type, "pep")) @@ -2234,21 +2234,21 @@ gabble_connection_fill_in_caps (GabbleConnection *self, LmMessage *presence_message) { GabblePresence *presence = self->self_presence; - LmMessageNode *node = lm_message_get_node (presence_message); + WockyNode *node = lm_message_get_node (presence_message); gchar *caps_hash; gboolean share_v1, voice_v1, video_v1; GString *ext = g_string_new (""); /* XEP-0115 version 1.5 uses a verification string in the 'ver' attribute */ caps_hash = caps_hash_compute_from_self_presence (self); - node = lm_message_node_add_child (node, "c", NULL); - lm_message_node_set_attributes ( + node = wocky_node_add_child_with_content (node, "c", NULL); + wocky_node_set_attributes ( node, - "xmlns", NS_CAPS, "hash", "sha-1", "node", NS_GABBLE_CAPS, "ver", caps_hash, NULL); + node->ns = g_quark_from_string (NS_CAPS); /* Ensure this set of capabilities is in the cache. */ gabble_presence_cache_add_own_caps (self->presence_cache, caps_hash, @@ -2272,7 +2272,7 @@ gabble_connection_fill_in_caps (GabbleConnection *self, if (video_v1) g_string_append (ext, " " BUNDLE_VIDEO_V1); - lm_message_node_set_attribute (node, "ext", ext->str); + wocky_node_set_attribute (node, "ext", ext->str); g_string_free (ext, TRUE); g_free (caps_hash); } @@ -2319,18 +2319,18 @@ gabble_connection_request_decloak (GabbleConnection *self, { GabblePresence *presence = self->self_presence; LmMessage *message = gabble_presence_as_message (presence, to); - LmMessageNode *decloak; + WockyNode *decloak; gboolean ret; gabble_connection_fill_in_caps (self, message); - decloak = lm_message_node_add_child (lm_message_get_node (message), + decloak = wocky_node_add_child_with_content (lm_message_get_node (message), "temppres", NULL); - lm_message_node_set_attribute (decloak, "xmlns", NS_TEMPPRES); + decloak->ns = g_quark_from_string (NS_TEMPPRES); if (reason != NULL && *reason != '\0') { - lm_message_node_set_attribute (decloak, "reason", reason); + wocky_node_set_attribute (decloak, "reason", reason); } ret = _gabble_connection_send (self, message, error); @@ -2445,11 +2445,11 @@ _gabble_connection_send_iq_error (GabbleConnection *conn, { const gchar *to, *id; LmMessage *msg; - LmMessageNode *iq_node; + WockyNode *iq_node; iq_node = lm_message_get_node (message); - to = lm_message_node_get_attribute (iq_node, "from"); - id = lm_message_node_get_attribute (iq_node, "id"); + to = wocky_node_get_attribute (iq_node, "from"); + id = wocky_node_get_attribute (iq_node, "id"); if (id == NULL) { @@ -2460,7 +2460,7 @@ _gabble_connection_send_iq_error (GabbleConnection *conn, msg = lm_message_new_with_sub_type (to, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_ERROR); - lm_message_node_set_attribute (wocky_stanza_get_top_node (msg), "id", id); + wocky_node_set_attribute (wocky_stanza_get_top_node (msg), "id", id); lm_message_node_steal_children ( wocky_stanza_get_top_node (msg), iq_node); @@ -2476,27 +2476,27 @@ static void add_feature_node (gpointer namespace, gpointer result_query) { - LmMessageNode *feature_node; + WockyNode *feature_node; - feature_node = lm_message_node_add_child (result_query, "feature", + feature_node = wocky_node_add_child_with_content (result_query, "feature", NULL); - lm_message_node_set_attribute (feature_node, "var", namespace); + wocky_node_set_attribute (feature_node, "var", namespace); } static void add_identity_node (const GabbleDiscoIdentity *identity, gpointer result_query) { - LmMessageNode *identity_node; + WockyNode *identity_node; - identity_node = lm_message_node_add_child + identity_node = wocky_node_add_child_with_content (result_query, "identity", NULL); - lm_message_node_set_attribute (identity_node, "category", identity->category); - lm_message_node_set_attribute (identity_node, "type", identity->type); + wocky_node_set_attribute (identity_node, "category", identity->category); + wocky_node_set_attribute (identity_node, "type", identity->type); if (identity->lang) - lm_message_node_set_attribute (identity_node, "lang", identity->lang); + wocky_node_set_attribute (identity_node, "lang", identity->lang); if (identity->name) - lm_message_node_set_attribute (identity_node, "name", identity->name); + wocky_node_set_attribute (identity_node, "name", identity->name); } /** @@ -2719,7 +2719,7 @@ connection_disco_cb (GabbleDisco *disco, GabbleDiscoRequest *request, const gchar *jid, const gchar *node, - LmMessageNode *result, + WockyNode *result, GError *disco_error, gpointer user_data) { @@ -2749,13 +2749,13 @@ connection_disco_cb (GabbleDisco *disco, for (i = node_iter (result); i; i = node_iter_next (i)) { - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); if (0 == strcmp (child->name, "identity")) { - const gchar *category = lm_message_node_get_attribute (child, + const gchar *category = wocky_node_get_attribute (child, "category"); - const gchar *type = lm_message_node_get_attribute (child, "type"); + const gchar *type = wocky_node_get_attribute (child, "type"); if (!tp_strdiff (category, "pubsub") && !tp_strdiff (type, "pep")) @@ -2766,7 +2766,7 @@ connection_disco_cb (GabbleDisco *disco, } else if (0 == strcmp (child->name, "feature")) { - const gchar *var = lm_message_node_get_attribute (child, "var"); + const gchar *var = wocky_node_get_attribute (child, "var"); if (var == NULL) continue; @@ -3551,7 +3551,7 @@ gabble_connection_send_presence (GabbleConnection *conn, wocky_stanza_get_top_node (message), conn); if (!CHECK_STR_EMPTY(status)) - lm_message_node_add_child ( + wocky_node_add_child_with_content ( wocky_stanza_get_top_node (message), "status", status); result = _gabble_connection_send (conn, message, error); diff --git a/src/debug.h b/src/debug.h index 028cc6078..f51ad8a55 100644 --- a/src/debug.h +++ b/src/debug.h @@ -83,7 +83,7 @@ G_END_DECLS # define NODE_DEBUG(n, s) \ G_STMT_START { \ - gchar *debug_tmp = lm_message_node_to_string (n); \ + gchar *debug_tmp = wocky_node_to_string (n); \ gabble_log (G_LOG_LEVEL_DEBUG, DEBUG_FLAG, "%s: %s:\n%s", G_STRFUNC, s, debug_tmp); \ g_free (debug_tmp); \ } G_STMT_END diff --git a/src/disco.c b/src/disco.c index ba29a0fb7..3cba045b7 100644 --- a/src/disco.c +++ b/src/disco.c @@ -391,7 +391,7 @@ request_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, GabbleDiscoRequest *request = (GabbleDiscoRequest *) user_data; GabbleDisco *disco = GABBLE_DISCO (object); GabbleDiscoPrivate *priv = disco->priv; - LmMessageNode *query_node; + WockyNode *query_node; GError *err = NULL; g_assert (request); @@ -490,7 +490,7 @@ gabble_disco_request_with_timeout (GabbleDisco *self, GabbleDiscoType type, GabbleDiscoPrivate *priv = self->priv; GabbleDiscoRequest *request; LmMessage *msg; - LmMessageNode *lm_node; + WockyNode *lm_node; request = g_slice_new0 (GabbleDiscoRequest); request->disco = self; @@ -511,14 +511,14 @@ gabble_disco_request_with_timeout (GabbleDisco *self, GabbleDiscoType type, priv->requests = g_list_prepend (priv->requests, request); msg = lm_message_new_with_sub_type (jid, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET); - lm_node = lm_message_node_add_child ( + lm_node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "query", NULL); - lm_message_node_set_attribute (lm_node, "xmlns", disco_type_to_xmlns (type)); + lm_node->ns = g_quark_from_string (disco_type_to_xmlns (type)); if (node) { - lm_message_node_set_attribute (lm_node, "node", node); + wocky_node_set_attribute (lm_node, "node", node); } if (! _gabble_connection_send_with_reply (priv->connection, msg, @@ -575,11 +575,11 @@ item_info_cb (GabbleDisco *disco, GabbleDiscoRequest *request, const gchar *jid, const gchar *node, - LmMessageNode *result, + WockyNode *result, GError *error, gpointer user_data) { - LmMessageNode *identity, *value_node; + WockyNode *identity, *value_node; const char *category, *type, *var, *name, *value; GHashTable *keys; GabbleDiscoItem item; @@ -595,19 +595,19 @@ item_info_cb (GabbleDisco *disco, goto done; } - identity = lm_message_node_get_child (result, "identity"); + identity = wocky_node_get_child (result, "identity"); if (NULL == identity) goto done; - name = lm_message_node_get_attribute (identity, "name"); + name = wocky_node_get_attribute (identity, "name"); if (NULL == name) goto done; - category = lm_message_node_get_attribute (identity, "category"); + category = wocky_node_get_attribute (identity, "category"); if (NULL == category) goto done; - type = lm_message_node_get_attribute (identity, "type"); + type = wocky_node_get_attribute (identity, "type"); if (NULL == type) goto done; @@ -618,11 +618,11 @@ item_info_cb (GabbleDisco *disco, for (i = node_iter (result); i; i = node_iter_next (i)) { - LmMessageNode *feature = node_iter_data (i); + WockyNode *feature = node_iter_data (i); if (0 == strcmp (feature->name, "feature")) { - var = lm_message_node_get_attribute (feature, "var"); + var = wocky_node_get_attribute (feature, "var"); if (var) g_hash_table_insert (keys, g_strdup (var), NULL); } @@ -634,20 +634,20 @@ item_info_cb (GabbleDisco *disco, for (j = node_iter (feature); j; j = node_iter_next (j)) { - LmMessageNode *field = node_iter_data (j); + WockyNode *field = node_iter_data (j); if (0 != strcmp (field->name, "field")) continue; - var = lm_message_node_get_attribute (field, "var"); + var = wocky_node_get_attribute (field, "var"); if (NULL == var) continue; - value_node = lm_message_node_get_child (field, "value"); + value_node = wocky_node_get_child (field, "value"); if (NULL == value_node) continue; - value = lm_message_node_get_value (value_node); + value = value_node->content; if (NULL == value) continue; @@ -725,7 +725,7 @@ disco_items_cb (GabbleDisco *disco, GabbleDiscoRequest *request, const gchar *jid, const gchar *node, - LmMessageNode *result, + WockyNode *result, GError *error, gpointer user_data) { @@ -744,12 +744,12 @@ disco_items_cb (GabbleDisco *disco, for (i = node_iter (result); i; i = node_iter_next (i)) { - LmMessageNode *item = node_iter_data (i); + WockyNode *item = node_iter_data (i); if (0 != strcmp (item->name, "item")) continue; - item_jid = lm_message_node_get_attribute (item, "jid"); + item_jid = wocky_node_get_attribute (item, "jid"); if (NULL != item_jid && !g_hash_table_lookup_extended (pipeline->remaining_items, item_jid, diff --git a/src/disco.h b/src/disco.h index cf937d19b..a5dd6f483 100644 --- a/src/disco.h +++ b/src/disco.h @@ -83,7 +83,7 @@ struct _GabbleDisco { }; typedef void (*GabbleDiscoCb)(GabbleDisco *self, GabbleDiscoRequest *request, - const gchar *jid, const gchar *node, LmMessageNode *query_result, + const gchar *jid, const gchar *node, WockyNode *query_result, GError* error, gpointer user_data); GabbleDisco *gabble_disco_new (GabbleConnection *); diff --git a/src/error.c b/src/error.c index 57774e7c9..e0c9cde9c 100644 --- a/src/error.c +++ b/src/error.c @@ -352,7 +352,7 @@ gabble_xmpp_error_quark (void) } GabbleXmppError -gabble_xmpp_error_from_node (LmMessageNode *error_node, +gabble_xmpp_error_from_node (WockyNode *error_node, GabbleXmppErrorType *type_out) { gint i, j; @@ -365,7 +365,7 @@ gabble_xmpp_error_from_node (LmMessageNode *error_node, { if (type_out != NULL) *type_out = gabble_xmpp_error_type_to_enum ( - lm_message_node_get_attribute (error_node, "type")); + wocky_node_get_attribute (error_node, "type")); /* we loop backwards because the most specific errors are the larger * numbers; the >= 0 test is OK because i is signed */ @@ -380,7 +380,7 @@ gabble_xmpp_error_from_node (LmMessageNode *error_node, } /* Ok, do it the legacy way */ - error_code_str = lm_message_node_get_attribute (error_node, "code"); + error_code_str = wocky_node_get_attribute (error_node, "code"); if (error_code_str) { gint error_code; @@ -431,13 +431,13 @@ gabble_xmpp_error_to_g_error (GabbleXmppError error) /* * See RFC 3920: 4.7 Stream Errors, 9.3 Stanza Errors. */ -LmMessageNode * +WockyNode * gabble_xmpp_error_to_node (GabbleXmppError error, - LmMessageNode *parent_node, + WockyNode *parent_node, const gchar *errmsg) { const XmppErrorSpec *spec, *extra; - LmMessageNode *error_node, *node; + WockyNode *error_node, *node; gchar str[6]; g_return_val_if_fail (error != XMPP_ERROR_UNDEFINED_CONDITION && @@ -454,27 +454,27 @@ gabble_xmpp_error_to_node (GabbleXmppError error, spec = &xmpp_errors[error]; } - error_node = lm_message_node_add_child (parent_node, "error", NULL); + error_node = wocky_node_add_child_with_content (parent_node, "error", NULL); sprintf (str, "%d", spec->legacy_errors[0]); - lm_message_node_set_attribute (error_node, "code", str); + wocky_node_set_attribute (error_node, "code", str); if (spec->type) { - lm_message_node_set_attribute (error_node, "type", spec->type); + wocky_node_set_attribute (error_node, "type", spec->type); } - node = lm_message_node_add_child (error_node, spec->name, NULL); - lm_message_node_set_attribute (node, "xmlns", NS_XMPP_STANZAS); + node = wocky_node_add_child_with_content (error_node, spec->name, NULL); + node->ns = g_quark_from_string (NS_XMPP_STANZAS); if (extra != NULL) { - node = lm_message_node_add_child (error_node, extra->name, NULL); - lm_message_node_set_attribute (node, "xmlns", extra->namespace); + node = wocky_node_add_child_with_content (error_node, extra->name, NULL); + node->ns = g_quark_from_string (extra->namespace); } if (NULL != errmsg) - lm_message_node_add_child (error_node, "text", errmsg); + wocky_node_add_child_with_content (error_node, "text", errmsg); return error_node; } @@ -504,7 +504,7 @@ gabble_message_get_xmpp_error (LmMessage *msg) if (lm_message_get_sub_type (msg) == LM_MESSAGE_SUB_TYPE_ERROR) { - LmMessageNode *error_node = lm_message_node_get_child ( + WockyNode *error_node = wocky_node_get_child ( wocky_stanza_get_top_node (msg), "error"); if (error_node != NULL) diff --git a/src/error.h b/src/error.h index 58c303d80..32d4dd302 100644 --- a/src/error.h +++ b/src/error.h @@ -86,10 +86,10 @@ typedef enum { GQuark gabble_xmpp_error_quark (void); #define GABBLE_XMPP_ERROR (gabble_xmpp_error_quark ()) -GabbleXmppError gabble_xmpp_error_from_node (LmMessageNode *error_node, +GabbleXmppError gabble_xmpp_error_from_node (WockyNode *error_node, GabbleXmppErrorType *type_out); -LmMessageNode *gabble_xmpp_error_to_node (GabbleXmppError error, - LmMessageNode *parent_node, const gchar *errmsg); +WockyNode *gabble_xmpp_error_to_node (GabbleXmppError error, + WockyNode *parent_node, const gchar *errmsg); const gchar *gabble_xmpp_error_string (GabbleXmppError error); const gchar *gabble_xmpp_error_description (GabbleXmppError error); GError *gabble_message_get_xmpp_error (LmMessage *msg); diff --git a/src/ft-channel.c b/src/ft-channel.c index 664da51d0..efca1cef2 100644 --- a/src/ft-channel.c +++ b/src/ft-channel.c @@ -1260,7 +1260,7 @@ bytestream_negotiate_cb (GabbleBytestreamIface *bytestream, gpointer user_data) { GabbleFileTransferChannel *self = GABBLE_FILE_TRANSFER_CHANNEL (user_data); - LmMessageNode *file; + WockyNode *file; if (bytestream == NULL) { @@ -1272,17 +1272,17 @@ bytestream_negotiate_cb (GabbleBytestreamIface *bytestream, return; } - file = lm_message_node_find_child (wocky_stanza_get_top_node (msg), "file"); + file = lm_message_node_get_child_with_namespace (wocky_stanza_get_top_node (msg), "file", NULL); if (file != NULL) { - LmMessageNode *range; + WockyNode *range; - range = lm_message_node_get_child_any_ns (file, "range"); + range = wocky_node_get_child_any_ns (file, "range"); if (range != NULL) { const gchar *offset_str; - offset_str = lm_message_node_get_attribute (range, "offset"); + offset_str = wocky_node_get_attribute (range, "offset"); if (offset_str != NULL) { self->priv->initial_offset = g_ascii_strtoull (offset_str, NULL, @@ -1304,7 +1304,7 @@ offer_bytestream (GabbleFileTransferChannel *self, const gchar *jid, { gboolean result; LmMessage *msg; - LmMessageNode *si_node, *file_node; + WockyNode *si_node, *file_node; gchar *stream_id, *size_str, *full_jid; if (resource) @@ -1330,16 +1330,16 @@ offer_bytestream (GabbleFileTransferChannel *self, const gchar *jid, size_str = g_strdup_printf ("%" G_GUINT64_FORMAT, self->priv->size); - file_node = lm_message_node_add_child (si_node, "file", NULL); - lm_message_node_set_attributes (file_node, - "xmlns", NS_FILE_TRANSFER, + file_node = wocky_node_add_child_with_content (si_node, "file", NULL); + file_node->ns = g_quark_from_string (NS_FILE_TRANSFER); + wocky_node_set_attributes (file_node, "name", self->priv->filename, "size", size_str, "mime-type", self->priv->content_type, NULL); if (self->priv->content_hash != NULL) - lm_message_node_set_attribute (file_node, "hash", self->priv->content_hash); + wocky_node_set_attribute (file_node, "hash", self->priv->content_hash); if (self->priv->date != 0) { @@ -1352,13 +1352,13 @@ offer_bytestream (GabbleFileTransferChannel *self, const gchar *jid, strftime (date_str, sizeof (date_str), "%FT%H:%M:%SZ", tm); - lm_message_node_set_attribute (file_node, "date", date_str); + wocky_node_set_attribute (file_node, "date", date_str); } - lm_message_node_add_child (file_node, "desc", self->priv->description); + wocky_node_add_child_with_content (file_node, "desc", self->priv->description); /* we support resume */ - lm_message_node_add_child (file_node, "range", NULL); + wocky_node_add_child_with_content (file_node, "range", NULL); result = gabble_bytestream_factory_negotiate_stream ( self->priv->connection->bytestream_factory, msg, stream_id, @@ -1697,24 +1697,24 @@ bytestream_data_received_cb (GabbleBytestreamIface *stream, } static void -augment_si_reply (LmMessageNode *si, +augment_si_reply (WockyNode *si, gpointer user_data) { GabbleFileTransferChannel *self = GABBLE_FILE_TRANSFER_CHANNEL (user_data); - LmMessageNode *file; + WockyNode *file; - file = lm_message_node_add_child (si, "file", NULL); - lm_message_node_set_attribute (file, "xmlns", NS_FILE_TRANSFER); + file = wocky_node_add_child_with_content (si, "file", NULL); + file->ns = g_quark_from_string (NS_FILE_TRANSFER); if (self->priv->initial_offset != 0) { - LmMessageNode *range; + WockyNode *range; gchar *offset_str; - range = lm_message_node_add_child (file, "range", NULL); + range = wocky_node_add_child_with_content (file, "range", NULL); offset_str = g_strdup_printf ("%" G_GUINT64_FORMAT, self->priv->initial_offset); - lm_message_node_set_attribute (range, "offset", offset_str); + wocky_node_set_attribute (range, "offset", offset_str); /* Don't set "length" attribute as the default is the length of the file * from offset to the end which is what we want when resuming a FT. */ diff --git a/src/ft-manager.c b/src/ft-manager.c index 9c3128df8..360b14f87 100644 --- a/src/ft-manager.c +++ b/src/ft-manager.c @@ -631,9 +631,9 @@ gabble_ft_manager_type_foreach_channel_class (GType type, g_hash_table_destroy (table); } -static LmMessageNode * +static WockyNode * hyvaa_vappua ( - LmMessageNode *si_node, + WockyNode *si_node, const gchar **filename, const gchar **size_str, GError **error) @@ -645,13 +645,13 @@ hyvaa_vappua ( return NULL; \ } - LmMessageNode *file_node = lm_message_node_get_child_with_namespace (si_node, + WockyNode *file_node = lm_message_node_get_child_with_namespace (si_node, "file", NS_FILE_TRANSFER); die_if_null (file_node, "Invalid file transfer SI request: no <file>") - die_if_null (*filename = lm_message_node_get_attribute (file_node, "name"), + die_if_null (*filename = wocky_node_get_attribute (file_node, "name"), "Invalid file transfer SI request: missing file name") - die_if_null (*size_str = lm_message_node_get_attribute (file_node, "size"), + die_if_null (*size_str = wocky_node_get_attribute (file_node, "size"), "Invalid file transfer SI request: missing file size") return file_node; @@ -664,7 +664,7 @@ void gabble_ft_manager_handle_si_request (GabbleFtManager *self, const gchar *stream_id, LmMessage *msg) { - LmMessageNode *si_node, *file_node, *desc_node; + WockyNode *si_node, *file_node, *desc_node; const gchar *filename, *size_str, *content_type, *content_hash, *description; const gchar *date_str; guint64 size; @@ -690,24 +690,24 @@ void gabble_ft_manager_handle_si_request (GabbleFtManager *self, size = g_ascii_strtoull (size_str, NULL, 0); - content_type = lm_message_node_get_attribute (file_node, "mime-type"); + content_type = wocky_node_get_attribute (file_node, "mime-type"); if (content_type == NULL) content_type = "application/octet-stream"; /* The hash is always an MD5-sum, if present. */ - content_hash = lm_message_node_get_attribute (file_node, "hash"); + content_hash = wocky_node_get_attribute (file_node, "hash"); if (content_hash != NULL) content_hash_type = TP_FILE_HASH_TYPE_MD5; else content_hash_type = TP_FILE_HASH_TYPE_NONE; - desc_node = lm_message_node_get_child (file_node, "desc"); + desc_node = wocky_node_get_child (file_node, "desc"); if (desc_node != NULL) - description = lm_message_node_get_value (desc_node); + description = desc_node->content; else description = NULL; - date_str = lm_message_node_get_attribute (file_node, "date"); + date_str = wocky_node_get_attribute (file_node, "date"); if (date_str != NULL) { GTimeVal val; @@ -717,7 +717,7 @@ void gabble_ft_manager_handle_si_request (GabbleFtManager *self, date = val.tv_sec; } - resume_supported = (lm_message_node_get_child (file_node, "range") != NULL); + resume_supported = (wocky_node_get_child (file_node, "range") != NULL); chan = gabble_file_transfer_channel_new (self->priv->connection, handle, handle, TP_FILE_TRANSFER_STATE_PENDING, diff --git a/src/jingle-content.c b/src/jingle-content.c index 25167d32f..a2913ca8d 100644 --- a/src/jingle-content.c +++ b/src/jingle-content.c @@ -468,10 +468,10 @@ transport_created (GabbleJingleContent *c) static void -parse_description (GabbleJingleContent *c, LmMessageNode *desc_node, +parse_description (GabbleJingleContent *c, WockyNode *desc_node, GError **error) { - void (*virtual_method)(GabbleJingleContent *, LmMessageNode *, + void (*virtual_method)(GabbleJingleContent *, WockyNode *, GError **) = GABBLE_JINGLE_CONTENT_GET_CLASS (c)->parse_description; g_assert (virtual_method != NULL); @@ -483,13 +483,13 @@ send_gtalk4_transport_accept (gpointer user_data) { GabbleJingleContent *c = GABBLE_JINGLE_CONTENT (user_data); GabbleJingleContentPrivate *priv = c->priv; - LmMessageNode *sess_node, *tnode; + WockyNode *sess_node, *tnode; LmMessage *msg = gabble_jingle_session_new_message (c->session, JINGLE_ACTION_TRANSPORT_ACCEPT, &sess_node); DEBUG ("Sending Gtalk4 'transport-accept' message to peer"); - tnode = lm_message_node_add_child (sess_node, "transport", NULL); - lm_message_node_set_attribute (tnode, "xmlns", priv->transport_ns); + tnode = wocky_node_add_child_with_content (sess_node, "transport", NULL); + tnode->ns = g_quark_from_string (priv->transport_ns); gabble_jingle_session_send (c->session, msg, NULL, NULL); @@ -498,20 +498,20 @@ send_gtalk4_transport_accept (gpointer user_data) void gabble_jingle_content_parse_add (GabbleJingleContent *c, - LmMessageNode *content_node, gboolean google_mode, GError **error) + WockyNode *content_node, gboolean google_mode, GError **error) { GabbleJingleContentPrivate *priv = c->priv; const gchar *name, *creator, *senders, *disposition; - LmMessageNode *trans_node, *desc_node; + WockyNode *trans_node, *desc_node; GType transport_type = 0; GabbleJingleTransportIface *trans = NULL; JingleDialect dialect = gabble_jingle_session_get_dialect (c->session); - desc_node = lm_message_node_get_child_any_ns (content_node, "description"); - trans_node = lm_message_node_get_child_any_ns (content_node, "transport"); - creator = lm_message_node_get_attribute (content_node, "creator"); - name = lm_message_node_get_attribute (content_node, "name"); - senders = lm_message_node_get_attribute (content_node, "senders"); + desc_node = wocky_node_get_child_any_ns (content_node, "description"); + trans_node = wocky_node_get_child_any_ns (content_node, "transport"); + creator = wocky_node_get_attribute (content_node, "creator"); + name = wocky_node_get_attribute (content_node, "name"); + senders = wocky_node_get_attribute (content_node, "senders"); g_assert (priv->transport_ns == NULL); @@ -593,7 +593,7 @@ gabble_jingle_content_parse_add (GabbleJingleContent *c, if (*error != NULL) return; - disposition = lm_message_node_get_attribute (content_node, "disposition"); + disposition = wocky_node_get_attribute (content_node, "disposition"); if (disposition == NULL) disposition = "session"; @@ -673,7 +673,7 @@ gabble_jingle_content_create_share_channel (GabbleJingleContent *self, const gchar *name) { GabbleJingleContentPrivate *priv = self->priv; - LmMessageNode *sess_node, *channel_node; + WockyNode *sess_node, *channel_node; LmMessage *msg = NULL; /* Send the info action before creating the channel, in case candidates need @@ -683,9 +683,9 @@ gabble_jingle_content_create_share_channel (GabbleJingleContent *self, JINGLE_ACTION_INFO, &sess_node); DEBUG ("Sending 'info' message to peer : channel %s", name); - channel_node = lm_message_node_add_child (sess_node, "channel", NULL); - lm_message_node_set_attribute (channel_node, "xmlns", priv->content_ns); - lm_message_node_set_attribute (channel_node, "name", name); + channel_node = wocky_node_add_child_with_content (sess_node, "channel", NULL); + channel_node->ns = g_quark_from_string (priv->content_ns); + wocky_node_set_attribute (channel_node, "name", name); gabble_jingle_session_send (self->session, msg, NULL, NULL); @@ -696,15 +696,15 @@ void gabble_jingle_content_send_complete (GabbleJingleContent *self) { GabbleJingleContentPrivate *priv = self->priv; - LmMessageNode *sess_node, *complete_node; + WockyNode *sess_node, *complete_node; LmMessage *msg = NULL; msg = gabble_jingle_session_new_message (self->session, JINGLE_ACTION_INFO, &sess_node); DEBUG ("Sending 'info' message to peer : complete"); - complete_node = lm_message_node_add_child (sess_node, "complete", NULL); - lm_message_node_set_attribute (complete_node, "xmlns", priv->content_ns); + complete_node = wocky_node_add_child_with_content (sess_node, "complete", NULL); + complete_node->ns = g_quark_from_string (priv->content_ns); gabble_jingle_session_send (self->session, msg, NULL, NULL); @@ -712,19 +712,19 @@ gabble_jingle_content_send_complete (GabbleJingleContent *self) void gabble_jingle_content_parse_info (GabbleJingleContent *c, - LmMessageNode *content_node, GError **error) + WockyNode *content_node, GError **error) { - LmMessageNode *channel_node; - LmMessageNode *complete_node; + WockyNode *channel_node; + WockyNode *complete_node; - channel_node = lm_message_node_get_child_any_ns (content_node, "channel"); - complete_node = lm_message_node_get_child_any_ns (content_node, "complete"); + channel_node = wocky_node_get_child_any_ns (content_node, "channel"); + complete_node = wocky_node_get_child_any_ns (content_node, "complete"); DEBUG ("parsing info message : %p - %p", channel_node, complete_node); if (channel_node) { const gchar *name; - name = lm_message_node_get_attribute (channel_node, "name"); + name = wocky_node_get_attribute (channel_node, "name"); if (name != NULL) new_share_channel (c, name); } @@ -737,17 +737,17 @@ gabble_jingle_content_parse_info (GabbleJingleContent *c, void gabble_jingle_content_parse_accept (GabbleJingleContent *c, - LmMessageNode *content_node, gboolean google_mode, GError **error) + WockyNode *content_node, gboolean google_mode, GError **error) { GabbleJingleContentPrivate *priv = c->priv; const gchar *senders; - LmMessageNode *trans_node, *desc_node; + WockyNode *trans_node, *desc_node; JingleDialect dialect = gabble_jingle_session_get_dialect (c->session); JingleContentSenders newsenders; - desc_node = lm_message_node_get_child_any_ns (content_node, "description"); - trans_node = lm_message_node_get_child_any_ns (content_node, "transport"); - senders = lm_message_node_get_attribute (content_node, "senders"); + desc_node = wocky_node_get_child_any_ns (content_node, "description"); + trans_node = wocky_node_get_child_any_ns (content_node, "transport"); + senders = wocky_node_get_attribute (content_node, "senders"); if (GABBLE_IS_JINGLE_MEDIA_RTP (c) && JINGLE_IS_GOOGLE_DIALECT (dialect) && trans_node == NULL) @@ -792,11 +792,11 @@ gabble_jingle_content_parse_accept (GabbleJingleContent *c, void gabble_jingle_content_parse_description_info (GabbleJingleContent *c, - LmMessageNode *content_node, GError **error) + WockyNode *content_node, GError **error) { GabbleJingleContentPrivate *priv = c->priv; - LmMessageNode *desc_node; - desc_node = lm_message_node_get_child_any_ns (content_node, "description"); + WockyNode *desc_node; + desc_node = wocky_node_get_child_any_ns (content_node, "description"); if (desc_node == NULL) { SET_BAD_REQ ("invalid description-info action"); @@ -818,15 +818,15 @@ gabble_jingle_content_parse_description_info (GabbleJingleContent *c, void gabble_jingle_content_produce_node (GabbleJingleContent *c, - LmMessageNode *parent, + WockyNode *parent, gboolean include_description, gboolean include_transport, - LmMessageNode **trans_node_out) + WockyNode **trans_node_out) { GabbleJingleContentPrivate *priv = c->priv; - LmMessageNode *content_node, *trans_node; + WockyNode *content_node, *trans_node; JingleDialect dialect = gabble_jingle_session_get_dialect (c->session); - void (*produce_desc)(GabbleJingleContent *, LmMessageNode *) = + void (*produce_desc)(GabbleJingleContent *, WockyNode *) = GABBLE_JINGLE_CONTENT_GET_CLASS (c)->produce_description; if ((dialect == JINGLE_DIALECT_GTALK3) || @@ -836,16 +836,16 @@ gabble_jingle_content_produce_node (GabbleJingleContent *c, } else { - content_node = lm_message_node_add_child (parent, "content", NULL); - lm_message_node_set_attributes (content_node, + content_node = wocky_node_add_child_with_content (parent, "content", NULL); + wocky_node_set_attributes (content_node, "name", priv->name, "senders", produce_senders (priv->senders), NULL); if (gabble_jingle_content_creator_is_initiator (c)) - lm_message_node_set_attribute (content_node, "creator", "initiator"); + wocky_node_set_attribute (content_node, "creator", "initiator"); else - lm_message_node_set_attribute (content_node, "creator", "responder"); + wocky_node_set_attribute (content_node, "creator", "responder"); } if (include_description) @@ -860,8 +860,8 @@ gabble_jingle_content_produce_node (GabbleJingleContent *c, } else { - trans_node = lm_message_node_add_child (content_node, "transport", NULL); - lm_message_node_set_attribute (trans_node, "xmlns", priv->transport_ns); + trans_node = wocky_node_add_child_with_content (content_node, "transport", NULL); + trans_node->ns = g_quark_from_string (priv->transport_ns); } if (trans_node_out != NULL) @@ -871,12 +871,12 @@ gabble_jingle_content_produce_node (GabbleJingleContent *c, void gabble_jingle_content_update_senders (GabbleJingleContent *c, - LmMessageNode *content_node, GError **error) + WockyNode *content_node, GError **error) { GabbleJingleContentPrivate *priv = c->priv; JingleContentSenders senders; - senders = parse_senders (lm_message_node_get_attribute (content_node, "senders")); + senders = parse_senders (wocky_node_get_attribute (content_node, "senders")); if (senders == JINGLE_CONTENT_SENDERS_NONE) { @@ -890,7 +890,7 @@ gabble_jingle_content_update_senders (GabbleJingleContent *c, void gabble_jingle_content_parse_transport_info (GabbleJingleContent *self, - LmMessageNode *trans_node, GError **error) + WockyNode *trans_node, GError **error) { GabbleJingleContentPrivate *priv = self->priv; @@ -958,7 +958,7 @@ send_content_add_or_accept (GabbleJingleContent *self) { GabbleJingleContentPrivate *priv = self->priv; LmMessage *msg; - LmMessageNode *sess_node, *transport_node; + WockyNode *sess_node, *transport_node; JingleAction action; JingleContentState new_state = JINGLE_CONTENT_STATE_EMPTY; @@ -1045,7 +1045,7 @@ gabble_jingle_content_maybe_send_description (GabbleJingleContent *self) if (gabble_jingle_session_defines_action (self->session, JINGLE_ACTION_DESCRIPTION_INFO)) { - LmMessageNode *sess_node; + WockyNode *sess_node; LmMessage *msg = gabble_jingle_session_new_message (self->session, JINGLE_ACTION_DESCRIPTION_INFO, &sess_node); @@ -1071,7 +1071,7 @@ gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self, void gabble_jingle_content_inject_candidates (GabbleJingleContent *self, - LmMessageNode *transport_node) + WockyNode *transport_node) { gabble_jingle_transport_iface_inject_candidates (self->priv->transport, transport_node); @@ -1125,7 +1125,7 @@ gabble_jingle_content_change_direction (GabbleJingleContent *c, { GabbleJingleContentPrivate *priv = c->priv; LmMessage *msg; - LmMessageNode *sess_node; + WockyNode *sess_node; JingleDialect dialect = gabble_jingle_session_get_dialect (c->session); if (senders == priv->senders) @@ -1177,7 +1177,7 @@ _content_remove (GabbleJingleContent *c, { GabbleJingleContentPrivate *priv = c->priv; LmMessage *msg; - LmMessageNode *sess_node; + WockyNode *sess_node; DEBUG ("called for %p (%s)", c, priv->name); @@ -1202,9 +1202,9 @@ _content_remove (GabbleJingleContent *c, if (reason != JINGLE_REASON_UNKNOWN) { - LmMessageNode *reason_node = lm_message_node_add_child (sess_node, + WockyNode *reason_node = wocky_node_add_child_with_content (sess_node, "reason", NULL); - lm_message_node_add_child (reason_node, + wocky_node_add_child_with_content (reason_node, gabble_jingle_session_get_reason_name (reason), NULL); } diff --git a/src/jingle-content.h b/src/jingle-content.h index 809de89fc..b5d991e09 100644 --- a/src/jingle-content.h +++ b/src/jingle-content.h @@ -82,9 +82,9 @@ GType gabble_jingle_content_get_type (void); struct _GabbleJingleContentClass { GObjectClass parent_class; - void (*parse_description) (GabbleJingleContent *, LmMessageNode *, + void (*parse_description) (GabbleJingleContent *, WockyNode *, GError **); - void (*produce_description) (GabbleJingleContent *, LmMessageNode *); + void (*produce_description) (GabbleJingleContent *, WockyNode *); void (*transport_created) (GabbleJingleContent *, GabbleJingleTransportIface *); JingleContentSenders (*get_default_senders) (GabbleJingleContent *); @@ -101,23 +101,23 @@ struct _GabbleJingleContent { }; void gabble_jingle_content_parse_add (GabbleJingleContent *c, - LmMessageNode *content_node, gboolean google_mode, GError **error); + WockyNode *content_node, gboolean google_mode, GError **error); void gabble_jingle_content_update_senders (GabbleJingleContent *c, - LmMessageNode *content_node, GError **error); + WockyNode *content_node, GError **error); void gabble_jingle_content_produce_node (GabbleJingleContent *c, - LmMessageNode *parent, + WockyNode *parent, gboolean include_description, gboolean include_transport, - LmMessageNode **trans_node_out); + WockyNode **trans_node_out); void gabble_jingle_content_parse_accept (GabbleJingleContent *c, - LmMessageNode *content_node, gboolean google_mode, GError **error); + WockyNode *content_node, gboolean google_mode, GError **error); void gabble_jingle_content_parse_info (GabbleJingleContent *c, - LmMessageNode *content_node, GError **error); + WockyNode *content_node, GError **error); void gabble_jingle_content_parse_transport_info (GabbleJingleContent *self, - LmMessageNode *trans_node, GError **error); + WockyNode *trans_node, GError **error); void gabble_jingle_content_parse_description_info (GabbleJingleContent *self, - LmMessageNode *trans_node, GError **error); + WockyNode *trans_node, GError **error); guint gabble_jingle_content_create_share_channel (GabbleJingleContent *self, const gchar *name); void gabble_jingle_content_add_candidates (GabbleJingleContent *self, GList *li); @@ -136,7 +136,7 @@ gboolean gabble_jingle_content_change_direction (GabbleJingleContent *c, void gabble_jingle_content_retransmit_candidates (GabbleJingleContent *self, gboolean all); void gabble_jingle_content_inject_candidates (GabbleJingleContent *self, - LmMessageNode *transport_node); + WockyNode *transport_node); gboolean gabble_jingle_content_is_created_by_us (GabbleJingleContent *c); gboolean gabble_jingle_content_creator_is_initiator (GabbleJingleContent *c); diff --git a/src/jingle-factory.c b/src/jingle-factory.c index 07d954270..f41dc1202 100644 --- a/src/jingle-factory.c +++ b/src/jingle-factory.c @@ -258,7 +258,7 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, { GabbleJingleFactoryPrivate *priv = fac->priv; LmMessageSubType sub_type; - LmMessageNode *query_node, *node; + WockyNode *query_node, *node; const gchar *from = wocky_stanza_get_from (message); if (from != NULL) @@ -288,7 +288,7 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, { GabbleXmppError xmpp_error = XMPP_ERROR_UNDEFINED_CONDITION; - node = lm_message_node_get_child (wocky_stanza_get_top_node (message), + node = wocky_node_get_child (wocky_stanza_get_top_node (message), "error"); if (node != NULL) { @@ -309,13 +309,13 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, } if (fac->priv->get_stun_from_jingle) - node = lm_message_node_get_child (query_node, "stun"); + node = wocky_node_get_child (query_node, "stun"); else node = NULL; if (node != NULL) { - node = lm_message_node_get_child (node, "server"); + node = wocky_node_get_child (node, "server"); if (node != NULL) { @@ -323,8 +323,8 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, const gchar *port_attr; guint port = GABBLE_PARAMS_DEFAULT_STUN_PORT; - server = lm_message_node_get_attribute (node, "host"); - port_attr = lm_message_node_get_attribute (node, "udp"); + server = wocky_node_get_attribute (node, "host"); + port_attr = wocky_node_get_attribute (node, "udp"); if (port_attr != NULL) port = atoi (port_attr); @@ -338,19 +338,19 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, } } - node = lm_message_node_get_child (query_node, "relay"); + node = wocky_node_get_child (query_node, "relay"); if (node != NULL) { - LmMessageNode *subnode; + WockyNode *subnode; - subnode = lm_message_node_get_child (node, "token"); + subnode = wocky_node_get_child (node, "token"); if (subnode != NULL) { const gchar *token; - token = lm_message_node_get_value (subnode); + token = subnode->content; if (token != NULL) { DEBUG ("jingle info: got Google relay token %s", token); @@ -359,14 +359,14 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, } } - subnode = lm_message_node_get_child (node, "server"); + subnode = wocky_node_get_child (node, "server"); if (subnode != NULL) { const gchar *server; const gchar *port; - server = lm_message_node_get_attribute (subnode, "host"); + server = wocky_node_get_attribute (subnode, "host"); if (server != NULL) { @@ -379,7 +379,7 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, { /* this is not part of the real protocol, but we can't listen on * port 80 in an unprivileged regression test */ - port = lm_message_node_get_attribute (subnode, + port = wocky_node_get_attribute (subnode, "gabble-test-http-port"); if (port != NULL) @@ -393,7 +393,7 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, /* FIXME: these are not really actually used anywhere at * the moment, because we get the same info when creating * relay session. */ - port = lm_message_node_get_attribute (subnode, "udp"); + port = wocky_node_get_attribute (subnode, "udp"); if (port != NULL) { @@ -401,7 +401,7 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, fac->priv->relay_udp = atoi (port); } - port = lm_message_node_get_attribute (subnode, "tcp"); + port = wocky_node_get_attribute (subnode, "tcp"); if (port != NULL) { @@ -409,7 +409,7 @@ got_jingle_info_stanza (GabbleJingleFactory *fac, fac->priv->relay_tcp = atoi (port); } - port = lm_message_node_get_attribute (subnode, "tcpssl"); + port = wocky_node_get_attribute (subnode, "tcpssl"); if (port != NULL) { @@ -464,7 +464,7 @@ jingle_info_send_request (GabbleJingleFactory *fac) GabbleJingleFactoryPrivate *priv = fac->priv; TpBaseConnection *base = (TpBaseConnection *) priv->conn; LmMessage *msg; - LmMessageNode *node; + WockyNode *node; const gchar *jid; GError *error = NULL; TpHandleRepoIface *contact_handles = tp_base_connection_get_handles (base, @@ -474,9 +474,9 @@ jingle_info_send_request (GabbleJingleFactory *fac) msg = lm_message_new_with_sub_type (jid, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET); - node = lm_message_node_add_child ( + node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "query", NULL); - lm_message_node_set_attribute (node, "xmlns", NS_GOOGLE_JINGLE_INFO); + node->ns = g_quark_from_string (NS_GOOGLE_JINGLE_INFO); if (!_gabble_connection_send_with_reply (priv->conn, msg, jingle_info_reply_cb, G_OBJECT (fac), fac, &error)) @@ -803,7 +803,7 @@ jingle_cb (LmMessageHandler *handler, /* see if it's a jingle message and detect dialect */ sid = gabble_jingle_session_detect (msg, &action, &dialect); - from = lm_message_node_get_attribute (lm_message_get_node (msg), "from"); + from = wocky_node_get_attribute (lm_message_get_node (msg), "from"); if (sid == NULL || from == NULL) return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; diff --git a/src/jingle-media-rtp.c b/src/jingle-media-rtp.c index 652919df5..a0e23e0de 100644 --- a/src/jingle-media-rtp.c +++ b/src/jingle-media-rtp.c @@ -281,9 +281,9 @@ gabble_jingle_media_rtp_set_property (GObject *object, } static void parse_description (GabbleJingleContent *content, - LmMessageNode *desc_node, GError **error); + WockyNode *desc_node, GError **error); static void produce_description (GabbleJingleContent *obj, - LmMessageNode *content_node); + WockyNode *content_node); static void transport_created (GabbleJingleContent *obj, GabbleJingleTransportIface *transport); @@ -352,12 +352,12 @@ static void transport_created (GabbleJingleContent *content, static JingleMediaType -extract_media_type (LmMessageNode *desc_node, +extract_media_type (WockyNode *desc_node, GError **error) { if (lm_message_node_has_namespace (desc_node, NS_JINGLE_RTP, NULL)) { - const gchar *type = lm_message_node_get_attribute (desc_node, "media"); + const gchar *type = wocky_node_get_attribute (desc_node, "media"); if (type == NULL) { @@ -411,21 +411,20 @@ content_has_cap (GabbleJingleContent *content, const gchar *cap) } static JingleFeedbackMessage * -parse_rtcp_fb (GabbleJingleContent *content, LmMessageNode *node) +parse_rtcp_fb (GabbleJingleContent *content, WockyNode *node) { - const gchar *pt_ns = - lm_message_node_get_namespace (node); + const gchar *pt_ns = wocky_node_get_ns (node); const gchar *type; const gchar *subtype; if (tp_strdiff (pt_ns, NS_JINGLE_RTCP_FB)) return NULL; - type = lm_message_node_get_attribute (node, "type"); + type = wocky_node_get_attribute (node, "type"); if (type == NULL) return NULL; - subtype = lm_message_node_get_attribute (node, "subtype"); + subtype = wocky_node_get_attribute (node, "subtype"); /* This is optional, defaults to "" */ if (subtype == NULL) @@ -439,10 +438,9 @@ parse_rtcp_fb (GabbleJingleContent *content, LmMessageNode *node) * Returns G_MAXUINT on error */ static guint -parse_rtcp_fb_trr_int (GabbleJingleContent *content, LmMessageNode *node) +parse_rtcp_fb_trr_int (GabbleJingleContent *content, WockyNode *node) { - const gchar *pt_ns = - lm_message_node_get_namespace (node); + const gchar *pt_ns = wocky_node_get_ns (node); const gchar *txt; guint trr_int; gchar *endptr = NULL; @@ -450,7 +448,7 @@ parse_rtcp_fb_trr_int (GabbleJingleContent *content, LmMessageNode *node) if (tp_strdiff (pt_ns, NS_JINGLE_RTCP_FB)) return G_MAXUINT; - txt = lm_message_node_get_attribute (node, "value"); + txt = wocky_node_get_attribute (node, "value"); if (txt == NULL) return G_MAXUINT; @@ -470,7 +468,8 @@ parse_rtcp_fb_trr_int (GabbleJingleContent *content, LmMessageNode *node) * otherwise. */ static JingleCodec * -parse_payload_type (GabbleJingleContent *content, LmMessageNode *node) +parse_payload_type (GabbleJingleContent *content, + WockyNode *node) { GabbleJingleMediaRtp *self = GABBLE_JINGLE_MEDIA_RTP (content); GabbleJingleMediaRtpPrivate *priv = self->priv; @@ -482,26 +481,26 @@ parse_payload_type (GabbleJingleContent *content, LmMessageNode *node) guint channels = 0; NodeIter i; - txt = lm_message_node_get_attribute (node, "id"); + txt = wocky_node_get_attribute (node, "id"); if (txt == NULL) return NULL; id = atoi (txt); - name = lm_message_node_get_attribute (node, "name"); + name = wocky_node_get_attribute (node, "name"); if (name == NULL) name = ""; /* xep-0167 v0.22, gtalk libjingle 0.3/0.4 use "clockrate" */ - txt = lm_message_node_get_attribute (node, "clockrate"); + txt = wocky_node_get_attribute (node, "clockrate"); /* older jingle rtp used "rate" ? */ if (txt == NULL) - txt = lm_message_node_get_attribute (node, "rate"); + txt = wocky_node_get_attribute (node, "rate"); if (txt != NULL) clockrate = atoi (txt); - txt = lm_message_node_get_attribute (node, "channels"); + txt = wocky_node_get_attribute (node, "channels"); if (txt != NULL) channels = atoi (txt); @@ -509,14 +508,14 @@ parse_payload_type (GabbleJingleContent *content, LmMessageNode *node) for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *param = node_iter_data (i); + WockyNode *param = node_iter_data (i); if (!tp_strdiff (lm_message_node_get_name (param), "parameter")) { const gchar *param_name, *param_value; - param_name = lm_message_node_get_attribute (param, "name"); - param_value = lm_message_node_get_attribute (param, "value"); + param_name = wocky_node_get_attribute (param, "name"); + param_value = wocky_node_get_attribute (param, "value"); if (param_name == NULL || param_value == NULL) continue; @@ -554,14 +553,14 @@ parse_payload_type (GabbleJingleContent *content, LmMessageNode *node) } static JingleRtpHeaderExtension * -parse_rtp_header_extension (LmMessageNode *node) +parse_rtp_header_extension (WockyNode *node) { guint id; JingleContentSenders senders; const gchar *uri; const char *txt; - txt = lm_message_node_get_attribute (node, "id"); + txt = wocky_node_get_attribute (node, "id"); if (txt == NULL) return NULL; @@ -571,7 +570,7 @@ parse_rtp_header_extension (LmMessageNode *node) if ((id < 1 || id > 256) && (id < 4096 || id > 4351)) return NULL; - txt = lm_message_node_get_attribute (node, "senders"); + txt = wocky_node_get_attribute (node, "senders"); if (txt == NULL || !g_ascii_strcasecmp (txt, "both")) senders = JINGLE_CONTENT_SENDERS_BOTH; @@ -582,7 +581,7 @@ parse_rtp_header_extension (LmMessageNode *node) else return NULL; - uri = lm_message_node_get_attribute (node, "uri"); + uri = wocky_node_get_attribute (node, "uri"); if (uri == NULL) return NULL; @@ -713,7 +712,7 @@ out: static void parse_description (GabbleJingleContent *content, - LmMessageNode *desc_node, GError **error) + WockyNode *desc_node, GError **error) { GabbleJingleMediaRtp *self = GABBLE_JINGLE_MEDIA_RTP (content); GabbleJingleMediaRtpPrivate *priv = self->priv; @@ -749,7 +748,7 @@ parse_description (GabbleJingleContent *content, for (i = node_iter (desc_node); i && !description_error; i = node_iter_next (i)) { - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); if (!tp_strdiff (lm_message_node_get_name (node), "payload-type")) { @@ -895,65 +894,64 @@ gtalk_case (const gchar *codec) static void _produce_extra_param (gpointer key, gpointer value, gpointer user_data) { - LmMessageNode *pt_node = user_data; - LmMessageNode *param; + WockyNode *pt_node = user_data; + WockyNode *param; gchar *param_name = key; gchar *param_value = value; - param = lm_message_node_add_child (pt_node, "parameter", NULL); - lm_message_node_set_attribute (param, "name", param_name); - lm_message_node_set_attribute (param, "value", param_value); + param = wocky_node_add_child_with_content (pt_node, "parameter", NULL); + wocky_node_set_attribute (param, "name", param_name); + wocky_node_set_attribute (param, "value", param_value); } static void -produce_rtcp_fb_trr_int (LmMessageNode *node, +produce_rtcp_fb_trr_int (WockyNode *node, guint trr_int) { - LmMessageNode *trr_int_node; + WockyNode *trr_int_node; gchar tmp[10]; if (trr_int == G_MAXUINT || trr_int == 0) return; - trr_int_node = lm_message_node_add_child (node, "rtcp-fb-trr-int", NULL); - - lm_message_node_set_attribute (trr_int_node, "xmlns", NS_JINGLE_RTCP_FB); + trr_int_node = wocky_node_add_child_ns (node, "rtcp-fb-trr-int", + NS_JINGLE_RTCP_FB); snprintf (tmp, 9, "%d", trr_int); - lm_message_node_set_attribute (trr_int_node, "value", tmp); + wocky_node_set_attribute (trr_int_node, "value", tmp); } static void -produce_rtcp_fb (JingleFeedbackMessage *fb, LmMessageNode *node) +produce_rtcp_fb (JingleFeedbackMessage *fb, WockyNode *node) { - LmMessageNode *fb_node; + WockyNode *fb_node; - fb_node = lm_message_node_add_child (node, "rtcp-fb", NULL); + fb_node = wocky_node_add_child (node, "rtcp-fb"); - lm_message_node_set_attribute (fb_node, "xmlns", NS_JINGLE_RTCP_FB); - lm_message_node_set_attribute (fb_node, "type", fb->type); + wocky_node_set_attribute (fb_node, "xmlns", NS_JINGLE_RTCP_FB); + wocky_node_set_attribute (fb_node, "type", fb->type); if (fb->subtype != NULL && fb->subtype[0] != 0) - lm_message_node_set_attribute (fb_node, "subtype", fb->subtype); + wocky_node_set_attribute (fb_node, "subtype", fb->subtype); } static void produce_payload_type (GabbleJingleContent *content, - LmMessageNode *desc_node, + WockyNode *desc_node, JingleMediaType type, JingleCodec *p, JingleDialect dialect) { GabbleJingleMediaRtp *self = GABBLE_JINGLE_MEDIA_RTP (content); GabbleJingleMediaRtpPrivate *priv = self->priv; - LmMessageNode *pt_node; + WockyNode *pt_node; gchar buf[16]; - pt_node = lm_message_node_add_child (desc_node, "payload-type", NULL); + pt_node = wocky_node_add_child_with_content (desc_node, "payload-type", NULL); /* id: required */ sprintf (buf, "%d", p->id); - lm_message_node_set_attribute (pt_node, "id", buf); + wocky_node_set_attribute (pt_node, "id", buf); if (dialect == JINGLE_DIALECT_GTALK3) { @@ -965,8 +963,8 @@ produce_payload_type (GabbleJingleContent *content, * doesn't matter, so just always set the namespace on audio * payloads. */ - lm_message_node_set_attribute (pt_node, "xmlns", - NS_GOOGLE_SESSION_PHONE); + pt_node->ns = g_quark_from_static_string ( + NS_GOOGLE_SESSION_PHONE); } else { @@ -974,7 +972,7 @@ produce_payload_type (GabbleJingleContent *content, * our initiate.. These are a recv parameters, to it doesn't matter * for what we're sending, just for what we're getting.. 320x240 * seems a sane enough default */ - lm_message_node_set_attributes (pt_node, + wocky_node_set_attributes (pt_node, "width", "320", "height", "240", "framerate", "30", @@ -987,9 +985,9 @@ produce_payload_type (GabbleJingleContent *content, if (*p->name != '\0') { if (JINGLE_IS_GOOGLE_DIALECT (dialect)) - lm_message_node_set_attribute (pt_node, "name", gtalk_case (p->name)); + wocky_node_set_attribute (pt_node, "name", gtalk_case (p->name)); else - lm_message_node_set_attribute (pt_node, "name", p->name); + wocky_node_set_attribute (pt_node, "name", p->name); } /* clock rate: optional */ @@ -1001,13 +999,13 @@ produce_payload_type (GabbleJingleContent *content, attname = "rate"; sprintf (buf, "%u", p->clockrate); - lm_message_node_set_attribute (pt_node, attname, buf); + wocky_node_set_attribute (pt_node, attname, buf); } if (p->channels != 0) { sprintf (buf, "%u", p->channels); - lm_message_node_set_attribute (pt_node, "channels", buf); + wocky_node_set_attribute (pt_node, "channels", buf); } if (p->params != NULL) @@ -1021,17 +1019,17 @@ produce_payload_type (GabbleJingleContent *content, } } -static LmMessageNode * +static WockyNode * produce_description_node (JingleDialect dialect, JingleMediaType media_type, - LmMessageNode *content_node) + WockyNode *content_node) { - LmMessageNode *desc_node; + WockyNode *desc_node; const gchar *xmlns = NULL; if (dialect == JINGLE_DIALECT_GTALK3) return NULL; - desc_node = lm_message_node_add_child (content_node, "description", NULL); + desc_node = wocky_node_add_child_with_content (content_node, "description", NULL); switch (dialect) { @@ -1053,15 +1051,15 @@ produce_description_node (JingleDialect dialect, JingleMediaType media_type, default: xmlns = NS_JINGLE_RTP; if (media_type == JINGLE_MEDIA_TYPE_AUDIO) - lm_message_node_set_attribute (desc_node, "media", "audio"); + wocky_node_set_attribute (desc_node, "media", "audio"); else if (media_type == JINGLE_MEDIA_TYPE_VIDEO) - lm_message_node_set_attribute (desc_node, "media", "video"); + wocky_node_set_attribute (desc_node, "media", "video"); else g_assert_not_reached (); break; } - lm_message_node_set_attribute (desc_node, "xmlns", xmlns); + desc_node->ns = g_quark_from_string (xmlns); return desc_node; } @@ -1070,33 +1068,33 @@ static void produce_hdrext (gpointer data, gpointer user_data) { JingleRtpHeaderExtension *hdrext = data; - LmMessageNode *desc_node = user_data; - LmMessageNode *hdrext_node; + WockyNode *desc_node = user_data; + WockyNode *hdrext_node; gchar buf[16]; - hdrext_node = lm_message_node_add_child (desc_node, "rtp-hdrext", NULL); + hdrext_node = wocky_node_add_child (desc_node, "rtp-hdrext"); /* id: required */ sprintf (buf, "%d", hdrext->id); - lm_message_node_set_attribute (hdrext_node, "id", buf); - lm_message_node_set_attribute (hdrext_node, "uri", hdrext->uri); + wocky_node_set_attribute (hdrext_node, "id", buf); + wocky_node_set_attribute (hdrext_node, "uri", hdrext->uri); if (hdrext->senders == JINGLE_CONTENT_SENDERS_INITIATOR) - lm_message_node_set_attribute (hdrext_node, "senders", "initiator"); + wocky_node_set_attribute (hdrext_node, "senders", "initiator"); else if (hdrext->senders == JINGLE_CONTENT_SENDERS_RESPONDER) - lm_message_node_set_attribute (hdrext_node, "senders", "responder"); + wocky_node_set_attribute (hdrext_node, "senders", "responder"); - lm_message_node_set_attribute (hdrext_node, "xmlns", NS_JINGLE_RTP_HDREXT); + wocky_node_set_attribute (hdrext_node, "xmlns", NS_JINGLE_RTP_HDREXT); } static void -produce_description (GabbleJingleContent *content, LmMessageNode *content_node) +produce_description (GabbleJingleContent *content, WockyNode *content_node) { GabbleJingleMediaRtp *self = GABBLE_JINGLE_MEDIA_RTP (content); GabbleJingleMediaRtpPrivate *priv = self->priv; GList *li; JingleDialect dialect = gabble_jingle_session_get_dialect (content->session); - LmMessageNode *desc_node; + WockyNode *desc_node; if (content_has_cap (content, NS_JINGLE_RTCP_FB)) priv->has_rtcp_fb = TRUE; diff --git a/src/jingle-session.c b/src/jingle-session.c index 539c0d162..7b39d0b92 100644 --- a/src/jingle-session.c +++ b/src/jingle-session.c @@ -489,9 +489,9 @@ gabble_jingle_session_class_init (GabbleJingleSessionClass *cls) } typedef void (*HandlerFunc)(GabbleJingleSession *sess, - LmMessageNode *node, GError **error); + WockyNode *node, GError **error); typedef void (*ContentHandlerFunc)(GabbleJingleSession *sess, - GabbleJingleContent *c, LmMessageNode *content_node, gpointer user_data, + GabbleJingleContent *c, WockyNode *content_node, gpointer user_data, GError **error); static gboolean @@ -713,7 +713,7 @@ lookup_content (GabbleJingleSession *sess, static void _foreach_content (GabbleJingleSession *sess, - LmMessageNode *node, + WockyNode *node, gboolean fail_if_missing, ContentHandlerFunc func, gpointer user_data, @@ -724,14 +724,14 @@ _foreach_content (GabbleJingleSession *sess, for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *content_node = node_iter_data (i); + WockyNode *content_node = node_iter_data (i); if (tp_strdiff (lm_message_node_get_name (content_node), "content")) continue; if (!lookup_content (sess, - lm_message_node_get_attribute (content_node, "name"), - lm_message_node_get_attribute (content_node, "creator"), + wocky_node_get_attribute (content_node, "name"), + wocky_node_get_attribute (content_node, "creator"), fail_if_missing, &c, error)) return; @@ -754,7 +754,7 @@ static gboolean idle_content_reject (gpointer data) { LmMessage *msg; - LmMessageNode *sess_node, *node; + WockyNode *sess_node, *node; struct idle_content_reject_ctx *ctx = data; msg = gabble_jingle_session_new_message (ctx->session, @@ -762,8 +762,8 @@ idle_content_reject (gpointer data) g_debug ("name = %s, intiiator = %s", ctx->name, ctx->creator); - node = lm_message_node_add_child (sess_node, "content", NULL); - lm_message_node_set_attributes (node, + node = wocky_node_add_child_with_content (sess_node, "content", NULL); + wocky_node_set_attributes (node, "name", ctx->name, "creator", ctx->creator, NULL); gabble_jingle_session_send (ctx->session, msg, NULL, NULL); @@ -796,7 +796,7 @@ fire_idle_content_reject (GabbleJingleSession *sess, const gchar *name, static GabbleJingleContent * create_content (GabbleJingleSession *sess, GType content_type, JingleMediaType type, const gchar *content_ns, const gchar *transport_ns, - const gchar *name, LmMessageNode *content_node, GError **error) + const gchar *name, WockyNode *content_node, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; GabbleJingleContent *c; @@ -864,11 +864,11 @@ create_content (GabbleJingleSession *sess, GType content_type, static void _each_content_add (GabbleJingleSession *sess, GabbleJingleContent *c, - LmMessageNode *content_node, gpointer user_data, GError **error) + WockyNode *content_node, gpointer user_data, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; - const gchar *name = lm_message_node_get_attribute (content_node, "name"); - LmMessageNode *desc_node = lm_message_node_get_child_any_ns (content_node, + const gchar *name = wocky_node_get_attribute (content_node, "name"); + WockyNode *desc_node = wocky_node_get_child_any_ns (content_node, "description"); GType content_type = 0; const gchar *content_ns = NULL; @@ -890,7 +890,7 @@ _each_content_add (GabbleJingleSession *sess, GabbleJingleContent *c, "unsupported content type with ns %s", content_ns); else fire_idle_content_reject (sess, name, - lm_message_node_get_attribute (content_node, "creator")); + wocky_node_get_attribute (content_node, "creator")); return; } @@ -908,7 +908,7 @@ _each_content_add (GabbleJingleSession *sess, GabbleJingleContent *c, static void _each_content_remove (GabbleJingleSession *sess, GabbleJingleContent *c, - LmMessageNode *content_node, gpointer user_data, GError **error) + WockyNode *content_node, gpointer user_data, GError **error) { g_assert (c != NULL); @@ -917,7 +917,7 @@ _each_content_remove (GabbleJingleSession *sess, GabbleJingleContent *c, static void _each_content_rejected (GabbleJingleSession *sess, GabbleJingleContent *c, - LmMessageNode *content_node, gpointer user_data, GError **error) + WockyNode *content_node, gpointer user_data, GError **error) { JingleReason reason = GPOINTER_TO_UINT (user_data); g_assert (c != NULL); @@ -929,7 +929,7 @@ _each_content_rejected (GabbleJingleSession *sess, GabbleJingleContent *c, static void _each_content_modify (GabbleJingleSession *sess, GabbleJingleContent *c, - LmMessageNode *content_node, gpointer user_data, GError **error) + WockyNode *content_node, gpointer user_data, GError **error) { g_assert (c != NULL); @@ -941,7 +941,7 @@ _each_content_modify (GabbleJingleSession *sess, GabbleJingleContent *c, static void _each_content_replace (GabbleJingleSession *sess, GabbleJingleContent *c, - LmMessageNode *content_node, gpointer user_data, GError **error) + WockyNode *content_node, gpointer user_data, GError **error) { _each_content_remove (sess, c, content_node, NULL, error); @@ -953,7 +953,7 @@ _each_content_replace (GabbleJingleSession *sess, GabbleJingleContent *c, static void _each_content_accept (GabbleJingleSession *sess, GabbleJingleContent *c, - LmMessageNode *content_node, gpointer user_data, GError **error) + WockyNode *content_node, gpointer user_data, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; JingleContentState state; @@ -964,7 +964,7 @@ _each_content_accept (GabbleJingleSession *sess, GabbleJingleContent *c, if (state != JINGLE_CONTENT_STATE_SENT) { #ifdef ENABLE_DEBUG - const gchar *name = lm_message_node_get_attribute (content_node, "name"); + const gchar *name = wocky_node_get_attribute (content_node, "name"); DEBUG ("ignoring content \"%s\"s acceptance for content not in SENT state", name); #endif return; @@ -976,13 +976,13 @@ _each_content_accept (GabbleJingleSession *sess, GabbleJingleContent *c, static void _each_description_info (GabbleJingleSession *sess, GabbleJingleContent *c, - LmMessageNode *content_node, gpointer user_data, GError **error) + WockyNode *content_node, gpointer user_data, GError **error) { gabble_jingle_content_parse_description_info (c, content_node, error); } static void -on_session_initiate (GabbleJingleSession *sess, LmMessageNode *node, +on_session_initiate (GabbleJingleSession *sess, WockyNode *node, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; @@ -999,8 +999,8 @@ on_session_initiate (GabbleJingleSession *sess, LmMessageNode *node, if ((priv->dialect == JINGLE_DIALECT_GTALK3)) { const gchar *content_ns = NULL; - LmMessageNode *desc_node = - lm_message_node_get_child_any_ns (node, "description"); + WockyNode *desc_node = + wocky_node_get_child_any_ns (node, "description"); content_ns = lm_message_node_get_namespace (desc_node); if (!tp_strdiff (content_ns, NS_GOOGLE_SESSION_VIDEO)) @@ -1049,38 +1049,38 @@ on_session_initiate (GabbleJingleSession *sess, LmMessageNode *node, } static void -on_content_add (GabbleJingleSession *sess, LmMessageNode *node, +on_content_add (GabbleJingleSession *sess, WockyNode *node, GError **error) { _foreach_content (sess, node, FALSE, _each_content_add, NULL, error); } static void -on_content_modify (GabbleJingleSession *sess, LmMessageNode *node, +on_content_modify (GabbleJingleSession *sess, WockyNode *node, GError **error) { _foreach_content (sess, node, TRUE, _each_content_modify, NULL, error); } static void -on_content_remove (GabbleJingleSession *sess, LmMessageNode *node, +on_content_remove (GabbleJingleSession *sess, WockyNode *node, GError **error) { _foreach_content (sess, node, TRUE, _each_content_remove, NULL, error); } static void -on_content_replace (GabbleJingleSession *sess, LmMessageNode *node, +on_content_replace (GabbleJingleSession *sess, WockyNode *node, GError **error) { _foreach_content (sess, node, TRUE, _each_content_replace, NULL, error); } static void -on_content_reject (GabbleJingleSession *sess, LmMessageNode *node, +on_content_reject (GabbleJingleSession *sess, WockyNode *node, GError **error) { - LmMessageNode *n = lm_message_node_get_child (node, "reason"); + WockyNode *n = wocky_node_get_child (node, "reason"); JingleReason reason = JINGLE_REASON_UNKNOWN; DEBUG (" "); @@ -1096,14 +1096,14 @@ on_content_reject (GabbleJingleSession *sess, LmMessageNode *node, } static void -on_content_accept (GabbleJingleSession *sess, LmMessageNode *node, +on_content_accept (GabbleJingleSession *sess, WockyNode *node, GError **error) { _foreach_content (sess, node, TRUE, _each_content_accept, NULL, error); } static void -on_session_accept (GabbleJingleSession *sess, LmMessageNode *node, +on_session_accept (GabbleJingleSession *sess, WockyNode *node, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; @@ -1211,14 +1211,14 @@ set_ringing (GabbleJingleSession *sess, static gboolean handle_payload (GabbleJingleSession *sess, - LmMessageNode *payload, + WockyNode *payload, gboolean *handled, GError **error) { const gchar *ns = lm_message_node_get_namespace (payload); const gchar *elt = lm_message_node_get_name (payload); - const gchar *name = lm_message_node_get_attribute (payload, "name"); - const gchar *creator = lm_message_node_get_attribute (payload, "creator"); + const gchar *name = wocky_node_get_attribute (payload, "name"); + const gchar *creator = wocky_node_get_attribute (payload, "creator"); if (tp_strdiff (ns, NS_JINGLE_RTP_INFO)) { @@ -1271,7 +1271,7 @@ handle_payload (GabbleJingleSession *sess, static void on_session_info (GabbleJingleSession *sess, - LmMessageNode *node, + WockyNode *node, GError **error) { gboolean understood_a_payload = FALSE; @@ -1286,7 +1286,7 @@ on_session_info (GabbleJingleSession *sess, { gboolean handled; GError *e = NULL; - LmMessageNode *n = node_iter_data (i); + WockyNode *n = node_iter_data (i); if (handle_payload (sess, n, &handled, &e)) { @@ -1316,11 +1316,11 @@ on_session_info (GabbleJingleSession *sess, } static void -on_session_terminate (GabbleJingleSession *sess, LmMessageNode *node, +on_session_terminate (GabbleJingleSession *sess, WockyNode *node, GError **error) { gchar *text = NULL; - LmMessageNode *n = lm_message_node_get_child (node, "reason"); + WockyNode *n = wocky_node_get_child (node, "reason"); JingleReason jingle_reason = JINGLE_REASON_UNKNOWN; if (n != NULL) @@ -1336,7 +1336,7 @@ on_session_terminate (GabbleJingleSession *sess, LmMessageNode *node, } static void -on_transport_info (GabbleJingleSession *sess, LmMessageNode *node, +on_transport_info (GabbleJingleSession *sess, WockyNode *node, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; @@ -1349,7 +1349,7 @@ on_transport_info (GabbleJingleSession *sess, LmMessageNode *node, if (priv->dialect == JINGLE_DIALECT_GTALK4) { - if (!tp_strdiff (lm_message_node_get_attribute (node, "type"), + if (!tp_strdiff (wocky_node_get_attribute (node, "type"), "candidates")) { GList *contents = gabble_jingle_session_get_contents (sess); @@ -1365,7 +1365,7 @@ on_transport_info (GabbleJingleSession *sess, LmMessageNode *node, } else { - node = lm_message_node_get_child_any_ns (node, "transport"); + node = wocky_node_get_child_any_ns (node, "transport"); if (node == NULL) { @@ -1398,12 +1398,12 @@ on_transport_info (GabbleJingleSession *sess, LmMessageNode *node, WockyNode *transport_node; if (lookup_content (sess, - lm_message_node_get_attribute (content_node, "name"), - lm_message_node_get_attribute (content_node, "creator"), + wocky_node_get_attribute (content_node, "name"), + wocky_node_get_attribute (content_node, "creator"), TRUE /* fail_if_missing */, &c, &e)) { /* we need transport child of content node */ - transport_node = lm_message_node_get_child_any_ns ( + transport_node = wocky_node_get_child_any_ns ( content_node, "transport"); gabble_jingle_content_parse_transport_info (c, transport_node, &e); @@ -1423,21 +1423,21 @@ on_transport_info (GabbleJingleSession *sess, LmMessageNode *node, } static void -on_transport_accept (GabbleJingleSession *sess, LmMessageNode *node, +on_transport_accept (GabbleJingleSession *sess, WockyNode *node, GError **error) { DEBUG ("Ignoring 'transport-accept' action from peer"); } static void -on_description_info (GabbleJingleSession *sess, LmMessageNode *node, +on_description_info (GabbleJingleSession *sess, WockyNode *node, GError **error) { _foreach_content (sess, node, TRUE, _each_description_info, NULL, error); } static void -on_info (GabbleJingleSession *sess, LmMessageNode *node, +on_info (GabbleJingleSession *sess, WockyNode *node, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; @@ -1478,7 +1478,7 @@ static HandlerFunc handlers[] = { static void jingle_state_machine_dance (GabbleJingleSession *sess, JingleAction action, - LmMessageNode *node, + WockyNode *node, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; @@ -1491,7 +1491,7 @@ jingle_state_machine_dance (GabbleJingleSession *sess, } static JingleDialect -detect_google_dialect (LmMessageNode *session_node) +detect_google_dialect (WockyNode *session_node) { /* The GTALK3 dialect is the only one that supports video at this time */ if (lm_message_node_get_child_with_namespace (session_node, @@ -1510,7 +1510,7 @@ const gchar * gabble_jingle_session_detect (LmMessage *message, JingleAction *action, JingleDialect *dialect) { const gchar *actxt, *sid; - LmMessageNode *iq_node, *session_node; + WockyNode *iq_node, *session_node; gboolean google_mode = FALSE; /* all jingle actions are sets */ @@ -1519,8 +1519,8 @@ gabble_jingle_session_detect (LmMessage *message, JingleAction *action, JingleDi iq_node = lm_message_get_node (message); - if ((NULL == lm_message_node_get_attribute (iq_node, "from")) || - (NULL == lm_message_node_get_attribute (iq_node, "to"))) + if ((NULL == wocky_node_get_attribute (iq_node, "from")) || + (NULL == wocky_node_get_attribute (iq_node, "to"))) return NULL; /* first, we try standard jingle */ @@ -1561,13 +1561,13 @@ gabble_jingle_session_detect (LmMessage *message, JingleAction *action, JingleDi if (google_mode) { - actxt = lm_message_node_get_attribute (session_node, "type"); - sid = lm_message_node_get_attribute (session_node, "id"); + actxt = wocky_node_get_attribute (session_node, "type"); + sid = wocky_node_get_attribute (session_node, "id"); } else { - actxt = lm_message_node_get_attribute (session_node, "action"); - sid = lm_message_node_get_attribute (session_node, "sid"); + actxt = wocky_node_get_attribute (session_node, "action"); + sid = wocky_node_get_attribute (session_node, "sid"); } *action = parse_action (actxt); @@ -1579,13 +1579,13 @@ gboolean gabble_jingle_session_parse (GabbleJingleSession *sess, JingleAction action, LmMessage *message, GError **error) { GabbleJingleSessionPrivate *priv = sess->priv; - LmMessageNode *iq_node, *session_node; + WockyNode *iq_node, *session_node; const gchar *from, *action_name; iq_node = lm_message_get_node (message); /* IQ from/to can come in handy */ - from = lm_message_node_get_attribute (iq_node, "from"); + from = wocky_node_get_attribute (iq_node, "from"); if (action == JINGLE_ACTION_UNKNOWN) { @@ -1649,11 +1649,11 @@ gabble_jingle_session_parse (GabbleJingleSession *sess, JingleAction action, LmM LmMessage * gabble_jingle_session_new_message (GabbleJingleSession *sess, - JingleAction action, LmMessageNode **sess_node) + JingleAction action, WockyNode **sess_node) { GabbleJingleSessionPrivate *priv = sess->priv; LmMessage *msg; - LmMessageNode *iq_node, *session_node; + WockyNode *iq_node, *session_node; gchar *el = NULL, *ns = NULL; gboolean gtalk_mode = FALSE; @@ -1690,9 +1690,9 @@ gabble_jingle_session_new_message (GabbleJingleSession *sess, g_assert_not_reached (); } - session_node = lm_message_node_add_child (iq_node, el, NULL); - lm_message_node_set_attributes (session_node, - "xmlns", ns, + session_node = wocky_node_add_child_with_content (iq_node, el, NULL); + session_node->ns = g_quark_from_static_string (ns); + wocky_node_set_attributes (session_node, "initiator", priv->initiator, (gtalk_mode) ? "id" : "sid", priv->sid, (gtalk_mode) ? "type" : "action", @@ -1751,8 +1751,8 @@ static void _fill_content (GabbleJingleSession *sess, GabbleJingleContent *c, gpointer user_data) { - LmMessageNode *sess_node = user_data; - LmMessageNode *transport_node; + WockyNode *sess_node = user_data; + WockyNode *transport_node; JingleContentState state; gabble_jingle_content_produce_node (c, sess_node, TRUE, TRUE, @@ -1871,7 +1871,7 @@ try_session_initiate_or_accept (GabbleJingleSession *sess) TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); LmMessage *msg; - LmMessageNode *sess_node; + WockyNode *sess_node; gboolean contents_ready = TRUE; JingleAction action; JingleState new_state; @@ -1964,15 +1964,11 @@ try_session_initiate_or_accept (GabbleJingleSession *sess) if (has_video || has_audio) { - sess_node = lm_message_node_add_child (sess_node, "description", + sess_node = wocky_node_add_child_with_content (sess_node, "description", NULL); - if (has_video) - lm_message_node_set_attribute (sess_node, "xmlns", - NS_GOOGLE_SESSION_VIDEO); - else - lm_message_node_set_attribute (sess_node, "xmlns", - NS_GOOGLE_SESSION_PHONE); + sess_node->ns = g_quark_from_static_string ( + has_video ? NS_GOOGLE_SESSION_VIDEO : NS_GOOGLE_SESSION_PHONE); } } @@ -2071,19 +2067,19 @@ gabble_jingle_session_terminate (GabbleJingleSession *sess, if (priv->state != JINGLE_STATE_PENDING_CREATED) { - LmMessageNode *session_node; + WockyNode *session_node; LmMessage *msg = gabble_jingle_session_new_message (sess, JINGLE_ACTION_SESSION_TERMINATE, &session_node); if (priv->dialect == JINGLE_DIALECT_V032 && reason_elt != NULL) { - LmMessageNode *r = lm_message_node_add_child (session_node, "reason", + WockyNode *r = wocky_node_add_child_with_content (session_node, "reason", NULL); - lm_message_node_add_child (r, reason_elt, NULL); + wocky_node_add_child_with_content (r, reason_elt, NULL); if (!CHECK_STR_EMPTY(text)) - lm_message_node_add_child (r, "text", text); + wocky_node_add_child_with_content (r, "text", text); } gabble_jingle_session_send (sess, msg, NULL, NULL); @@ -2302,7 +2298,7 @@ gabble_jingle_session_send_rtp_info (GabbleJingleSession *sess, const gchar *name) { LmMessage *message; - LmMessageNode *jingle, *notification; + WockyNode *jingle, *notification; if (!gabble_jingle_session_defines_action (sess, JINGLE_ACTION_SESSION_INFO)) { @@ -2313,9 +2309,8 @@ gabble_jingle_session_send_rtp_info (GabbleJingleSession *sess, message = gabble_jingle_session_new_message (sess, JINGLE_ACTION_SESSION_INFO, &jingle); - notification = lm_message_node_add_child (jingle, name, NULL); - lm_message_node_set_attributes (notification, "xmlns", NS_JINGLE_RTP_INFO, - NULL); + notification = wocky_node_add_child_with_content (jingle, name, NULL); + notification->ns = g_quark_from_static_string (NS_JINGLE_RTP_INFO); /* This is just informational, so ignoring the reply. */ gabble_jingle_session_send (sess, message, NULL, NULL); diff --git a/src/jingle-session.h b/src/jingle-session.h index f2a1fb83a..fda18e3b2 100644 --- a/src/jingle-session.h +++ b/src/jingle-session.h @@ -80,7 +80,7 @@ const gchar * gabble_jingle_session_detect (LmMessage *message, gboolean gabble_jingle_session_parse (GabbleJingleSession *sess, JingleAction action, LmMessage *message, GError **error); LmMessage *gabble_jingle_session_new_message (GabbleJingleSession *sess, - JingleAction action, LmMessageNode **sess_node); + JingleAction action, WockyNode **sess_node); void gabble_jingle_session_accept (GabbleJingleSession *sess); gboolean gabble_jingle_session_terminate (GabbleJingleSession *sess, diff --git a/src/jingle-share.c b/src/jingle-share.c index f4935be95..eacd9686b 100644 --- a/src/jingle-share.c +++ b/src/jingle-share.c @@ -183,9 +183,9 @@ gabble_jingle_share_dispose (GObject *object) static void parse_description (GabbleJingleContent *content, - LmMessageNode *desc_node, GError **error); + WockyNode *desc_node, GError **error); static void produce_description (GabbleJingleContent *obj, - LmMessageNode *content_node); + WockyNode *content_node); static void @@ -291,14 +291,14 @@ gabble_jingle_share_class_init (GabbleJingleShareClass *cls) static void parse_description (GabbleJingleContent *content, - LmMessageNode *desc_node, GError **error) + WockyNode *desc_node, GError **error) { GabbleJingleShare *self = GABBLE_JINGLE_SHARE (content); GabbleJingleSharePrivate *priv = self->priv; NodeIter i; - LmMessageNode *manifest_node = NULL; - LmMessageNode *protocol_node = NULL; - LmMessageNode *http_node = NULL; + WockyNode *manifest_node = NULL; + WockyNode *protocol_node = NULL; + WockyNode *http_node = NULL; DEBUG ("parse description called"); @@ -308,7 +308,7 @@ parse_description (GabbleJingleContent *content, return; } - manifest_node = lm_message_node_get_child (desc_node, "manifest"); + manifest_node = wocky_node_get_child (desc_node, "manifest"); if (manifest_node == NULL) { @@ -317,9 +317,9 @@ parse_description (GabbleJingleContent *content, return; } - protocol_node = lm_message_node_get_child (desc_node, "protocol"); + protocol_node = wocky_node_get_child (desc_node, "protocol"); if (protocol_node != NULL) - http_node = lm_message_node_get_child (protocol_node, "http"); + http_node = wocky_node_get_child (protocol_node, "http"); free_manifest (self); priv->manifest = g_slice_new0 (GabbleJingleShareManifest); @@ -327,9 +327,9 @@ parse_description (GabbleJingleContent *content, /* Build the manifest */ for (i = node_iter (manifest_node); i; i = node_iter_next (i)) { - LmMessageNode *node = node_iter_data (i); - LmMessageNode *name = NULL; - LmMessageNode *image = NULL; + WockyNode *node = node_iter_data (i); + WockyNode *name = NULL; + WockyNode *image = NULL; gboolean folder; const gchar *size; GabbleJingleShareManifestEntry *m = NULL; @@ -341,19 +341,19 @@ parse_description (GabbleJingleContent *content, else continue; - name = lm_message_node_get_child (node, "name"); + name = wocky_node_get_child (node, "name"); if (name == NULL) continue; m = g_slice_new0 (GabbleJingleShareManifestEntry); m->folder = folder; - m->name = g_strdup (lm_message_node_get_value (name)); + m->name = g_strdup (name->content); - size = lm_message_node_get_attribute (node, "size"); + size = wocky_node_get_attribute (node, "size"); if (size) m->size = g_ascii_strtoull (size, NULL, 10); - image = lm_message_node_get_child (node, "image"); + image = wocky_node_get_child (node, "image"); if (image) { const gchar *width; @@ -361,11 +361,11 @@ parse_description (GabbleJingleContent *content, m->image = TRUE; - width = lm_message_node_get_attribute (image, "width"); + width = wocky_node_get_attribute (image, "width"); if (width) m->image_width = g_ascii_strtoull (width, NULL, 10); - height =lm_message_node_get_attribute (image, "height"); + height =wocky_node_get_attribute (image, "height"); if (height) m->image_height = g_ascii_strtoull (height, NULL, 10); } @@ -378,25 +378,25 @@ parse_description (GabbleJingleContent *content, /* clear the previously set values */ for (i = node_iter (http_node); i; i = node_iter_next (i)) { - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); const gchar *name; if (tp_strdiff (lm_message_node_get_name (node), "url")) continue; - name = lm_message_node_get_attribute (node, "name"); + name = wocky_node_get_attribute (node, "name"); if (name == NULL) continue; if (!tp_strdiff (name, "source-path")) { - const gchar *url = lm_message_node_get_value (node); + const gchar *url = node->content; priv->manifest->source_url = g_strdup (url); } if (!tp_strdiff (name, "preview-path")) { - const gchar *url = lm_message_node_get_value (node); + const gchar *url = node->content; priv->manifest->preview_url = g_strdup (url); } } @@ -446,76 +446,76 @@ parse_description (GabbleJingleContent *content, } static void -produce_description (GabbleJingleContent *content, LmMessageNode *content_node) +produce_description (GabbleJingleContent *content, WockyNode *content_node) { GabbleJingleShare *self = GABBLE_JINGLE_SHARE (content); GabbleJingleSharePrivate *priv = self->priv; GList *i; - LmMessageNode *desc_node; - LmMessageNode *manifest_node; - LmMessageNode *protocol_node; - LmMessageNode *http_node; - LmMessageNode *url_node; + WockyNode *desc_node; + WockyNode *manifest_node; + WockyNode *protocol_node; + WockyNode *http_node; + WockyNode *url_node; DEBUG ("produce description called"); ensure_manifest (self); - desc_node = lm_message_node_add_child (content_node, "description", NULL); + desc_node = wocky_node_add_child_with_content (content_node, "description", NULL); - lm_message_node_set_attribute (desc_node, "xmlns", NS_GOOGLE_SESSION_SHARE); + desc_node->ns = g_quark_from_string (NS_GOOGLE_SESSION_SHARE); - manifest_node = lm_message_node_add_child (desc_node, "manifest", NULL); + manifest_node = wocky_node_add_child_with_content (desc_node, "manifest", NULL); for (i = priv->manifest->entries; i; i = i->next) { GabbleJingleShareManifestEntry *m = i->data; - LmMessageNode *file_node; - LmMessageNode *image_node; + WockyNode *file_node; + WockyNode *image_node; gchar *size_str, *width_str, *height_str; if (m->folder) - file_node = lm_message_node_add_child (manifest_node, "folder", NULL); + file_node = wocky_node_add_child_with_content (manifest_node, "folder", NULL); else - file_node = lm_message_node_add_child (manifest_node, "file", NULL); + file_node = wocky_node_add_child_with_content (manifest_node, "file", NULL); if (m->size > 0) { size_str = g_strdup_printf ("%" G_GUINT64_FORMAT, m->size); - lm_message_node_set_attribute (file_node, "size", size_str); + wocky_node_set_attribute (file_node, "size", size_str); g_free (size_str); } - lm_message_node_add_child (file_node, "name", m->name); + wocky_node_add_child_with_content (file_node, "name", m->name); if (m->image && (m->image_width > 0 || m->image_height > 0)) { - image_node = lm_message_node_add_child (file_node, "image", NULL); + image_node = wocky_node_add_child_with_content (file_node, "image", NULL); if (m->image_width > 0) { width_str = g_strdup_printf ("%d", m->image_width); - lm_message_node_set_attribute (image_node, "width", width_str); + wocky_node_set_attribute (image_node, "width", width_str); g_free (width_str); } if (m->image_height > 0) { height_str = g_strdup_printf ("%d", m->image_height); - lm_message_node_set_attribute (image_node, "height", height_str); + wocky_node_set_attribute (image_node, "height", height_str); g_free (height_str); } } } - protocol_node = lm_message_node_add_child (desc_node, "protocol", NULL); - http_node = lm_message_node_add_child (protocol_node, "http", NULL); - url_node = lm_message_node_add_child (http_node, "url", + protocol_node = wocky_node_add_child_with_content (desc_node, "protocol", NULL); + http_node = wocky_node_add_child_with_content (protocol_node, "http", NULL); + url_node = wocky_node_add_child_with_content (http_node, "url", priv->manifest->source_url); - lm_message_node_set_attribute (url_node, "name", "source-path"); - url_node = lm_message_node_add_child (http_node, "url", + wocky_node_set_attribute (url_node, "name", "source-path"); + url_node = wocky_node_add_child_with_content (http_node, "url", priv->manifest->preview_url); - lm_message_node_set_attribute (url_node, "name", "preview-path"); + wocky_node_set_attribute (url_node, "name", "preview-path"); } diff --git a/src/jingle-transport-google.c b/src/jingle-transport-google.c index 934dbab6d..b40325498 100644 --- a/src/jingle-transport-google.c +++ b/src/jingle-transport-google.c @@ -236,7 +236,7 @@ gabble_jingle_transport_google_class_init (GabbleJingleTransportGoogleClass *cls static void parse_candidates (GabbleJingleTransportIface *obj, - LmMessageNode *transport_node, GError **error) + WockyNode *transport_node, GError **error) { GabbleJingleTransportGoogle *t = GABBLE_JINGLE_TRANSPORT_GOOGLE (obj); GabbleJingleTransportGooglePrivate *priv = t->priv; @@ -245,7 +245,7 @@ parse_candidates (GabbleJingleTransportIface *obj, for (i = node_iter (transport_node); i; i = node_iter_next (i)) { - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); const gchar *name, *address, *user, *pass, *str; guint port, net, gen, component; int pref; @@ -256,7 +256,7 @@ parse_candidates (GabbleJingleTransportIface *obj, if (tp_strdiff (lm_message_node_get_name (node), "candidate")) continue; - name = lm_message_node_get_attribute (node, "name"); + name = wocky_node_get_attribute (node, "name"); if (name == NULL) break; @@ -269,16 +269,16 @@ parse_candidates (GabbleJingleTransportIface *obj, component = GPOINTER_TO_INT (g_hash_table_lookup (priv->component_names, name)); - address = lm_message_node_get_attribute (node, "address"); + address = wocky_node_get_attribute (node, "address"); if (address == NULL) break; - str = lm_message_node_get_attribute (node, "port"); + str = wocky_node_get_attribute (node, "port"); if (str == NULL) break; port = atoi (str); - str = lm_message_node_get_attribute (node, "protocol"); + str = wocky_node_get_attribute (node, "protocol"); if (str == NULL) break; @@ -310,13 +310,13 @@ parse_candidates (GabbleJingleTransportIface *obj, break; } - str = lm_message_node_get_attribute (node, "preference"); + str = wocky_node_get_attribute (node, "preference"); if (str == NULL) break; pref = g_ascii_strtod (str, NULL) * 65536; - str = lm_message_node_get_attribute (node, "type"); + str = wocky_node_get_attribute (node, "type"); if (str == NULL) break; @@ -339,25 +339,25 @@ parse_candidates (GabbleJingleTransportIface *obj, break; } - user = lm_message_node_get_attribute (node, "username"); + user = wocky_node_get_attribute (node, "username"); if (user == NULL) break; - pass = lm_message_node_get_attribute (node, "password"); + pass = wocky_node_get_attribute (node, "password"); if (pass == NULL) break; - str = lm_message_node_get_attribute (node, "network"); + str = wocky_node_get_attribute (node, "network"); if (str == NULL) break; net = atoi (str); - str = lm_message_node_get_attribute (node, "generation"); + str = wocky_node_get_attribute (node, "generation"); if (str == NULL) break; gen = atoi (str); - str = lm_message_node_get_attribute (node, "component"); + str = wocky_node_get_attribute (node, "component"); if (str != NULL) component = atoi (str); @@ -392,7 +392,7 @@ transmit_candidates (GabbleJingleTransportGoogle *transport, GabbleJingleTransportGooglePrivate *priv = transport->priv; GList *li; LmMessage *msg; - LmMessageNode *trans_node, *sess_node; + WockyNode *trans_node, *sess_node; if (candidates == NULL) return; @@ -407,7 +407,7 @@ transmit_candidates (GabbleJingleTransportGoogle *transport, { JingleCandidate *c = (JingleCandidate *) li->data; gchar port_str[16], pref_str[16], comp_str[16], *type_str, *proto_str; - LmMessageNode *cnode; + WockyNode *cnode; sprintf (port_str, "%d", c->port); sprintf (pref_str, "%lf", c->preference / 65536.0); @@ -441,8 +441,8 @@ transmit_candidates (GabbleJingleTransportGoogle *transport, g_assert_not_reached (); } - cnode = lm_message_node_add_child (trans_node, "candidate", NULL); - lm_message_node_set_attributes (cnode, + cnode = wocky_node_add_child_with_content (trans_node, "candidate", NULL); + wocky_node_set_attributes (cnode, "address", c->address, "port", port_str, "username", c->username, @@ -455,7 +455,7 @@ transmit_candidates (GabbleJingleTransportGoogle *transport, "generation", "0", NULL); - lm_message_node_set_attribute (cnode, "name", name); + wocky_node_set_attribute (cnode, "name", name); } _gabble_connection_send_with_reply (priv->content->conn, msg, NULL, NULL, diff --git a/src/jingle-transport-iceudp.c b/src/jingle-transport-iceudp.c index 4b108868b..3fefe25b4 100644 --- a/src/jingle-transport-iceudp.c +++ b/src/jingle-transport-iceudp.c @@ -228,7 +228,7 @@ gabble_jingle_transport_iceudp_class_init (GabbleJingleTransportIceUdpClass *cls static void parse_candidates (GabbleJingleTransportIface *obj, - LmMessageNode *transport_node, GError **error) + WockyNode *transport_node, GError **error) { GabbleJingleTransportIceUdp *t = GABBLE_JINGLE_TRANSPORT_ICEUDP (obj); GabbleJingleTransportIceUdpPrivate *priv = t->priv; @@ -240,7 +240,7 @@ parse_candidates (GabbleJingleTransportIface *obj, for (i = node_iter (transport_node); i; i = node_iter_next (i)) { - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); const gchar *id, *address, *user, *pass, *str; guint port, net, gen, component = 1; gdouble pref; @@ -253,21 +253,21 @@ parse_candidates (GabbleJingleTransportIface *obj, node_contains_a_candidate = TRUE; - id = lm_message_node_get_attribute (node, "foundation"); + id = wocky_node_get_attribute (node, "foundation"); if (id == NULL) { DEBUG ("candidate doesn't contain foundation"); continue; } - address = lm_message_node_get_attribute (node, "ip"); + address = wocky_node_get_attribute (node, "ip"); if (address == NULL) { DEBUG ("candidate doesn't contain ip"); continue; } - str = lm_message_node_get_attribute (node, "port"); + str = wocky_node_get_attribute (node, "port"); if (str == NULL) { DEBUG ("candidate doesn't contain port"); @@ -275,7 +275,7 @@ parse_candidates (GabbleJingleTransportIface *obj, } port = atoi (str); - str = lm_message_node_get_attribute (node, "protocol"); + str = wocky_node_get_attribute (node, "protocol"); if (str == NULL) { DEBUG ("candidate doesn't contain protocol"); @@ -293,7 +293,7 @@ parse_candidates (GabbleJingleTransportIface *obj, continue; } - str = lm_message_node_get_attribute (node, "priority"); + str = wocky_node_get_attribute (node, "priority"); if (str == NULL) { DEBUG ("candidate doesn't contain priority"); @@ -301,7 +301,7 @@ parse_candidates (GabbleJingleTransportIface *obj, } pref = g_ascii_strtod (str, NULL); - str = lm_message_node_get_attribute (node, "type"); + str = wocky_node_get_attribute (node, "type"); if (str == NULL) { DEBUG ("candidate doesn't contain type"); @@ -330,21 +330,21 @@ parse_candidates (GabbleJingleTransportIface *obj, continue; } - user = lm_message_node_get_attribute (transport_node, "ufrag"); + user = wocky_node_get_attribute (transport_node, "ufrag"); if (user == NULL) { DEBUG ("transport doesn't contain ufrag"); continue; } - pass = lm_message_node_get_attribute (transport_node, "pwd"); + pass = wocky_node_get_attribute (transport_node, "pwd"); if (pass == NULL) { DEBUG ("transport doesn't contain pwd"); continue; } - str = lm_message_node_get_attribute (node, "network"); + str = wocky_node_get_attribute (node, "network"); if (str == NULL) { DEBUG ("candidate doesn't contain network"); @@ -352,7 +352,7 @@ parse_candidates (GabbleJingleTransportIface *obj, } net = atoi (str); - str = lm_message_node_get_attribute (node, "generation"); + str = wocky_node_get_attribute (node, "generation"); if (str == NULL) { DEBUG ("candidate doesn't contain generation"); @@ -360,7 +360,7 @@ parse_candidates (GabbleJingleTransportIface *obj, } gen = atoi (str); - str = lm_message_node_get_attribute (node, "component"); + str = wocky_node_get_attribute (node, "component"); if (str == NULL) { DEBUG ("candidate doesn't contain component"); @@ -401,7 +401,7 @@ parse_candidates (GabbleJingleTransportIface *obj, static void inject_candidates (GabbleJingleTransportIface *obj, - LmMessageNode *transport_node) + WockyNode *transport_node) { GabbleJingleTransportIceUdp *self = GABBLE_JINGLE_TRANSPORT_ICEUDP (obj); GabbleJingleTransportIceUdpPrivate *priv = self->priv; @@ -413,7 +413,7 @@ inject_candidates (GabbleJingleTransportIface *obj, JingleCandidate *c = (JingleCandidate *) priv->pending_candidates->data; gchar port_str[16], pref_str[16], comp_str[16], id_str[16], *type_str, *proto_str; - LmMessageNode *cnode; + WockyNode *cnode; if (username == NULL) { @@ -458,13 +458,13 @@ inject_candidates (GabbleJingleTransportIface *obj, continue; } - lm_message_node_set_attributes (transport_node, + wocky_node_set_attributes (transport_node, "ufrag", c->username, "pwd", c->password, NULL); - cnode = lm_message_node_add_child (transport_node, "candidate", NULL); - lm_message_node_set_attributes (cnode, + cnode = wocky_node_add_child_with_content (transport_node, "candidate", NULL); + wocky_node_set_attributes (cnode, "ip", c->address, "port", port_str, "priority", pref_str, @@ -491,7 +491,7 @@ send_candidates (GabbleJingleTransportIface *iface, while (priv->pending_candidates != NULL) { - LmMessageNode *trans_node, *sess_node; + WockyNode *trans_node, *sess_node; LmMessage *msg; msg = gabble_jingle_session_new_message (priv->content->session, diff --git a/src/jingle-transport-iface.c b/src/jingle-transport-iface.c index 76dd29d15..671eac20d 100644 --- a/src/jingle-transport-iface.c +++ b/src/jingle-transport-iface.c @@ -41,10 +41,10 @@ gabble_jingle_transport_iface_new (GType type, void gabble_jingle_transport_iface_parse_candidates (GabbleJingleTransportIface *self, - LmMessageNode *node, GError **error) + WockyNode *node, GError **error) { void (*virtual_method)(GabbleJingleTransportIface *, - LmMessageNode *, GError **) = + WockyNode *, GError **) = GABBLE_JINGLE_TRANSPORT_IFACE_GET_CLASS (self)->parse_candidates; g_assert (virtual_method != NULL); @@ -70,9 +70,9 @@ gabble_jingle_transport_iface_new_local_candidates (GabbleJingleTransportIface * void gabble_jingle_transport_iface_inject_candidates ( GabbleJingleTransportIface *self, - LmMessageNode *transport_node) + WockyNode *transport_node) { - void (*virtual_method)(GabbleJingleTransportIface *, LmMessageNode *) = + void (*virtual_method)(GabbleJingleTransportIface *, WockyNode *) = GABBLE_JINGLE_TRANSPORT_IFACE_GET_CLASS (self)->inject_candidates; if (virtual_method != NULL) diff --git a/src/jingle-transport-iface.h b/src/jingle-transport-iface.h index 9e0a36810..fbd5fd773 100644 --- a/src/jingle-transport-iface.h +++ b/src/jingle-transport-iface.h @@ -42,11 +42,11 @@ struct _GabbleJingleTransportIfaceClass { GTypeInterface parent; void (*parse_candidates) (GabbleJingleTransportIface *, - LmMessageNode *, GError **); + WockyNode *, GError **); void (*new_local_candidates) (GabbleJingleTransportIface *, GList *); void (*inject_candidates) (GabbleJingleTransportIface *, - LmMessageNode *transport_node); + WockyNode *transport_node); void (*send_candidates) (GabbleJingleTransportIface *, gboolean all); gboolean (*can_accept) (GabbleJingleTransportIface *); @@ -69,14 +69,14 @@ GType gabble_jingle_transport_iface_get_type (void); GabbleJingleTransportIfaceClass)) void gabble_jingle_transport_iface_parse_candidates (GabbleJingleTransportIface *, - LmMessageNode *, GError **); + WockyNode *, GError **); void gabble_jingle_transport_iface_new_local_candidates ( GabbleJingleTransportIface *self, GList *candidates); void gabble_jingle_transport_iface_inject_candidates ( GabbleJingleTransportIface *self, - LmMessageNode *transport_node); + WockyNode *transport_node); void gabble_jingle_transport_iface_send_candidates ( GabbleJingleTransportIface *self, gboolean all); diff --git a/src/jingle-transport-rawudp.c b/src/jingle-transport-rawudp.c index 3ba83c4f1..00bfed6bb 100644 --- a/src/jingle-transport-rawudp.c +++ b/src/jingle-transport-rawudp.c @@ -217,7 +217,7 @@ gabble_jingle_transport_rawudp_class_init (GabbleJingleTransportRawUdpClass *cls static void parse_candidates (GabbleJingleTransportIface *obj, - LmMessageNode *transport_node, GError **error) + WockyNode *transport_node, GError **error) { GabbleJingleTransportRawUdp *t = GABBLE_JINGLE_TRANSPORT_RAWUDP (obj); GabbleJingleTransportRawUdpPrivate *priv = t->priv; @@ -234,7 +234,7 @@ parse_candidates (GabbleJingleTransportIface *obj, for (i = node_iter (transport_node); i; i = node_iter_next (i)) { - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); const gchar *id, *ip, *str; guint port, gen, component = 1; JingleCandidate *c; @@ -242,7 +242,7 @@ parse_candidates (GabbleJingleTransportIface *obj, if (tp_strdiff (node->name, "candidate")) continue; - str = lm_message_node_get_attribute (node, "component"); + str = wocky_node_get_attribute (node, "component"); if (str != NULL) component = atoi (str); @@ -252,20 +252,20 @@ parse_candidates (GabbleJingleTransportIface *obj, continue; } - id = lm_message_node_get_attribute (node, "id"); + id = wocky_node_get_attribute (node, "id"); if (id == NULL) break; - ip = lm_message_node_get_attribute (node, "ip"); + ip = wocky_node_get_attribute (node, "ip"); if (ip == NULL) break; - str = lm_message_node_get_attribute (node, "port"); + str = wocky_node_get_attribute (node, "port"); if (str == NULL) break; port = atoi (str); - str = lm_message_node_get_attribute (node, "generation"); + str = wocky_node_get_attribute (node, "generation"); if (str == NULL) break; gen = atoi (str); @@ -294,14 +294,14 @@ parse_candidates (GabbleJingleTransportIface *obj, static void inject_candidates (GabbleJingleTransportIface *obj, - LmMessageNode *transport_node) + WockyNode *transport_node) { GabbleJingleTransportRawUdp *self = GABBLE_JINGLE_TRANSPORT_RAWUDP (obj); GabbleJingleTransportRawUdpPrivate *priv = self->priv; JingleCandidate *c; GList *li; gchar port_str[16], comp_str[16]; - LmMessageNode *cnode; + WockyNode *cnode; /* If we don't have the local candidates yet, we should've waited with * the session initiation, or can_accept would have returned FALSE. @@ -314,8 +314,8 @@ inject_candidates (GabbleJingleTransportIface *obj, sprintf (port_str, "%d", c->port); sprintf (comp_str, "%d", c->component); - cnode = lm_message_node_add_child (transport_node, "candidate", NULL); - lm_message_node_set_attributes (cnode, + cnode = wocky_node_add_child_with_content (transport_node, "candidate", NULL); + wocky_node_set_attributes (cnode, "ip", c->address, "port", port_str, "generation", "0", diff --git a/src/message-util.c b/src/message-util.c index e4512abb0..504b6563d 100644 --- a/src/message-util.c +++ b/src/message-util.c @@ -40,32 +40,30 @@ static void _add_chat_state (LmMessage *msg, TpChannelChatState state) { - LmMessageNode *node = NULL; + WockyNode *node = NULL; WockyNode *n = wocky_stanza_get_top_node (msg); switch (state) { case TP_CHANNEL_CHAT_STATE_GONE: - node = lm_message_node_add_child (n, "gone", NULL); + node = wocky_node_add_child_with_content (n, "gone", NULL); break; case TP_CHANNEL_CHAT_STATE_INACTIVE: - node = lm_message_node_add_child (n, "inactive", NULL); + node = wocky_node_add_child_with_content (n, "inactive", NULL); break; case TP_CHANNEL_CHAT_STATE_ACTIVE: - node = lm_message_node_add_child (n, "active", NULL); + node = wocky_node_add_child_with_content (n, "active", NULL); break; case TP_CHANNEL_CHAT_STATE_PAUSED: - node = lm_message_node_add_child (n, "paused", NULL); + node = wocky_node_add_child_with_content (n, "paused", NULL); break; case TP_CHANNEL_CHAT_STATE_COMPOSING: - node = lm_message_node_add_child (n, "composing", NULL); + node = wocky_node_add_child_with_content (n, "composing", NULL); break; } if (node != NULL) - { - lm_message_node_set_attributes (node, "xmlns", NS_CHAT_STATES, NULL); - } + node->ns = g_quark_from_static_string (NS_CHAT_STATES); } @@ -156,7 +154,7 @@ gabble_message_util_send_message (GObject *obj, node = wocky_stanza_get_top_node (msg); /* Generate a UUID for the message */ id = gabble_generate_id (); - lm_message_node_set_attribute (node, "id", id); + wocky_node_set_attribute (node, "id", id); tp_message_set_string (message, 0, "message-token", id); if (send_nick) @@ -166,12 +164,12 @@ gabble_message_util_send_message (GObject *obj, { gchar *tmp; tmp = g_strconcat ("/me ", text, NULL); - lm_message_node_add_child (node, "body", tmp); + wocky_node_add_child_with_content (node, "body", tmp); g_free (tmp); } else { - lm_message_node_add_child (node, "body", text); + wocky_node_add_child_with_content (node, "body", text); } _add_chat_state (msg, state); @@ -262,7 +260,7 @@ gabble_tp_send_error_from_wocky_xmpp_error (WockyXmppError err) } static TpChannelTextSendError -_tp_send_error_from_error_node (LmMessageNode *error_node, +_tp_send_error_from_error_node (WockyNode *error_node, TpDeliveryStatus *delivery_status) { if (error_node != NULL) @@ -320,7 +318,7 @@ _tp_send_error_from_error_node (LmMessageNode *error_node, static gint _tp_chat_state_from_message (LmMessage *message) { - LmMessageNode *node; + WockyNode *node; #define MAP_TO(str, state) \ node = lm_message_node_get_child_with_namespace ( \ @@ -376,26 +374,26 @@ gabble_message_util_parse_incoming_message (LmMessage *message, TpDeliveryStatus *delivery_status) { const gchar *type, *body; - LmMessageNode *node; + WockyNode *node; *send_error = GABBLE_TEXT_CHANNEL_SEND_NO_ERROR; *delivery_status = TP_DELIVERY_STATUS_UNKNOWN; if (lm_message_get_sub_type (message) == LM_MESSAGE_SUB_TYPE_ERROR) { - LmMessageNode *error_node; + WockyNode *error_node; - error_node = lm_message_node_get_child ( + error_node = wocky_node_get_child ( wocky_stanza_get_top_node (message), "error"); *send_error = _tp_send_error_from_error_node (error_node, delivery_status); } - *id = lm_message_node_get_attribute (wocky_stanza_get_top_node (message), + *id = wocky_node_get_attribute (wocky_stanza_get_top_node (message), "id"); - *from = lm_message_node_get_attribute (wocky_stanza_get_top_node (message), + *from = wocky_node_get_attribute (wocky_stanza_get_top_node (message), "from"); if (*from == NULL) { @@ -403,7 +401,7 @@ gabble_message_util_parse_incoming_message (LmMessage *message, return FALSE; } - type = lm_message_node_get_attribute (wocky_stanza_get_top_node (message), + type = wocky_node_get_attribute (wocky_stanza_get_top_node (message), "type"); /* @@ -422,7 +420,7 @@ gabble_message_util_parse_incoming_message (LmMessage *message, * in GMT. They're in the format yyyymmddThhmmss, so if we append 'Z' * we'll get (one of the many valid syntaxes for) an ISO-8601 timestamp. */ - stamp_str = lm_message_node_get_attribute (node, "stamp"); + stamp_str = wocky_node_get_attribute (node, "stamp"); if (stamp_str != NULL) { @@ -446,12 +444,12 @@ gabble_message_util_parse_incoming_message (LmMessage *message, /* * Parse body if it exists. */ - node = lm_message_node_get_child (wocky_stanza_get_top_node (message), + node = wocky_node_get_child (wocky_stanza_get_top_node (message), "body"); if (node) { - body = lm_message_node_get_value (node); + body = node->content; } else { diff --git a/src/muc-channel.c b/src/muc-channel.c index ad9163920..c2b800419 100644 --- a/src/muc-channel.c +++ b/src/muc-channel.c @@ -516,13 +516,13 @@ properties_disco_cb (GabbleDisco *disco, GabbleDiscoRequest *request, const gchar *jid, const gchar *node, - LmMessageNode *query_result, + WockyNode *query_result, GError *error, gpointer user_data) { GabbleMucChannel *chan = user_data; TpIntSet *changed_props_val, *changed_props_flags; - LmMessageNode *lm_node; + WockyNode *lm_node; const gchar *str; GValue val = { 0, }; NodeIter i; @@ -543,14 +543,14 @@ properties_disco_cb (GabbleDisco *disco, */ /* ROOM_PROP_NAME */ - lm_node = lm_message_node_get_child (query_result, "identity"); + lm_node = wocky_node_get_child (query_result, "identity"); if (lm_node) { const gchar *category, *type, *name; - category = lm_message_node_get_attribute (lm_node, "category"); - type = lm_message_node_get_attribute (lm_node, "type"); - name = lm_message_node_get_attribute (lm_node, "name"); + category = wocky_node_get_attribute (lm_node, "category"); + type = wocky_node_get_attribute (lm_node, "type"); + name = wocky_node_get_attribute (lm_node, "name"); if (!tp_strdiff (category, "conference") && !tp_strdiff (type, "text") && @@ -573,11 +573,11 @@ properties_disco_cb (GabbleDisco *disco, for (i = node_iter (query_result); i; i = node_iter_next (i)) { guint prop_id = INVALID_ROOM_PROP; - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); if (strcmp (child->name, "feature") == 0) { - str = lm_message_node_get_attribute (child, "var"); + str = wocky_node_get_attribute (child, "var"); if (str == NULL) continue; @@ -686,24 +686,24 @@ properties_disco_cb (GabbleDisco *disco, for (j = node_iter (child); j; j = node_iter_next (j)) { - LmMessageNode *field = node_iter_data (j); - LmMessageNode *value_node; + WockyNode *field = node_iter_data (j); + WockyNode *value_node; if (strcmp (field->name, "field") != 0) continue; - str = lm_message_node_get_attribute (field, "var"); + str = wocky_node_get_attribute (field, "var"); if (str == NULL) continue; if (strcmp (str, "muc#roominfo_description") != 0) continue; - value_node = lm_message_node_get_child (field, "value"); + value_node = wocky_node_get_child (field, "value"); if (value_node == NULL) continue; - str = lm_message_node_get_value (value_node); + str = value_node->content; if (str == NULL) { str = ""; @@ -1535,21 +1535,21 @@ room_created_submit_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, return LM_HANDLER_RESULT_REMOVE_MESSAGE; } -static LmMessageNode * +static WockyNode * config_form_get_form_node (LmMessage *msg) { - LmMessageNode *node; + WockyNode *node; NodeIter i; /* find the query node */ - node = lm_message_node_get_child (wocky_stanza_get_top_node (msg), "query"); + node = wocky_node_get_child (wocky_stanza_get_top_node (msg), "query"); if (node == NULL) return NULL; /* then the form node */ for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); if (tp_strdiff (child->name, "x")) { @@ -1561,7 +1561,7 @@ config_form_get_form_node (LmMessage *msg) continue; } - if (tp_strdiff (lm_message_node_get_attribute (child, "type"), "form")) + if (tp_strdiff (wocky_node_get_attribute (child, "type"), "form")) { continue; } @@ -1579,7 +1579,7 @@ perms_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, { GabbleMucChannel *chan = GABBLE_MUC_CHANNEL (object); GabbleMucChannelPrivate *priv = chan->priv; - LmMessageNode *form_node; + WockyNode *form_node; NodeIter i; if (lm_message_get_sub_type (reply_msg) != LM_MESSAGE_SUB_TYPE_RESULT) @@ -1603,12 +1603,12 @@ perms_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, for (i = node_iter (form_node); i; i = node_iter_next (i)) { const gchar *var; - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); if (strcmp (node->name, "field") != 0) continue; - var = lm_message_node_get_attribute (node, "var"); + var = wocky_node_get_attribute (node, "var"); if (var == NULL) continue; @@ -1746,15 +1746,15 @@ update_permissions (GabbleMucChannel *chan) /* request the configuration form purely to see if the description * is writable by us in this room. sigh. GO MUC!!! */ LmMessage *msg; - LmMessageNode *node; + WockyNode *node; GError *error = NULL; gboolean success; msg = lm_message_new_with_sub_type (priv->jid, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET); - node = lm_message_node_add_child ( + node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "query", NULL); - lm_message_node_set_attribute (node, "xmlns", NS_MUC_OWNER); + node->ns = g_quark_from_string (NS_MUC_OWNER); success = _gabble_connection_send_with_reply ( GABBLE_CONNECTION (tp_base_channel_get_connection (base)), msg, @@ -2631,10 +2631,10 @@ _gabble_muc_channel_handle_subject (GabbleMucChannel *chan, if (is_error) { - LmMessageNode *node; + WockyNode *node; const gchar *err_desc = NULL; - node = lm_message_node_get_child ( + node = wocky_node_get_child ( wocky_stanza_get_top_node (msg), "error"); if (node) { @@ -2982,29 +2982,29 @@ gabble_muc_channel_send_invite (GabbleMucChannel *self, TpBaseChannel *base = TP_BASE_CHANNEL (self); GabbleMucChannelPrivate *priv = self->priv; LmMessage *msg; - LmMessageNode *x_node, *invite_node; + WockyNode *x_node, *invite_node; gboolean result; g_signal_emit (self, signals[PRE_INVITE], 0, jid); msg = lm_message_new (priv->jid, LM_MESSAGE_TYPE_MESSAGE); - x_node = lm_message_node_add_child ( + x_node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "x", NULL); - lm_message_node_set_attribute (x_node, "xmlns", NS_MUC_USER); + x_node->ns = g_quark_from_string (NS_MUC_USER); - invite_node = lm_message_node_add_child (x_node, "invite", NULL); + invite_node = wocky_node_add_child_with_content (x_node, "invite", NULL); - lm_message_node_set_attribute (invite_node, "to", jid); + wocky_node_set_attribute (invite_node, "to", jid); if (message != NULL && *message != '\0') { - lm_message_node_add_child (invite_node, "reason", message); + wocky_node_add_child_with_content (invite_node, "reason", message); } if (continue_) { - lm_message_node_add_child (invite_node, "continue", NULL); + wocky_node_add_child_with_content (invite_node, "continue", NULL); } DEBUG ("sending MUC invitation for room %s to contact %s with reason " @@ -3120,7 +3120,7 @@ gabble_muc_channel_remove_member (GObject *obj, GabbleMucChannelPrivate *priv = chan->priv; TpGroupMixin *group = TP_GROUP_MIXIN (chan); LmMessage *msg; - LmMessageNode *query_node, *item_node; + WockyNode *query_node, *item_node; const gchar *jid, *nick; gboolean result; @@ -3137,11 +3137,11 @@ gabble_muc_channel_remove_member (GObject *obj, msg = lm_message_new_with_sub_type (priv->jid, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_SET); - query_node = lm_message_node_add_child ( + query_node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "query", NULL); - lm_message_node_set_attribute (query_node, "xmlns", NS_MUC_ADMIN); + query_node->ns = g_quark_from_string (NS_MUC_ADMIN); - item_node = lm_message_node_add_child (query_node, "item", NULL); + item_node = wocky_node_add_child_with_content (query_node, "item", NULL); jid = tp_handle_inspect (TP_GROUP_MIXIN (obj)->handle_repo, handle); @@ -3149,14 +3149,14 @@ gabble_muc_channel_remove_member (GObject *obj, if (nick != NULL) nick++; - lm_message_node_set_attributes (item_node, + wocky_node_set_attributes (item_node, "nick", nick, "role", "none", NULL); if (*message != '\0') { - lm_message_node_add_child (item_node, "reason", message); + wocky_node_add_child_with_content (item_node, "reason", message); } DEBUG ("sending MUC kick request for contact %u (%s) to room %s with reason " @@ -3187,7 +3187,7 @@ gabble_muc_channel_do_set_properties (GObject *obj, GabbleConnection *conn = GABBLE_CONNECTION (tp_base_channel_get_connection (base)); LmMessage *msg; - LmMessageNode *node; + WockyNode *node; gboolean success; g_assert (priv->properties_ctx == NULL); @@ -3202,7 +3202,7 @@ gabble_muc_channel_do_set_properties (GObject *obj, msg = lm_message_new_with_sub_type (priv->jid, LM_MESSAGE_TYPE_MESSAGE, LM_MESSAGE_SUB_TYPE_GROUPCHAT); - lm_message_node_add_child ( + wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "subject", str); success = _gabble_connection_send (conn, msg, error); @@ -3218,9 +3218,9 @@ gabble_muc_channel_do_set_properties (GObject *obj, { msg = lm_message_new_with_sub_type (priv->jid, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET); - node = lm_message_node_add_child ( + node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "query", NULL); - lm_message_node_set_attribute (node, "xmlns", NS_MUC_OWNER); + node->ns = g_quark_from_string (NS_MUC_OWNER); success = _gabble_connection_send_with_reply (conn, msg, request_config_form_reply_cb, G_OBJECT (obj), NULL, @@ -3251,7 +3251,7 @@ request_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, TpPropertiesContext *ctx = priv->properties_ctx; GError *error = NULL; LmMessage *msg = NULL; - LmMessageNode *submit_node, *form_node, *node; + WockyNode *submit_node, *form_node, *node; guint i, props_left; NodeIter j; @@ -3271,15 +3271,14 @@ request_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, msg = lm_message_new_with_sub_type (priv->jid, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_SET); - node = lm_message_node_add_child ( + node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "query", NULL); - lm_message_node_set_attribute (node, "xmlns", NS_MUC_OWNER); + node->ns = g_quark_from_string (NS_MUC_OWNER); - submit_node = lm_message_node_add_child (node, "x", NULL); - lm_message_node_set_attributes (submit_node, - "xmlns", NS_X_DATA, - "type", "submit", - NULL); + submit_node = wocky_node_add_child_with_content (node, "x", NULL); + submit_node->ns = g_quark_from_static_string (NS_X_DATA); + wocky_node_set_attribute (submit_node, + "type", "submit"); /* we assume that the number of props will fit in a guint on all supported * platforms, so fail at compile time if this is no longer the case @@ -3301,8 +3300,8 @@ request_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, for (j = node_iter (form_node); j; j = node_iter_next (j)) { const gchar *var; - LmMessageNode *field_node; - LmMessageNode *child = node_iter_data (j); + WockyNode *field_node; + WockyNode *child = node_iter_data (j); guint id; GType type; gboolean invert; @@ -3315,7 +3314,7 @@ request_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, continue; } - var = lm_message_node_get_attribute (child, "var"); + var = wocky_node_get_attribute (child, "var"); if (var == NULL) { DEBUG ("skipping node '%s' because of lacking var attribute", child->name); @@ -3414,13 +3413,13 @@ request_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, } /* add the corresponding field node to the reply message */ - field_node = lm_message_node_add_child (submit_node, "field", NULL); - lm_message_node_set_attribute (field_node, "var", var); + field_node = wocky_node_add_child_with_content (submit_node, "field", NULL); + wocky_node_set_attribute (field_node, "var", var); - type_str = lm_message_node_get_attribute (child, "type"); + type_str = wocky_node_get_attribute (child, "type"); if (type_str) { - lm_message_node_set_attribute (field_node, "type", type_str); + wocky_node_set_attribute (field_node, "type", type_str); } if (id != INVALID_ROOM_PROP && tp_properties_context_has (ctx, id)) @@ -3455,7 +3454,7 @@ request_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, props_left &= ~(1 << id); /* add the corresponding value node(s) to the reply message */ - lm_message_node_add_child (field_node, "value", val_str); + wocky_node_add_child_with_content (field_node, "value", val_str); } else { @@ -3464,14 +3463,14 @@ request_config_form_reply_cb (GabbleConnection *conn, LmMessage *sent_msg, for (k = node_iter (child); k; k = node_iter_next (k)) { - LmMessageNode *value_node = node_iter_data (k); + WockyNode *value_node = node_iter_data (k); if (tp_strdiff (value_node->name, "value")) /* Not a value, skip it */ continue; - lm_message_node_add_child (field_node, "value", - lm_message_node_get_value (value_node)); + wocky_node_add_child_with_content (field_node, "value", + value_node->content); } } } diff --git a/src/muc-channel.h b/src/muc-channel.h index 72d4d5cdf..770c3f02b 100644 --- a/src/muc-channel.h +++ b/src/muc-channel.h @@ -87,10 +87,10 @@ GType gabble_muc_channel_get_type (void); gboolean _gabble_muc_channel_is_ready (GabbleMucChannel *chan); void _gabble_muc_channel_presence_error (GabbleMucChannel *chan, - const gchar *jid, LmMessageNode *pres_node); + const gchar *jid, WockyNode *pres_node); void _gabble_muc_channel_member_presence_updated (GabbleMucChannel *chan, - TpHandle handle, LmMessage *message, LmMessageNode *x_node, - LmMessageNode *item_node); + TpHandle handle, LmMessage *message, WockyNode *x_node, + WockyNode *item_node); void _gabble_muc_channel_handle_subject (GabbleMucChannel *chan, TpChannelTextMessageType msg_type, TpHandleType handle_type, TpHandle sender, time_t timestamp, const gchar *subject, LmMessage *msg); diff --git a/src/muc-factory.c b/src/muc-factory.c index c9a5115c1..31633127b 100644 --- a/src/muc-factory.c +++ b/src/muc-factory.c @@ -574,7 +574,7 @@ obsolete_invite_disco_cb (GabbleDisco *self, GabbleDiscoRequest *request, const gchar *jid, const gchar *node, - LmMessageNode *query_result, + WockyNode *query_result, GError* error, gpointer user_data) { @@ -584,7 +584,7 @@ obsolete_invite_disco_cb (GabbleDisco *self, GabbleMucFactoryPrivate *priv = GABBLE_MUC_FACTORY_GET_PRIVATE (fac); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); - LmMessageNode *identity; + WockyNode *identity; const char *category = NULL, *type = NULL; g_hash_table_remove (priv->disco_requests, request); @@ -596,11 +596,11 @@ obsolete_invite_disco_cb (GabbleDisco *self, goto out; } - identity = lm_message_node_get_child (query_result, "identity"); + identity = wocky_node_get_child (query_result, "identity"); if (identity != NULL) { - category = lm_message_node_get_attribute (identity, "category"); - type = lm_message_node_get_attribute (identity, "type"); + category = wocky_node_get_attribute (identity, "category"); + type = wocky_node_get_attribute (identity, "type"); } if (tp_strdiff (category, "conference") || @@ -631,7 +631,7 @@ process_muc_invite (GabbleMucFactory *fac, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT); - LmMessageNode *x_node, *invite_node, *reason_node; + WockyNode *x_node, *invite_node, *reason_node; const gchar *invite_from, *reason = NULL; TpHandle inviter_handle; gchar *room; @@ -645,7 +645,7 @@ process_muc_invite (GabbleMucFactory *fac, return FALSE; /* and an invitation? */ - invite_node = lm_message_node_get_child (x_node, "invite"); + invite_node = wocky_node_get_child (x_node, "invite"); if (invite_node == NULL) return FALSE; @@ -659,7 +659,7 @@ process_muc_invite (GabbleMucFactory *fac, return TRUE; } - invite_from = lm_message_node_get_attribute (invite_node, "from"); + invite_from = wocky_node_get_attribute (invite_node, "from"); if (invite_from == NULL) { STANZA_DEBUG (message, "got a MUC invitation message with no JID; " @@ -678,10 +678,10 @@ process_muc_invite (GabbleMucFactory *fac, return TRUE; } - reason_node = lm_message_node_get_child (invite_node, "reason"); + reason_node = wocky_node_get_child (invite_node, "reason"); if (reason_node != NULL) - reason = lm_message_node_get_value (reason_node); + reason = reason_node->content; /* create the channel */ room = gabble_remove_resource (from); @@ -705,7 +705,7 @@ process_obsolete_invite (GabbleMucFactory *fac, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT); - LmMessageNode *x_node; + WockyNode *x_node; const gchar *room; TpHandle inviter_handle; GabbleDiscoRequest *request; @@ -729,7 +729,7 @@ process_obsolete_invite (GabbleMucFactory *fac, } /* the room JID is in x */ - room = lm_message_node_get_attribute (x_node, "jid"); + room = wocky_node_get_attribute (x_node, "jid"); if (room == NULL) { STANZA_DEBUG (message, diff --git a/src/presence-cache.c b/src/presence-cache.c index b85d852f6..484cb5f60 100644 --- a/src/presence-cache.c +++ b/src/presence-cache.c @@ -695,10 +695,10 @@ gabble_presence_cache_status_changed_cb (GabbleConnection *conn, } static GabblePresenceId -_presence_node_get_status (LmMessageNode *pres_node) +_presence_node_get_status (WockyNode *pres_node) { const gchar *presence_show; - LmMessageNode *child_node = lm_message_node_get_child (pres_node, "show"); + WockyNode *child_node = wocky_node_get_child (pres_node, "show"); if (!child_node) { @@ -710,7 +710,7 @@ _presence_node_get_status (LmMessageNode *pres_node) return GABBLE_PRESENCE_AVAILABLE; } - presence_show = lm_message_node_get_value (child_node); + presence_show = child_node->content; if (!presence_show) { @@ -743,7 +743,7 @@ static void _grab_nickname (GabblePresenceCache *cache, TpHandle handle, const gchar *from, - LmMessageNode *node) + WockyNode *node) { const gchar *nickname; GabblePresence *presence; @@ -758,7 +758,7 @@ _grab_nickname (GabblePresenceCache *cache, if (NULL == presence) return; - nickname = lm_message_node_get_value (node); + nickname = node->content; DEBUG ("got nickname \"%s\" for %s", nickname, from); if (tp_strdiff (presence->nickname, nickname)) @@ -773,7 +773,7 @@ static void self_vcard_request_cb (GabbleVCardManager *self, GabbleVCardManagerRequest *request, TpHandle handle, - LmMessageNode *vcard, + WockyNode *vcard, GError *error, gpointer user_data) { @@ -862,12 +862,12 @@ static void _grab_avatar_sha1 (GabblePresenceCache *cache, TpHandle handle, const gchar *from, - LmMessageNode *node) + WockyNode *node) { GabblePresenceCachePrivate *priv = cache->priv; TpBaseConnection *base_conn = (TpBaseConnection *) priv->conn; const gchar *sha1; - LmMessageNode *x_node, *photo_node; + WockyNode *x_node, *photo_node; GabblePresence *presence; if (handle == base_conn->self_handle) @@ -900,14 +900,14 @@ _grab_avatar_sha1 (GabblePresenceCache *cache, return; } - photo_node = lm_message_node_get_child (x_node, "photo"); + photo_node = wocky_node_get_child (x_node, "photo"); /* If there is no photo node, the resource supports XEP-0153, but has * nothing in particular to say about the avatar. */ if (NULL == photo_node) return; - sha1 = lm_message_node_get_value (photo_node); + sha1 = photo_node->content; /* "" means we know there is no avatar. NULL means we don't know what is the * avatar. In this case, there is a <photo> node. */ @@ -935,13 +935,13 @@ _grab_avatar_sha1 (GabblePresenceCache *cache, static GSList * _parse_cap_bundles ( - LmMessageNode *lm_node, + WockyNode *lm_node, const gchar **hash, const gchar **ver) { const gchar *node, *ext; GSList *uris = NULL; - LmMessageNode *cap_node; + WockyNode *cap_node; *hash = NULL; *ver = NULL; @@ -951,14 +951,14 @@ _parse_cap_bundles ( if (NULL == cap_node) return NULL; - *hash = lm_message_node_get_attribute (cap_node, "hash"); + *hash = wocky_node_get_attribute (cap_node, "hash"); - node = lm_message_node_get_attribute (cap_node, "node"); + node = wocky_node_get_attribute (cap_node, "node"); if (NULL == node) return NULL; - *ver = lm_message_node_get_attribute (cap_node, "ver"); + *ver = wocky_node_get_attribute (cap_node, "ver"); if (NULL != *ver) uris = g_slist_prepend (uris, g_strdup_printf ("%s#%s", node, *ver)); @@ -968,7 +968,7 @@ _parse_cap_bundles ( if (NULL != *hash) return uris; - ext = lm_message_node_get_attribute (cap_node, "ext"); + ext = wocky_node_get_attribute (cap_node, "ext"); if (NULL != ext) { @@ -987,11 +987,11 @@ _parse_cap_bundles ( static void _parse_node (GabblePresence *presence, - LmMessageNode *lm_node, + WockyNode *lm_node, const gchar *resource, guint serial) { - LmMessageNode *cap_node; + WockyNode *cap_node; const gchar *node; cap_node = lm_message_node_get_child_with_namespace (lm_node, "c", NS_CAPS); @@ -999,7 +999,7 @@ _parse_node (GabblePresence *presence, if (NULL == cap_node) return; - node = lm_message_node_get_attribute (cap_node, "node"); + node = wocky_node_get_attribute (cap_node, "node"); if (!tp_strdiff (node, "http://mail.google.com/xmpp/client/caps")) { @@ -1018,7 +1018,7 @@ static void _caps_disco_cb (GabbleDisco *disco, GabbleDiscoRequest *request, const gchar *jid, const gchar *node, - LmMessageNode *query_result, + WockyNode *query_result, GError *error, gpointer user_data); @@ -1173,7 +1173,7 @@ emit_capabilities_discovered (GabblePresenceCache *cache, static guint client_types_from_message (TpHandle handle, - LmMessageNode *lm_node, + WockyNode *lm_node, const gchar *resource) { WockyNode *identity, *query_result = (WockyNode *) lm_node; @@ -1235,7 +1235,7 @@ _caps_disco_cb (GabbleDisco *disco, GabbleDiscoRequest *request, const gchar *jid, const gchar *node, - LmMessageNode *query_result, + WockyNode *query_result, GError *error, gpointer user_data) { @@ -1586,7 +1586,7 @@ _process_caps (GabblePresenceCache *cache, GabblePresence *presence, TpHandle handle, const gchar *from, - LmMessageNode *lm_node) + WockyNode *lm_node) { const gchar *resource; GSList *uris, *i; @@ -1658,7 +1658,7 @@ gabble_presence_parse_presence_message (GabblePresenceCache *cache, gint8 priority = 0; const gchar *resource, *status_message = NULL; gchar *my_full_jid; - LmMessageNode *presence_node, *child_node; + WockyNode *presence_node, *child_node; LmHandlerResult ret = LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; GabblePresenceId presence_id; GabblePresence *presence; @@ -1694,19 +1694,19 @@ gabble_presence_parse_presence_message (GabblePresenceCache *cache, * tracking */ g_hash_table_remove (priv->decloak_requests, GUINT_TO_POINTER (handle)); - child_node = lm_message_node_get_child (presence_node, "status"); + child_node = wocky_node_get_child (presence_node, "status"); if (child_node) - status_message = lm_message_node_get_value (child_node); + status_message = child_node->content; if (child_node) - status_message = lm_message_node_get_value (child_node); + status_message = child_node->content; - child_node = lm_message_node_get_child (presence_node, "priority"); + child_node = wocky_node_get_child (presence_node, "priority"); if (child_node) { - const gchar *prio = lm_message_node_get_value (child_node); + const gchar *prio = child_node->content; if (prio != NULL) priority = CLAMP (atoi (prio), G_MININT8, G_MAXINT8); @@ -1726,7 +1726,7 @@ gabble_presence_parse_presence_message (GabblePresenceCache *cache, "decloak-automatically", &decloak, NULL); - reason = lm_message_node_get_attribute (child_node, "reason"); + reason = wocky_node_get_attribute (child_node, "reason"); if (reason == NULL) reason = ""; @@ -1792,7 +1792,7 @@ _parse_message_message (GabblePresenceCache *cache, const gchar *from, LmMessage *message) { - LmMessageNode *node; + WockyNode *node; GabblePresence *presence; switch (lm_message_get_sub_type (message)) @@ -1847,7 +1847,7 @@ gabble_presence_cache_lm_message_cb (LmMessageHandler *handler, g_assert (lmconn == priv->conn->lmconn); - from = lm_message_node_get_attribute (wocky_stanza_get_top_node (message), + from = wocky_node_get_attribute (wocky_stanza_get_top_node (message), "from"); if (NULL == from) diff --git a/src/presence.c b/src/presence.c index 9447031f9..41c7c7b7d 100644 --- a/src/presence.c +++ b/src/presence.c @@ -619,10 +619,10 @@ gabble_presence_as_message (GabblePresence *presence, if (res->priority) { gchar *priority = g_strdup_printf ("%d", res->priority); - LmMessageNode *node; + WockyNode *node; node = lm_message_get_node (message); - lm_message_node_add_child (node, "priority", priority); + wocky_node_add_child_with_content (node, "priority", priority); g_free (priority); } diff --git a/src/private-tubes-factory.c b/src/private-tubes-factory.c index a95944dd4..9833e80ad 100644 --- a/src/private-tubes-factory.c +++ b/src/private-tubes-factory.c @@ -728,7 +728,7 @@ private_tubes_factory_msg_tube_cb (LmMessageHandler *handler, GABBLE_PRIVATE_TUBES_FACTORY_GET_PRIVATE (self); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); - LmMessageNode *tube_node, *close_node; + WockyNode *tube_node, *close_node; GabbleTubesChannel *chan; const gchar *from; TpHandle handle; @@ -741,7 +741,7 @@ private_tubes_factory_msg_tube_cb (LmMessageHandler *handler, if (tube_node == NULL && close_node == NULL) return LM_HANDLER_RESULT_ALLOW_MORE_HANDLERS; - from = lm_message_node_get_attribute ( + from = wocky_node_get_attribute ( wocky_stanza_get_top_node (msg), "from"); if (from == NULL) { diff --git a/src/search-channel.c b/src/search-channel.c index 4fc6a29c1..bd0ffb2b4 100644 --- a/src/search-channel.c +++ b/src/search-channel.c @@ -206,7 +206,7 @@ supported_field_discovery_failed (GabbleSearchChannel *chan, static GPtrArray * parse_unextended_field_response ( GabbleSearchChannel *self, - LmMessageNode *query_node, + WockyNode *query_node, GError **error) { GPtrArray *search_keys = g_ptr_array_new (); @@ -214,13 +214,13 @@ parse_unextended_field_response ( for (i = node_iter (query_node); i; i = node_iter_next (i)) { - LmMessageNode *field = node_iter_data (i); + WockyNode *field = node_iter_data (i); gchar *tp_name; if (!strcmp (field->name, "instructions")) { DEBUG ("server gave us some instructions: %s", - lm_message_node_get_value (field)); + field->content); continue; } @@ -263,13 +263,13 @@ name_in_array (GPtrArray *array, static GPtrArray * parse_data_form ( GabbleSearchChannel *self, - LmMessageNode *x_node, + WockyNode *x_node, GError **error) { GPtrArray *search_keys = g_ptr_array_new (); NodeIter i; - if (tp_strdiff (lm_message_node_get_attribute (x_node, "type"), "form")) + if (tp_strdiff (wocky_node_get_attribute (x_node, "type"), "form")) { g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, "server is broken: <x> not type='form'"); @@ -278,15 +278,15 @@ parse_data_form ( for (i = node_iter (x_node); i; i = node_iter_next (i)) { - LmMessageNode *n = node_iter_data (i); - const gchar *type = lm_message_node_get_attribute (n, "type"); - const gchar *var = lm_message_node_get_attribute (n, "var"); + WockyNode *n = node_iter_data (i); + const gchar *type = wocky_node_get_attribute (n, "type"); + const gchar *var = wocky_node_get_attribute (n, "var"); gchar *tp_name; if (!strcmp (n->name, "title") || !strcmp (n->name, "instructions")) { - DEBUG ("ignoring <%s>: %s", n->name, lm_message_node_get_value (n)); + DEBUG ("ignoring <%s>: %s", n->name, n->content); continue; } @@ -302,8 +302,7 @@ parse_data_form ( if (!strcmp (var, "FORM_TYPE")) { if (node_iter (n) == NULL || - strcmp (lm_message_node_get_value (node_iter_data ( - node_iter (n))), NS_SEARCH)) + strcmp (node_iter_data (node_iter (n))->content, NS_SEARCH)) { DEBUG ("<x> form does not have FORM_TYPE %s", NS_SEARCH); g_set_error (error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE, @@ -357,9 +356,9 @@ fail: static void parse_search_field_response (GabbleSearchChannel *chan, - LmMessageNode *query_node) + WockyNode *query_node) { - LmMessageNode *x_node; + WockyNode *x_node; GPtrArray *search_keys = NULL; GError *e = NULL; @@ -402,7 +401,7 @@ query_reply_cb (GabbleConnection *conn, gpointer user_data) { GabbleSearchChannel *chan = GABBLE_SEARCH_CHANNEL (object); - LmMessageNode *query_node; + WockyNode *query_node; GError *err = NULL; query_node = lm_message_node_get_child_with_namespace ( @@ -442,14 +441,14 @@ request_search_fields (GabbleSearchChannel *chan) TpBaseChannel *base = TP_BASE_CHANNEL (chan); TpBaseConnection *base_conn = tp_base_channel_get_connection (base); LmMessage *msg; - LmMessageNode *lm_node; + WockyNode *lm_node; GError *error = NULL; msg = lm_message_new_with_sub_type (chan->priv->server, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_GET); - lm_node = lm_message_node_add_child ( + lm_node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "query", NULL); - lm_message_node_set_attribute (lm_node, "xmlns", NS_SEARCH); + lm_node->ns = g_quark_from_string (NS_SEARCH); if (! _gabble_connection_send_with_reply (GABBLE_CONNECTION (base_conn), msg, query_reply_cb, (GObject *) chan, NULL, &error)) @@ -642,9 +641,9 @@ add_search_result (GabbleSearchChannel *chan, static void parse_result_item (GabbleSearchChannel *chan, - LmMessageNode *item) + WockyNode *item) { - const gchar *jid = lm_message_node_get_attribute (item, "jid"); + const gchar *jid = wocky_node_get_attribute (item, "jid"); GHashTable *info; NodeIter i; @@ -659,8 +658,8 @@ parse_result_item (GabbleSearchChannel *chan, for (i = node_iter (item); i; i = node_iter_next (i)) { - LmMessageNode *n = node_iter_data (i); - gchar *value = (gchar *) lm_message_node_get_value (n); + WockyNode *n = node_iter_data (i); + gchar *value = (gchar *) n->content; g_hash_table_insert (info, n->name, value); } @@ -671,7 +670,7 @@ parse_result_item (GabbleSearchChannel *chan, static void parse_extended_result_item (GabbleSearchChannel *chan, - LmMessageNode *item) + WockyNode *item) { GHashTable *info; NodeIter i; @@ -680,8 +679,8 @@ parse_extended_result_item (GabbleSearchChannel *chan, for (i = node_iter (item); i; i = node_iter_next (i)) { - LmMessageNode *field = node_iter_data (i); - LmMessageNode *value_node; + WockyNode *field = node_iter_data (i); + WockyNode *value_node; const gchar *var, *value; if (tp_strdiff (field->name, "field")) @@ -691,21 +690,21 @@ parse_extended_result_item (GabbleSearchChannel *chan, continue; } - var = lm_message_node_get_attribute (field, "var"); + var = wocky_node_get_attribute (field, "var"); if (var == NULL) { DEBUG ("Ignore <field/> without 'var' attribut"); continue; } - value_node = lm_message_node_get_child (field, "value"); + value_node = wocky_node_get_child (field, "value"); if (value_node == NULL) { DEBUG ("Ignore <field/> without <value/> child"); continue; } - value = lm_message_node_get_value (value_node); + value = value_node->content; g_hash_table_insert (info, (gchar *) var, (gchar *) value); } @@ -724,14 +723,14 @@ parse_extended_result_item (GabbleSearchChannel *chan, static gboolean parse_unextended_search_results (GabbleSearchChannel *chan, - LmMessageNode *query_node, + WockyNode *query_node, GError **error) { NodeIter i; for (i = node_iter (query_node); i; i = node_iter_next (i)) { - LmMessageNode *item = node_iter_data (i); + WockyNode *item = node_iter_data (i); if (!strcmp (item->name, "item")) parse_result_item (chan, item); @@ -745,10 +744,10 @@ parse_unextended_search_results (GabbleSearchChannel *chan, static gboolean parse_extended_search_results (GabbleSearchChannel *chan, - LmMessageNode *query_node, + WockyNode *query_node, GError **error) { - LmMessageNode *x; + WockyNode *x; NodeIter i; x = lm_message_node_get_child_with_namespace (query_node, "x", NS_X_DATA); @@ -761,7 +760,7 @@ parse_extended_search_results (GabbleSearchChannel *chan, for (i = node_iter (x); i; i = node_iter_next (i)) { - LmMessageNode *item = node_iter_data (i); + WockyNode *item = node_iter_data (i); if (!tp_strdiff (item->name, "item")) parse_extended_result_item (chan, item); @@ -769,7 +768,7 @@ parse_extended_search_results (GabbleSearchChannel *chan, /* Ignore <reported> node */ continue; else if (!tp_strdiff (item->name, "title")) - DEBUG ("title: %s", lm_message_node_get_value (item)); + DEBUG ("title: %s", item->content); else DEBUG ("found <%s/> in <x/> rather than <item/>, <title/> and " "<reported/>, skipping", item->name); @@ -780,7 +779,7 @@ parse_extended_search_results (GabbleSearchChannel *chan, static gboolean parse_search_results (GabbleSearchChannel *chan, - LmMessageNode *query_node, + WockyNode *query_node, GError **error) { if (chan->priv->xforms) @@ -797,7 +796,7 @@ search_reply_cb (GabbleConnection *conn, gpointer user_data) { GabbleSearchChannel *chan = GABBLE_SEARCH_CHANNEL (object); - LmMessageNode *query_node; + WockyNode *query_node; GError *err = NULL; DEBUG ("called"); @@ -906,7 +905,7 @@ validate_terms (GabbleSearchChannel *chan, static void build_unextended_query ( GabbleSearchChannel *self, - LmMessageNode *query, + WockyNode *query, GHashTable *terms) { GHashTableIter iter; @@ -920,32 +919,30 @@ build_unextended_query ( g_assert (xmpp_field != NULL); - lm_message_node_add_child (query, xmpp_field, value); + wocky_node_add_child_with_content (query, xmpp_field, value); } } static void build_extended_query (GabbleSearchChannel *self, - LmMessageNode *query, + WockyNode *query, GHashTable *terms) { - LmMessageNode *x, *field; + WockyNode *x, *field; GHashTableIter iter; gpointer key, value; - x = lm_message_node_add_child (query, "x", ""); - lm_message_node_set_attributes (x, - "type", "submit", - "xmlns", NS_X_DATA, - NULL); + x = wocky_node_add_child_with_content (query, "x", ""); + x->ns = g_quark_from_static_string (NS_X_DATA); + wocky_node_set_attribute (x, "type", "submit"); /* add FORM_TYPE */ - field = lm_message_node_add_child (x, "field", ""); - lm_message_node_set_attributes (field, + field = wocky_node_add_child_with_content (x, "field", ""); + wocky_node_set_attributes (field, "type", "hidden", "var", "FORM_TYPE", NULL); - lm_message_node_add_child (field, "value", NS_SEARCH); + wocky_node_add_child_with_content (field, "value", NS_SEARCH); /* Add search terms */ g_hash_table_iter_init (&iter, terms); @@ -957,9 +954,9 @@ build_extended_query (GabbleSearchChannel *self, g_assert (xmpp_field != NULL); - field = lm_message_node_add_child (x, "field", ""); - lm_message_node_set_attribute (field, "var", xmpp_field); - lm_message_node_add_child (field, "value", value); + field = wocky_node_add_child_with_content (x, "field", ""); + wocky_node_set_attribute (field, "var", xmpp_field); + wocky_node_add_child_with_content (field, "value", value); if (!tp_strdiff (tp_name, "")) { @@ -970,12 +967,12 @@ build_extended_query (GabbleSearchChannel *self, { xmpp_field = g_ptr_array_index (self->priv->boolean_keys, i); - field = lm_message_node_add_child (x, "field", ""); - lm_message_node_set_attributes (field, + field = wocky_node_add_child_with_content (x, "field", ""); + wocky_node_set_attributes (field, "var", xmpp_field, "type", "boolean", NULL); - lm_message_node_add_child (field, "value", "1"); + wocky_node_add_child_with_content (field, "value", "1"); } } } @@ -989,7 +986,7 @@ do_search (GabbleSearchChannel *chan, TpBaseChannel *base = TP_BASE_CHANNEL (chan); TpBaseConnection *base_conn = tp_base_channel_get_connection (base); LmMessage *msg; - LmMessageNode *query; + WockyNode *query; gboolean ret; DEBUG ("called"); @@ -999,9 +996,9 @@ do_search (GabbleSearchChannel *chan, msg = lm_message_new_with_sub_type (chan->priv->server, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_SET); - query = lm_message_node_add_child ( + query = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "query", NULL); - lm_message_node_set_attribute (query, "xmlns", NS_SEARCH); + query->ns = g_quark_from_string (NS_SEARCH); if (chan->priv->xforms) { diff --git a/src/tube-dbus.c b/src/tube-dbus.c index 9581e797b..173f36a4d 100644 --- a/src/tube-dbus.c +++ b/src/tube-dbus.c @@ -1234,7 +1234,7 @@ gabble_tube_dbus_offer (GabbleTubeDBus *tube, const gchar *jid, *resource; gchar *full_jid; GabblePresence *presence; - LmMessageNode *tube_node, *si_node; + WockyNode *tube_node, *si_node; LmMessage *msg; gboolean result; @@ -1270,8 +1270,8 @@ gabble_tube_dbus_offer (GabbleTubeDBus *tube, wocky_stanza_get_top_node (msg), "si", NS_SI); g_assert (si_node != NULL); - tube_node = lm_message_node_add_child (si_node, "tube", NULL); - lm_message_node_set_attribute (tube_node, "xmlns", NS_TUBES); + tube_node = wocky_node_add_child_with_content (si_node, "tube", NULL); + tube_node->ns = g_quark_from_string (NS_TUBES); gabble_tube_iface_publish_in_node (GABBLE_TUBE_IFACE (tube), (TpBaseConnection *) priv->conn, tube_node); @@ -1563,13 +1563,13 @@ gabble_tube_dbus_new (GabbleConnection *conn, } static void -augment_si_accept_iq (LmMessageNode *si, +augment_si_accept_iq (WockyNode *si, gpointer user_data) { - LmMessageNode *tube_node; + WockyNode *tube_node; - tube_node = lm_message_node_add_child (si, "tube", ""); - lm_message_node_set_attribute (tube_node, "xmlns", NS_TUBES); + tube_node = wocky_node_add_child_with_content (si, "tube", ""); + tube_node->ns = g_quark_from_string (NS_TUBES); } /* diff --git a/src/tube-iface.c b/src/tube-iface.c index 31e2118ab..2563d16e8 100644 --- a/src/tube-iface.c +++ b/src/tube-iface.c @@ -171,9 +171,9 @@ gabble_tube_iface_get_type (void) void gabble_tube_iface_publish_in_node (GabbleTubeIface *tube, TpBaseConnection *conn, - LmMessageNode *node) + WockyNode *node) { - LmMessageNode *parameters_node; + WockyNode *parameters_node; GHashTable *parameters; TpTubeType type; gchar *service, *id_str; @@ -192,7 +192,7 @@ gabble_tube_iface_publish_in_node (GabbleTubeIface *tube, id_str = g_strdup_printf ("%u", tube_id); - lm_message_node_set_attributes (node, + wocky_node_set_attributes (node, "service", service, "id", id_str, NULL); @@ -210,14 +210,14 @@ gabble_tube_iface_publish_in_node (GabbleTubeIface *tube, "dbus-name", &name, NULL); - lm_message_node_set_attributes (node, + wocky_node_set_attributes (node, "type", "dbus", "stream-id", stream_id, "initiator", tp_handle_inspect (contact_repo, initiator_handle), NULL); if (name != NULL) - lm_message_node_set_attribute (node, "dbus-name", name); + wocky_node_set_attribute (node, "dbus-name", name); g_free (name); g_free (stream_id); @@ -225,7 +225,7 @@ gabble_tube_iface_publish_in_node (GabbleTubeIface *tube, break; case TP_TUBE_TYPE_STREAM: { - lm_message_node_set_attribute (node, "type", "stream"); + wocky_node_set_attribute (node, "type", "stream"); } break; default: @@ -234,7 +234,7 @@ gabble_tube_iface_publish_in_node (GabbleTubeIface *tube, } } - parameters_node = lm_message_node_add_child (node, "parameters", + parameters_node = wocky_node_add_child_with_content (node, "parameters", NULL); lm_message_node_add_children_from_properties (parameters_node, parameters, "parameter"); diff --git a/src/tube-iface.h b/src/tube-iface.h index b7bee5bfb..311bf65bc 100644 --- a/src/tube-iface.h +++ b/src/tube-iface.h @@ -60,7 +60,7 @@ void gabble_tube_iface_add_bytestream (GabbleTubeIface *tube, GabbleBytestreamIface *bytestream); void gabble_tube_iface_publish_in_node (GabbleTubeIface *tube, - TpBaseConnection *conn, LmMessageNode *node); + TpBaseConnection *conn, WockyNode *node); G_END_DECLS diff --git a/src/tube-stream.c b/src/tube-stream.c index d87490a61..94c4d6fa9 100644 --- a/src/tube-stream.c +++ b/src/tube-stream.c @@ -472,7 +472,7 @@ start_stream_initiation (GabbleTubeStream *self, GError **error) { GabbleTubeStreamPrivate *priv; - LmMessageNode *node, *si_node; + WockyNode *node, *si_node; LmMessage *msg; TpHandleRepoIface *contact_repo; const gchar *jid; @@ -533,17 +533,15 @@ start_stream_initiation (GabbleTubeStream *self, if (priv->handle_type == TP_HANDLE_TYPE_CONTACT) { - node = lm_message_node_add_child (si_node, "stream", NULL); + node = wocky_node_add_child_with_content (si_node, "stream", NULL); } else { - node = lm_message_node_add_child (si_node, "muc-stream", NULL); + node = wocky_node_add_child_with_content (si_node, "muc-stream", NULL); } - lm_message_node_set_attributes (node, - "xmlns", NS_TUBES, - "tube", id_str, - NULL); + node->ns = g_quark_from_static_string (NS_TUBES); + wocky_node_set_attribute (node, "tube", id_str); result = gabble_bytestream_factory_negotiate_stream ( priv->conn->bytestream_factory, msg, stream_id, @@ -1933,13 +1931,13 @@ gabble_tube_stream_close (GabbleTubeIface *tube, gboolean closed_remotely) } static void -augment_si_accept_iq (LmMessageNode *si, +augment_si_accept_iq (WockyNode *si, gpointer user_data) { - LmMessageNode *tube_node; + WockyNode *tube_node; - tube_node = lm_message_node_add_child (si, "tube", ""); - lm_message_node_set_attribute (tube_node, "xmlns", NS_TUBES); + tube_node = wocky_node_add_child_with_content (si, "tube", ""); + tube_node->ns = g_quark_from_string (NS_TUBES); } /** @@ -2225,7 +2223,7 @@ send_tube_offer (GabbleTubeStream *self, GError **error) { GabbleTubeStreamPrivate *priv = GABBLE_TUBE_STREAM_GET_PRIVATE (self); - LmMessageNode *tube_node = NULL; + WockyNode *tube_node = NULL; LmMessage *msg; TpHandleRepoIface *contact_repo; const gchar *jid; diff --git a/src/tubes-channel.c b/src/tubes-channel.c index aac9d677b..87f4ac90a 100644 --- a/src/tubes-channel.c +++ b/src/tubes-channel.c @@ -596,7 +596,7 @@ create_new_tube (GabbleTubesChannel *self, static gboolean extract_tube_information (GabbleTubesChannel *self, - LmMessageNode *tube_node, + WockyNode *tube_node, TpTubeType *type, TpHandle *initiator_handle, const gchar **service, @@ -611,7 +611,7 @@ extract_tube_information (GabbleTubesChannel *self, { const gchar *_type; - _type = lm_message_node_get_attribute (tube_node, "type"); + _type = wocky_node_get_attribute (tube_node, "type"); if (!tp_strdiff (_type, "stream")) { @@ -632,7 +632,7 @@ extract_tube_information (GabbleTubesChannel *self, { const gchar *initiator; - initiator = lm_message_node_get_attribute (tube_node, "initiator"); + initiator = wocky_node_get_attribute (tube_node, "initiator"); if (initiator != NULL) { @@ -653,14 +653,14 @@ extract_tube_information (GabbleTubesChannel *self, if (service != NULL) { - *service = lm_message_node_get_attribute (tube_node, "service"); + *service = wocky_node_get_attribute (tube_node, "service"); } if (parameters != NULL) { - LmMessageNode *node; + WockyNode *node; - node = lm_message_node_get_child (tube_node, "parameters"); + node = wocky_node_get_child (tube_node, "parameters"); *parameters = lm_message_node_extract_properties (node, "parameter"); } @@ -670,7 +670,7 @@ extract_tube_information (GabbleTubesChannel *self, gchar *endptr; unsigned long tmp; - str = lm_message_node_get_attribute (tube_node, "id"); + str = wocky_node_get_attribute (tube_node, "id"); if (str == NULL) { DEBUG ("no tube id in SI request"); @@ -813,10 +813,10 @@ contact_left_muc (GabbleTubesChannel *self, void gabble_tubes_channel_presence_updated (GabbleTubesChannel *self, TpHandle contact, - LmMessageNode *pnode) + WockyNode *pnode) { GabbleTubesChannelPrivate *priv = self->priv; - LmMessageNode *tubes_node; + WockyNode *tubes_node; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); NodeIter i; @@ -831,7 +831,7 @@ gabble_tubes_channel_presence_updated (GabbleTubesChannel *self, /* We are interested by this presence only if it contains tube information * or indicates someone left the muc */ - presence_type = lm_message_node_get_attribute (pnode, "type"); + presence_type = wocky_node_get_attribute (pnode, "type"); if (!tp_strdiff (presence_type, "unavailable")) { contact_left_muc (self, contact); @@ -853,13 +853,13 @@ gabble_tubes_channel_presence_updated (GabbleTubesChannel *self, for (i = node_iter (tubes_node); i; i = node_iter_next (i)) { - LmMessageNode *tube_node = node_iter_data (i); + WockyNode *tube_node = node_iter_data (i); const gchar *stream_id; GabbleTubeIface *tube; guint tube_id; TpTubeType type; - stream_id = lm_message_node_get_attribute (tube_node, "stream-id"); + stream_id = wocky_node_get_attribute (tube_node, "stream-id"); if (!extract_tube_information (self, tube_node, NULL, NULL, NULL, NULL, &tube_id)) @@ -941,7 +941,7 @@ gabble_tubes_channel_presence_updated (GabbleTubesChannel *self, /* Contact just joined the tube */ const gchar *new_name; - new_name = lm_message_node_get_attribute (tube_node, + new_name = wocky_node_get_attribute (tube_node, "dbus-name"); if (!new_name) @@ -1087,7 +1087,7 @@ gabble_tubes_channel_list_tubes (TpSvcChannelTypeTubes *iface, struct _i_hate_g_hash_table_foreach { GabbleTubesChannel *self; - LmMessageNode *tubes_node; + WockyNode *tubes_node; }; static void @@ -1100,7 +1100,7 @@ publish_tubes_in_node (gpointer key, (struct _i_hate_g_hash_table_foreach *) user_data; GabbleTubesChannelPrivate *priv = data->self->priv; TpTubeChannelState state; - LmMessageNode *tube_node; + WockyNode *tube_node; TpTubeType type; TpHandle initiator; @@ -1120,7 +1120,7 @@ publish_tubes_in_node (gpointer key, /* We only announce stream tubes we initiated */ return; - tube_node = lm_message_node_add_child (data->tubes_node, "tube", NULL); + tube_node = wocky_node_add_child_with_content (data->tubes_node, "tube", NULL); gabble_tube_iface_publish_in_node (tube, (TpBaseConnection *) priv->conn, tube_node); } @@ -1132,12 +1132,12 @@ pre_presence_cb (GabbleMucChannel *muc, { GabbleTubesChannelPrivate *priv = self->priv; struct _i_hate_g_hash_table_foreach data; - LmMessageNode *node; + WockyNode *node; /* Augment the muc presence with tubes information */ - node = lm_message_node_add_child ( + node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "tubes", NULL); - lm_message_node_set_attribute (node, "xmlns", NS_TUBES); + node->ns = g_quark_from_string (NS_TUBES); data.self = self; data.tubes_node = node; @@ -1167,7 +1167,7 @@ gabble_tubes_channel_tube_si_offered (GabbleTubesChannel *self, const gchar *service, *stream_id; GHashTable *parameters; TpTubeType type; - LmMessageNode *si_node, *tube_node; + WockyNode *si_node, *tube_node; guint tube_id; GabbleTubeIface *tube; @@ -1179,7 +1179,7 @@ gabble_tubes_channel_tube_si_offered (GabbleTubesChannel *self, si_node = lm_message_node_get_child_with_namespace ( wocky_stanza_get_top_node (msg), "si", NS_SI); g_return_if_fail (si_node != NULL); - stream_id = lm_message_node_get_attribute (si_node, "id"); + stream_id = wocky_node_get_attribute (si_node, "id"); g_return_if_fail (stream_id != NULL); tube_node = lm_message_node_get_child_with_namespace (si_node, "tube", NS_TUBES); @@ -1252,7 +1252,7 @@ gabble_tubes_channel_bytestream_offered (GabbleTubesChannel *self, GabbleTubesChannelPrivate *priv = self->priv; const gchar *stream_id, *tmp; gchar *endptr; - LmMessageNode *si_node, *stream_node; + WockyNode *si_node, *stream_node; guint tube_id; unsigned long tube_id_tmp; GabbleTubeIface *tube; @@ -1275,10 +1275,10 @@ gabble_tubes_channel_bytestream_offered (GabbleTubesChannel *self, "muc-stream", NS_TUBES); g_return_if_fail (stream_node != NULL); - stream_id = lm_message_node_get_attribute (si_node, "id"); + stream_id = wocky_node_get_attribute (si_node, "id"); g_return_if_fail (stream_id != NULL); - tmp = lm_message_node_get_attribute (stream_node, "tube"); + tmp = wocky_node_get_attribute (stream_node, "tube"); if (tmp == NULL) { GError e = { GABBLE_XMPP_ERROR, XMPP_ERROR_BAD_REQUEST, @@ -1367,7 +1367,7 @@ tube_msg_offered (GabbleTubesChannel *self, const gchar *service; GHashTable *parameters; TpTubeType type; - LmMessageNode *tube_node; + WockyNode *tube_node; guint tube_id; GabbleTubeIface *tube; @@ -1423,7 +1423,7 @@ tube_msg_close (GabbleTubesChannel *self, LmMessage *msg) { GabbleTubesChannelPrivate *priv = self->priv; - LmMessageNode *close_node; + WockyNode *close_node; guint tube_id; const gchar *tmp; gchar *endptr; @@ -1434,7 +1434,7 @@ tube_msg_close (GabbleTubesChannel *self, wocky_stanza_get_top_node (msg), "close", NS_TUBES); g_assert (close_node != NULL); - tmp = lm_message_node_get_attribute (close_node, "tube"); + tmp = wocky_node_get_attribute (close_node, "tube"); if (tmp == NULL) { DEBUG ("no tube id in close message"); @@ -1470,7 +1470,7 @@ void gabble_tubes_channel_tube_msg (GabbleTubesChannel *self, LmMessage *msg) { - LmMessageNode *node; + WockyNode *node; node = lm_message_node_get_child_with_namespace ( wocky_stanza_get_top_node (msg), "tube", NS_TUBES); diff --git a/src/tubes-channel.h b/src/tubes-channel.h index 8f761f9c7..ad9df21f1 100644 --- a/src/tubes-channel.h +++ b/src/tubes-channel.h @@ -77,7 +77,7 @@ GabbleTubeIface *gabble_tubes_channel_tube_request (GabbleTubesChannel *self, gboolean require_new); void gabble_tubes_channel_presence_updated (GabbleTubesChannel *chan, - TpHandle contact, LmMessageNode *presence); + TpHandle contact, WockyNode *presence); void gabble_tubes_channel_tube_si_offered (GabbleTubesChannel *chan, GabbleBytestreamIface *bytestream, LmMessage *msg); diff --git a/src/util.c b/src/util.c index 8203165df..85c9a42c8 100644 --- a/src/util.c +++ b/src/util.c @@ -137,16 +137,16 @@ gabble_generate_id (void) static void -lm_message_node_add_nick (LmMessageNode *node, const gchar *nick) +lm_message_node_add_nick (WockyNode *node, const gchar *nick) { - LmMessageNode *nick_node; + WockyNode *nick_node; - nick_node = lm_message_node_add_child (node, "nick", nick); - lm_message_node_set_attribute (nick_node, "xmlns", NS_NICK); + nick_node = wocky_node_add_child_with_content (node, "nick", nick); + nick_node->ns = g_quark_from_string (NS_NICK); } void -lm_message_node_add_own_nick (LmMessageNode *node, +lm_message_node_add_own_nick (WockyNode *node, GabbleConnection *connection) { gchar *nick; @@ -164,8 +164,8 @@ lm_message_node_add_own_nick (LmMessageNode *node, void -lm_message_node_steal_children (LmMessageNode *snatcher, - LmMessageNode *mum) +lm_message_node_steal_children (WockyNode *snatcher, + WockyNode *mum) { g_return_if_fail (snatcher->children == NULL); @@ -176,16 +176,16 @@ lm_message_node_steal_children (LmMessageNode *snatcher, mum->children = NULL; } -/* variant of lm_message_node_get_child() which ignores node namespace +/* variant of wocky_node_get_child() which ignores node namespace * prefix */ -LmMessageNode * -lm_message_node_get_child_any_ns (LmMessageNode *node, const gchar *name) +WockyNode * +wocky_node_get_child_any_ns (WockyNode *node, const gchar *name) { NodeIter i; for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); if (!tp_strdiff (lm_message_node_get_name (child), name)) return child; @@ -195,31 +195,31 @@ lm_message_node_get_child_any_ns (LmMessageNode *node, const gchar *name) } const gchar * -lm_message_node_get_namespace (LmMessageNode *node) +lm_message_node_get_namespace (WockyNode *node) { return wocky_node_get_ns (node); } const gchar * -lm_message_node_get_name (LmMessageNode *node) +lm_message_node_get_name (WockyNode *node) { return node->name; } gboolean -lm_message_node_has_namespace (LmMessageNode *node, +lm_message_node_has_namespace (WockyNode *node, const gchar *ns, const gchar *tag) { return (!tp_strdiff (lm_message_node_get_namespace (node), ns)); } -LmMessageNode * -lm_message_node_get_child_with_namespace (LmMessageNode *node, +WockyNode * +lm_message_node_get_child_with_namespace (WockyNode *node, const gchar *name, const gchar *ns) { - LmMessageNode *found; + WockyNode *found; NodeIter i; found = wocky_node_get_child_ns (node, name, ns); @@ -228,7 +228,7 @@ lm_message_node_get_child_with_namespace (LmMessageNode *node, for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); found = lm_message_node_get_child_with_namespace (child, name, ns); if (found != NULL) @@ -255,7 +255,7 @@ enum { * Used to implement lm_message_build and lm_message_build_with_sub_type. */ static void -lm_message_node_add_build_va (LmMessageNode *node, guint spec, va_list ap) +lm_message_node_add_build_va (WockyNode *node, guint spec, va_list ap) { GSList *stack = NULL; guint arg = spec; @@ -273,7 +273,7 @@ lm_message_node_add_build_va (LmMessageNode *node, guint spec, va_list ap) g_return_if_fail (key != NULL); g_return_if_fail (value != NULL); - lm_message_node_set_attribute (stack->data, key, value); + wocky_node_set_attribute (stack->data, key, value); } break; @@ -281,11 +281,11 @@ lm_message_node_add_build_va (LmMessageNode *node, guint spec, va_list ap) { gchar *name = va_arg (ap, gchar *); gchar *value = va_arg (ap, gchar *); - LmMessageNode *child; + WockyNode *child; g_return_if_fail (name != NULL); g_return_if_fail (value != NULL); - child = lm_message_node_add_child (stack->data, name, value); + child = wocky_node_add_child_with_content (stack->data, name, value); stack = g_slist_prepend (stack, child); } break; @@ -303,7 +303,7 @@ lm_message_node_add_build_va (LmMessageNode *node, guint spec, va_list ap) case BUILD_POINTER: { - LmMessageNode **assign_to = va_arg (ap, LmMessageNode **); + WockyNode **assign_to = va_arg (ap, WockyNode **); g_return_if_fail (assign_to != NULL); *assign_to = stack->data; @@ -639,7 +639,7 @@ OUT: * */ GHashTable * -lm_message_node_extract_properties (LmMessageNode *node, +lm_message_node_extract_properties (WockyNode *node, const gchar *prop) { GHashTable *properties; @@ -653,7 +653,7 @@ lm_message_node_extract_properties (LmMessageNode *node, for (i = node_iter (node); i; i = node_iter_next (i)) { - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); const gchar *name; const gchar *type; const gchar *value; @@ -662,13 +662,13 @@ lm_message_node_extract_properties (LmMessageNode *node, if (0 != strcmp (child->name, prop)) continue; - name = lm_message_node_get_attribute (child, "name"); + name = wocky_node_get_attribute (child, "name"); if (!name) continue; - type = lm_message_node_get_attribute (child, "type"); - value = lm_message_node_get_value (child); + type = wocky_node_get_attribute (child, "type"); + value = child->content; if (type == NULL || value == NULL) continue; @@ -741,7 +741,7 @@ lm_message_node_extract_properties (LmMessageNode *node, struct _set_child_from_property_data { - LmMessageNode *node; + WockyNode *node; const gchar *prop; }; @@ -753,7 +753,7 @@ set_child_from_property (gpointer key, GValue *gvalue = value; struct _set_child_from_property_data *data = (struct _set_child_from_property_data *) user_data; - LmMessageNode *child; + WockyNode *child; const char *type = NULL; if (G_VALUE_TYPE (gvalue) == G_TYPE_STRING) @@ -784,11 +784,11 @@ set_child_from_property (gpointer key, return; } - child = lm_message_node_add_child (data->node, data->prop, ""); + child = wocky_node_add_child_with_content (data->node, data->prop, ""); if (G_VALUE_TYPE (gvalue) == G_TYPE_STRING) { - lm_message_node_set_value (child, + wocky_node_set_content (child, g_value_get_string (gvalue)); } else if (G_VALUE_TYPE (gvalue) == DBUS_TYPE_G_UCHAR_ARRAY) @@ -799,7 +799,7 @@ set_child_from_property (gpointer key, type = "bytes"; arr = g_value_get_boxed (gvalue); str = base64_encode (arr->len, arr->data, FALSE); - lm_message_node_set_value (child, str); + wocky_node_set_content (child, str); g_free (str); } @@ -808,7 +808,7 @@ set_child_from_property (gpointer key, gchar *str; str = g_strdup_printf ("%d", g_value_get_int (gvalue)); - lm_message_node_set_value (child, str); + wocky_node_set_content (child, str); g_free (str); } @@ -817,7 +817,7 @@ set_child_from_property (gpointer key, gchar *str; str = g_strdup_printf ("%u", g_value_get_uint (gvalue)); - lm_message_node_set_value (child, str); + wocky_node_set_content (child, str); g_free (str); } @@ -826,7 +826,7 @@ set_child_from_property (gpointer key, /* we output as "0" or "1" despite the canonical representation for * xs:boolean being "false" or "true", for compatibility with older * Gabble versions (OLPC Trial-3) */ - lm_message_node_set_value (child, + wocky_node_set_content (child, g_value_get_boolean (gvalue) ? "1" : "0"); } else @@ -834,8 +834,8 @@ set_child_from_property (gpointer key, g_assert_not_reached (); } - lm_message_node_set_attribute (child, "name", key); - lm_message_node_set_attribute (child, "type", type); + wocky_node_set_attribute (child, "name", key); + wocky_node_set_attribute (child, "type", type); } /** @@ -857,7 +857,7 @@ set_child_from_property (gpointer key, * */ void -lm_message_node_add_children_from_properties (LmMessageNode *node, +lm_message_node_add_children_from_properties (WockyNode *node, GHashTable *properties, const gchar *prop) { @@ -881,7 +881,7 @@ LmMessage * lm_iq_message_make_result (LmMessage *iq_message) { LmMessage *result; - LmMessageNode *iq, *result_iq; + WockyNode *iq, *result_iq; const gchar *from_jid, *id; g_assert (lm_message_get_type (iq_message) == LM_MESSAGE_TYPE_IQ); @@ -889,7 +889,7 @@ lm_iq_message_make_result (LmMessage *iq_message) lm_message_get_sub_type (iq_message) == LM_MESSAGE_SUB_TYPE_SET); iq = lm_message_get_node (iq_message); - id = lm_message_node_get_attribute (iq, "id"); + id = wocky_node_get_attribute (iq, "id"); if (id == NULL) { @@ -897,12 +897,12 @@ lm_iq_message_make_result (LmMessage *iq_message) return NULL; } - from_jid = lm_message_node_get_attribute (iq, "from"); + from_jid = wocky_node_get_attribute (iq, "from"); result = lm_message_new_with_sub_type (from_jid, LM_MESSAGE_TYPE_IQ, LM_MESSAGE_SUB_TYPE_RESULT); result_iq = lm_message_get_node (result); - lm_message_node_set_attribute (result_iq, "id", id); + wocky_node_set_attribute (result_iq, "id", id); return result; } @@ -1056,7 +1056,7 @@ typedef struct { } Attribute; const gchar * -lm_message_node_get_attribute_with_namespace (LmMessageNode *node, +wocky_node_get_attribute_with_namespace (WockyNode *node, const gchar *attribute, const gchar *ns) { diff --git a/src/util.h b/src/util.h index 9727e60de..d2550d806 100644 --- a/src/util.h +++ b/src/util.h @@ -40,7 +40,7 @@ typedef GSList * NodeIter; #define node_iter(node) (node->children) #define node_iter_next(i) (g_slist_next (i)) -#define node_iter_data(i) ((LmMessageNode *) i->data) +#define node_iter_data(i) ((WockyNode *) i->data) /* Guarantees that the resulting hash is in lower-case */ gchar *sha1_hex (const gchar *bytes, guint len); @@ -51,13 +51,13 @@ void sha1_bin (const gchar *bytes, guint len, guchar out[SHA1_HASH_SIZE]); gchar *gabble_generate_id (void); -void lm_message_node_add_own_nick (LmMessageNode *node, +void lm_message_node_add_own_nick (WockyNode *node, GabbleConnection *conn); -void lm_message_node_steal_children (LmMessageNode *snatcher, - LmMessageNode *mum); -gboolean lm_message_node_has_namespace (LmMessageNode *node, const gchar *ns, +void lm_message_node_steal_children (WockyNode *snatcher, + WockyNode *mum); +gboolean lm_message_node_has_namespace (WockyNode *node, const gchar *ns, const gchar *tag); -LmMessageNode *lm_message_node_get_child_with_namespace (LmMessageNode *node, +WockyNode *lm_message_node_get_child_with_namespace (WockyNode *node, const gchar *name, const gchar *ns); G_GNUC_NULL_TERMINATED LmMessage *lm_message_build (const gchar *to, LmMessageType type, guint spec, ...); @@ -78,14 +78,14 @@ gchar *gabble_normalize_room (TpHandleRepoIface *repo, const gchar *jid, TpHandle gabble_get_room_handle_from_jid (TpHandleRepoIface *room_repo, const gchar *jid); -GHashTable *lm_message_node_extract_properties (LmMessageNode *node, +GHashTable *lm_message_node_extract_properties (WockyNode *node, const gchar *prop); void -lm_message_node_add_children_from_properties (LmMessageNode *node, +lm_message_node_add_children_from_properties (WockyNode *node, GHashTable *properties, const gchar *prop); -const gchar * lm_message_node_get_namespace (LmMessageNode *node); -const gchar * lm_message_node_get_name (LmMessageNode *node); -LmMessageNode * lm_message_node_get_child_any_ns (LmMessageNode *node, +const gchar * lm_message_node_get_namespace (WockyNode *node); +const gchar * lm_message_node_get_name (WockyNode *node); +WockyNode * wocky_node_get_child_any_ns (WockyNode *node, const gchar *name); LmMessage * @@ -95,7 +95,7 @@ void gabble_signal_connect_weak (gpointer instance, const gchar *detailed_signal GCallback c_handler, GObject *user_data); guint gabble_idle_add_weak (GSourceFunc function, GObject *object); -const gchar * lm_message_node_get_attribute_with_namespace (LmMessageNode *node, +const gchar * wocky_node_get_attribute_with_namespace (WockyNode *node, const gchar *attribute, const gchar *ns); diff --git a/src/vcard-manager.c b/src/vcard-manager.c index 87dd58b8e..24a2667bf 100644 --- a/src/vcard-manager.c +++ b/src/vcard-manager.c @@ -154,7 +154,7 @@ struct _GabbleVCardManagerPrivate /* Patched vCard that we sent to the server to update, but haven't * got confirmation yet. We don't want to store it in cache (visible * to others) before we're sure the server accepts it. */ - LmMessageNode *patched_vcard; + WockyNode *patched_vcard; }; struct _GabbleVCardManagerRequest @@ -208,7 +208,7 @@ struct _GabbleVCardCacheEntry guint suspended_timer_id; /* VCard node for this entry (owned reference), or NULL if there's no node */ - LmMessageNode *vcard_node; + WockyNode *vcard_node; /* If @vcard_node is not NULL, the time the message will expire */ time_t expires; @@ -235,7 +235,7 @@ gabble_vcard_manager_cache_quark (void) static void cache_entry_free (void *data); static gint cache_entry_compare (gconstpointer a, gconstpointer b); static void manager_patch_vcard ( - GabbleVCardManager *self, LmMessageNode *vcard_node); + GabbleVCardManager *self, WockyNode *vcard_node); static void request_send (GabbleVCardManagerRequest *request, guint timeout); @@ -350,6 +350,42 @@ gabble_vcard_manager_set_property (GObject *object, } } +static gboolean +copy_attribute (const gchar *key, + const gchar *value, + const gchar *prefix, + const gchar *ns, + gpointer user_data) +{ + WockyNode *copy = (WockyNode *) user_data; + + wocky_node_set_attribute_ns (copy, key, value, ns); + return TRUE; +} + +static WockyNode * +copy_node (WockyNode *node) +{ + WockyNode *copy; + GSList *l; + + copy = wocky_node_new (node->name, wocky_node_get_ns (node)); + wocky_node_set_content (copy, node->content); + wocky_node_set_language (copy, wocky_node_get_language (node)); + + wocky_node_each_attribute (node, copy_attribute, copy); + + for (l = node->children; l != NULL; l = g_slist_next (l)) + { + WockyNode *child = l->data; + + copy->children = g_slist_prepend (copy->children, copy_node (child)); + } + copy->children = g_slist_reverse (copy->children); + + return copy; +} + static void delete_request (GabbleVCardManagerRequest *request); static void cancel_request (GabbleVCardManagerRequest *request); static void cancel_all_edit_requests (GabbleVCardManager *manager); @@ -382,7 +418,7 @@ cache_entry_free (gpointer data) gabble_request_pipeline_item_cancel (entry->pipeline_item); } - tp_clear_pointer (&entry->vcard_node, lm_message_node_unref); + tp_clear_pointer (&entry->vcard_node, wocky_node_free); tp_handle_unref (contact_repo, entry->handle); @@ -503,13 +539,13 @@ gabble_vcard_manager_invalidate_cache (GabbleVCardManager *manager, tp_heap_remove (priv->timed_cache, entry); - tp_clear_pointer (&entry->vcard_node, lm_message_node_unref); + tp_clear_pointer (&entry->vcard_node, wocky_node_free); cache_entry_attempt_to_free (entry); } static void complete_one_request (GabbleVCardManagerRequest *request, - LmMessageNode *vcard_node, GError *error); + WockyNode *vcard_node, GError *error); static void cache_entry_complete_requests (GabbleVCardCacheEntry *entry, GError *error) @@ -530,7 +566,7 @@ cache_entry_complete_requests (GabbleVCardCacheEntry *entry, GError *error) static void complete_one_request (GabbleVCardManagerRequest *request, - LmMessageNode *vcard_node, + WockyNode *vcard_node, GError *error) { if (request->callback) @@ -609,26 +645,26 @@ gabble_vcard_manager_finalize (GObject *object) } gchar * -vcard_get_avatar_sha1 (LmMessageNode *vcard) +vcard_get_avatar_sha1 (WockyNode *vcard) { gchar *sha1; const gchar *binval_value; GString *avatar; - LmMessageNode *node; - LmMessageNode *binval; + WockyNode *node; + WockyNode *binval; - node = lm_message_node_get_child (vcard, "PHOTO"); + node = wocky_node_get_child (vcard, "PHOTO"); if (!node) return g_strdup (""); DEBUG ("Our vCard has a PHOTO %p", node); - binval = lm_message_node_get_child (node, "BINVAL"); + binval = wocky_node_get_child (node, "BINVAL"); if (!binval) return g_strdup (""); - binval_value = lm_message_node_get_value (binval); + binval_value = binval->content; if (!binval_value) return g_strdup (""); @@ -655,7 +691,7 @@ static void initial_request_cb (GabbleVCardManager *self, GabbleVCardManagerRequest *request, TpHandle handle, - LmMessageNode *vcard, + WockyNode *vcard, GError *error, gpointer user_data) { @@ -810,17 +846,17 @@ cancel_request (GabbleVCardManagerRequest *request) } static gchar * -extract_nickname (LmMessageNode *vcard_node) +extract_nickname (WockyNode *vcard_node) { - LmMessageNode *node; + WockyNode *node; const gchar *nick; - node = lm_message_node_get_child (vcard_node, "NICKNAME"); + node = wocky_node_get_child (vcard_node, "NICKNAME"); if (node == NULL) return NULL; - nick = lm_message_node_get_value (node); + nick = node->content; return g_strdup (nick); } @@ -829,7 +865,7 @@ static void observe_vcard (GabbleConnection *conn, GabbleVCardManager *manager, TpHandle handle, - LmMessageNode *vcard_node) + WockyNode *vcard_node) { TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( (TpBaseConnection *) conn, TP_HANDLE_TYPE_CONTACT); @@ -841,11 +877,11 @@ observe_vcard (GabbleConnection *conn, if (alias == NULL) { - LmMessageNode *fn_node = lm_message_node_get_child (vcard_node, "FN"); + WockyNode *fn_node = wocky_node_get_child (vcard_node, "FN"); if (fn_node != NULL) { - const gchar *fn = lm_message_node_get_value (fn_node); + const gchar *fn = fn_node->content; if (!CHECK_STR_EMPTY(fn)) { @@ -901,7 +937,7 @@ replace_reply_cb (GabbleConnection *conn, GabbleVCardManagerPrivate *priv = self->priv; TpBaseConnection *base = (TpBaseConnection *) conn; GList *li; - LmMessageNode *node = NULL; + WockyNode *node = NULL; /* If we sent a SET request, it's dead now. */ priv->edit_pipeline_item = NULL; @@ -911,7 +947,7 @@ replace_reply_cb (GabbleConnection *conn, if (error) { /* We won't need our patched vcard after all */ - tp_clear_pointer (&priv->patched_vcard, lm_message_node_unref); + tp_clear_pointer (&priv->patched_vcard, wocky_node_free); } else { @@ -921,7 +957,7 @@ replace_reply_cb (GabbleConnection *conn, g_assert (priv->patched_vcard != NULL); /* Finally we may put the new vcard in the cache. */ - tp_clear_pointer (&entry->vcard_node, lm_message_node_unref); + tp_clear_pointer (&entry->vcard_node, wocky_node_free); entry->vcard_node = priv->patched_vcard; priv->patched_vcard = NULL; @@ -974,14 +1010,14 @@ replace_reply_cb (GabbleConnection *conn, * (NICKNAME, PHOTO and in future FN are the problematic ones). */ static gboolean gabble_vcard_manager_replace_is_significant (GabbleVCardManagerEditInfo *info, - LmMessageNode *old_vcard) + WockyNode *old_vcard) { gboolean seen = FALSE; NodeIter i; for (i = node_iter (old_vcard); i != NULL; i = node_iter_next (i)) { - LmMessageNode *node = node_iter_data (i); + WockyNode *node = node_iter_data (i); const gchar *value; const gchar *new_value; @@ -996,7 +1032,7 @@ gabble_vcard_manager_replace_is_significant (GabbleVCardManagerEditInfo *info, /* consider NULL and "" to be different representations for the * same thing */ - value = lm_message_node_get_value (node); + value = node->content; new_value = info->element_value; if (value == NULL) @@ -1024,11 +1060,11 @@ gabble_vcard_manager_replace_is_significant (GabbleVCardManagerEditInfo *info, child_iter = child_iter->next) { GabbleVCardChild *child = child_iter->data; - LmMessageNode *child_node = lm_message_node_get_child (node, + WockyNode *child_node = wocky_node_get_child (node, child->key); if (child_node == NULL || - tp_strdiff (lm_message_node_get_value (child_node), + tp_strdiff (child_node->content, child->value)) { return TRUE; @@ -1048,17 +1084,17 @@ gabble_vcard_manager_replace_is_significant (GabbleVCardManagerEditInfo *info, return !seen; } -static LmMessageNode *vcard_copy (LmMessageNode *parent, LmMessageNode *src, +static WockyNode *vcard_copy (WockyNode *parent, WockyNode *src, const gchar *exclude, gboolean *exclude_mattered); static LmMessage * gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info, - LmMessageNode *old_vcard, + WockyNode *old_vcard, GabbleVCardManager *vcard_manager) { LmMessage *msg; - LmMessageNode *vcard_node; - LmMessageNode *node; + WockyNode *vcard_node; + WockyNode *node; GList *iter; gboolean maybe_changed = FALSE; GabbleConnection *conn = vcard_manager->priv->connection; @@ -1087,7 +1123,7 @@ gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info, * */ gchar *alias; - node = lm_message_node_get_child (old_vcard, info->element_name); + node = wocky_node_get_child (old_vcard, info->element_name); /* If the user has set this field explicitly via SetContactInfo(), * that takes precedence */ @@ -1138,18 +1174,18 @@ gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info, if (info->edit_type == GABBLE_VCARD_EDIT_CLEAR) { /* start from a clean slate... */ - vcard_node = lm_message_node_add_child ( + vcard_node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (msg), "vCard", ""); - lm_message_node_set_attribute (vcard_node, "xmlns", "vcard-temp"); + vcard_node->ns = g_quark_from_string ("vcard-temp"); /* ... but as a special case, the photo gets copied in from the old * vCard, because SetContactInfo doesn't touch photos */ - node = lm_message_node_get_child (old_vcard, "PHOTO"); + node = wocky_node_get_child (old_vcard, "PHOTO"); if (node != NULL) vcard_copy (vcard_node, node, NULL, NULL); - /* Yes, we can do this: "LmMessageNode" is really a WockyNode */ + /* Yes, we can do this: "WockyNode" is really a WockyNode */ if (wocky_node_equal (old_vcard, vcard_node)) { /* nothing actually happened, forget it */ @@ -1179,14 +1215,14 @@ gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info, { maybe_changed = TRUE; - node = lm_message_node_add_child (vcard_node, + node = wocky_node_add_child_with_content (vcard_node, info->element_name, info->element_value); for (iter = info->children; iter != NULL; iter = iter->next) { GabbleVCardChild *child = iter->data; - lm_message_node_add_child (node, child->key, child->value); + wocky_node_add_child_with_content (node, child->key, child->value); } } @@ -1204,24 +1240,24 @@ gabble_vcard_manager_edit_info_apply (GabbleVCardManagerEditInfo *info, * * Note that this function doesn't copy any attributes other than * xmlns, because LM provides no way to iterate over attributes. Thanks, LM. */ -static LmMessageNode * -vcard_copy (LmMessageNode *parent, - LmMessageNode *src, +static WockyNode * +vcard_copy (WockyNode *parent, + WockyNode *src, const gchar *exclude, gboolean *exclude_mattered) { - LmMessageNode *new = lm_message_node_add_child (parent, src->name, - lm_message_node_get_value (src)); + WockyNode *new = wocky_node_add_child_with_content (parent, src->name, + src->content); const gchar *xmlns; NodeIter i; - xmlns = lm_message_node_get_attribute (src, "xmlns"); + xmlns = wocky_node_get_ns (src); if (xmlns != NULL) - lm_message_node_set_attribute (new, "xmlns", xmlns); + new->ns = g_quark_from_string (xmlns); for (i = node_iter (src); i; i = node_iter_next (i)) { - LmMessageNode *child = node_iter_data (i); + WockyNode *child = node_iter_data (i); if (tp_strdiff (child->name, exclude)) { @@ -1239,7 +1275,7 @@ vcard_copy (LmMessageNode *parent, static void manager_patch_vcard (GabbleVCardManager *self, - LmMessageNode *vcard_node) + WockyNode *vcard_node) { GabbleVCardManagerPrivate *priv = self->priv; LmMessage *msg = NULL; @@ -1266,7 +1302,7 @@ manager_patch_vcard (GabbleVCardManager *self, msg = new_msg; /* gabble_vcard_manager_edit_info_apply always returns an IQ message * with one vCard child */ - vcard_node = lm_message_node_get_child ( + vcard_node = wocky_node_get_child ( wocky_stanza_get_top_node (msg), "vCard"); g_assert (vcard_node != NULL); } @@ -1282,7 +1318,7 @@ manager_patch_vcard (GabbleVCardManager *self, /* We'll save the patched vcard, and if the server says * we're ok, put it into the cache. But we want to leave the * original vcard in the cache until that happens. */ - priv->patched_vcard = lm_message_node_ref (vcard_node); + priv->patched_vcard = copy_node (vcard_node); priv->edit_pipeline_item = gabble_request_pipeline_enqueue ( priv->connection->req_pipeline, msg, default_request_timeout, @@ -1339,7 +1375,7 @@ pipeline_reply_cb (GabbleConnection *conn, TpBaseConnection *base = (TpBaseConnection *) conn; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT); - LmMessageNode *vcard_node = NULL; + WockyNode *vcard_node = NULL; DEBUG("called for entry %p", entry); @@ -1358,7 +1394,7 @@ pipeline_reply_cb (GabbleConnection *conn, { /* First, handle the error "wait": suspend the request and replay it * later */ - LmMessageNode *error_node = NULL; + WockyNode *error_node = NULL; GabbleXmppError xmpp_error = XMPP_ERROR_UNDEFINED_CONDITION; GabbleXmppErrorType error_type = XMPP_ERROR_UNDEFINED_CONDITION; @@ -1366,7 +1402,7 @@ pipeline_reply_cb (GabbleConnection *conn, * from an XMPP stanza. */ if (reply_msg != NULL) - error_node = lm_message_node_get_child ( + error_node = wocky_node_get_child ( wocky_stanza_get_top_node (reply_msg), "error"); if (error_node != NULL) @@ -1408,7 +1444,7 @@ pipeline_reply_cb (GabbleConnection *conn, g_assert (reply_msg != NULL); - vcard_node = lm_message_node_get_child ( + vcard_node = wocky_node_get_child ( wocky_stanza_get_top_node (reply_msg), "vCard"); if (NULL == vcard_node) @@ -1417,14 +1453,14 @@ pipeline_reply_cb (GabbleConnection *conn, DEBUG ("successful lookup response contained no <vCard> node, " "creating an empty one"); - vcard_node = lm_message_node_add_child ( + vcard_node = wocky_node_add_child_with_content ( wocky_stanza_get_top_node (reply_msg), "vCard", NULL); - lm_message_node_set_attribute (vcard_node, "xmlns", NS_VCARD_TEMP); + vcard_node->ns = g_quark_from_string (NS_VCARD_TEMP); } /* Put the message in the cache */ - entry->vcard_node = lm_message_node_ref (vcard_node); + entry->vcard_node = copy_node (vcard_node); entry->expires = time (NULL) + VCARD_CACHE_ENTRY_TTL; tp_heap_add (priv->timed_cache, entry); @@ -1695,7 +1731,7 @@ gabble_vcard_manager_cancel_request (GabbleVCardManager *self, gboolean gabble_vcard_manager_get_cached (GabbleVCardManager *self, TpHandle handle, - LmMessageNode **node) + WockyNode **node) { GabbleVCardManagerPrivate *priv = self->priv; GabbleVCardCacheEntry *entry = g_hash_table_lookup (priv->cache, diff --git a/src/vcard-manager.h b/src/vcard-manager.h index 7c4cb44d9..35d63fb34 100644 --- a/src/vcard-manager.h +++ b/src/vcard-manager.h @@ -90,7 +90,7 @@ typedef enum { typedef void (*GabbleVCardManagerCb)(GabbleVCardManager *self, GabbleVCardManagerRequest *request, TpHandle handle, - LmMessageNode *vcard, + WockyNode *vcard, GError *error, gpointer user_data); @@ -115,12 +115,12 @@ gboolean gabble_vcard_manager_has_cached_alias (GabbleVCardManager *manager, gboolean gabble_vcard_manager_get_cached (GabbleVCardManager *, TpHandle, - LmMessageNode **); + WockyNode **); void gabble_vcard_manager_invalidate_cache (GabbleVCardManager *, TpHandle); typedef void (*GabbleVCardManagerEditCb)(GabbleVCardManager *self, GabbleVCardManagerEditRequest *request, - LmMessageNode *vcard, + WockyNode *vcard, GError *error, gpointer user_data); @@ -133,7 +133,7 @@ GabbleVCardManagerEditRequest *gabble_vcard_manager_edit (GabbleVCardManager *, void gabble_vcard_manager_remove_edit_request (GabbleVCardManagerEditRequest *); -gchar *vcard_get_avatar_sha1 (LmMessageNode *vcard); +gchar *vcard_get_avatar_sha1 (WockyNode *vcard); GabbleVCardManagerEditInfo *gabble_vcard_manager_edit_info_new ( const gchar *element_name, |