diff options
author | dequis <dx@dxzone.com.ar> | 2015-03-13 06:28:36 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-04-10 14:10:41 -0300 |
commit | a4be2f6df564eea09612731be194278e4fb755e0 (patch) | |
tree | 746d86bfa3691d19395802101dddf95d6e106527 /protocols/msn/ns.c | |
parent | 3b09b38a6f8bd15e0971085f9c6a48c31d7f1c17 (diff) |
msn: add msn_queue_feed(), move read() out of msn_handler()
Diffstat (limited to 'protocols/msn/ns.c')
-rw-r--r-- | protocols/msn/ns.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 2d0d1a10..3976bfd0 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -147,15 +147,23 @@ static gboolean msn_ns_callback(gpointer data, gint source, b_input_condition co { struct msn_data *handler = data; struct im_connection *ic = handler->ic; + char bytes[1024]; + int st; - if (msn_handler(handler) == -1) { /* Don't do this on ret == 0, it's already done then. */ + st = read(handler->fd, bytes, 1024); + if (st <= 0) { imcb_error(ic, "Error while reading from server"); imc_logout(ic, TRUE); - return FALSE; - } else { - return TRUE; } + + msn_queue_feed(handler, bytes, st); + + /* Ignore ret == 0, it's already disconnected then. */ + msn_handler(handler); + + return TRUE; + } int msn_ns_command(struct msn_data *handler, char **cmd, int num_parts) |