Mercurial > pidgin
changeset 6762:818ce550d2ce
[gaim-migrate @ 7294]
Added gaim_ssl_connect_fd().
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 06 Sep 2003 01:57:18 +0000 |
parents | ddbe06989d46 |
children | 362e60e7c265 |
files | src/sslconn.c src/sslconn.h |
diffstat | 2 files changed, 45 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/sslconn.c Sat Sep 06 01:24:50 2003 +0000 +++ b/src/sslconn.c Sat Sep 06 01:57:18 2003 +0000 @@ -109,6 +109,38 @@ return (GaimSslConnection *)gsc; } +GaimSslConnection * +gaim_ssl_connect_fd(GaimAccount *account, int fd, + GaimSslInputFunction func, void *data) +{ + GaimSslConnection *gsc; + GaimSslOps *ops; + + g_return_val_if_fail(fd > 0, NULL); + g_return_val_if_fail(func != NULL, NULL); + g_return_val_if_fail(gaim_ssl_is_supported(), NULL); + + ops = gaim_ssl_get_ops(); + + g_return_val_if_fail(ops != NULL, NULL); + g_return_val_if_fail(ops->connect_cb != NULL, NULL); + + if (!_ssl_initialized) + { + if (!ssl_init()) + return NULL; + } + + gsc = g_new0(GaimSslConnection, 1); + + gsc->user_data = data; + gsc->input_func = func; + + ops->connect_cb(gsc, fd, GAIM_INPUT_READ); + + return (GaimSslConnection *)gsc; +} + void gaim_ssl_close(GaimSslConnection *gsc) {
--- a/src/sslconn.h Sat Sep 06 01:24:50 2003 +0000 +++ b/src/sslconn.h Sat Sep 06 01:57:18 2003 +0000 @@ -93,6 +93,19 @@ void *data); /** + * Makes a SSL connection using an already open file descriptor. + * + * @param account The account making the connection. + * @param fd The file descriptor. + * @param func The SSL input handler function. + * @param data User-defined data. + * + * @return The SSL connection handle. + */ +GaimSslConnection *gaim_ssl_connect_fd(GaimAccount *account, int fd, + GaimSslInputFunction func, void *data); + +/** * Closes a SSL connection. * * @param gsc The SSL connection to close.