Mercurial > pidgin.yaz
diff libpurple/protocols/msn/servconn.c @ 24390:d72c185d0be3
Separate the parsing of data into a separate function from the reading of
data, to remove a big chunk of duplicate code in the read_cb callbacks
for servconn and httpconn
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 15 Nov 2008 16:15:33 +0000 |
parents | ae66b7b3086a |
children | 3d6fe79753c3 |
line wrap: on
line diff
--- a/libpurple/protocols/msn/servconn.c Sat Nov 15 09:44:05 2008 +0000 +++ b/libpurple/protocols/msn/servconn.c Sat Nov 15 16:15:33 2008 +0000 @@ -366,17 +366,13 @@ read_cb(gpointer data, gint source, PurpleInputCondition cond) { MsnServConn *servconn; - MsnSession *session; char buf[MSN_BUF_LEN]; - char *cur, *end, *old_rx_buf; gssize len; - int cur_len; servconn = data; - session = servconn->session; if (servconn->type == MSN_SERVCONN_NS) - session->account->gc->last_received = time(NULL); + servconn->session->account->gc->last_received = time(NULL); len = read(servconn->fd, buf, sizeof(buf) - 1); if (len < 0 && errno == EAGAIN) @@ -396,6 +392,14 @@ memcpy(servconn->rx_buf + servconn->rx_len, buf, len + 1); servconn->rx_len += len; + msn_servconn_process_data(servconn); +} + +void msn_servconn_process_data(MsnServConn *servconn) +{ + char *cur, *end, *old_rx_buf; + int cur_len; + end = old_rx_buf = servconn->rx_buf; servconn->processing = TRUE;