Changeset 1323e36
- Timestamp:
- 2007-08-19T13:57:32Z (17 years ago)
- Branches:
- master
- Children:
- 9fd4241
- Parents:
- f06e3ac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
skype/skype.c
rf06e3ac r1323e36 65 65 } 66 66 67 static gboolean skype_read_callback( gpointer data, gint fd, b_input_condition cond ) 68 { 69 struct im_connection *ic = data; 70 struct skype_data *sd = ic->proto_data; 71 char buf[1024]; 72 int st; 73 74 if( sd->fd == -1 ) 75 return FALSE; 76 st = read( sd->fd, buf, sizeof( buf ) ); 77 if( st > 0 ) 78 { 79 buf[st] = '\0'; 80 printf("read(): '%s'\n", buf); 81 } 82 else if( st == 0 || ( st < 0 && !sockerr_again() ) ) 83 { 84 closesocket( sd->fd ); 85 sd->fd = -1; 86 87 imcb_error( ic, "Error while reading from server" ); 88 imc_logout( ic, TRUE ); 89 return FALSE; 90 } 91 92 /* EAGAIN/etc or a successful read. */ 93 return TRUE; 94 } 95 67 96 static gboolean skype_write_queue( struct im_connection *ic ) 68 97 { … … 70 99 int st; 71 100 101 printf("sd->fd: %d\n", sd->fd); 72 102 st = write( sd->fd, sd->txq, sd->tx_len ); 73 103 … … 110 140 gboolean skype_start_stream( struct im_connection *ic ) 111 141 { 142 struct skype_data *sd = ic->proto_data; 112 143 char *buf; 113 144 int st; 145 146 if( sd->r_inpa <= 0 ) 147 sd->r_inpa = b_input_add( sd->fd, GAIM_INPUT_READ, skype_read_callback, ic ); 114 148 115 149 buf = g_strdup_printf("SEARCH FRIENDS"); … … 122 156 { 123 157 struct im_connection *ic = data; 158 struct skype_data *sd = ic->proto_data; 124 159 125 160 imcb_connected(ic); 161 if( sd->fd < 0 ) 162 { 163 imcb_error( ic, "Could not connect to server" ); 164 imc_logout( ic, TRUE ); 165 return; 166 } 126 167 //imcb_add_buddy(ic, "vmiklos_dsd@skype.com", NULL); 127 168 //imcb_buddy_status(ic, "vmiklos_dsd@skype.com", OPT_LOGGED_IN, NULL, NULL); … … 140 181 sd->fd = proxy_connect(acc->server, set_getint( &acc->set, "port" ), skype_connected, ic ); 141 182 printf("sd->fd: %d\n", sd->fd); 142 if( sd->fd < 0 )143 {144 imcb_error( ic, "Could not connect to server" );145 imc_logout( ic, TRUE );146 return;147 }148 183 149 184 sd->ic = ic;
Note: See TracChangeset
for help on using the changeset viewer.