Mercurial > pidgin.yaz
diff libfaim/conn.c @ 2034:6bdf9954097c
[gaim-migrate @ 2044]
oscar is much less segfaulty. and more reliable. yes.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 16 Jun 2001 05:28:08 +0000 |
parents | 109cacf1ff97 |
children |
line wrap: on
line diff
--- a/libfaim/conn.c Sat Jun 16 03:18:00 2001 +0000 +++ b/libfaim/conn.c Sat Jun 16 05:28:08 2001 +0000 @@ -22,7 +22,7 @@ * Clears out the connection list and kills any connections left. * */ -faim_internal void aim_connrst(struct aim_session_t *sess) +static void aim_connrst(struct aim_session_t *sess) { faim_mutex_init(&sess->connlistlock); if (sess->connlist) { @@ -72,7 +72,7 @@ * Allocate a new empty connection structure. * */ -faim_internal struct aim_conn_t *aim_conn_getnext(struct aim_session_t *sess) +static struct aim_conn_t *aim_conn_getnext(struct aim_session_t *sess) { struct aim_conn_t *newconn, *cur; @@ -191,6 +191,38 @@ break; } faim_mutex_unlock(&sess->connlistlock); + + return cur; +} + +faim_export struct aim_conn_t *aim_getconn_type_all(struct aim_session_t *sess, + int type) +{ + struct aim_conn_t *cur; + + faim_mutex_lock(&sess->connlistlock); + for (cur = sess->connlist; cur; cur = cur->next) { + if (cur->type == type) + break; + } + faim_mutex_unlock(&sess->connlistlock); + + return cur; +} + +/* If you pass -1 for the fd, you'll get what you ask for. Gibberish. */ +faim_export struct aim_conn_t *aim_getconn_fd(struct aim_session_t *sess, + int fd) +{ + struct aim_conn_t *cur; + + faim_mutex_lock(&sess->connlistlock); + for (cur = sess->connlist; cur; cur = cur->next) { + if (cur->fd == fd) + break; + } + faim_mutex_unlock(&sess->connlistlock); + return cur; } @@ -393,6 +425,7 @@ conn->priv = src->priv; conn->lastactivity = src->lastactivity; conn->forcedlatency = src->forcedlatency; + conn->sessv = src->sessv; /* clone handler list */ for (cur = src->handlerlist; cur; cur = cur->next) { @@ -432,7 +465,8 @@ return NULL; faim_mutex_lock(&connstruct->active); - + + connstruct->sessv = (void *)sess; connstruct->type = type; if (!dest) { /* just allocate a struct */ @@ -899,6 +933,15 @@ return 0; } +faim_export struct aim_session_t *aim_conn_getsess(struct aim_conn_t *conn) +{ + + if (!conn) + return NULL; + + return (struct aim_session_t *)conn->sessv; +} + /* * aim_logoff() *