--- a/loudmouth/lm-connection.c Sun Apr 29 22:09:44 2007 +0200
+++ b/loudmouth/lm-connection.c Sun Jun 10 18:03:38 2007 +0200
@@ -54,6 +54,7 @@
GMainContext *context;
gchar *server;
gchar *jid;
+ gchar *resource;
guint port;
LmSSL *ssl;
@@ -210,6 +211,7 @@
g_free (connection->server);
g_free (connection->jid);
g_free (connection->stream_id);
+ g_free (connection->resource);
if (connection->parser) {
lm_parser_free (connection->parser);
@@ -1617,6 +1619,7 @@
connection->context = NULL;
connection->port = LM_CONNECTION_DEFAULT_PORT;
connection->jid = NULL;
+ connection->resource = NULL;
connection->ssl = NULL;
connection->proxy = NULL;
connection->disconnect_cb = NULL;
@@ -1863,6 +1866,8 @@
data->password = g_strdup (password);
data->resource = g_strdup (resource);
+ /* assume that this is our visible resource. */
+ connection->resource = g_strdup (resource);
handler = lm_message_handler_new (connection_auth_req_reply,
data,
(GDestroyNotify) auth_req_data_free);
@@ -2075,6 +2080,23 @@
}
/**
+ * lm_connection_get_full_jid:
+ * @connection: an #LmConnection
+ *
+ * Creates a full jid for @connection out of the connection jid and the
+ * resource used for authentication.
+ *
+ * Return value: A newly created string representing the full jid.
+ **/
+gchar *
+lm_connection_get_full_jid (LmConnection *connection)
+{
+ g_return_val_if_fail (connection != NULL, NULL);
+
+ return g_strconcat(connection->jid, "/", connection->resource, NULL);
+}
+
+/**
* lm_connection_set_jid:
* @connection: an #LmConnection
* @jid: JID to be used for @connection
@@ -2483,6 +2505,21 @@
return connection_send (connection, str, -1, error);
}
+
+/**
+ * lm_connection_get_client_host:
+ * @connection: An #LmConnection
+ *
+ * Returns the local host name of the connection.
+ *
+ * Return value: A newly allocated string representing the local host name.
+ **/
+gchar *
+lm_connection_get_local_host (LmConnection *connection)
+{
+ return _lm_sock_get_local_host (connection->fd);
+}
+
/**
* lm_connection_get_state:
* @connection: Connection to get state on