summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac10
m---------lib/ext/wocky0
-rw-r--r--plugins/gateways.c21
-rw-r--r--src/bytestream-socks5.c4
-rw-r--r--src/caps-hash.c3
-rw-r--r--src/connection.c6
-rw-r--r--src/error.c10
-rw-r--r--src/jingle-factory.c6
-rw-r--r--src/muc-channel.c22
-rw-r--r--tests/twisted/Makefile.am2
-rw-r--r--tests/twisted/caps/compat-bundles.py18
-rw-r--r--tests/twisted/caps_helper.py34
-rw-r--r--tests/twisted/jingle/session-id-collision.py1
13 files changed, 65 insertions, 72 deletions
diff --git a/configure.ac b/configure.ac
index 80267dc4d..2d5e6cd89 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,9 +118,17 @@ AC_ARG_ENABLE([is-a-phone],
[is_a_phone=$enableval], [is_a_phone=no])
if test x$is_a_phone = xyes; then
- AC_DEFINE(IS_A_PHONE, [], [Defined if the target device is a phone])
+ AC_DEFINE(CLIENT_TYPE, ["phone"],
+ [Client type from http://xmpp.org/registrar/disco-categories.html#client])
+ CLIENT_TYPE=phone
+else
+ AC_DEFINE(CLIENT_TYPE, ["pc"],
+ [Client type from http://xmpp.org/registrar/disco-categories.html#client])
+ CLIENT_TYPE=pc
fi
+AC_SUBST(CLIENT_TYPE)
+
dnl Check for Glib
PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.16, gobject-2.0 >= 2.16, gthread-2.0 >= 2.16])
diff --git a/lib/ext/wocky b/lib/ext/wocky
-Subproject c1044f07d71abd3df64337832ce489f39079414
+Subproject 83221b4b791d2e00fc286694d9912832cca8305
diff --git a/plugins/gateways.c b/plugins/gateways.c
index e5699dcf2..42b5be910 100644
--- a/plugins/gateways.c
+++ b/plugins/gateways.c
@@ -244,18 +244,8 @@ register_cb (GObject *porter,
reply = wocky_porter_send_iq_finish (WOCKY_PORTER (porter), result, &error);
- if (reply == NULL)
- goto finally;
-
- error = wocky_xmpp_stanza_to_gerror (reply); /* NULL on success */
- g_object_unref (reply);
-
-finally:
- if (error == NULL)
- {
- gabble_svc_gabble_plugin_gateways_return_from_register (context);
- }
- else
+ if (reply == NULL ||
+ wocky_xmpp_stanza_extract_errors (reply, NULL, &error, NULL, NULL))
{
GError *tp_error = NULL;
@@ -290,6 +280,13 @@ finally:
g_error_free (error);
g_error_free (tp_error);
}
+ else
+ {
+ gabble_svc_gabble_plugin_gateways_return_from_register (context);
+ }
+
+ if (reply != NULL)
+ g_object_unref (reply);
}
static void
diff --git a/src/bytestream-socks5.c b/src/bytestream-socks5.c
index 4d8641ccf..32f0082fd 100644
--- a/src/bytestream-socks5.c
+++ b/src/bytestream-socks5.c
@@ -672,7 +672,7 @@ socks5_error (GabbleBytestreamSocks5 *self)
case SOCKS5_STATE_INITIATOR_AWAITING_AUTH_REQUEST:
case SOCKS5_STATE_INITIATOR_AWAITING_COMMAND:
- DEBUG ("Something goes wrong during SOCKS5 negotation. Don't close "
+ DEBUG ("Something goes wrong during SOCKS5 negotiation. Don't close "
"the bytestream yet as the target can still try other streamhosts");
break;
@@ -1588,7 +1588,7 @@ socks5_init_reply_cb (GabbleConnection *conn,
if (priv->socks5_state != SOCKS5_STATE_INITIATOR_OFFER_SENT)
{
- DEBUG ("We are already in the negotation process (state: %u). "
+ DEBUG ("We are already in the negotiation process (state: %u). "
"Closing the bytestream", priv->socks5_state);
goto socks5_init_error;
}
diff --git a/src/caps-hash.c b/src/caps-hash.c
index c42fb4ebd..d0ce37888 100644
--- a/src/caps-hash.c
+++ b/src/caps-hash.c
@@ -372,7 +372,8 @@ caps_hash_compute_from_self_presence (GabbleConnection *self)
gchar *str;
/* XEP-0030 requires at least 1 identity. We don't need more. */
- g_ptr_array_add (identities, g_strdup ("client/pc//" PACKAGE_STRING));
+ g_ptr_array_add (identities, g_strdup_printf (
+ "client/%s//%s", CLIENT_TYPE, PACKAGE_STRING));
/* Gabble does not use dataforms, let 'dataforms' be empty */
diff --git a/src/connection.c b/src/connection.c
index 72a9bbce5..d0643e2e1 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2382,11 +2382,7 @@ connection_iq_disco_cb (LmMessageHandler *handler,
(result_query, "identity", NULL);
lm_message_node_set_attribute (identity, "category", "client");
lm_message_node_set_attribute (identity, "name", PACKAGE_STRING);
-#ifdef IS_A_PHONE
- lm_message_node_set_attribute (identity, "type", "phone");
-#else
- lm_message_node_set_attribute (identity, "type", "pc");
-#endif
+ lm_message_node_set_attribute (identity, "type", CLIENT_TYPE);
if (node == NULL)
features = gabble_presence_peek_caps (self->self_presence);
diff --git a/src/error.c b/src/error.c
index 4774aa6b4..57edadc63 100644
--- a/src/error.c
+++ b/src/error.c
@@ -583,16 +583,6 @@ map_wocky_xmpp_error (const GError *error)
case WOCKY_XMPP_ERROR_SERVICE_UNAVAILABLE:
return TP_ERROR_NOT_AVAILABLE;
- case WOCKY_XMPP_ERROR_JINGLE_OUT_OF_ORDER:
- case WOCKY_XMPP_ERROR_JINGLE_UNKNOWN_SESSION:
- case WOCKY_XMPP_ERROR_JINGLE_UNSUPPORTED_CONTENT:
- case WOCKY_XMPP_ERROR_JINGLE_UNSUPPORTED_TRANSPORT:
- case WOCKY_XMPP_ERROR_SI_NO_VALID_STREAMS:
- case WOCKY_XMPP_ERROR_SI_BAD_PROFILE:
- /* FIXME: in practice these map to abrupt session termination, rather
- * than a specific D-Bus error */
- return TP_ERROR_NOT_AVAILABLE;
-
case WOCKY_XMPP_ERROR_UNDEFINED_CONDITION:
default:
return TP_ERROR_NOT_AVAILABLE;
diff --git a/src/jingle-factory.c b/src/jingle-factory.c
index a32c472c3..0262fb3cb 100644
--- a/src/jingle-factory.c
+++ b/src/jingle-factory.c
@@ -1124,9 +1124,11 @@ on_http_response (SoupSession *soup,
const gchar *relay_ssltcp_port;
const gchar *username;
const gchar *password;
+ gchar *escaped_str;
- DEBUG ("Response from Google:\n====\n%s\n====",
- msg->response_body->data);
+ escaped_str = g_strescape (msg->response_body->data, "\r\n");
+ DEBUG ("Response from Google:\n====\n%s\n====", escaped_str);
+ g_free (escaped_str);
lines = g_strsplit (msg->response_body->data, "\n", 0);
diff --git a/src/muc-channel.c b/src/muc-channel.c
index de36ed8f8..6e9530091 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -358,7 +358,7 @@ static void handle_errmsg (GObject *source,
WockyMucMember *who,
const gchar *text,
WockyXmppError error,
- const gchar *etype,
+ WockyXmppErrorType etype,
gpointer data);
static GObject *
@@ -1966,33 +1966,31 @@ handle_error (GObject *source,
{
GError *tp_error /* doesn't need initializing */;
- // FIXME, the wocky enum is identical to the gabble enum, but
- // don't rely on this:
- switch ((GabbleXmppError) errnum)
+ switch (errnum)
{
- case XMPP_ERROR_FORBIDDEN:
+ case WOCKY_XMPP_ERROR_FORBIDDEN:
tp_error = g_error_new (TP_ERRORS, TP_ERROR_CHANNEL_BANNED,
"banned from room");
reason = TP_CHANNEL_GROUP_CHANGE_REASON_BANNED;
break;
- case XMPP_ERROR_SERVICE_UNAVAILABLE:
+ case WOCKY_XMPP_ERROR_SERVICE_UNAVAILABLE:
tp_error = g_error_new (TP_ERRORS, TP_ERROR_CHANNEL_FULL,
"room is full");
break;
- case XMPP_ERROR_REGISTRATION_REQUIRED:
+ case WOCKY_XMPP_ERROR_REGISTRATION_REQUIRED:
tp_error = g_error_new (TP_ERRORS, TP_ERROR_CHANNEL_INVITE_ONLY,
"room is invite only");
break;
- case XMPP_ERROR_CONFLICT:
+ case WOCKY_XMPP_ERROR_CONFLICT:
if (handle_nick_conflict (gmuc, &tp_error))
return;
break;
default:
tp_error = g_error_new (TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
- "%s", gabble_xmpp_error_description (errnum));
+ "%s", wocky_xmpp_error_description (errnum));
break;
}
@@ -2611,14 +2609,13 @@ handle_errmsg (GObject *source,
WockyMucMember *who,
const gchar *text,
WockyXmppError error,
- const gchar *etype,
+ WockyXmppErrorType etype,
gpointer data)
{
GabbleMucChannel *gmuc = GABBLE_MUC_CHANNEL (data);
GabbleMucChannelPrivate *priv = GABBLE_MUC_CHANNEL_GET_PRIVATE (gmuc);
TpBaseConnection *conn = (TpBaseConnection *) priv->conn;
gboolean from_member = (who != NULL);
- GabbleXmppErrorType status = XMPP_ERROR_TYPE_UNDEFINED;
TpChannelTextSendError tp_err = TP_CHANNEL_TEXT_SEND_ERROR_UNKNOWN;
TpDeliveryStatus ds = TP_DELIVERY_STATUS_DELIVERED;
TpHandleRepoIface *repo = NULL;
@@ -2647,9 +2644,8 @@ handle_errmsg (GObject *source,
}
tp_err = gabble_tp_send_error_from_wocky_xmpp_error (error);
- status = gabble_xmpp_error_type_to_enum (etype);
- if (status == XMPP_ERROR_TYPE_WAIT)
+ if (etype == XMPP_ERROR_TYPE_WAIT)
ds = TP_DELIVERY_STATUS_TEMPORARILY_FAILED;
else
ds = TP_DELIVERY_STATUS_PERMANENTLY_FAILED;
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 2a672fa2d..9552ace6a 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -120,6 +120,7 @@ TWISTED_TESTS = \
jingle/outgoing-many-streams.py \
jingle/payload-types.py \
jingle/preload-caps-crash.py \
+ jingle/session-id-collision.py \
jingle/stream-handler-error.py \
jingle/test-content-adding-removal.py \
jingle/test-description-info.py \
@@ -213,6 +214,7 @@ endif
config.py: Makefile
$(AM_V_GEN) { \
echo "PACKAGE_STRING = \"$(PACKAGE_STRING)\""; \
+ echo "CLIENT_TYPE = '$(CLIENT_TYPE)'"; \
echo "DEBUGGING = $(DEBUGGING_PYBOOL)"; \
echo "PLUGINS_ENABLED = $(PLUGINS_ENABLED_PYBOOL)"; \
echo "CHANNEL_TYPE_CALL_ENABLED = $(CHANNEL_TYPE_CALL_ENABLED_PYBOOL)"; \
diff --git a/tests/twisted/caps/compat-bundles.py b/tests/twisted/caps/compat-bundles.py
index e894746b7..e7804084e 100644
--- a/tests/twisted/caps/compat-bundles.py
+++ b/tests/twisted/caps/compat-bundles.py
@@ -12,25 +12,19 @@ import dbus
from twisted.words.xish import xpath, domish
from servicetest import EventPattern, assertEquals
-from gabbletest import exec_test
+from gabbletest import exec_test, elem, elem_iq
import constants as cs
import ns
def disco_bundle(q, bus, conn, stream, node, features):
-
- request = """
-<iq from='fake_contact@jabber.org/resource'
- id='disco1'
- to='gabble@jabber.org/resource'
- type='get'>
- <query xmlns='""" + ns.DISCO_INFO + """'
- node='""" + node + """'/>
-</iq>
-"""
+ request = \
+ elem_iq(stream, 'get', from_='fake_contact@jabber.org/resource')(
+ elem(ns.DISCO_INFO, 'query', node=node)
+ )
stream.send(request)
disco_response = q.expect('stream-iq', query_ns=ns.DISCO_INFO,
- iq_id='disco1')
+ iq_id=request['id'])
nodes = xpath.queryForNodes('/iq/query/feature', disco_response.stanza)
vars = [n["var"] for n in nodes]
assertEquals(set(features), set(vars))
diff --git a/tests/twisted/caps_helper.py b/tests/twisted/caps_helper.py
index 06ec94115..0027f77d4 100644
--- a/tests/twisted/caps_helper.py
+++ b/tests/twisted/caps_helper.py
@@ -4,13 +4,13 @@ import base64
import dbus
from twisted.words.xish import domish, xpath
-from gabbletest import make_result_iq, make_presence
+from gabbletest import make_result_iq, make_presence, elem_iq, elem
from servicetest import (
EventPattern,
assertEquals, assertContains, assertDoesNotContain, assertLength,
)
-from config import PACKAGE_STRING
+import config
import ns
import constants as cs
@@ -201,27 +201,33 @@ def disco_caps(q, stream, presence):
assertEquals('sha-1', hash)
# ask caps
- request = """
-<iq from='fake_contact@jabber.org/resource'
- id='disco1'
- to='gabble@jabber.org/resource'
- type='get'>
- <query xmlns='""" + ns.DISCO_INFO + """'
- node='""" + node + '#' + ver + """'/>
-</iq>
-"""
+ request = \
+ elem_iq(stream, 'get', from_='fake_contact@jabber.org/resource')(
+ elem(ns.DISCO_INFO, 'query', node=(node + '#' + ver))
+ )
stream.send(request)
# receive caps
- event = q.expect('stream-iq', query_ns=ns.DISCO_INFO, iq_id='disco1')
+ event = q.expect('stream-iq', query_ns=ns.DISCO_INFO, iq_id=request['id'])
+
+ # Check that Gabble's announcing the identity we think it should be.
+ identity_nodes = xpath.queryForNodes('/iq/query/identity', event.stanza)
+ assertLength(1, identity_nodes)
+ identity_node = identity_nodes[0]
+
+ assertEquals('client', identity_node['category'])
+ assertEquals(config.CLIENT_TYPE, identity_node['type'])
+ assertEquals(config.PACKAGE_STRING, identity_node['name'])
+ assertDoesNotContain('xml:lang', identity_node.attributes)
+
+ identity = 'client/%s//%s' % (config.CLIENT_TYPE, config.PACKAGE_STRING)
features = []
for feature in xpath.queryForNodes('/iq/query/feature', event.stanza):
features.append(feature['var'])
# Check if the hash matches the announced capabilities
- assertEquals(compute_caps_hash(['client/pc//%s' % PACKAGE_STRING], features, {}),
- ver)
+ assertEquals(compute_caps_hash([identity], features, {}), ver)
return (event, features)
diff --git a/tests/twisted/jingle/session-id-collision.py b/tests/twisted/jingle/session-id-collision.py
index 912367d4f..14cd7bac0 100644
--- a/tests/twisted/jingle/session-id-collision.py
+++ b/tests/twisted/jingle/session-id-collision.py
@@ -5,6 +5,7 @@ sid.
"""
from jingletest2 import JingleTest2, test_all_dialects
+import constants as cs
def test(jp, q, bus, conn, stream):
jt1 = JingleTest2(jp, conn, q, stream, 'test@localhost',