Changeset ed2e37f for skype


Ignore:
Timestamp:
2007-08-20T16:35:48Z (17 years ago)
Author:
VMiklos <vmiklos@…>
Branches:
master
Children:
0c60f96
Parents:
ba20c39
Message:

more error handling, no more SIGPIPE \o/ :)

Location:
skype
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skype/README

    rba20c39 red2e37f  
    3333cp skype.so /usr/lib/bitlbee
    3434
    35 - Start the tcp server:
     35- Start skyped (the tcp server):
    3636
    3737python skyped.py
     
    4848- Receiving messages
    4949
    50 - Writing a tcp daemon that is a gateway between Skype and tcp
     50- skyped (the tcp daemon that is a gateway between Skype and tcp)
     51
     52- Error handling when skyped is not running and when it exists
    5153
    5254What needs to be done (aka. TODO):
     
    6668- maybe on account on/off, change our state from/to offline? so that we won't miss any message
    6769
    68 - handle the case when the tcp server is not running (currently SIGPIPE is not handled at all by the plugin)
    69 
    7070If something does not work and it's not in the TODO section, then please contact me!
    7171
  • skype/skype.c

    rba20c39 red2e37f  
    77 */
    88#include <stdio.h>
     9#include <poll.h>
    910#include <bitlbee.h>
    1011
     
    5859        printf("write(): %s", buf);
    5960        write( sd->fd, buf, len );
    60 
    61         // TODO: error handling
    6261
    6362        return TRUE;
     
    147146                                                // new body
    148147                                                printf("<%s> %s\n", sd->handle, info);
    149                                                 imcb_buddy_msg(ic, sd->handle, info, 0, 0);
     148                                                if(sd->handle)
     149                                                        imcb_buddy_msg(ic, sd->handle, info, 0, 0);
    150150                                                g_free(sd->handle);
    151151                                                sd->handle = NULL;
     
    191191        struct im_connection *ic = data;
    192192        struct skype_data *sd = ic->proto_data;
    193 
    194         imcb_connected(ic);
    195         if( sd->fd < 0 )
     193        struct pollfd pfd[1];
     194
     195        pfd[0].fd = sd->fd;
     196        pfd[0].events = POLLOUT;
     197
     198        poll(pfd, 1, 1000);
     199        if(pfd[0].revents & POLLHUP)
    196200        {
    197201                imcb_error( ic, "Could not connect to server" );
     
    199203                return FALSE;
    200204        }
     205        imcb_connected(ic);
    201206        return skype_start_stream(ic);
    202207}
Note: See TracChangeset for help on using the changeset viewer.