equal
deleted
inserted
replaced
52 struct _LmConnection { |
52 struct _LmConnection { |
53 /* Parameters */ |
53 /* Parameters */ |
54 GMainContext *context; |
54 GMainContext *context; |
55 gchar *server; |
55 gchar *server; |
56 gchar *jid; |
56 gchar *jid; |
|
57 gchar *resource; |
57 guint port; |
58 guint port; |
58 |
59 |
59 LmSSL *ssl; |
60 LmSSL *ssl; |
60 |
61 |
61 LmProxy *proxy; |
62 LmProxy *proxy; |
208 LmMessage *m; |
209 LmMessage *m; |
209 |
210 |
210 g_free (connection->server); |
211 g_free (connection->server); |
211 g_free (connection->jid); |
212 g_free (connection->jid); |
212 g_free (connection->stream_id); |
213 g_free (connection->stream_id); |
|
214 g_free (connection->resource); |
213 |
215 |
214 if (connection->parser) { |
216 if (connection->parser) { |
215 lm_parser_free (connection->parser); |
217 lm_parser_free (connection->parser); |
216 } |
218 } |
217 |
219 |
1615 } |
1617 } |
1616 |
1618 |
1617 connection->context = NULL; |
1619 connection->context = NULL; |
1618 connection->port = LM_CONNECTION_DEFAULT_PORT; |
1620 connection->port = LM_CONNECTION_DEFAULT_PORT; |
1619 connection->jid = NULL; |
1621 connection->jid = NULL; |
|
1622 connection->resource = NULL; |
1620 connection->ssl = NULL; |
1623 connection->ssl = NULL; |
1621 connection->proxy = NULL; |
1624 connection->proxy = NULL; |
1622 connection->disconnect_cb = NULL; |
1625 connection->disconnect_cb = NULL; |
1623 connection->incoming_messages = g_queue_new (); |
1626 connection->incoming_messages = g_queue_new (); |
1624 connection->cancel_open = FALSE; |
1627 connection->cancel_open = FALSE; |
1861 data = g_new0 (AuthReqData, 1); |
1864 data = g_new0 (AuthReqData, 1); |
1862 data->username = g_strdup (username); |
1865 data->username = g_strdup (username); |
1863 data->password = g_strdup (password); |
1866 data->password = g_strdup (password); |
1864 data->resource = g_strdup (resource); |
1867 data->resource = g_strdup (resource); |
1865 |
1868 |
|
1869 /* assume that this is our visible resource. */ |
|
1870 connection->resource = g_strdup (resource); |
1866 handler = lm_message_handler_new (connection_auth_req_reply, |
1871 handler = lm_message_handler_new (connection_auth_req_reply, |
1867 data, |
1872 data, |
1868 (GDestroyNotify) auth_req_data_free); |
1873 (GDestroyNotify) auth_req_data_free); |
1869 result = lm_connection_send_with_reply (connection, m, handler, error); |
1874 result = lm_connection_send_with_reply (connection, m, handler, error); |
1870 |
1875 |
2073 |
2078 |
2074 return connection->jid; |
2079 return connection->jid; |
2075 } |
2080 } |
2076 |
2081 |
2077 /** |
2082 /** |
|
2083 * lm_connection_get_full_jid: |
|
2084 * @connection: an #LmConnection |
|
2085 * |
|
2086 * Creates a full jid for @connection out of the connection jid and the |
|
2087 * resource used for authentication. |
|
2088 * |
|
2089 * Return value: A newly created string representing the full jid. |
|
2090 **/ |
|
2091 gchar * |
|
2092 lm_connection_get_full_jid (LmConnection *connection) |
|
2093 { |
|
2094 g_return_val_if_fail (connection != NULL, NULL); |
|
2095 |
|
2096 return g_strconcat(connection->jid, "/", connection->resource, NULL); |
|
2097 } |
|
2098 |
|
2099 /** |
2078 * lm_connection_set_jid: |
2100 * lm_connection_set_jid: |
2079 * @connection: an #LmConnection |
2101 * @connection: an #LmConnection |
2080 * @jid: JID to be used for @connection |
2102 * @jid: JID to be used for @connection |
2081 * |
2103 * |
2082 * Sets the JID to be used for @connection. |
2104 * Sets the JID to be used for @connection. |
2481 g_return_val_if_fail (connection != NULL, FALSE); |
2503 g_return_val_if_fail (connection != NULL, FALSE); |
2482 g_return_val_if_fail (str != NULL, FALSE); |
2504 g_return_val_if_fail (str != NULL, FALSE); |
2483 |
2505 |
2484 return connection_send (connection, str, -1, error); |
2506 return connection_send (connection, str, -1, error); |
2485 } |
2507 } |
|
2508 |
|
2509 /** |
|
2510 * lm_connection_get_client_host: |
|
2511 * @connection: An #LmConnection |
|
2512 * |
|
2513 * Returns the local host name of the connection. |
|
2514 * |
|
2515 * Return value: A newly allocated string representing the local host name. |
|
2516 **/ |
|
2517 gchar * |
|
2518 lm_connection_get_local_host (LmConnection *connection) |
|
2519 { |
|
2520 return _lm_sock_get_local_host (connection->fd); |
|
2521 } |
|
2522 |
2486 /** |
2523 /** |
2487 * lm_connection_get_state: |
2524 * lm_connection_get_state: |
2488 * @connection: Connection to get state on |
2525 * @connection: Connection to get state on |
2489 * |
2526 * |
2490 * Returns the state of the connection. |
2527 * Returns the state of the connection. |