Mercurial > pidgin
changeset 26087:0a5737e1e969
Update to newest XEP-0166 Jingle spec.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Thu, 05 Feb 2009 01:31:40 +0000 |
parents | af42303654a5 |
children | a9cdc8b391c4 |
files | libpurple/protocols/jabber/jingle/jingle.c libpurple/protocols/jabber/jingle/jingle.h |
diffstat | 2 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jingle/jingle.c Thu Feb 05 00:31:35 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/jingle.c Thu Feb 05 01:31:40 2009 +0000 @@ -41,8 +41,12 @@ return "content-add"; case JINGLE_CONTENT_MODIFY: return "content-modify"; + case JINGLE_CONTENT_REJECT: + return "content-reject"; case JINGLE_CONTENT_REMOVE: return "content-remove"; + case JINGLE_DESCRIPTION_INFO: + return "description-info"; case JINGLE_SESSION_ACCEPT: return "session-accept"; case JINGLE_SESSION_INFO: @@ -55,6 +59,8 @@ return "transport-accept"; case JINGLE_TRANSPORT_INFO: return "transport-info"; + case JINGLE_TRANSPORT_REJECT: + return "transport-reject"; case JINGLE_TRANSPORT_REPLACE: return "transport-replace"; default: @@ -71,8 +77,12 @@ return JINGLE_CONTENT_ADD; else if (!strcmp(action, "content-modify")) return JINGLE_CONTENT_MODIFY; + else if (!strcmp(action, "content-reject")) + return JINGLE_CONTENT_REJECT; else if (!strcmp(action, "content-remove")) return JINGLE_CONTENT_REMOVE; + else if (!strcmp(action, "description-info")) + return JINGLE_DESCRIPTION_INFO; else if (!strcmp(action, "session-accept")) return JINGLE_SESSION_ACCEPT; else if (!strcmp(action, "session-info")) @@ -85,6 +95,8 @@ return JINGLE_TRANSPORT_ACCEPT; else if (!strcmp(action, "transport-info")) return JINGLE_TRANSPORT_INFO; + else if (!strcmp(action, "transport-reject")) + return JINGLE_TRANSPORT_REJECT; else if (!strcmp(action, "transport-replace")) return JINGLE_TRANSPORT_REPLACE; else @@ -207,6 +219,30 @@ } static void +jingle_handle_description_info(JingleSession *session, xmlnode *jingle) +{ + xmlnode *content = xmlnode_get_child(jingle, "content"); + + jabber_iq_send(jingle_session_create_ack(session, jingle)); + + jingle_session_accept_session(session); + + for (; content; content = xmlnode_get_next_twin(content)) { + const gchar *name = xmlnode_get_attrib(content, "name"); + const gchar *creator = xmlnode_get_attrib(content, "creator"); + JingleContent *parsed_content = + jingle_session_find_content(session, name, creator); + if (parsed_content == NULL) { + purple_debug_error("jingle", "Error parsing content\n"); + /* XXX: send error */ + } else { + jingle_content_handle_action(parsed_content, content, + JINGLE_DESCRIPTION_INFO); + } + } +} + +static void jingle_handle_session_accept(JingleSession *session, xmlnode *jingle) { xmlnode *content = xmlnode_get_child(jingle, "content"); @@ -408,6 +444,8 @@ jingle_handle_content_reject(session, jingle); } else if (!strcmp(action, "content-remove")) { jingle_handle_content_remove(session, jingle); + } else if (!strcmp(action, "description-info")) { + jingle_handle_description_info(session, jingle); } else if (!strcmp(action, "session-accept")) { jingle_handle_session_accept(session, jingle); } else if (!strcmp(action, "session-info")) {
--- a/libpurple/protocols/jabber/jingle/jingle.h Thu Feb 05 00:31:35 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/jingle.h Thu Feb 05 01:31:40 2009 +0000 @@ -53,6 +53,7 @@ JINGLE_CONTENT_MODIFY, JINGLE_CONTENT_REJECT, JINGLE_CONTENT_REMOVE, + JINGLE_DESCRIPTION_INFO, JINGLE_SESSION_ACCEPT, JINGLE_SESSION_INFO, JINGLE_SESSION_INITIATE,