diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-11-18 18:15:04 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-11-18 18:15:04 +0000 |
commit | 5c7b956faeffeda6b4ef2666750398fdb9bb0fba (patch) | |
tree | 3993b5525ed3294837113b5ab6aa1e0471800bd1 /src | |
parent | b96c4501cca2edda99a94bf3a84165618d53cc92 (diff) |
tpsip_normalize_contact: add connection-independent normalization
Diffstat (limited to 'src')
-rw-r--r-- | src/sip-connection-helpers.c | 28 | ||||
-rw-r--r-- | src/sip-connection-helpers.h | 5 |
2 files changed, 24 insertions, 9 deletions
diff --git a/src/sip-connection-helpers.c b/src/sip-connection-helpers.c index 0fda819..8ad9b42 100644 --- a/src/sip-connection-helpers.c +++ b/src/sip-connection-helpers.c @@ -775,14 +775,11 @@ priv_lowercase_url_part (su_home_t *home, const char *src) #define TPSIP_RESERVED_CHARS_ALLOWED_IN_USERNAME "!*'()&=+$,;?/" gchar * -tpsip_handle_normalize (TpHandleRepoIface *repo, - const gchar *sipuri, - gpointer context, - GError **error) +tpsip_normalize_contact (const gchar *sipuri, + const url_t *base_url, + const gchar *transport, + GError **error) { - TpsipConnection *conn = TPSIP_CONNECTION (context); - TpsipConnectionPrivate *priv = TPSIP_CONNECTION_GET_PRIVATE (conn); - const url_t *base_url = priv->account_url; su_home_t home[1] = { SU_HOME_INIT(home) }; url_t *url; gchar *retval = NULL; @@ -827,8 +824,8 @@ tpsip_handle_normalize (TpHandleRepoIface *repo, { /* Set the scheme to SIP or SIPS accordingly to the connection's * transport preference */ - if (priv->transport != NULL - && g_ascii_strcasecmp (priv->transport, "tls") == 0) + if (transport != NULL + && g_ascii_strcasecmp (transport, "tls") == 0) { url->url_type = url_sips; url->url_scheme = "sips"; @@ -879,6 +876,19 @@ error: return retval; } +gchar * +tpsip_handle_normalize (TpHandleRepoIface *repo, + const gchar *sipuri, + gpointer context, + GError **error) +{ + TpsipConnection *conn = TPSIP_CONNECTION (context); + TpsipConnectionPrivate *priv = TPSIP_CONNECTION_GET_PRIVATE (conn); + + return tpsip_normalize_contact (sipuri, priv->account_url, priv->transport, + error); +} + static GQuark tpsip_handle_url_quark () { diff --git a/src/sip-connection-helpers.h b/src/sip-connection-helpers.h index 327c13c..4644908 100644 --- a/src/sip-connection-helpers.h +++ b/src/sip-connection-helpers.h @@ -66,6 +66,11 @@ gchar * tpsip_handle_normalize (TpHandleRepoIface *repo, gpointer context, GError **error); +gchar *tpsip_normalize_contact (const gchar *sipuri, + const url_t *base_url, + const gchar *transport, + GError **error); + const url_t* tpsip_conn_get_contact_url (TpsipConnection *conn, TpHandle handle); |